Is there a way to display a loading icon on an inline button for telegram bot?

Viewed 80

I'm developing a simple bot for myself.

I prompt the user with some inline buttons, which execute some functions on the backend. Since some functions take a little longer to execute, may I graphically show that the button tap was recorded, perhaps with a loading icon? Otherwise, the user might think something went wrong and keep on tapping.

I'm working on Python with python-telegram-bot v20.0a2.

1 Answers

the official TG clients will display a loading icon by default until you call answer_callback_query. So you can just delay calling that method until after your backend is done. IIRC after some timeout the icon will vanish on it's own, too, though, if your computation takes too long.

Related