kamihi.bot.action
⚓︎
Action helper class.
License
MIT
Classes:
Name | Description |
---|---|
Action |
Action class for Kamihi bot. |
Action
⚓︎
Action(
name: str,
commands: list[str],
description: str,
func: Callable,
)
Action class for Kamihi bot.
This class provides helpers for defining actions, their commands and their handlers.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the action. |
commands |
list[str]
|
List of commands associated. |
description |
str
|
Description of the action. |
Initialize the Action class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The name of the action. |
required |
|
list[str]
|
List of commands associated. |
required |
|
str
|
Description of the action. |
required |
|
Callable
|
The function to be executed when the action is called. |
required |
Methods:
Name | Description |
---|---|
clean_up |
Clean up the action from the database. |
is_valid |
Check if the action is valid. |
save_to_db |
Save the action to the database. |
Source code in src/kamihi/bot/action.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
clean_up
classmethod
⚓︎
clean_up(keep: list[str]) -> None
Clean up the action from the database.
Source code in src/kamihi/bot/action.py
145 146 147 148 |
|
is_valid
⚓︎
is_valid() -> bool
Check if the action is valid.
Source code in src/kamihi/bot/action.py
134 135 136 |
|
save_to_db
⚓︎
save_to_db() -> RegisteredAction
Save the action to the database.
Source code in src/kamihi/bot/action.py
138 139 140 141 142 143 |
|