So I receive this "[400] Bad Request: reply markup too long" error and I don't even understand why telegram considers it too long. My reply markup only contains a keyboard with one row of one column buttons! How the hell is that even long?

Code where I send those buttons:

public static async Task SendInlineKeyboard(Message message, TelegramBotClient client)
{
      var inlineKeyboard = new InlineKeyboardMarkup(new[]
      {
          new [] // first row
          {
               new InlineKeyboardButton
               {
                    CallbackData = "SomeData",
                    Text = null
               };
          }
      });

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

1 Answers

0
Марк Павлович On Best Solutions

The problem is that you can't send buttons with a null-text. Telegram can't process that text and gives you an error, and somewhy Telegram.Bot library in .NET says that it's not the problem about the null-text, but that it is all about length of the message.

But in your specific case that is a mistake (that your library tells you that it's about the length of the message). The problem is about your Text=null in the place of initializing that button.