Example #1
0
        public async Task EditTextButtonsMenuAsync(CallbackQueryUpdateMessage message, ButtonStructure structure)
        {
            var langCode    = message.LanguageCode;
            var menuBuilder = new InlineKeyboardButtonMenuBuilder(_localizer);
            var replyMarkup = menuBuilder
                              .AddButtonCodePerLine(structure.MenuButtons, langCode, message.MenuMessageId)
                              .AddBackButton(structure.PreviousButtonCode, message.MenuMessageId)
                              .Build();

            await TelegramBot.EditMessageTextAsync(
                message.ChatId,
                message.MenuMessageId,
                _localizer.GetButtonText(langCode, structure.TopButtonCode),
                replyMarkup : replyMarkup);
        }
Example #2
0
        public async Task SendTextButtonsMenuAsync(UpdateMessage message, ButtonStructure structure)
        {
            var langCode      = message.LanguageCode;
            var menuBuilder   = new InlineKeyboardButtonMenuBuilder(_localizer);
            var answerMessage = await TelegramBot.SendTextMessageAsync(
                message.ChatId,
                _localizer.GetButtonText(langCode, structure.TopButtonCode),
                replyMarkup : null);

            var expectedAnswerId = answerMessage.MessageId;
            var replyMarkup      = menuBuilder.AddButtonCodePerLine(structure.MenuButtons, langCode, expectedAnswerId).Build();
            await TelegramBot.EditMessageTextAsync(
                message.ChatId,
                expectedAnswerId,
                _localizer.GetButtonText(langCode, structure.TopButtonCode),
                replyMarkup : replyMarkup);
        }