Answer the question
In order to leave comments, you need to log in
How to add inline button in telegram bot?
How to make an inline button with such an arrow? :
What would such a menu appear when you click on it above the keyboard? :
I use the PyTelegramBotApi library
Answer the question
In order to leave comments, you need to log in
Enable the bot's inline mode.
Send an inline keyboard with a parameter switch_inline_query_current_chat
equal to, say, "Accumulators"
Add an inline_handler in which to catch the query and generate the desired results
@bot.message_handler(commands=['start'])
def send_start(message):
markup = InlineKeyboardMarkup()
markup.add(InlineKeyboardButton('Аккумуляторы', switch_inline_query_current_chat='Аккумуляторы'))
bot.send_message(message.chat.id, 'Товары', reply_markup=markup)
@bot.inline_handler(lambda query: query.query == 'Аккумуляторы')
def query_video(inline_query):
r = InlineQueryResultArticle('1', 'SONY VTC6 3000 mah 30A 18650', InputTextMessageContent('Аккумулятор 1'), description='blah', url='https://buy-battery.com/goods/1', hide_url=True, thumb_url='https://via.placeholder.com/50')
r2 = InlineQueryResultArticle('2', 'SONY VTC5A 2600 mah 35A 18650', InputTextMessageContent('Аккумулятор 2'), description='blah', url='https://buy-battery.com/goods/2', hide_url=True, thumb_url='https://via.placeholder.com/50')
bot.answer_inline_query(inline_query.id, [r, r2])
Most likely you are interested in the parameter switch_inline_query_current_chat , see here .
To do this, you will need to configure the bot to work in inline mode.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question