mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-27 00:30:17 +08:00
481973d5e6
* NewProjectWizard * dependencies and validations * Implement checkers * Implement project generator * Add new template RunTerminal.run.xml for Run Configuration * Set supported IDEA version to 221 * Fix localization * Fix since-until * Rearrange files
26 lines
979 B
Plaintext
26 lines
979 B
Plaintext
package $PACKAGE_NAME
|
|
|
|
import net.mamoe.mirai.alsoLogin
|
|
import net.mamoe.mirai.console.MiraiConsole
|
|
import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.enable
|
|
import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.load
|
|
import net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader
|
|
import java.io.File
|
|
import java.util.Properties
|
|
|
|
suspend fun main() {
|
|
MiraiConsoleTerminalLoader.startAsDaemon()
|
|
|
|
val pluginInstance = ${CLASS_NAME}#if (${LANGUAGE_TYPE} != "Kotlin").INSTANCE #end
|
|
|
|
|
|
pluginInstance.load() // 主动加载插件, Console 会调用 ${CLASS_NAME}.onLoad
|
|
pluginInstance.enable() // 主动启用插件, Console 会调用 ${CLASS_NAME}.onEnable
|
|
|
|
val properties = Properties().apply { File("account.properties").inputStream().use { load(it) } }
|
|
|
|
val bot = MiraiConsole.addBot(properties.getProperty("id").toLong(), properties.getProperty("password")).alsoLogin() // 登录一个测试环境的 Bot
|
|
|
|
MiraiConsole.job.join()
|
|
}
|