2017-07-31 99 views
0

InlineKeyboardButton在版本13中删除了nuget telegram bot api? 我使用了一个使用telegram.bot版本10的示例项目,它包含telegram.bot.types中的InlineKeyboardButton,它工作正常。Telegram Bot API缺失对象

但是当我使用版本13时,出现错误。

有什么想法吗?

这是整个代码的一部分:

  if (message.Text.StartsWith("/inline")) // send inline keyboard 
     { 
      await Bot.SendChatActionAsync(message.Chat.Id, ChatAction.Typing); 

      var keyboard = new InlineKeyboardMarkup(new[] 
      { 
       new[] // first row 
       { 
        new InlineKeyboardButton("1.1"), 
        new InlineKeyboardButton("1.2"), 
       }, 
       new[] // second row 
       { 
        new InlineKeyboardButton("2.1"), 
        new InlineKeyboardButton("2.2"), 
       } 
      }); 

      await Task.Delay(500); // simulate longer running task 

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

请提供您的错误和代码片段,以便您可以更好地获得帮助。 – tashakori

+0

@tashakori我添加了那部分。我在VS ..中获得了红色下划线,并且在删除了版本13并添加了版本10参考后,错误消失了。 –

回答

0

如在更新日志mentiond: https://github.com/TelegramBots/telegram.bot/blob/master/CHANGELOG.md

“用户和聊天的ID回复到基本类型 DateTime是否现在是在本地时区 Splitedd Keyboardbuttons InlineKeyboardCallbackButton,InlineKeyboardCallbackGameButton,InlineKeyboardPayButton,InlineKeyboardSwitchCallbackQueryCurrentButton,InlineKeyboardSwitchInlineQueryButton和InlineKeyboardUrlButton“

请注意,InlineKeyboardButton不再可用,请改为使用 InlineKeyboardCallbackButton。