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 only required environment variable required is
AUTOMATA_TOKEN
, which is a Discord token, which you can see how to get here
- At the moment, the only required environment variable required is
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 40+, and some of them do some data fetching / loading on startup, so 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 is a comma-delimited list as well, so you can enable multiple plugins at once.
- Create the directory
mounted_plugins
within the project by runningmkdir ./mounted_plugins
- Start the containers by running
docker-compose up -d
-
Run MongoDB
You can use Docker for running MongoDB (recommended), just add the following to the
docker-compose.yml
file to expose it to your local machine... mongo: ... ports: - "127.0.0.1:27017:27017" ...
And start it only by running
docker-compose up -d mongo
-
Install the requirements found in the
requirements.txt
file usingpip install -r requirements.txt
- Using a virtual environment is highly recommended, this section of the Flask documentation explains this well.
-
Run the bot using
python Bot.py
- Automata is built around the discord.py framework, therefore the plugins make heavy use of its decorators to abstract most of the complexity behind the scenes.
- Create the folder
mounted_plugins
if it doesn't already existplugins
is baked into the image when it is built, so editing files there won't have an effect
- Create a new plugin within the
mounted_plugins
folder- Create a new Jigsaw plugin manifest
- You can use
plugins/Ping/plugin.json
as an example
- You can use
- Create a new plugin
- You can use
plugins/Ping/__init__.py
as an example
- You can use
- Create a new Jigsaw plugin manifest
- Start the bot using the instructions from Running locally
When you make changes to your plugins, restart the Automata container using docker-compose restart automata
- Create a new plugin, following the directions above within 'Using Docker', but within the
plugins
folder instead - Start the bot using the instructions from Running locally
- Edit the
docker-compose.yml
, replacing theimage: muncs/automata
line for the automata container withbuild: .
- 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
- Just edit the core files / plugins directly :)
- Start the bot using the instructions from Running locally
- 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 |