Actions
A generic action. Every action must inherit from this class and override its methods.
Process the payload and return a response.
Serialize the class instance to a dictionary.
- Return type
dict- Returns
A serialized class instance.
Bases:
navmenu.actions.ActionAn action that returns a message.
- Parameters
text (
str) – The message text.
Process the payload and return a response.
- Parameters
payload (
Optional[dict]) – An incoming message payload.- Return type
- Returns
A message or a response object.
Serialize the class instance to a dictionary.
- Return type
dict- Returns
A serialized class instance.
Bases:
navmenu.actions.ActionAn action that opens a submenu.
- Parameters
menu_name (
str) – The name of the menu to open.
Process the payload and return a response.
- Parameters
payload (
Optional[dict]) – An incoming message payload.- Return type
- Returns
A message or a response object.
Serialize the class instance to a dictionary.
- Return type
dict- Returns
A serialized class instance.
Bases:
navmenu.actions.ActionAn action that returns user to the one of previous menus.
- Parameters
count (
int) – How many times to go back.
Process the payload and return a response.
- Parameters
payload (
Optional[dict]) – An incoming message payload.- Return type
- Returns
A message or a response object.
Serialize the class instance to a dictionary.
- Return type
dict- Returns
A serialized class instance.
Bases:
navmenu.actions.ActionAn action that executes a code and optionally returns a message with the result.
- Parameters
command (
str) – The code to execute.return_text (
bool) – Whether to return result as a message with text.
Process the payload and return a response.
- Parameters
payload (
Optional[dict]) – An incoming message payload.- Return type
Optional[Message]- Returns
A message or a response object.
Serialize the class instance to a dictionary.
- Return type
dict- Returns
A serialized class instance.
Bases:
navmenu.actions.ActionAn action that runs a function and optionally returns a response.
- Parameters
Process the payload and return a response.
Serialize the class instance to a dictionary.
- Return type
dict- Returns
A serialized class instance.