Reputation: 31
I think I've found a Telegram bug on the iOS app that causes the bot to send multiple times the same message. The steps to reproduce the problem are:
It will be noticed at this point that the bot starts sending the same message numerous times. It is not easy to reproduce, it is important to lock the screen when the bot has not yet answered, so it is easier with bots that take a few moments to respond. Also, in the answer the bot has to send a message (not editing one that already exist).
I use Microsoft Bot Framework to develop the bot, however all the bots give me the same problem, both mine and others developed with other technologies different from mine. For example, I was able to reproduce it on @BotFather too. Sometimes it enters in a loop, and to stop it you have to send any message to the bot. I use an iPhone 5, iOS version 12.1.2, Telegram version 5.2. I also tried it on an iPhone 8, but not with other versions of Telegram. I also happen to receive more than 20 identical messages.
I've already contacted Bot Support on Telegram but no one answers me. Is there anyone who experienced the same problem?
Upvotes: 3
Views: 2194
Reputation: 41
I am facing the same problem, but it is not a telegram bug. When dealing with callback buttons, you must use answerCallbackQuery. Otherwise telegram thinks the callback was not handled and repeats the messages.
I use .net and the telegram.bot library and that fixes the problem.
await botClient.AnswerCallbackQueryAsync(request.CallbackQueryId, cancellationToken: cancellationToken);
Upvotes: 0
Reputation: 9
On iOS and macOS, when I click on an inline button and switch the client computer (macbook) off (sleep mode) and turn it on my bot receives the last message sent by the user. Each time message_id is the same. I solve it the following way: when my script sends a request to the Telegram server it receives a response. That response contains a message_id field and I save it.
Any next message must have another message_id. I just compare that number with the stored number and only if the number is other than saved I run the rest part of my script.
You can try my test bot and watch results in google table.
@ios_bug_bot (https://t.me/ios_bug_bot)
https://docs.google.com/spreadsheets/d/1VTx-O1w_-ka1RzGfaVLVBDu0CQxk16QeJTeFYOE4yvo/edit?usp=sharing
The bot source code is here
https://github.com/avtomatron/telegram_bot/blob/master/google_script_bot
Upvotes: 1