提示。如何从发送到机器人的图片中获取标题? 我不明白。谢谢。
@ bot.message_handler(content_types = ['photo'])
def handle_docs_photo(message):
尝试:
chat_id = message.chat.id
text = message.text
vid_id = message.chat.first_name
file_info = bot.get_file(message.photo[len(message.photo)-1].file_id)
downloaded_file = bot.download_file(file_info.file_path)
src='/home/pi/test/'+file_info.file_path;
with open(src, 'wb') as new_file:
new_file.write(downloaded_file)
bot.reply_to(message,"Foto add")
img = open(src, 'rb')
bot.send_photo(adminid, img)
keyboard = types.InlineKeyboardMarkup(row_width=1)
callback_bad = types.InlineKeyboardButton(text="KILL", callback_data='story[!!!]'+str(file_info.file_path))
keyboard.add(callback_bad)
bot.send_message(adminid,"Add: "+vid_id , reply_markup=keyboard)
except Exception as e:
bot.send_message(adminid, e)