I'm currently using pyTelegramBotAPI to make a bot on telegram, and have a function to edit a message as well as the InlineKeyboardButtons below it to prevent it from being spammed by users. However, there is always a noticable delay between editing the message and the button being edited and I can't seem to find anything on this. I've tried using threading but it still doesn't edit the message and buttons simultaneously. For clarification, the following is my code:
def test_callback(call):
if call.data == 'c':
markup = types.InlineKeyboardMarkup([[types.InlineKeyboardButton('Encode', callback_data='ce'), types.InlineKeyboardButton('Decode', callback_data='cd')]])
bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text='Select Decode or Encode:')
bot.edit_message_reply_markup(call.from_user.id, call.message.message_id, reply_markup=markup)
The documentation also doesn't cover this at all, so any help would be appreciated.
CodePudding user response:
You should be able to just pass reply_markup=markup
to the edit_message_text
call instead of calling edit_message_reply_markup
separately.