plugin supporting

This commit is contained in:
jiahua.liu 2020-01-19 20:41:51 +08:00
parent 4f82703703
commit 8ada62d748
3 changed files with 12 additions and 4 deletions

4
mirai-console/README.MD Normal file
View File

@ -0,0 +1,4 @@
### Mirai Console
#### Mirai Console allows you to run Mirai in command lines.
#### More Importantly, Mirai Console support <b>Plugins</b>

View File

@ -1,5 +1,4 @@
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import net.mamoe.mirai.Bot
import net.mamoe.mirai.alsoLogin
import net.mamoe.mirai.plugin.PluginManager
@ -40,8 +39,13 @@ tailrec fun processNextCommandLine() {
val qqNumber = commandArgs[1].toLong()
val qqPassword = commandArgs[2]
println("login...")
GlobalScope.launch {
Bot(qqNumber, qqPassword).alsoLogin()
runBlocking {
try {
Bot(qqNumber, qqPassword).alsoLogin()
} catch (e: Exception) {
println("login failed")
}
}
}
}