e8ac0e1f58715861298a8a88d942d1c3e3563ba5
Overview
Kwaylon lives in a Docker container
docker-compose.yml- Used to easily run the container with some preset configurations
Dockerfile- Used by
docker-composeto (re)build the container, if necessary - Runs
src/main.pyas it's CMD
- Used by
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
Kwaylon.read_command- Used to manually force Kwaylon to read N days backwards in eachTextChanneland record the reactions to the database.Kwaylon.respond_to_jokeKwaylon.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 above although it can
also be passed into the Kwaylon constructor using the db_path argument.
Mounting on Raspberry Pi
Run dietpi-drive_manager for access to the wizard for
mounting network drives in DietPi.
Add network drivesambaJOHN-NAShome/Kwaylonjohn<SYNOLOGY password>/mnt/Kwaylon
Description
Languages
Python
97.5%
Dockerfile
1.9%
Shell
0.6%