Trying to make a dice-roll function in my telegram bot. How it works right now:
- When a user sends "roll" bot replies with sendDice method and sends another message with result like "you rolled 5, you won and blah-blah .." > how it looks <
The problem is — the second message should not appear instantly, ideally after dice-roll animation is finished.
My first and obvious try on that was to add "sleep(3)"
before sending the second message, and it worked fine, until I realized it completely delays the execution of my script for those 3 seconds. (if two users rolled at the same time, one of the users has to wait until another guy's roll will be finished). So it's not cool
What can I use? :c