Уведомления

Группа в Telegram: @pythonsu

#1 Июль 7, 2018 15:09:51

kriks
Зарегистрирован: 2017-08-03
Сообщения: 12
Репутация: +  0  -
Профиль   Отправить e-mail  

Telegram API. Получить текст подписи к изображению

Парни. Помогите.
Как получить Caption от изображения, отправленного боту? Я не могу реализовать парсинг. Спасибо.
Ниже код получения картинки.

 @bot.message_handler(content_types=['photo']) 
def handle_docs_photo(message):
try:
    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)

Отредактировано kriks (Июль 7, 2018 15:21:34)

Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version