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.distto.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_PLUGINSenv. 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_pluginswithin 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.ymlfile 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.txtfile 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_pluginsif it doesn't already existpluginsis baked into the image when it is built, so editing files there won't have an effect
- Create a new plugin within the
mounted_pluginsfolder- Create a new Jigsaw plugin manifest
- You can use
plugins/Ping/plugin.jsonas an example
- You can use
- Create a new plugin
- You can use
plugins/Ping/__init__.pyas 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
pluginsfolder instead - Start the bot using the instructions from Running locally
- Edit the
docker-compose.yml, replacing theimage: muncs/automataline 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
masterbranch 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 |