ConversationMenuPool
A container for many menu instances that are created during a replay of a conversation.
You typically do not have to construct this class yourself, but it is used internally in order to provide conversation
inside conversations.
Type Parameters
C
C extends Context
Methods
markMenuAsDirty
markMenuAsDirty(
chat_id: string | number,
message_id: number,
menu?: ConversationMenu<C>,
): void;
Marks a menu as dirty. When an API call will be performed that edits the specified message, the given menu will be injected into the payload. If no such API happens while processing an update, the all dirty menus will be updated eagerly using edit
.
getAndClearDirtyMenu
getAndClearDirtyMenu(chat_id: string | number, message_id: number);
Looks up a dirty menu, returns it, and marks it as clean. Returns undefined if the given message does not have a menu that is marked as dirty.
create
create(id?: string, options?: Partial<ConversationMenuOptions<C>>);
Creates a new conversational menu with the given identifier and options.
If no identifier is specified, an identifier will be auto-generated. This identifier is guaranteed not to clash with any outside menu identifiers used by the menu plugin. In contrast, if an identifier is passed that coincides with the identifier of a menu outside the conversation, menu compatibility can be achieved.
lookup
lookup(id: string | { id: string });
Looks up a menu by its identifier and returns the menu. Throws an error if the identifier cannot be found.
install
install(ctx: C);
Prepares a context object for supporting conversational menus. Returns a function to handle clicks.