1
0
Fork 0
mirror of https://gitlab.com/niansa/SomeBot.git synced 2025-03-06 20:48:26 +01:00

Added ideas document

This commit is contained in:
niansa 2023-03-02 20:55:09 +01:00
parent 6906af1d01
commit db47c8c985

View file

@ -0,0 +1,51 @@
# KeineAhnung Bot custom commands
## Language
Custom commands are going to be written in Luau
### Functions
Commands are going to have to have the following global functions:
#### build_metadata()
Required to return a table with the following pieces of information:
- `publisher_id`: Example: "tuxifan"
- `package_id`: Example: "moderation"
- `command_id`: Example: "warn"
- `version_num`: Version number used internally, example: 011806
- `version_str`: Version string visible to user, example: "1.18.6"
- `disabled`: True if this commands only purpose is to provide/manage storage, example: false
- `parameters`: List of parameters accepted by command, to be thought of
#### initialize()
Called when command is added to a guild. Should be used to Initialize storage.
#### on_call(context, parameters)
Called when someone executes the function. Must be used to process the command.
#### deinitialize()
Called when command is removed from guild. Must not interact with the Discord API. Should be used to clean up used non-private storage.
## Storage
### Private
There is going to be private storage, only accessible by the command itself. Removed on command removal.
### Secret
There is going to be secret storage, accessible by all commands on the same guild that have the same secret assigned to them by the user. Removed on removal of last command with same secret.
### Shared
There is going to be public storage, accessible by all commands on the same guild, identified the `publisher_id`, `package_id` and the `command_id`. Removed on removal of last command with the same identification.
### Global
There is going to be protected storage, accessible by all commands on the same guild, identified the `publisher_id` and the `package_id`. Removed on removal of last command with the same identification.