Home>

pyTelegramBotAPI

I'm familiar with inline buttons, so I decided to check reply.

There is a callback_data in inline, with the help of it we can find out what the user wants.

types.InlineKeyboardButton(text='About me', callback_data='about')
if call.data== 'about':
    do something

And in the case of reply, you can find out what the user requested only with the help of text.

start_menu= types.ReplyKeyboardMarkup(resize_keyboard= True)
start= types.KeyboardButton('How are you?')
start_menu.add(start)
if message.text== 'How are you?':
    do something

I've read the documentation, but haven't found any other methods to get the value from the button. Does anyone know how to get the value using something else like callback_data?

So therein lies their difference. The only thing is that the necessary text for replays needs to be passed to the handler

Clark Devlin2022-01-20 20:48:05

@clark-devlin, I don’t quite understand, conditionally I have two "How are you?" buttons, how can I write a separate action for each?

SaNoKProG2022-01-20 20:56:39

For a replay, just pile up a bunch of other replays before it.

Clark Devlin2022-01-20 21:19:51