Answer the question
In order to leave comments, you need to log in
How to implement transition on Inline buttons using call.data?
Button handler "Ring selected", "Chain selected" does not work
import config
import telebot
from telebot import types
bot = telebot.TeleBot(config.token)
@bot.callback_query_handler(func=lambda call:True)
def answer(call):
if call.data=='yes':
markup_inline = types.InlineKeyboardMarkup()
item_ring = types.InlineKeyboardButton(text="Кольцо", callback_data='ring')
item_chain = types.InlineKeyboardButton(text="Цепочка", callback_data="chain")
markup_inline.add(item_ring, item_chain)
bot.send_message(call.message.chat.id, "Какой вид украшения вы хотите заказать?", reply_markup=markup_inline)
elif call.data=='no':
bot.send_message(call.message.chat.id, 'До свидания!')
@bot.callback_query_handler(func=lambda call:True)
def step(call):
if call.data=="ring":
bot.send_message(call.message.chat.id, "Выбрано кольцо")
elif call.data=="chain":
bot.send_message(call.message.chat.id, "Выбрана цепочка")
if __name__ == '__main__':
bot.polling()
Answer the question
In order to leave comments, you need to log in
@dp.callback_query_handler(lambda c: c.data == 'ring’)
def step(call):
…
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question