if (update.Message.Text == "/hi" || update.Message.Text == "hi")
{
bot.MakeRequestAsync(new SendMessage(update.Message.Chat.Id, "TEST!")).Wait();
}
telegram api for .net have type of keyboardmuckup but never user in any example i see it. can i implement custom keyboard in telegram bot api to get command from user from button instead command text .
2
Answers
Absolutely yes. You never see
ReplyKeyboardMarkup
in codes but in telegram bot documnetation. If you look at this documentation, you see many parts( for exampleReplyKeyboardMarkup
and each part have someField
. you must send those fields( specially thoseRequired
fields) with their value, Telegram would recognize that those fields without mentioning titel(title is for exampleReplyKeyboardMarkup
) you must not mention these titles in your code.you can see a working keyborad in php here.
Every thing is simple as sending a message, the main point in keybords is to use triple arrays nested in each other
in c# you can do this:
first array of string shows in first raw and second array shows in second raw …
and you can send this key board to user via sendMessage: