-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Please answer these questions before submitting your issue. Thanks!
-
What version of pyTelegramBotAPI are you using?
4.14.0 -
What OS are you using?
Windows 10 -
What version of python are you using?
Python 3.12.0
Hi everyone! I am making a bot and currently I have started to try using States. I know that it is possible to use the state as a condition for a message_handler, like this:
@bot.message_handler(state=states.some_state)
def some_function(message):
# Some code
But what i want to do is the same thing but with callback_query_handler. Basically, I just want my callback handler to only react to calls while user is in a particular state. But is it even possible? I couldn't find any examples or info online.
I expected something like this to work:
@bot.callback_query_handler(func = lambda call: bot.get_state(call.from_user.id, call.message.chat.id) == states.some_state)
def some_function(call):
# Some code
And it doesn't work at all. Would be nice to know if I can even do this)
Metadata
Metadata
Assignees
Labels
No labels