I have a telegram bot like this:
- Getting updates by
webhook
- Language: C# (I welcome answers with other languages too)
We have the following scenario for the user:
- Send
/MyPhoto a_parameter
command to the bot - Send a photo to the bot
- Send another photo to the bot
- Send another photo to the bot
- Send
Base question:
What is the best way to make sure the sent photo by the user is right after sending /MyPhoto a_parameter
command?
Some ways:
- I can save every executed command by each user in the database and fetch the last executed command by the current user and compare it with
/MyPhoto
, if they are equal then i sure the user is sending a photo after/MyPhoto
command. - Create a cache system to hold the last executed command by each user (Mix with db)
But if it is possible, I want prevent fetch the last executed command from database to improve performance.
Do you know a better solution? For example using some thing in telegram bot API to keep last executed command as hidden in send/receive messages between user and bot .
I edited the question with adding steps 3 & 4 in the above scenario.