Closed IzumiiKonata closed 1 year ago
启动部分代码 ` final ApplicationDslBuilder<SimpleApplicationConfiguration, SimpleApplicationBuilder, SimpleApplication> appBuilder = Applications.buildSimbotApplication(Simple.INSTANCE); appBuilder.build((builder, configuration) -> { // 安装mirai组件 builder.install(MiraiComponent.Factory, (config, perceivable) -> Unit.INSTANCE); // 安装mirai的bot管理器 builder.install(MiraiBotManager.Factory, (config, perceivable) -> Unit.INSTANCE);
// 寻找mirai的bot管理器,并注册bot
builder.bots(Lambdas.suspendConsumer(botRegistrar -> {
for (EventProvider provider : botRegistrar.getProviders()) {
if (provider instanceof MiraiBotManager) {
MiraiBotManager miraiBotManager = (MiraiBotManager) provider;
final MiraiBot bot = miraiBotManager.register([qq], [password]);
bot.startBlocking();
// or bot.startAsync()
break;
}
}
}));
});
SimpleApplication application = appBuilder.createAsync().join();
SimpleEventListenerManager eventListenerManager = application.getEventListenerManager();
eventListenerManager.register(SimpleListeners.listener(
MiraiGroupMessageEvent.Key,
(context, event) -> {
String message = event.getMessageContent().getPlainText();
MessagesBuilder specialMessages = new MessagesBuilder();
for (Message.Element<?> element : event.getMessageContent().getMessages()) {
if (!(element instanceof Text)) {
specialMessages.append(element);
}
}
if (message.startsWith(ProjectMisaka.getInstance().getCommandManager().getPrefix())) {
ProjectMisaka.getInstance().getCommandManager().tryExecute(message, specialMessages.build(), event);
}
EventManager.call(new SimbotGroupMessageEvent(event));
}
));
new Thread(application::joinBlocking, "Simbot Thread").start();
`
版本号
3.0.0-RC.3
附加版本
simbot-component-mirai-core: 3.0.0.0-M5
选择此问题涉及的编程语言
Java
选择此问题涉及的组件库
mirai
问题描述
更新依赖前能跑起来,把simbot-core从3.0.0-RC2更新到3.0.0-RC3 simbot-component-mirai-core从3.0.0.0-M4更新到3.0.0.0-M5后注册bot时就卡住不动了
复现方式
更新依赖,然后启动项目
相关日志
No response
其他补充
No response