错误CS0234名称空间'Telegram.Bot'

时间:2017-06-10 12:40:11

标签: c# telegram-bot

我想在c#中的电报机器人中创建InlineKeyBord 但我有这个错误:

  

CS0234名称空间'Telegram.Bot'中不存在类型或命名空间名称'SendTextMessageAsync'

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);

1 个答案:

答案 0 :(得分:1)

变化:

await Telegram.Bot.SendTextMessageAsync(message.Chat.Id, "Choose", replyMarkup: keyboard);

为:

// 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);