Q
Q
qwwwwwty2021-11-14 20:39:16
Python
qwwwwwty, 2021-11-14 20:39:16

How to bind content_type = ["photo"] to a specific function and to a command, Python Aiogram?

how to bind content_type = ["photo"] to a specific function and to a command so that the bot does not download photos all in a row , but those that are only attached with a specific text (for example, !dem)?

one developer gave me a hint, but I don't quite understand how to implement it all. I quote the words of the developer:
"Yes, just apply the Text filter with the ignore_caption=False parameter. In the same registration where the photo is, import the Text filter and use it"

here the function is registered:

def register_handlers_user(dp: Dispatcher):
    dp.register_message_handler(handle_docs_photo, commands=['dem'], commands_prefix="!/")
    dp.register_message_handler(handle_docs_photo, content_types=['photo']

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question