Answer the question
In order to leave comments, you need to log in
Why doesn't clicking on the inlinekeyboard work?
The response does not work when the button is clicked. The def callback_inline specifies that after clicking the button, the bot sends the message "Nice!".
from telebot import types
import telebot
def callback_inline(call):
if call.message:
if call.data == 'press':
bot.send_message(call.message.chat.id, 'Nice!')
print(call.message.chat.first_name, call.message.chat.id, "command=press")
@bot.message_handler(content_types=["text"])
def button(message):
button_1 = types.InlineKeyboardMarkup()
button1 = types.InlineKeyboardButton("Button", callback_data='press')
button_1.add(button1)
bot.send_message(message.chat.id, text='Press:', reply_markup=button_1)
bot.infinity_polling()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question