Answer the question
In order to leave comments, you need to log in
Sending messages on button click (telebot)?
Hello, I have a bot. I need it to send a specific message when the cellback button is clicked. Will there be examples?
@bot.message_handler(commands=['start'])
def any_msg(message):
keyboard = types.InlineKeyboardMarkup()
next = types.InlineKeyboardButton(text="Пройти регистрацию", callback_data="next")
keyboard.add(next)
bot.send_message(message.chat.id, "Ляляляляля...", reply_markup=keyboard)
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
if call.data == "next":
#?????????????????????
Answer the question
In order to leave comments, you need to log in
@bot.callback_query_handler(func=lambda call: True)
def ans(call):
kb = types.InlineKeyboardMarkup()
cid = call.message.chat.id
mid = call.message.message_id
if call.data == "next":
bot.edit_message_text('answer', cid, mid, reply_markup=kb, parse_mode='Markdown')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question