question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add hint for long action codes as chained ones longer than 64 bytes are failing

See original GitHub issue

When 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:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Apr 30, 2019

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.

0reactions
EdJoPaTocommented, Apr 30, 2019

@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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Update millions or records in a table - Ask TOM
One of our apps updates a table of several hundred million records. The cursor..For loop approach for the update was calculated to take...
Read more >
java - _jspService is exceeding the 65535 bytes limit
The bytecode of a method may not be longer than 65535bytes. Some other tools also fail to generate proper code. 'asm for instance...
Read more >
Legacy SQL Functions and Operators | BigQuery - Google Cloud
Returns true if argument is true for at least one of its inputs. TO_BASE64(), Converts the BYTES argument to a base-64 encoded string....
Read more >
Web service error codes (Microsoft Dataverse) - Power Apps
The following list shows the error codes used in Dataverse. For more information about handling errors when using the Dataverse SDK for ....
Read more >
An Overview of Cryptography - Gary Kessler Associates
Cipher Block Chaining (CBC) mode adds a feedback mechanism to the encryption scheme; the plaintext is exclusively-ORed (XORed) with the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found