mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-07-03 05:47:24 +00:00
feat(bot): 新增命令列表更新功能.
增加`命令列表更新`功能, 该功能可根据已加载的 Ability, 调用 Telegram Bot API 更新命令列表. 后续会尝试支持 BotCommandScope.
This commit is contained in:
@ -119,6 +119,20 @@ internal class Launcher : AutoCloseable {
|
||||
)
|
||||
botSessionMap[bot] = botApi.registerBot(bot)
|
||||
log.info { "机器人 `${bot.botUsername}` 已启动." }
|
||||
|
||||
if (botConfig.autoUpdateCommandList) {
|
||||
log.debug { "[Bot ${botConfig.account.name}] 正在自动更新命令列表..." }
|
||||
try {
|
||||
val result = bot.updateCommandList()
|
||||
if (result) {
|
||||
log.info { "[Bot ${botConfig.account.name}] 已成功更新 Bot 命令列表." }
|
||||
} else {
|
||||
log.warn { "[Bot ${botConfig.account.name}] 自动更新 Bot 命令列表失败!" }
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
log.warn(e) { "命令列表自动更新失败." }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
|
Reference in New Issue
Block a user