代码:
bot = telebot.TeleBot("TOKEN", parse_mode=None)
@bot.message_handler(content_types=['photo'])
def handle_docs_photo(message):
bot.send_photo("1267203280",message.file_id)
错误:
File "/home/Mrcpp1/test.py", line 23, in handle_docs_photo
bot.send_photo("1267203280",message.file_id)
AttributeError: 'Message' object has no attribute 'file_id'
我搜索了一下,机器人找不到答案我尝试了不同的方法,但都解决不了如何解决?
使用send_photo
:
try:
bot.send_photo(message.from_user.id, open("path_to_your_photo", 'rb'))
except Exception as error:
bot.send_message(message.from_user.id, str(error))