I want to use custom keyboard to get the selected option.
How to get the selected option ? Is there any example?
my question is answered by “node-telegram-bot-api”
here: How to get the response of the keyboard selection?
Is there any solution for c#?
2
Answers
When you call
SendTextMessageAsync
, you pass anIReplyMarkup
object which specifies a “custom reply keyboard”. I don’t know much about the Telegram Bot API, but this looks to be the same feature referred to by the GitHub issue you linked.There appear to be several implementations listed in the API documentation. I suspect either
InlineKeyboardMarkup
orReplyKeyboardMarkup
is what you’re looking for.To create a custom keyboard you have to sent a text message and pass a
IReplyMarkup
. The selected option is sent as a message which can be handled in theOnMessage
event. You can hide the custom keyboard when you set aReplyKeyboardHide
as reply markup.Here is an example:
Here is a chat with a custom keyboard:
Here is a chat where I clicked the first button:
I hope this helps!