We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
simbot-component-telegram:v0.0.8
Java
Telegram
由于TelegramBot的特性,几乎在每次启动的时候都要执行一些类来初始化机器人例如:
// 获取命令更新器并添加命令 阻塞线程 bot.commandsBlocking() .getUpdater() .addCommand("start", "开始使用Bot") .addCommand("help", "获取帮助信息") .addCommand("info", "查看Bot信息") .addCommand("111", "111") .updateBlocking();
但是由于Simbot是异步启动在Springboot中使用@PostConstruct注解在启动后自动运行初始化类的时候Bot还没启动完毕,导致拿不到Bot,请问是否考虑提供一个接口,在所有Bot都启动完毕后就会自动执行依赖了这个接口的类
Springboot
@PostConstruct
Bot
(还是说其实已经有这种东西了,但是我看了一下文档似乎没找到.)
The text was updated successfully, but these errors were encountered:
一般来说应该会有一个XxxBotStartedEvent在bot被启动后推送,不过TG组件似乎尚未实现这个事件
可以考虑在异步中轮询判断,直到有bot了,并且bot.isStarted为true后执行逻辑,然后终止循环
在异步中主要是为了防止长时间阻塞导致其他的副作用
Sorry, something went wrong.
OK了解
TelegramBotRegisteredEvent
TelegramBotStartedEvent
ForteScarlet
Successfully merging a pull request may close this issue.
版本号
simbot-component-telegram:v0.0.8
涉及的编程语言
Java
涉及的组件库
Telegram
疑问描述
由于TelegramBot的特性,几乎在每次启动的时候都要执行一些类来初始化机器人例如:
但是由于Simbot是异步启动在
Springboot
中使用@PostConstruct
注解在启动后自动运行初始化类的时候Bot
还没启动完毕,导致拿不到Bot,请问是否考虑提供一个接口,在所有Bot
都启动完毕后就会自动执行依赖了这个接口的类(还是说其实已经有这种东西了,但是我看了一下文档似乎没找到.)
The text was updated successfully, but these errors were encountered: