mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Do not kill backend if auto-login failed
This commit is contained in:
parent
0b957d6475
commit
c0531acab7
@ -16,7 +16,6 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.alsoLogin
|
||||
import net.mamoe.mirai.console.MalformedMiraiConsoleImplementationError
|
||||
import net.mamoe.mirai.console.MiraiConsole
|
||||
import net.mamoe.mirai.console.MiraiConsoleFrontEndDescription
|
||||
@ -236,9 +235,10 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope, MiraiConsoleI
|
||||
}
|
||||
}
|
||||
}
|
||||
when (account.password.kind) {
|
||||
|
||||
val bot = when (account.password.kind) {
|
||||
PLAIN -> {
|
||||
MiraiConsole.addBot(id, account.password.value, BotConfiguration::configBot).alsoLogin()
|
||||
MiraiConsole.addBot(id, account.password.value, BotConfiguration::configBot)
|
||||
}
|
||||
MD5 -> {
|
||||
val md5 = kotlin.runCatching {
|
||||
@ -246,9 +246,13 @@ internal object MiraiConsoleImplementationBridge : CoroutineScope, MiraiConsoleI
|
||||
}.getOrElse {
|
||||
error("Bad auto-login md5: '${account.password.value}' for account $id")
|
||||
}
|
||||
MiraiConsole.addBot(id, md5, BotConfiguration::configBot).alsoLogin()
|
||||
MiraiConsole.addBot(id, md5, BotConfiguration::configBot)
|
||||
}
|
||||
}
|
||||
|
||||
runCatching { bot.login() }.getOrElse {
|
||||
mainLogger.error(it)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user