rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.68k stars 1.18k forks source link

[400] Bad Request: reply markup is too long #218

Closed mr-yusupov closed 7 years ago

mr-yusupov commented 7 years ago

Hello, can anybody help me with such error: org.telegram.telegrambots.exceptions.TelegramApiRequestException: Error sending message: [400] Bad Request: reply markup is too long

Is there any limit on reply markup buttons? @rubenlagus

Best regards, Ziyoiddin Yusupov

rubenlagus commented 7 years ago

There is no limit in my library, but indeed there are limits in Telegram API. If I'm not wrong, there is no exact length value since it depend on type and content of buttons. How big is your keyboard?

mr-yusupov commented 7 years ago

Yes, I know that it is not from your lib, i was wondering maybe someone have met this issue already (maybe you). Well, in my case i tried to create 150 buttons (with one or two strings, no icons) it worked, but when i have put 180 it returned empty string from the server (saw in debug mode).

The problem is that there is nothing about this issue in official documentation (or I missed that). Moreover, the server is not responding with proper message.

Anyway, I will try to use inline keyboards.

Sorry, bothering you, i guess we can close this issue here.

Best regads, Ziyoiddin Yusupov

P.S. Keet it up, great work! @rubenlagus

rubenlagus commented 7 years ago

Closing it, but as sidenote, I wouldn't try to go over 12 (8 for inline keyboards) buttons per row and more than 300 (100 for inline mode) buttons because of two reasons:

  1. You may start hitting API "too_long" problems
  2. It will create a horrible UX

Regards