Simply a customs agent
- Install docker for windows, macos or linux.
- Run the following command
docker build -t <username>/<repository>:latest -f ./docker/dockerfile .
- Launch the image using
docker run -d --restart=always --env-file .env.prod <username>/<repository>:latest
.env.dev
or .env.prod
.
- Download Python 3.10
- Download MongoDB Community Server
- Download MongoDB Compass (unless you have installed it with MongoDB Community Server)
.env.dev
and .env.prod
in the project root in order to interact with mongoDB. See section .env setup
for more.
ℹ️ dev-requirements.txt
contains all the extra dependencies for development purposes.
- At the root of the project
./BuggyBot
create two files and name them.env.dev
andenv.prod
. - Add the following lines for both configuration:
MONGODB_CONNECTION_STRING=YOUR MONGODB CONNECTION STRING MONGODB_CONNECTION_TIMEOUT_MS=YOUR TIMEOUT TIME IN MS MONGODB_DATABASE_NAME=YOUR MONGODB NAME STUDENT_COLLECTION_NAME=YOUR STUDENT COLLECTION NAME DISCORD_TOKEN=YOUR DISCORD BOT TOKEN SERVER_ID=YOUR SERVER ID (RIGHT CLICK ON SERVER ICON AND COPY ID) LOGGER_FILENAME=YOUR LOG FILENAME
=
. Even for string, do not add "
.
ℹ️ One file is dedicated to dev purposes (like having a local server), and the other to production (like giving the real connection string for the database).
ℹ️ If the log file is not present, it will be created automatically.
In production:
python main.py --env prod
In development:
python main.py --env dev
➡️ Create a directory to store docker-compose.yml and .env.prod (See repository for the model).
➡️ Create inside your directory another that directory named log
.
➕ To update the container automatically, use the updater.sh script located in ./docker/script. You may need to grant execute permissions to the script with the following command (optional):
sudo chmod +x update_buggybot.sh
➡️ Create a docker-compose.yml and .env.prod (See repository for the model).
docker-compose up -d
This directory contains tools to help development. Add all python files that will help you to develop easier.
bot
directory.
➡️ You can use constants from the bot
directory if needed.
To upload a new list of students provided by the department, run:
python tools update_students_list tools/FILENAME.xlsx
To migrate non-registered members : This command enables you to migrate members to the new bot. It will automatically register members present on the discord.
python tools migrate_students
It can happen that certain members cannot be migrated du to their name being too long or that we found duplicates. If this happens, script will ask you if you want to contact them by hand or automatically by sending them a message asking them to register.
ℹ️ Note: Most of the tools commands use dev
by default. To use the tool in production, simply add --env prod
at the end of the command.
To fix linter and format errors run these two commands:
ruff check . --fix
black .