Y
Y
Yura2021-02-10 15:03:22
Python
Yura, 2021-02-10 15:03:22

How to pass text to types.InlineKeyboardButton?

I have a button, telebot.types.InlineKeyboardButton(text="Text button", callback_data="func")
How to pass some text when clicking on it, so that in the func function in the call one could get it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twentyz, 2021-02-10
@N0tdefined

In callback_data, pass not only the name of the function, but also the required text itself. Then you parse where necessary from callback_data the name of the function and the text.
Example callback_data="func/your text"
Next, you parse the string and you're done.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question