Answer the question
In order to leave comments, you need to log in
Why does the telegram bot spam after pressing the inline button?
I write in Python using python-telegram-bot
Essence:
When you press the inline button, a simple message should be sent in response.
What happens:
When you press the inline button, a message is sent, but if you lock the screen on your phone (close the telegram client), the bot will duplicate the message. If after that you open the telegram client and enter the chat with the bot, then the bot will slap a couple more duplicates of the previous message. Of course, that this nonsense should not be.
Inline button click handler code:
def button(self, bot, update):
query = update.callback_query
if query.data == 'getOrderInfoByID':
bot.send_message(parse_mode='HTML', chat_id=query.message.chat_id, text='Текст')
Answer the question
In order to leave comments, you need to log in
The problem is not knowing the Telegram API)
When using the Inline Callback Query, Telegram will spam updates until it receives a response to the callback (not some kind of action like sending a message, but specifically the response to the callback!)
More details here: https://core .telegram.org/bots/api#answercallbackquery
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question