@pertbobrov33

Как отправить фото с теском одним сообщением через python-telegram-bot?

Написал по туториалу сомого простого бота, но не могу заставить его отправить мне сообщение вида: картинка+текст
Код:
import logging
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters

logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                    level=logging.INFO)

def start(update, context):
    update.message.reply_text('Hi!')

def help(update, context):
    update.message.reply_text('HELP?')

def error(update, context):
    logger.warning('Update "%s" caused error "%s"', update, context.error)

def send_photo(update, context):
    update.send_photo(photo="photo/photo.jpeg", caption="hello test123")

def reply(update, context):
    if update.message.text == "Hello":
        send_photo(update, context)

def main():
    updater = Updater('1081942003:AAGDY--U_XAQBYgSY0ZfkvRhMK8eqNuU6Mo', use_context=True)
    dp = updater.dispatcher
    dp.add_handler(CommandHandler("start", start))
    dp.add_handler(CommandHandler("help", help))
    dp.add_handler(MessageHandler(Filters.text, reply))
    dp.add_error_handler(error)
    updater.start_polling()
    updater.idle()

if __name__ == '__main__':
    main()

Буду благодарен за помощь
  • Вопрос задан
  • 304 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы