pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

specified new message content and reply markup

Open murmaider227 opened this issue 6 years ago • 1 comments

Hi, i have if call.data == 'pn'': bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=con.tittle + con.pn, reply_markup=gen_markup()) elif call.data == 'vt': bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=con.tittle + con.vt, reply_markup=gen_markup()) elif call.data == 'sr'': bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=con.tittle + con.sr, reply_markup=gen_markup())

At first everything works well, but if I click on the menu items many times it gives me this error

Bad Request: message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message

The text in the vars is different

murmaider227 avatar Mar 01 '20 22:03 murmaider227

try without if elif, it helped me: @bot.callback_query_handler(func=lambda call: call.data == 'pn') def pn(call): bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=con.tittle + con.pn, reply_markup=gen_markup())

@bot.callback_query_handler(func=lambda call: call.data == 'vt') def vt(call): bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=con.tittle + con.vt, reply_markup=gen_markup())

@bot.callback_query_handler(func=lambda call: call.data == 'sr') def srn(call): bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text=con.tittle + con.sr, reply_markup=gen_markup())

semenovsd avatar May 09 '20 14:05 semenovsd