ConversationMenuOptions
Options when creating a menu
Properties
parent
parent?: string | { id: string };
Identifier of the parent menu. Using a back
button will navigate to this menu.
autoAnswer
autoAnswer: boolean;
Conversational menus will automatically call ctx
with no arguments. If you want to call the method yourself, for example because you need to send custom messages, you can set auto
to false
to disable this behavior.
fingerprint
fingerprint: DynamicString<C>;
Fingerprint function that lets you generate a unique string every time a menu is rendered. Used to determine if a menu is outdated. If specified, replaces the built-in heuristic.
Using this option is required if you want to enable compatibility with an outside menu defined by the menu plugin. It is rarely useful if you simply want to define a menu inside a conversation.
The built-in heuristic that determines whether a menu is outdated takes the following things into account:
- identifier of the menu
- shape of the menu
- position of the pressed button
- potential payload
- text of the pressed button
If all of these things are identical but the menu is still outdated, you can use this option to supply the neccessary data that lets the menu plugin determine more accurately if the menu is outdated. Similarly, if any of these things differ but you want to consider the menu to be up to date, you can also use this option to signal that.
In other words, specifying a fingerprint function will replace the above heuristic entirely by your own implementation.