EdJoPaTo / grammy-inline-menu

Inline Menus for Telegram made simple. Successor of telegraf-inline-menu.
MIT License
357 stars 44 forks source link

Bug: submenu wont render on some button ids, is there a rule for this other than it must be unique? #208

Closed snurfer0 closed 1 year ago

snurfer0 commented 1 year ago

Describe the bug I have an issue regarding menu buttons unique id. Is there a rule for this parameter as it seems not all kinds of strings are allowed to be passed there. Therefore, for some kinds of strings the menu which includes this button with the bugged id wont be rendered at all.

Versions

To Reproduce Steps to reproduce the behavior:

  1. Create a main menu with a submenu button.
  2. The submenu button should redirect to a menu that has the following code.
    
    menu.interact(
    'Add username',
    'action:add:username:developer', // works on '123', but the example id is unique as well
    {
        do: async (ctx) => ctx.answerCallbackQuery('You hit a button1 in a submenu'),
    }
    );

4. Click on the submenu which includes the bugged id button
5. See bug

**Expected behavior**
Should render the submenu or at least log some error so I understand what's happening.
EdJoPaTo commented 1 year ago

Interesting… I don’t know what might be the cause here but I also don’t fully understand your example… / is the only character which is prohibited because it’s the splitter between the menu structure. Your action:add:… seems quite long so I think your total length might get too long too? But this would error 🤔 Is the intention to use .navigate here as you want to display a button redirecting to an existing submenu in another place? But then / instead of : would have been correct?

Have you read https://github.com/EdJoPaTo/grammy-inline-menu#how-does-it-work ? Maybe take a look at the .tree()?

snurfer0 commented 1 year ago

I've changed the : to -, and also made them shorter. Works now, thanks.