Fully converted to slash commands

This commit is contained in:
NikolajDanger
2021-03-31 00:38:51 +02:00
parent a8a7e5eabd
commit b345720468
50 changed files with 1102 additions and 1111 deletions

View File

@ -31,16 +31,19 @@ There are no rules for which emoji to use where, but here's some inspiration:
# Terminology
Comments, strings, variable names, class names, docstrings, as well as all other text in your code, filenames and directory names should use this terminology correctly.
**bot** - The current discord client and instance of the Gwendolyn class.
**cog** - A class that contains an amount of bot commands.
**ctx** - The [context](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#context) of a command. All command and error functions should use `ctx` as the context variable.
**internal** - Functions, classes and methods that are only used by the bot and don't use the Discord API.
**utils** - Functions, classes and methods that are only used by the bot and don't use the Discord API.
# Code
## Code Style
+ All the Python code should follow the [PEP 8 guidelines](https://www.python.org/dev/peps/pep-0008/).
All the Python code should follow the [PEP 8 guidelines](https://www.python.org/dev/peps/pep-0008/), with the following differences:
+ Variable and function names must be camelCase, and must fully consist of either full words or common/understandable abbreviations.
### Documentation
+ Comment lines should not exede 72 characters.
@ -86,7 +89,7 @@ The `Command` methods in cogs should only exist to perform small tasks or call c
## Codebase Management
### Folders
+ `cogs/` contains the command cogs.
+ `funcs/` contains all functions and classes called on by the rest of the code.
+ `funcs/` contains all functions and classes called on to perform commands. All functions must be accessible through a class, of which the `Gwendolyn` class has an instance as an attribute.
+ `resources/` contains the images, lookup databases, fonts etc. that the rest of the code uses.
### Important files
@ -94,15 +97,16 @@ The `Command` methods in cogs should only exist to perform small tasks or call c
## Logging
Things you should know about the logging:
+ The `logThis()` function can be found in `.funcs/miscFuncs.py.
+ `log()` is a method of the `Gwendolyn` class.
+ It is used to log to the log-file (`gwendolyn.log`) and print to the command line.
+ The function can take either a list of strings or a string as its first parameter. If the parameter is a string, it is converted to a list of 1 string.
+ The first string in the list is printed. All strings in the list are logged to the log-file.
+ If the list is longer than 1 string, `(details in log)` is added to the printed string.
+ The level parameter is 20 by default, which means the level is `INFO`. 40 corresponds to a level of `ERROR`, and 10 corresponds to a level of `DEBUG`.
+ The level parameter is 20 by default, which means the level is `INFO`. 40 corresponds to a level of `ERROR`, and 10 corresponds to a level of `DEBUG`. Only use these levels when logging.
+ Logs of level `DEBUG` are not printed.
+ Logs of level `ERROR` should only be created in the `on_command_error()` or `Command.error()` functions.
### Logging rules
1. Never call the `logThis()` function from `/utils/utilFuncs/`. Always call `bot.log`.
1. There should be at most 3 `INFO` level logs while executing a single command. This includes the log created in the `on_command()` function in `Gwendolyn.py`, so your code for a command can at most make 2 logs of level `INFO`. `DEBUG` level logs should be used for all other logging.
1. Always provide the channel id if available. Although you shouldn't pass the channel id to a function purely to use it in logs.