D
D
Danil Andreev2020-07-13 20:53:06
Python
Danil Andreev, 2020-07-13 20:53:06

How to bind buttons in a telegram bot to a photo with text?

5f0c9eeec4955961193858.png

if call.data == 'Executive':
    pic = 'https://luxurytime.in/wp-content/uploads/2019/05/243-0043-1100x1100.jpg'
    bot.send_photo(call.message.chat.id, pic, caption='ULYSSE NARDIN Executive \nМеханизм с автоматическим подзаводом \nЗапас хода: 42 часа \nКорпус: 43 мм, сталь, керамика, керамический безель\nЧерный циферблат, римские цифры\nЧерный каучуковый ремешок\nВодонепроницаемость: 100 м\nЧасы, минуты, секундная стрелка на 6-ти часах, дата \nВторой часовой пояс')

It is necessary to bind buttons here somehow, I don’t know how they do it. Only so that they are under the photo with a description and not above it.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
alekssamos, 2020-07-13
@alekssamos

Either reply_markup or InlineKeyboardMarkup.

S
soremix, 2020-07-13
@SoreMix

Create an inline keyboard.
InlineKeyboardMarkup

A
Alex, 2020-07-14
@40usov

@bot.message_handler(content_types=['text'])
def text(message):
    markup = telebot.types.InlineKeyboardMarkup()
    btn = telebot.types.InlineKeyboardButton(text='Buy', callback_data='buy')
    markup.add(btn)

    bot.send_photo(chat_id=message.chat.id, photo=open('../jpg.jpg', 'rb'), caption='Текст под картинкой', reply_markup=markup)

5f0d932da5429565957975.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question