K
K
Kt0T02021-04-23 23:19:33
Python
Kt0T0, 2021-04-23 23:19:33

How to update text?

Is it possible to update text in inline buttons?
I take the data from the database, and display it in the button, how can I update it when the data changes?

60832b249a3a6496075748.png

markup_inline = types.InlineKeyboardMarkup()
  item1 = types.InlineKeyboardButton(text= 'Текст1 '+str(row[3]), callback_data= 'like1')
  item2 = types.InlineKeyboardButton(text= 'Текст2 '+str(row[3]), callback_data= 'like2')

  markup_inline.add(item1, item2)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-04-23
@SoreMix

You can call edit_message_reply_markupthe bot method by passing the necessary parameters.

edit_message_reply_markup(chat_id=None, message_id=None, inline_message_id=None, reply_markup=None):
"""
Use this method to edit only the reply markup of messages.
:param chat_id:
:param message_id:
:param inline_message_id:
:param reply_markup:
:return:
"""

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question