-
Create a bot account for testing
- Log in to https://discordapp.com/developers/applications
- Click "New Application" and give it a name
- Click on "Bot" in the list on the left
- Click "Add Bot" and then "Yes, do it!"
- Click on "OAuth2" in the list on the left
- Tick "bot" in scopes
- Tick "Administrator" in bot permissions
- Go to the generated link in scopes to add the bot to your test server
-
Set up environment variables
- Create a new file called
.env
in the root of this repo (next to config.json) - Populate your
.env
file with values from your bot application. You can find your values forDISCORD_ID
andDISCORD_SECRET
under General Information andDISCORD_TOKEN
under Bot. Do not share these values with anyone.CONFIG=config.dev.json DISCORD_ID=____YOUR_CLIENT_ID_HERE____ DISCORD_SECRET=____YOUR_CLIENT_SECRET_HERE____ DISCORD_TOKEN=____YOUR_BOT_TOKEN_HERE____
- Create a new file called
-
Configure the bot
- Make a copy of
config.json
calledconfig.dev.json
. Theconfig.json
file provided contains IDs for channels, servers, and roles. You will need to change these values in yourconfig.dev.json
to ones from your test server. - To get IDs go to your discord settings and enable developer mode. The toggle can be found at the bottom of the "Appearance" section under Advanced.
- You can now right click on channels, users, roles, etc. to copy their ID which you can put in your
config.json
file
- Make a copy of
- Install docker and docker-compose from https://www.docker.com/products/docker-desktop
- Make sure you have configured the bot by following the steps in the General Configuration section above
- Use
docker-compose up
to build and run the bot
-
Install python3.8 and pip for your operating system
-
Make sure you have configured the bot by following the steps in the General Configuration section above
-
Set up a virtual environment
- Create a venv
python -m venv venv
- Activate the venv
- Mac/Linux:
source venv/bin/activate
- Windows:
venv\Scripts\activate.bat
- Mac/Linux:
- Install pip dependencies
pip install -r requirements.txt
- Create a venv
-
Run the bot
- Start the bot with
python src/bot.py
- The bot should now be online in your server
- To test it out, run a command e.g.
!cowsay hello world
- Start the bot with