首页 > 解决方案 > 如何使用远程机器人从用户那里获取带有标题的照片

问题描述

我想用 python 在我的 Telegram 机器人上获得一张带有标题的照片。

@bot.message_handler(func=lambda message: True)

我想做这样的事情来获得带有标题的照片。

标签: pythonpy-telegram-bot-api

解决方案


去做这个,

@bot.message_handler(func=lambda message: True, content_types=['photo'])
def some_function(message):
    print(message.caption) # This will be your caption.

注意:您不能message.caption在任何地方使用,因为它不适用于短信


推荐阅读