Reputation: 43
I want to create InlineKeyBord in telegram bot in c# but I have this error:
CS0234 The type or namespace name 'SendTextMessageAsync' does not exist in the namespace 'Telegram.Bot'
var keyboard = new ReplyKeyboardMarkup(new [] {
new [] // 1st row
{
new KeyboardButton("1"),
new KeyboardButton("2"),
},
new [] // 2nd row
{
new KeyboardButton("3"),
new KeyboardButton("4"),
}
});
await Telegram.Bot.SendTextMessageAsync(message.Chat.Id, "Choose", replyMarkup: keyboard);
Upvotes: 0
Views: 563
Reputation: 23898
Change:
await Telegram.Bot.SendTextMessageAsync(message.Chat.Id, "Choose", replyMarkup: keyboard);
to:
// see https://mrroundrobin.github.io/telegram.bot/html/M_Telegram_Bot_TelegramBotClient__ctor.htm
var bot = new Telegram.Bot.TelegramBotClient(yourtokenhere);
await bot.SendTextMessageAsync(message.Chat.Id, "Choose", replyMarkup: keyboard);
Upvotes: 1