How the menu tree and callback data work
mainThe library manages menus using a tree-like structure of callback data paths. This allows for nested submenus.
- Root Path: The main menu uses the path provided to
MenuMiddleware(e.g.,/) as its base. - Buttons: A button in the main menu uses a path like
/my-button. - Submenus: A submenu is identified by a path ending in a slash, such as
/my-submenu/.
Behavior Logic:
- If the callback data ends with a
/, the library treats it as a request to show a corresponding submenu. - If the callback data does not end with a
/, the library treats it as an interaction (an action to be executed).
To manually send a submenu, you must provide the exact path used by the button (e.g., /my-submenu/).