Hello,
I’ve created a Telegram bot (set on webhook) to demonstrate the issue I’d like to address:
The program currently returns the user’s actions with a 3-second delay. However, I want to modify it to only process the user’s initial action. I want the bot to receive the first action, ignore any subsequent actions FOREVER (it should delete if from bot’s cache or elsewhere it is saved), response to that first action, then wait for the new first action from the user.
In its current state (the following code), the program responds to all user actions in the order they are received. I’m looking for a solution to make the bot work as follows:
- Receive the user’s first action.
- Respond to the first action.
- Wait for the user’s NEW action (not previous and past user’s actions).
- If the user has sent additional actions before the bot responds to the first action, ignore and discard them from memory without any reaction or acknowledgement forever.
I do not know how to do it, especially deleting those non-first actions so that the bot forget them forever and never use them.
I hope the explanation is clear enough.
Can anyone provide a solution to achieve this behavior?
The code:
https://dpaste.org/T9jyZ