Closed Flock-YT closed 3 months ago
你的 component 拼错了
如果修正单词后启动仍有问题的话可随时重启当前issue
修改后依旧有相同报错 此外我的bot.json是从组件代码库里抄的,所以那边可能也得改一下. https://github.com/simple-robot/simbot-component-telegram/tree/dev/main/simbot-component-telegram-core
提供下修改后的错误日志、依赖配置等内容
刚刚看错了修改了component单词后的报错并不是原报错而是BotRegisterFailureException
2024-07-18T16:23:53.627+08:00 ERROR 11704 --- [Eric_TG_Bot] [ main] o.s.boot.SpringApplication : Application run failed
love.forte.simbot.bot.BotRegisterFailureException: Failed to register bot from resource [file [C:\Users\mc328\IdeaProjects\Eric_TG_Bot\target\classes\simbot-bots\TG.bot.json]] to manager [love.forte.simbot.component.telegram.core.bot.internal.TelegramBotManagerImpl@35d26ad2] via configuration [SerializableTelegramBotConfiguration(ticket=Ticket(token=XXXXXXXXXX), config=love.forte.simbot.component.telegram.core.bot.SerializableTelegramBotConfiguration$Config@bb25753)]. The information: null
at love.forte.simbot.spring.configuration.application.BotAutoLoader.processRegisterBotFailed(DefaultSimbotApplicationProcessor.kt:344) ~[simbot-core-spring-boot-starter-4.3.0.jar:na]
at love.forte.simbot.spring.configuration.application.BotAutoLoader.load$lambda$2(DefaultSimbotApplicationProcessor.kt:224) ~[simbot-core-spring-boot-starter-4.3.0.jar:na]
at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:210) ~[kotlin-stdlib-1.9.24.jar:1.9.24-release-822]
at kotlin.sequences.FilteringSequence$iterator$1.calcNext(Sequences.kt:170) ~[kotlin-stdlib-1.9.24.jar:1.9.24-release-822]
at kotlin.sequences.FilteringSequence$iterator$1.hasNext(Sequences.kt:194) ~[kotlin-stdlib-1.9.24.jar:1.9.24-release-822]
at kotlin.sequences.TransformingSequence$iterator$1.hasNext(Sequences.kt:214) ~[kotlin-stdlib-1.9.24.jar:1.9.24-release-822]
at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:809) ~[kotlin-stdlib-1.9.24.jar:1.9.24-release-822]
at love.forte.simbot.spring.configuration.application.BotAutoLoader.load(DefaultSimbotApplicationProcessor.kt:248) ~[simbot-core-spring-boot-starter-4.3.0.jar:na]
at love.forte.simbot.spring.configuration.application.DefaultSimbotApplicationProcessor.loadBots(DefaultSimbotApplicationProcessor.kt:126) ~[simbot-core-spring-boot-starter-4.3.0.jar:na]
at love.forte.simbot.spring.configuration.application.DefaultSimbotApplicationProcessor.process0(DefaultSimbotApplicationProcessor.kt:122) ~[simbot-core-spring-boot-starter-4.3.0.jar:na]
at love.forte.simbot.spring.configuration.application.DefaultSimbotApplicationProcessor.process(DefaultSimbotApplicationProcessor.kt:111) ~[simbot-core-spring-boot-starter-4.3.0.jar:na]
at love.forte.simbot.spring.configuration.application.SimbotApplicationRunner.run(SimbotApplicationRunner.kt:56) ~[simbot-core-spring-boot-starter-4.3.0.jar:na]
at org.springframework.boot.SpringApplication.lambda$callRunner$4(SpringApplication.java:786) ~[spring-boot-3.3.1.jar:3.3.1]
at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:83) ~[spring-core-6.1.10.jar:6.1.10]
at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[spring-core-6.1.10.jar:6.1.10]
at org.springframework.util.function.ThrowingConsumer$1.accept(ThrowingConsumer.java:88) ~[spring-core-6.1.10.jar:6.1.10]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:798) ~[spring-boot-3.3.1.jar:3.3.1]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:786) ~[spring-boot-3.3.1.jar:3.3.1]
at org.springframework.boot.SpringApplication.lambda$callRunners$3(SpringApplication.java:774) ~[spring-boot-3.3.1.jar:3.3.1]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[na:na]
at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[na:na]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:774) ~[spring-boot-3.3.1.jar:3.3.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:342) ~[spring-boot-3.3.1.jar:3.3.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.1.jar:3.3.1]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.1.jar:3.3.1]
at me.lele.eric_tg_bot.EricTgBotApplication.main(EricTgBotApplication.java:13) ~[classes/:na]
Caused by: java.lang.ExceptionInInitializerError: null
at love.forte.simbot.telegram.stdlib.bot.internal.BotImpl.
进程已结束,退出代码为 1
依赖相关:
bot.json配置相关:
你需要添加一个 Ktor 的 HTTP Client 依赖,可以参考 QQ组件 中有关 Ktor 的说明,都是类似的,只不过TG组件不要求WebSocket的支持
emmmm添加依赖后虽然开启来不报错了但是他并没有驻留而是直接进程结束了,不确定是不是我哪里配置错了.
2024-07-18T16:39:26.627+08:00 INFO 30808 --- [Eric_TG_Bot] [ main] m.lele.eric_tg_bot.EricTgBotApplication : Starting EricTgBotApplication using Java 21.0.3 with PID 30808 (C:\Users\mc328\IdeaProjects\Eric_TG_Bot\target\classes started by mc328 in C:\Users\mc328\IdeaProjects\Eric_TG_Bot) 2024-07-18T16:39:26.629+08:00 INFO 30808 --- [Eric_TG_Bot] [ main] m.lele.eric_tg_bot.EricTgBotApplication : No active profile set, falling back to 1 default profile: "default" 2024-07-18T16:39:27.471+08:00 INFO 30808 --- [Eric_TG_Bot] [ main] love.forte.simbot.utils.BlockingRunner : Blocking runner wait timeout is enabled with wait timeout 1m. You can enable debug logging for 'love.forte.simbot.utils.BlockingRunner' for more stack information or disable it with the JVM parameter '-Dsimbot.blockingRunner.disableWaitTimeout=true'. 2024-07-18T16:39:27.609+08:00 INFO 30808 --- [Eric_TG_Bot] [ main] m.lele.eric_tg_bot.EricTgBotApplication : Started EricTgBotApplication in 1.258 seconds (process running for 1.837) 2024-07-18T16:39:27.696+08:00 INFO 30808 --- [Eric_TG_Bot] [ main] l.f.s.s.c.application.BotAutoLoader : The number of registered bots is 1 2024-07-18T16:39:27.699+08:00 INFO 30808 --- [Eric_TG_Bot] [ main] l.f.s.s.c.a.SimbotApplicationRunner : Launch application SpringApplication(isActive=true, isCompleted=false, eventDispatcher=SimpleEventDispatcher, components=Components(values=[TelegramComponent(id=simbot.telegram)]), plugins=Plugins(values=[love.forte.simbot.component.telegram.core.bot.internal.TelegramBotManagerImpl@5927f904])) with mode: NONE
进程已结束,退出代码为 0
补充一下我的配置
Main bot.json Springboot配置 目录结构 依赖
这是正常现象,参考集成Spring的可配置项 simbot.application.application-launch-mode
以及,顺带一提,如果你希望通过组件主动抓取事件来达成“事件订阅”的效果,你的配置文件需要配置 longPolling
,比如:
{
// 其他省略
"config": {
"longPolling": {
"limit": 100, // 每次最大抓取事件量
"timeout": 3600, // 每次抓取等待超时时间,不配置默认10分钟,单位秒
"allowedUpdates": null, // 允许抓取的事件的列表,List<String> 格式,默认为 `null` 即全部抓取
}
}
}
oo抱歉,因为早期用simbot的时候不需要特别配置THREAD模式,所以没回去仔细看文档,目前看来问题应该是解决了,感谢.
(希望可以在tg core的仓库中标注一下要添加Ktor 的 HTTP Client 依赖以防再有我这样的小白出现:)
TG组件毕竟还在早期,我甚至都没想到会有人这么快就用(
是否会提供贡献?
否
版本号
Simbot Core版本: simbot-core-spring-boot-starter-4.3.0
附加版本
TG组件版本: simbot-component-telegram-core-jvm-0.0.6
涉及的编程语言
Java
项目构建工具
Maven
涉及的组件库
Telegram
问题描述
Springboot模式下启动就报错,搭配的组件为TG组件,未测试其他组件是否有报错.
复现方式
启动即可复现
相关日志
其他补充
No response