YAD Bot helps your friends achieve their goals. After breaking down their goals into specific tasks, you can give them stars when they complete their tasks.
I’m using the bot on a Debian bookworm.
Python 3.9 or later.
A Discord bot token (see the help).
A MariaDB or MySQL server.
Dependencies (Debian packages):
- python3-discord
- python3-yaml
- python3-mysqldb
- python3-requests
Create a base, then the tables. Replace <username> with the user name in lowercase.
CREATE TABLE <username>_stars (
id INT AUTO_INCREMENT PRIMARY KEY,
date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
server_id BIGINT NOT NULL,
chan_id BIGINT NOT NULL,
message_id BIGINT NOT NULL,
star_count INT NOT NULL
);
CREATE TABLE <username>_rewards (
id INT AUTO_INCREMENT PRIMARY KEY,
date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
server_id BIGINT NOT NULL,
chan_id BIGINT NOT NULL,
message_id BIGINT NOT NULL,
code VARCHAR(30) NOT NULL,
cost INT NOT NULL
);
CREATE TABLE <username>_history (
date_creation TIMESTAMP NOT NULL,
server_id BIGINT NOT NULL,
chan_id BIGINT NOT NULL,
message_id BIGINT NOT NULL PRIMARY KEY,
reply_to BIGINT NULL,
user_name VARCHAR(32) NOT NULL,
content TEXT NOT NULL,
edited BOOLEAN NOT NULL DEFAULT FALSE,
attachments TEXT NULL,
reactions TEXT NULL,
date_deletion TIMESTAMP NULL
);
% git clone https://github.com/almic-stardust/yad_bot
% cd yad_bot
Adjust the configuration to your needs:
Config_dist.yaml
Example of configuration file to modify. Rename it as Config.yaml
Localization_dist.yaml
Example of localization file to adjust. Rename it as Localization.yaml
% python3 Bot.py
!stars help
Show help information about managing the stars.
!rewards help
Show help information about managing the rewards.
!roll XdY
Show the result of throwing X dices of Y faces.
The different sections of the bot are separated into modules.
Bot.py
The main script. Start the bot, and handles events concerning sent/deleted messages (on_message/on_raw_message_delete).
Config_manager.py
Loads and processes the configuration and localizations.
DB_manager.py
Manages database-related operations.
Discord_related.py
Functions specific to Discord (like splitting replies to stay under Discord’s message size limit).
Stars.py
Functions to manage the stars.
Rewards.py
Functions to manage the rewards.