Core: how to set a value for buttons of telegram bot keyboard?

Created on 3 Jul 2016  路  1Comment  路  Source: php-telegram-bot/core

I have a custom keyboard with a button,For example "button1",I want to return a special value (a number) when I press "button1".Is this possible in telegram bot ?

Most helpful comment

What kind of button?
is it KeyboardButton or InlineKeyboardButton?

What you want is best done with InlineKeyboardButton with Callback Query.
If each button is gonna have value that ain't gonna change (for example button1 always will have value 1) you can use KeyboardButton and check incoming message text and assign a value according to the text received.

KeyboardButton = Buttons on the bottom of the chat (basically user keyboard-style)
InlineKeyboardButton = Buttons under messages

>All comments

What kind of button?
is it KeyboardButton or InlineKeyboardButton?

What you want is best done with InlineKeyboardButton with Callback Query.
If each button is gonna have value that ain't gonna change (for example button1 always will have value 1) you can use KeyboardButton and check incoming message text and assign a value according to the text received.

KeyboardButton = Buttons on the bottom of the chat (basically user keyboard-style)
InlineKeyboardButton = Buttons under messages

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheSleepySlee picture TheSleepySlee  路  3Comments

dorcu picture dorcu  路  3Comments

marcolino7 picture marcolino7  路  3Comments

Recouse picture Recouse  路  3Comments

abbe-cipher picture abbe-cipher  路  4Comments