miraiBotsIfSupport
inline fun ApplicationBuilder<*>.miraiBotsIfSupport(crossinline block: suspend MiraiBotManager.(BotRegistrar) -> Unit)(source)
从当前 ApplicationBuilder 中,通过 ApplicationBuilder.bots 寻找并使用注册的 MiraiBotManager.
simpleApplication {
miraiBotsIfSupport { // it: simboot.BotRegistrar, this: MiraiBotManager
val bot: MiraiBot = register(114514L, "password")
bot.start()
}
}
Content copied to clipboard
如果当前环境中不存在 MiraiBotManager, 则 block 不会被执行。