11

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) }
imbananko
  • 122
  • 8
  • 1
    Maybe share some code to help you better? – Pato05 Apr 15 '20 at 13:41
  • 1
    updated with code – imbananko Apr 30 '20 at 09:44
  • As far as I know, telegram blocks multiple button clicks from a single client in a short period of time... – Pato05 Jun 02 '20 at 00:21
  • @Pato05 thanks for reply, but is there any documentation about that? And also why do multiple clicks work well in chat but not in channel? – imbananko Jun 08 '20 at 14:50
  • @imbananko are you using reply keyboards or inline keyboards? The problem is when you are an admin of that channel or subscriber? – wowkin2 Aug 13 '20 at 07:54
  • @imbananko do you send answerCallbackQuery after first button click? – wowkin2 Aug 13 '20 at 07:56
  • 1
    https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this the limitations do not really cover this, imo. – Robert Heine Aug 14 '20 at 07:47
  • @wowkin2 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 answerCallbackQuery – imbananko Aug 16 '20 at 19:15
  • @imbananko but you need to send answerCallbackQuery at the beginning of your handler, not after button processed. You can see that in most documentation examples. – wowkin2 Aug 16 '20 at 19:59
  • @wowkin2 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 wrong – imbananko Aug 28 '20 at 23:02

0 Answers0