Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TelegramBot启动时未初始化用户信息 #885

Closed
Flock-YT opened this issue Jul 20, 2024 · 0 comments · Fixed by simple-robot/simbot-component-telegram#18
Closed

TelegramBot启动时未初始化用户信息 #885

Flock-YT opened this issue Jul 20, 2024 · 0 comments · Fixed by simple-robot/simbot-component-telegram#18
Assignees
Labels
bug 这是个BUG 组件:Telegram 与 Telegram 组件相关

Comments

@Flock-YT
Copy link

Flock-YT commented Jul 20, 2024

是否会提供贡献?

版本号

simpler-robot:v4.3.0

附加版本

simbot-component-telegram:v0.0.6

涉及的编程语言

Java

项目构建工具

Maven

涉及的组件库

Telegram

问题描述

TelegramBot启动时未初始化用户信息导致从BotManagers中获取到已经注册好的Bot的ID时发生错误。

复现方式

BotManagers botManagers = application.getBotManagers();

        Sequence<Bot> botSequence = botManagers.allBots();

        Iterator<Bot> iterator = botSequence.iterator();

        while (iterator.hasNext()) {
            Bot bot = iterator.next();
            ID id = bot.getId();
            System.out.println(id);
        }

相关日志

java.lang.IllegalStateException: `userInfo` has not been initialized yet.
	at love.forte.simbot.component.telegram.core.bot.internal.TelegramBotImpl.getUserInfo(TelegramBotImpl.kt:77) ~[simbot-component-telegram-core-jvm-0.0.6.jar:na]
	at love.forte.simbot.component.telegram.core.bot.TelegramBot.getId(TelegramBot.kt:74) ~[simbot-component-telegram-core-jvm-0.0.6.jar:na]
	at me.lele.eric_tg_bot.listener.Test.onStart(Test.java:32) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at kotlin.reflect.jvm.internal.calls.CallerImpl$Method.callMethod(CallerImpl.kt:97) ~[kotlin-reflect-1.9.24.jar:1.9.24-release-822]
	at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:113) ~[kotlin-reflect-1.9.24.jar:1.9.24-release-822]
	at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108) ~[kotlin-reflect-1.9.24.jar:1.9.24-release-822]
	at love.forte.simbot.quantcat.common.binder.FunctionalBindableEventListener$4.invokeSuspend$lambda$1$lambda$0(FunctionalBindableEventListener.kt:124) ~[simbot-quantcat-common-jvm-4.3.0.jar:na]
	at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:48) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:40) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.9.24.jar:1.9.24-release-822]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702) ~[kotlinx-coroutines-core-jvm-1.8.1.jar:na]

其他补充

No response

@Flock-YT Flock-YT added the bug? 疑似为bug、存在普遍性问题、待确认 label Jul 20, 2024
@ForliyScarlet ForliyScarlet added the 等待确认 等待负责人员的确认 label Jul 20, 2024
@ForteScarlet ForteScarlet added 组件:Telegram 与 Telegram 组件相关 bug 这是个BUG and removed bug? 疑似为bug、存在普遍性问题、待确认 等待确认 等待负责人员的确认 labels Jul 20, 2024
@ForteScarlet ForteScarlet changed the title Springboot模式下无法从BotManagers中获取到已经注册好的Bot TelegramBot启动时未初始化用户信息 Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 这是个BUG 组件:Telegram 与 Telegram 组件相关
Projects
None yet
3 participants