mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-09 10:06:59 +08:00
mirai console shutdown logic
This commit is contained in:
parent
2a82fe6b80
commit
e284267d47
@ -49,6 +49,8 @@ object MiraiConsole {
|
|||||||
var coreVersion = "v0.15.1"
|
var coreVersion = "v0.15.1"
|
||||||
val build = "Beta"
|
val build = "Beta"
|
||||||
|
|
||||||
|
var allDown = false
|
||||||
|
|
||||||
lateinit var frontEnd: MiraiConsoleUI
|
lateinit var frontEnd: MiraiConsoleUI
|
||||||
fun start(
|
fun start(
|
||||||
frontEnd: MiraiConsoleUI
|
frontEnd: MiraiConsoleUI
|
||||||
@ -80,6 +82,7 @@ object MiraiConsole {
|
|||||||
|
|
||||||
fun stop() {
|
fun stop() {
|
||||||
PluginManager.disableAllPlugins()
|
PluginManager.disableAllPlugins()
|
||||||
|
allDown = true
|
||||||
bots.forEach {
|
bots.forEach {
|
||||||
it.get()?.close()
|
it.get()?.close()
|
||||||
}
|
}
|
||||||
@ -290,6 +293,9 @@ object MiraiConsole {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tailrec fun processNextCommandLine() {
|
tailrec fun processNextCommandLine() {
|
||||||
|
if (allDown) {
|
||||||
|
return
|
||||||
|
}
|
||||||
var fullCommand = commandChannel.poll()
|
var fullCommand = commandChannel.poll()
|
||||||
if (fullCommand != null) {
|
if (fullCommand != null) {
|
||||||
if (!fullCommand.startsWith("/")) {
|
if (!fullCommand.startsWith("/")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user