Answer the question
In order to leave comments, you need to log in
Why callback_data is not processed and the function is not called?
Hello, I would like to ask a question:
Why is the callback_data not processed and the function is not called? (if it only applies to my code)
Here is my code:
@bot.message_handler(content_types=['text'])
def mess(message):
elif message.text == "1":
markup = types.InlineKeyboardMarkup(row_width=1)
odin = types.InlineKeyboardButton("Готово", callback_data="odin")
markup.add(odin)
bot.send_message(message.chat.id, "Укажите свою настоящую Фамилию и Имя", reply_markup=markup)
@bot.callback_query_handler(func=lambda call: True)
def Inline_callback(call):
try:
if call.message:
if call.data == "odin":
if int(message.chat.id) == int(config.owner):
try:
chatId=message.text.split(': ')[0]
text=message.text.split(': ')[1]
bot.send_message(chatId, text)
except:
pass
else:
bot.send_message(config.owner, str(message.chat.id) + ': ' + message.text)
bot.send_message(message.chat.id, '%s, wait please '%message.chat.username)
Answer the question
In order to leave comments, you need to log in
@bot.message_handler(content_types=['text'])
def mess(message):
elif message.text == "1":
markup = types.InlineKeyboardMarkup(row_width=1)
odin = types.InlineKeyboardButton("Готово", callback_data="odin")
markup.add(odin)
bot.send_message(message.chat.id, "Укажите свою настоящую Фамилию и Имя", reply_markup=markup)
@bot.callback_query_handler(func=lambda call: True)
def Inline_callback(call):
try:
if call.message:
if call.data == "odin":
if int(message.chat.id) == int(config.owner):
try:
chatId=message.text.split(': ')[0]
text=message.text.split(': ')[1]
bot.send_message(chatId, text)
except:
pass
else:
bot.send_message(config.owner, str(message.chat.id) + ': ' + message.text)
bot.send_message(message.chat.id, '%s, wait please '%message.chat.username)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question