mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 07:30:09 +08:00
Mirai Console (Terminal)V0.01
This commit is contained in:
parent
d0fb1383a0
commit
758ea29caa
@ -44,6 +44,11 @@ import kotlin.system.exitProcess
|
||||
|
||||
object MiraiConsoleTerminalUI : MiraiConsoleUI {
|
||||
val cacheLogSize = 50
|
||||
var mainTitle = "Mirai Console v0.01 Core v0.15"
|
||||
|
||||
override fun pushVersion(consoleVersion: String, consoleBuild: String, coreVersion: String) {
|
||||
mainTitle = "Mirai Console(Terminal) $consoleVersion $consoleBuild Core $coreVersion"
|
||||
}
|
||||
|
||||
override fun pushLog(identity: Long, message: String) {
|
||||
log[identity]!!.push(message)
|
||||
@ -70,7 +75,7 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
|
||||
override suspend fun requestInput(question: String): String {
|
||||
requesting = true
|
||||
while (requesting) {
|
||||
Thread.sleep(100)//不然会卡死 迷惑吧
|
||||
delay(100)//不然会卡死 迷惑吧
|
||||
}
|
||||
return requestResult!!
|
||||
}
|
||||
@ -96,6 +101,7 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
|
||||
val log = ConcurrentHashMap<Long, LimitLinkedQueue<String>>().also {
|
||||
it[0L] = LimitLinkedQueue(cacheLogSize)
|
||||
}
|
||||
|
||||
val botAdminCount = ConcurrentHashMap<Long, Int>()
|
||||
|
||||
private val screens = mutableListOf(0L)
|
||||
@ -294,7 +300,6 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
|
||||
val height = terminal.terminalSize.rows
|
||||
terminal.setBackgroundColor(TextColor.ANSI.DEFAULT)
|
||||
|
||||
val mainTitle = "Mirai Console v0.01 Core v0.15"
|
||||
textGraphics.foregroundColor = TextColor.ANSI.WHITE
|
||||
textGraphics.backgroundColor = TextColor.ANSI.GREEN
|
||||
textGraphics.putString((width - mainTitle.length) / 2, 1, mainTitle, SGR.BOLD)
|
||||
|
@ -45,8 +45,8 @@ object MiraiConsole {
|
||||
|
||||
var path: String = System.getProperty("user.dir")
|
||||
|
||||
val version = "0.01"
|
||||
var coreVersion = "0.15"
|
||||
val version = "v0.01"
|
||||
var coreVersion = "v0.15.1"
|
||||
val build = "Beta"
|
||||
|
||||
lateinit var frontEnd: MiraiConsoleUI
|
||||
@ -54,7 +54,10 @@ object MiraiConsole {
|
||||
frontEnd: MiraiConsoleUI
|
||||
) {
|
||||
this.frontEnd = frontEnd
|
||||
logger("Mirai-console [v$version $build | core version v$coreVersion] is still in testing stage, majority feature is available")
|
||||
frontEnd.pushVersion(
|
||||
version, build, coreVersion
|
||||
)
|
||||
logger("Mirai-console [$version $build | core version $coreVersion] is still in testing stage, majority feature is available")
|
||||
logger(
|
||||
"Mirai-console now running under " + System.getProperty(
|
||||
"user.dir"
|
||||
|
@ -32,6 +32,13 @@ interface MiraiConsoleUI {
|
||||
bot: Bot
|
||||
)
|
||||
|
||||
|
||||
fun pushVersion(
|
||||
consoleVersion: String,
|
||||
consoleBuild: String,
|
||||
coreVersion: String
|
||||
)
|
||||
|
||||
/**
|
||||
* 让UI层提供一个Input
|
||||
* 这个Input 不 等于 Command
|
||||
@ -41,6 +48,7 @@ interface MiraiConsoleUI {
|
||||
question: String
|
||||
): String
|
||||
|
||||
|
||||
/**
|
||||
* 让UI层更新BOT管理员的数据
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user