MenuFlavor
Context flavor for context objects in listeners that react to menus. Provides ctx
, a control pane for the respective menu.
Properties
match
match?: string;
menu
menu: MenuControlPanel;
Control panel for the currently active menu. ctx
is only available for listeners that are passed as handlers to a menu, and it allows you to perform simple actions such as navigating the menu, or updating or closing it.
As an example, if you have a text button that changes its label based on ctx
, then you should call
ctx.menu.update()
whenever you alter the context object in such a way that the label should update. The same is true for dynamic ranges that change their layout.
If you edit the message yourself after calling one of the functions on ctx
, the new menu will be automatically injected into the payload. Otherwise, a dedicated API call will be performed after your middleware completes.