Search code examples
pythontelegrampython-telegram-bot

Some questions about using python-telegram-bot


Some questions about using python-telegram-bot

I'm using python-telegram-bot to create a telegram bot.

I want to forward a graphic message (similar to the one below) to the robot, and the robot removes the image and returns the text.

I didn't find an example in the official documentation.

I hope someone can help me.

enter image description here

I read about Combining filters,like handler = MessageHandler(Filters.forwarded & Filters.photo, callback)

but I don't know how to use them to separate images and text


Solution

  • I sloved it

    just use the code below

    def callback(update: Update, context: CallbackContext):
        print(update.message.caption)
    

    then python will print out the text

    don't forget to import CallbackContext and Updater