Discord bot handling the management of the MUN Computer Science Society Discord server
For feature requests / help getting the bot running, don't fret to ask questions in the #automata
channel in the guild!
-
Clone the project by running
https://github.com/MUNComputerScienceSociety/Automata.git
, and change into the directory by runningcd ./Automata
-
Copy
.env.dist
to.env
-
Fill out the required information in the
.env
-
At the moment, the required environment variables are:
AUTOMATA_TOKEN
: A Discord token, which you can see how to get hereAUTOMATA_PRIMARY_GUILD
: The ID of the Discord server you will be testing in. You can find this by following the instructions here.AUTOMATA_EXECUTIVE_DOCS_CHANNEL
: The ID of the channel to post executive docs notifications to. This can be any channel in your primary guild, with the warning that it'll be a bit noisy on first start. You can find this by following the instructions here.
-
Note
Note about running locally and avoiding spam:
When this bot was smaller, it wasn't so bad to run all the plugins; but since we have 10+, and some of them do some data fetching / loading on startup, the logs can get a bit loud.
If you're working on a plugin, you can add its name to the AUTOMATA_ENABLED_PLUGINS
env. var (like AUTOMATA_ENABLED_PLUGINS=["PluginName"]
), and it will be the only plugin that will be loaded.
This env. var is a JSON-encoded list, so you can enable multiple plugins at once.
Once done, follow the instructions under either of the headings below, depending on how you wish to run the bot.
Start the containers by running docker-compose up -d
-
Install uv and Python 3.12 or above.
-
Run MongoDB
- You can use Docker for running MongoDB (recommended), by starting only the
mongo
container withdocker-compose up -d mongo
- Alternatively, you can install Mongo via whatever means is recommended for your OS
- You can use Docker for running MongoDB (recommended), by starting only the
-
Install the dependencies with
uv sync
-
Run the bot using
uv run python -m automata
Features are provided to the bot via plugins - if you wish to add your own functionality, you should build your own plugin. To do so:
- Create a new file in
automata/plugins
for your plugin - Add to your file the code for your plugin
- This plugin will be a discord.py cog - you can refer to their docs for examples of the things you can do and how to do them
- You can use
lmgtfy.py
as a simple example
- In
automata/plugins/__init__.py
, import your plugin and add it to theall_plugins
list- Once again, you can copy this from the
lmgtfy.py
example
- Once again, you can copy this from the
Once done, you can run your plugin locally by following the instructions under Running your changes locally.
- Edit the
docker-compose.yml
, and comment out theimage
line in theautomata
container and uncomment thebuild
line - Edit the bot core or the plugins as you wish
- Start the container, forcing a rebuild of the image using
docker-compose up -d --build
If you do not want to run the bot in Docker, you can just start the bot using the instructions from Running locally - no special steps required.
- Fork this repository, clone your fork, and commit your changes to a branch on your fork
- Create a PR to merge your branch into the
master
branch here, and make sure to tag an executive / mention the PR in Discord so we see it - We'll likely request some changes before it is merged
- Once it's good, a few minutes after the PR is merged the feature should be live, since Automata uses CI/CD :)
Automata is comprised of a number of containers, each with distinct responsibilities. Their responsibilities are as follows:
Container | Responsibilities |
---|---|
automata | The Discord bot itself |
mongo | A MongoDB server used to provide persistent data storage to the automata container |