mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-05 05:59:18 +08:00
Fix frontend
This commit is contained in:
parent
bd33a0e39a
commit
58eac01cad
3
.gitignore
vendored
3
.gitignore
vendored
@ -44,3 +44,6 @@ keys.properties
|
||||
|
||||
bintray.user.txt
|
||||
bintray.key.txt
|
||||
|
||||
token.txt
|
||||
/*/token.txt
|
@ -48,7 +48,7 @@ object BuiltInCommands {
|
||||
}
|
||||
|
||||
object Help : SimpleCommand(
|
||||
ConsoleCommandOwner, "help", "?",
|
||||
ConsoleCommandOwner, "help",
|
||||
description = "Gets help about the console."
|
||||
) {
|
||||
init {
|
||||
|
@ -21,9 +21,12 @@
|
||||
package net.mamoe.mirai.console.pure
|
||||
|
||||
import kotlinx.coroutines.isActive
|
||||
import net.mamoe.mirai.console.MiraiConsole
|
||||
import net.mamoe.mirai.console.command.CommandExecuteStatus
|
||||
import net.mamoe.mirai.console.command.CommandPrefix
|
||||
import net.mamoe.mirai.console.command.ConsoleCommandSender
|
||||
import net.mamoe.mirai.console.command.executeCommandDetailed
|
||||
import net.mamoe.mirai.console.job
|
||||
import net.mamoe.mirai.console.pure.MiraiConsolePure.Companion.start
|
||||
import net.mamoe.mirai.console.utils.ConsoleInternalAPI
|
||||
import net.mamoe.mirai.message.data.Message
|
||||
@ -42,8 +45,8 @@ object MiraiConsolePureLoader {
|
||||
|
||||
|
||||
internal fun startup() {
|
||||
startConsoleThread()
|
||||
MiraiConsolePure().start()
|
||||
startConsoleThread()
|
||||
}
|
||||
|
||||
internal fun startConsoleThread() {
|
||||
@ -51,7 +54,11 @@ internal fun startConsoleThread() {
|
||||
val consoleLogger = DefaultLogger("Console")
|
||||
kotlinx.coroutines.runBlocking {
|
||||
while (isActive) {
|
||||
val next = MiraiConsoleFrontEndPure.requestInput("")
|
||||
val next = MiraiConsoleFrontEndPure.requestInput("").let {
|
||||
if (it.startsWith(CommandPrefix)) {
|
||||
it
|
||||
} else CommandPrefix + it
|
||||
}
|
||||
if (next.isBlank()) {
|
||||
continue
|
||||
}
|
||||
@ -71,6 +78,10 @@ internal fun startConsoleThread() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}.let { thread ->
|
||||
MiraiConsole.job.invokeOnCompletion {
|
||||
thread.interrupt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user