mirai console shutdown logic

This commit is contained in:
jiahua.liu 2020-02-17 16:56:03 +08:00
parent 2a82fe6b80
commit e284267d47

View File

@ -49,6 +49,8 @@ object MiraiConsole {
var coreVersion = "v0.15.1"
val build = "Beta"
var allDown = false
lateinit var frontEnd: MiraiConsoleUI
fun start(
frontEnd: MiraiConsoleUI
@ -80,6 +82,7 @@ object MiraiConsole {
fun stop() {
PluginManager.disableAllPlugins()
allDown = true
bots.forEach {
it.get()?.close()
}
@ -290,6 +293,9 @@ object MiraiConsole {
}
tailrec fun processNextCommandLine() {
if (allDown) {
return
}
var fullCommand = commandChannel.poll()
if (fullCommand != null) {
if (!fullCommand.startsWith("/")) {