- Make sure you have the following prerequisites installed:
- Fork the repository and clone it into the directory of your choice.
This is not necessary for CodeyBot developers - you can work directly from the main repository.
- Set up your Discord testing server.
For CodeyBot developers, we have our own dedicated testing server - ask your team lead for more details.
- Set up your Discord testing bot for Codey. In the Discord Developer Portal, make sure to turn on all intents:
Also, give the following permissions to your bot:
Then, add your bot to the Discord testing server.
- In your cloned project, navigate to
config/
. Duplicate thevars.template.json
file, move your copy to thedev
folder, and rename your filevars.json
. This will be the config file for your local bot. Edit the values invars.json
as according to the following config variable descriptions:
BOOTCAMP_GUILD_ID
: the ID of the Bootcamp server.NOTIF_CHANNEL_ID
: the ID of the channel the bot will send system notifications to.MOD_USER_ID_FOR_BAN_APPEAL
: the user ID of the mod tagged in the appeal messages for bans. Note that this file will not be pushed to the remote.
- Make an
.env
file in the root folder of the project, and put your Discord bot's token, which can be found in the Discord Developer Portal. The format of the.env
file should be as follows.
DISCORD_TOKEN=<insert token here>
DO NOT REVEAL THE DISCORD_TOKEN; ANYONE WITH THIS TOKEN CAN CONTROL YOUR BOT.
Note that this file will also not be pushed to the remote.
- Run
yarn
in the root folder of your project to install all the dependencies required.
-
Run
yarn image:build
to create and build the Docker image for the bot. -
If you run
docker image ls
, you should seecodey:latest
as one of the Docker images. -
Next, run
yarn start
to start the bot. If this is run successfully, you should see a similar output to the following:
yarn run v1.22.18
$ docker-compose up -d
codey-bot is up-to-date
Done in 1.07s.
-
Run
yarn logs
to see the logs of the bot. -
If everything is set up correctly, you should see your bot send a message in the configured notification channel (the channel assigned to
NOTIF_CHANNEL_ID
in yourvars.json
):
Codey is up! App version: <app version>
- To stop the bot, run
yarn stop
. To stop the bot and remove the container, runyarn clean
.
You can choose to run the bot locally instead of using Docker. This is helpful if Docker is not working as intended.
- Install the dependencies
ghostscript
andgraphicsmagick
locally. This is required for the resume pdf->image converter functionality of Codey.
For example, on Mac and some Linux distros, you can do:
sudo apt install ghostscript
sudo apt install graphicsmagick
-
Run
yarn ts:build
to build the bot locally. If this run successfully, you should see adist
folder in your project, which contains all the compiled JS code. -
Next, run
yarn local:run
to run the bot locally. Note that the logs are printed directly into the console output. -
If everything is set up correctly, you should see your bot send a message in the configured notification channel (the channel assigned to
NOTIF_CHANNEL_ID
in yourvars.json
):
Codey is up! App version: <app version>
- If you wish to stop the bot, just stop the command.