C
C
cheremuxatop2020-07-28 16:54:48
Python
cheremuxatop, 2020-07-28 16:54:48

How to fix bug when x2 click on INLINE button in pyTelegramBotAPI?

There is a code that handles INLINE button clicks by passing callback_data to callback_query.
This code DISPLAYS money to the user, when the button is pressed, everything works fine, but if you quickly press it 2 times, then the bot somehow considers this and thinks that everything is okay.
How to fix it? So many checks already cram and nothing ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-07-28
@cheremuxatop

Store the user's last access time and ignore messages from this user if the difference between the past and current requests is less than a given limit, for example 2-3 seconds. I don’t know about pyTelegramBotAPI, but for example, for aiogram , this can be done at the middleware level with a simple decorator. You can see how it works there - ThrottlingMiddleware

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question