From e46c3bd65bb53cf1e7baf138076b9d1c8505e7db Mon Sep 17 00:00:00 2001 From: jsl12 <32917998+jsl12@users.noreply.github.com> Date: Sat, 3 Sep 2022 16:39:16 -0500 Subject: [PATCH] added some README info --- README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a14af3b --- /dev/null +++ b/README.md @@ -0,0 +1,71 @@ +# Overview + +Kwaylon lives in a Docker container + +- `docker-compose.yml` + - Used to easily run the container with some preset configurations +- `Dockerfile` + - Used by `docker-compose` to (re)build the container, if necessary + - Runs `src/main.py` as it's [CMD](https://docs.docker.com/engine/reference/builder/#cmd) +- `src/main.py` + - Handles getting the login token from an environment variable + - Connects event callbacks to Kwaylon methods + - Runs the Discord client +- `kwaylon.Kwaylon(Client)` + - Defines the logic + +# Operation + +## Messages + +Messages are each handled separately with the `Kwaylon.handle_message` callback, which applies the following logic + +1. `Kwaylon.read_command` - Used to manually force Kwaylon to read N days backwards in each `TextChannel` and record the reactions to the database. +2. `Kwaylon.respond_to_joke` +3. `Kwaylon.respond_to_emoji` - Used for the emoji leaderboard commands + +### Read Command +Looks for a mention of the bot with "read N days" + +### Respond to Jokes + +Iterates through each object that inherits from `kwaylon.jokes.Joke` + +### Respond to Emoji Command + +# Files + +## File Structure + +Files are ultimately stored on the NAS in `/home/Kwaylon` for the `john` user, which is mounted to `/mnt/Kwaylon` on the +Raspberry Pi + +``` +└── ./Kwaylon + ├── data + │ └── messages.db + ├── src + | ├── .env + | ├── kwaylon + | └── main.py + ├── docker-compose.yml + └── Dockerfile +``` + +## Message Database + +The path of the message database defaults to working with the [file structure](#file-structure) above although it can +also be passed into the `Kwaylon` constructor using the `db_path` argument. + +## Mounting on Raspberry Pi + +Run [`dietpi-drive_manager`](https://dietpi.com/docs/dietpi_tools/#dietpi-drive-manager) for access to the wizard for +mounting network drives in DietPi. + +- `Add network drive` +- `samba` +- `JOHN-NAS` +- `home/Kwaylon` +- `john` +- `` +- `/mnt/Kwaylon` \ No newline at end of file