Mohsen K
Mohsen K

Reputation: 287

Telegram Bot API missing object

is InlineKeyboardButton removed in version 13 of nuget telegram bot api? i used a sample project that was using telegram.bot version 10 and it contains the InlineKeyboardButton in the telegram.bot.types and it works fine.

but when I use the version 13, i get an error.

any idea ?

this is part of the whole code :

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

Upvotes: 1

Views: 694

Answers (1)

tashakori
tashakori

Reputation: 2441

As mentiond in changelog: https://github.com/TelegramBots/telegram.bot/blob/master/CHANGELOG.md

"User and Chat Ids reverted to base types DateTimes are now in local time zone Splitedd Keyboardbuttons in InlineKeyboardCallbackButton, InlineKeyboardCallbackGameButton, InlineKeyboardPayButton, InlineKeyboardSwitchCallbackQueryCurrentButton, InlineKeyboardSwitchInlineQueryButton and InlineKeyboardUrlButton"

Note that InlineKeyboardButton is no longer available, use InlineKeyboardCallbackButton instead.

Upvotes: 1

Related Questions