From cbca4323b45724ca6a01551da103de62ca455585 Mon Sep 17 00:00:00 2001 From: RTAkland Date: Fri, 6 Sep 2024 14:09:50 +0800 Subject: [PATCH] chore: add usage tip --- .../kotlin/cn/rtast/fancybot/commands/WeatherCommand.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/kotlin/cn/rtast/fancybot/commands/WeatherCommand.kt b/src/main/kotlin/cn/rtast/fancybot/commands/WeatherCommand.kt index 0b86b85..9cebc23 100644 --- a/src/main/kotlin/cn/rtast/fancybot/commands/WeatherCommand.kt +++ b/src/main/kotlin/cn/rtast/fancybot/commands/WeatherCommand.kt @@ -20,6 +20,14 @@ class WeatherCommand : BaseCommand() { override val commandNames = listOf("/weather", "/天气") override suspend fun executeGroup(listener: OBMessage, message: GroupMessage, args: List) { + if (args.isEmpty()) { + val msg = MessageChain.Builder() + .addAt(message.sender.userId) + .addText("发送/weather <地区名>即可查看实时天气哦~") + .build() + listener.sendGroupMessage(message.groupId, msg) + return + } val locationName = args.first() val lookupLocationId = Http.get( "https://geoapi.qweather.com/v2/city/lookup",