简体   繁体   中英

Send a message with inline keyboard using Telegram.Bot C#

All I want is to send a message with inline keyboard using Telegram.Bot package. I have a bot, now I need a code that sends a message with one inline button. Button click should open a link.

Use InlineKeyboardMarkup , and pass it in SendTextMessageAsync method in replyMarkup parameter, Or with any send message method, here is an example:

InlineKeyboardButton button = InlineKeyboardButton.WithUrl("Text", "https://www.google.com/");

InlineKeyboardMarkup keyboard = new InlineKeyboardMarkup(button);

await bot.SendTextMessageAsync(chat, "My message text", replyMarkup: keyboard);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM