Add hint for long action codes as chained ones longer than 64 bytes are failing
See original GitHub issueWhen adding a submenus and other elements that have actions larger than 64 bytes (Telegram’s Max value) the button press will fail with a BUTTON_DATA_INVALID
From the Telegram API docs:
callback_data | String | Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
Replicating the issue using the Food Example code:
menu.submenu('Food menu', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', someMenu, {
hide: () => mainMenuToggle
})
This is a bigger problem when menus and submenus are chained forming longer callback_data strings
. For example main_menu:sub_menu:option_a-true
The module should test for action length and throw if supplied action or actions concatenated together exceed 64 bytes.
You do suggest using short ‘a’, ‘b’ or ‘c’ codes for the actions but if the actions are generated programmatically from option say object keys larger strings can cause the problem.
Great module ! thanks for the hard work
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Jup. That should help new users of the lib. The example is good and shows the build template for the action code, which I would think in combination with the limitation hint should be enough.
@RobinCrozdesk @paixaop can you check if the updated readme part (d783038), the middleware in the examples (also d783038) and the added exception (8e470d3) are helpful in your opinion to new users of this library?