mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-04-30 06:37:29 +00:00
fix(bot): 修复因机器人命令列表为空而导致命令列表自动更新报错的问题.
当机器人因扩展加载失败时, 将无法正常执行命令更新操作, 故添加空命令检查以避免该问题.
This commit is contained in:
parent
6e59a9a5ac
commit
ef37f3b2d7
@ -103,6 +103,12 @@ internal class ScalaBot(
|
|||||||
}
|
}
|
||||||
BotCommand(it.name(), abilityInfo)
|
BotCommand(it.name(), abilityInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (botCommands.isEmpty()) {
|
||||||
|
log.info { "Bot 没有任何命令, 命令列表更新已跳过." }
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
val setMyCommands = SetMyCommands()
|
val setMyCommands = SetMyCommands()
|
||||||
setMyCommands.commands = botCommands
|
setMyCommands.commands = botCommands
|
||||||
return execute(DeleteMyCommands()) && execute(setMyCommands)
|
return execute(DeleteMyCommands()) && execute(setMyCommands)
|
||||||
|
Loading…
Reference in New Issue
Block a user