F
F
From Prog2021-06-08 22:05:35
Python
From Prog, 2021-06-08 22:05:35

Is it possible to write if message.text in the TG bot decorator function?

@my_bot.message_handler(commands = ['rate'])
def messages(message):
        Можно ли тут писать if message.text == '':?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kiril-cloud, 2021-06-08
@FromProg

yes, but it will not work because you have a trigger for the rate command, you can either remove everything from @bot.message_handler()
or
@bot.message_handler(content_type=['text'])
brackets in this case, the trigger will work on all messages from the user

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question