import { type MenuControlPanel } from "https://deno.land/x/grammy_menu@v1.2.2/menu.ts";
Menu control panel. Can be used to update or close the menu, or to perform manual navigation between menus.
Methods
Call this method to update the menu. For instance, if you have a button
that changes its text based on ctx
, then you should call this method to
update it.
Calling this method will guarantee that the menu is updated, but note that this will perform the update lazily. A new menu is injected into the payload of the request the next time you edit the corresponding message. If you let your middleware complete without editing the message itself again, a dedicated API call will be performed that updates the menu.
Pass { immediate: true }
to perform the update eagerly instead of
lazily. A dedicated API call that updates the menu is sent immediately.
In that case, the method returns a Promise that you should await
. Eager
updating may cause flickering of the menu, and it may be slower in some
cases.
Closes the menu. Removes all buttons underneath the message.
Calling this method will guarantee that the menu is closed, but note that this will be done lazily. A new menu is injected into the payload of the request the next time you edit the corresponding message. If you let your middleware complete without editing the message itself again, a dedicated API call will be performed that closes the menu.
Pass { immediate: true }
to perform the update eagerly instead of
lazily. A dedicated API call that updates the menu is sent immediately.
In that case, the method returns a Promise that you should await
. Eager
closing may be slower in some cases.
Navigates to the parent menu. By default, the parent menu is the menu on
which you called register
when installing this menu.
Throws an error if this menu does not have a parent menu.
Calling this method will guarantee that the navigation is performed, but note that this will be done lazily. A new menu is injected into the payload of the request the next time you edit the corresponding message. If you let your middleware complete without editing the message itself again, a dedicated API call will be performed that performs the navigation.
Pass { immediate: true }
to navigate eagerly instead of lazily. A
dedicated API call is sent immediately. In that case, the method returns
a Promise that you should await
. Eager navigation may cause flickering
of the menu, and it may be slower in some cases.