Offset Issue if Error
If the first message received back has a problem (Such as a group chat that kicked the bot) the offset will not update.
You will be stuck in an endless loop with offset being 0.
As a temporary fix for myself, i edited the source and added my offset in and now my bot is working again. @ExcuseBot
I can't reproduce your issue, I've tested with stickers as you are commenting in the other issue and it's working normal.
First request:
Polling with options: {"qs":{"offset":1,"timeout":0},"url":"https://api.telegram.org/botTOKEN/getUpdates"} +5ms
polling data [{"update_id":784639540,"message":{"message_id":472,"from":{"id":1234,"..."},"chat":{"id":1234,"..."},"date":1437946658,"sticker":{"width":400,"height":512,"thumb":{"file_id":"...","file_size":2350,"width":100,"height":128},"file_id":"...","file_size":10452}}}] +193ms
Updates the offset:
updated offset: 784639540 +0ms
The next request:
Polling with options: {"qs":{"offset":784639541,"timeout":0},"url":"https://api.telegram.org/botTOKEN/getUpdates"}
Hmm very strange, I'll have to re-download the source (as i butchered mine to make it work temporarily) and see if it still happens
Same issue here, as i mentioned in the https://github.com/yagop/node-telegram-bot-api/issues/36 post.
@yagop
I also had this issue and a user was flooded with response and eventually blocked bot and that took down the bot-server all because of this loop.
Question: Why do we set the offset only when it's the last item to process? what's wrong with just setting it after each item (i.e. get rid of the if)?
I also think there need to be a much more reliable error handling around the self.callback -- i.e. wrap with try/catch as opposed to let it bubble to the promise error handler.
what do you think?
@yagop any updates on this? I keep running into this issue - I've nailed it down a bit:
- sometimes events get "stuck" and I keep receiving the same message, command, etc events
- calling
/getUpdateswith a super high offset fixes the issue - it seems to happen when many events get sent in a short amount of time
- I tried spamming a python bot that also uses the default long polling options - no issues there
Please proceed to issue #36 as it handles this particular bug!
Thanks @Beyondem, @mvalipour and @omnidan for your time and effort in this. See you there!