Answer the question
In order to leave comments, you need to log in
How to fix a bug with callback inline keyboard?
The code:
if message.text == 'startgame':
kb = types.InlineKeyboardMarkup()
b = types.InlineKeyboardButton(text='Initialization', callback_data='initialization')
kb.add(b)
bot.send_message(message.chat.id, 'hi', reply_markup=kb)
@bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
if call.data == 'initialization':
k = telebot.types.ReplyKeyboardMarkup(True, True)
k.row('Connect')
bot.edit_message_text(chat_id=call.message.chat.id, text='Initialization 0% (##########)', message_id=call.message.message_id)
bot.edit_message_text(chat_id=call.message.chat.id, text='Initialization 25% (//########)', message_id=call.message.message_id)
bot.edit_message_text(chat_id=call.message.chat.id, text='Initialization 60% (//////####)', message_id=call.message.message_id)
edituser(message.from_user.id, maine='start')
bot.edit_message_text(chat_id=call.message.chat.id, text='Initialization 100% (//////////)', message_id=call.message.message_id, reply_markup=k)
File "<string>", line 199, in send_message
NameError: name 'types' is not defined
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