ed-asriyan / lottie-converter

Converts Lottie Animations (.json / .lottie) and Telegram stickers (*.tgs) to GIF / PNG / APNG / WEBP / WEBM
https://t.me/tgtowabot
MIT License
820 stars 76 forks source link

Update queued request in Telegram Bot #26

Closed alitoufighi closed 3 years ago

alitoufighi commented 3 years ago

Hi. After using your bot for several months, today I ended up with a "Queued (505)..." message. This was somehow exciting to see people are using your bot, but it was confusing since I couldn't have any ideas on when this queue will end and the gif will be sent. Honestly, this caused me to send my sticker again to check if this works now. I believe the current behavior causes other people do the same, and may impose an excess load on your backend servers.

It would be good if the bot can periodically inform people of their queue status. For example, iterating the queue every 5 seconds and update that "Queued (x)..." message (if x is really the position in queue!).

ed-asriyan commented 3 years ago

Hello! Previously, the bot did as you said. On each sticker, the convert bot sent updates to all users in the queue. This caused errors because Telegram has rate limits (about 30 messages per second as far as I remember), and therefore I make the bot to update messages only in the following positions in the queue: 1 2 3 4 5 6 7 9 11 14 18 23 29 36 45 56 70 88 110 138 173 216 270 338 423 529 661 826 to prevent from reaching telegram limits.