Stop BotOnlineWatchdog if bot is closed

This commit is contained in:
Him188 2021-06-08 12:19:05 +08:00
parent 54a78313c8
commit ad3bd4cc0d

View File

@ -61,7 +61,7 @@ internal class SelectorNetworkHandler(
if (allowActiveMaintenance) {
val bot = context.bot
scope.launch(scope.hierarchicalName("BotOnlineWatchdog ${bot.id}")) {
while (isActive) {
while (isActive && bot.isActive) {
val instance = selector.getCurrentInstanceOrCreate()
awaitState(State.CLOSED) // suspend until next CLOSED