Telegram Bot API 缺少对象
Telegram Bot API missing object
InlineKeyboardButton
是否已在 nuget 电报机器人 api 版本 13 中删除?
我使用了一个使用 telegram.bot 版本 10 的示例项目,它在 telegram.bot.types
中包含 InlineKeyboardButton
,并且工作正常。
但是当我使用版本 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);
}
如变更日志中所述:
https://github.com/TelegramBots/telegram.bot/blob/master/CHANGELOG.md
"用户和聊天 ID 恢复为基本类型
DateTimes 现在处于本地时区
InlineKeyboardCallbackButton、InlineKeyboardCallbackGameButton、InlineKeyboardPayButton、InlineKeyboardSwitchCallbackQueryCurrentButton、InlineKeyboardSwitchInlineQueryButton 和 InlineKeyboardUrlButton 中的拆分键盘按钮
请注意,InlineKeyboardButton 不再可用,请使用
InlineKeyboardCallbackButton 代替。
InlineKeyboardButton
是否已在 nuget 电报机器人 api 版本 13 中删除?
我使用了一个使用 telegram.bot 版本 10 的示例项目,它在 telegram.bot.types
中包含 InlineKeyboardButton
,并且工作正常。
但是当我使用版本 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);
}
如变更日志中所述: https://github.com/TelegramBots/telegram.bot/blob/master/CHANGELOG.md
"用户和聊天 ID 恢复为基本类型 DateTimes 现在处于本地时区 InlineKeyboardCallbackButton、InlineKeyboardCallbackGameButton、InlineKeyboardPayButton、InlineKeyboardSwitchCallbackQueryCurrentButton、InlineKeyboardSwitchInlineQueryButton 和 InlineKeyboardUrlButton 中的拆分键盘按钮
请注意,InlineKeyboardButton 不再可用,请使用 InlineKeyboardCallbackButton 代替。