python - 如何使用远程机器人从用户那里获取带有标题的照片
问题描述
我想用 python 在我的 Telegram 机器人上获得一张带有标题的照片。
@bot.message_handler(func=lambda message: True)
我想做这样的事情来获得带有标题的照片。
解决方案
去做这个,
@bot.message_handler(func=lambda message: True, content_types=['photo'])
def some_function(message):
print(message.caption) # This will be your caption.
注意:您不能message.caption
在任何地方使用,因为它不适用于短信
推荐阅读
- php - 获取图像大小会导致 RSS 提要出错
- ruby-on-rails - 为旧版 Rails 应用程序寻找兼容的 Gem 版本
- r - 将 xts 对象列表写入 excel
- .net - MSBuild 尝试将 .NET 核心目标用于 .NET Framework 项目
- javascript - jQuery遍历复杂数组和对象
- c++ - 如何在不知道其名称的情况下检查某个进程是否正在运行
- sql - 如何根据用户的选择处理 groupby 行中的字段顺序?
- javascript - 使用一个提交按钮/onsubmit 调用两个函数
- android - 最电池友好的周期性任务方法
- c# - 如何在不重定向标准输出的情况下读取进程的控制台输出?