You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After upgrade to 7.2.x if I don't call AbilityBot.onRegister() method manually after bot creation, it will fail to receive any messages from API with following exception
Exception in thread "pool-2-thread-1" java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because "this.replies" is null
at org.telegram.telegrambots.abilitybots.api.bot.BaseAbilityBot.filterReply(BaseAbilityBot.java:621)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:411)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.telegram.telegrambots.abilitybots.api.bot.BaseAbilityBot.consume(BaseAbilityBot.java:201)
at org.telegram.telegrambots.abilitybots.api.bot.AbilityBot.consume(AbilityBot.java:37)
this.replies is indeed null until onRegister is called. So my question is, am I doing something wrong? Documentation says nothing about it and yet everything works fine only if I call this method manually. If it is an intention? If so, why it is not mentioned anywhere. And if it is an intention, it looks like a bad design choice, because some magic method on bot must be called additionally to its creation and registration in TelegramBotApplication
Hi, thanks. I used the @PostConstruct annotation which might be not the 100% right one, since post construction doesn't mean, the bot is already registered, but because the default implementation creates some stuff and doesn't seem to depend on being really registered, that did the trick. But like I wrote before, I found such design decision questionable, that some method has to be called before bot is usable. Is there any reason why you can't call onRegister on public method of the bot, when registerBot is called?
Describe the bug
After upgrade to 7.2.x if I don't call AbilityBot.onRegister() method manually after bot creation, it will fail to receive any messages from API with following exception
this.replies is indeed null until onRegister is called. So my question is, am I doing something wrong? Documentation says nothing about it and yet everything works fine only if I call this method manually. If it is an intention? If so, why it is not mentioned anywhere. And if it is an intention, it looks like a bad design choice, because some magic method on bot must be called additionally to its creation and registration in TelegramBotApplication
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Ideally, onRegister would be called automatically OR at least mentioned in the documentation and examples provided
The text was updated successfully, but these errors were encountered: