Telegram API POST /editmessagereplymarkup method executes with delay
Asked Answered
A

0

13

Given:

Action:

Click any button twice (or more) in short period of time (1-2 seconds)

Problem:

When I click buttons in group - everything is ok, but when I click same buttons with same logic in channel:

The first api call executes very fast But the second api call needs about 5 seconds to get responded, which freezes business logic and gets user annoyed

Methods:

private fun updateChatMarkup(messageId: Int, votes: Map<VoteValue, Int>) =
  EditMessageReplyMarkup()
      .setChatId(chatId)
      .setMessageId(messageId)
      .setReplyMarkup(createMarkup(votes)).let { execute(it) }   

private fun updateChannelMarkup(messageId: Int, votes: Map<VoteValue, Int>) =
  EditMessageReplyMarkup()
      .setChatId(channelId)
      .setMessageId(messageId)
      .setReplyMarkup(createMarkup(votes, messageId)).let { execute(it) }
Alda answered 15/4, 2020 at 10:39 Comment(11)
Maybe share some code to help you better?Ramires
updated with codeAlda
As far as I know, telegram blocks multiple button clicks from a single client in a short period of time...Ramires
@Ramires thanks for reply, but is there any documentation about that? And also why do multiple clicks work well in chat but not in channel?Alda
@Alda are you using reply keyboards or inline keyboards? The problem is when you are an admin of that channel or subscriber?Hiatus
@Alda do you send answerCallbackQuery after first button click?Hiatus
core.telegram.org/bots/… the limitations do not really cover this, imo.Volsci
@Hiatus hi, I'm using replyMarkup keyboard. Both admins and users face the same problem. Right now I'm using answerCallbackQuery after each button processed, but the problem existed long before I started using answerCallbackQueryAlda
@Alda but you need to send answerCallbackQuery at the beginning of your handler, not after button processed. You can see that in most documentation examples.Hiatus
@Hiatus hi sorry for long reply. I made a little investigation, but the point is - there is no correlation between how fast I do answerCallbackQuery and how fast telegram updates my inline buttons on the channel. I experimented making answerCallbackQuery at the beginning of update handle method - results are always the same: first update - lightning fast, second and next - 5-seconds delay. Please correct me if I'm wrongAlda
I'm experiencing the same issue, it is fast after the first button click but the next ones take time to respondDextrorotation

© 2022 - 2024 — McMap. All rights reserved.