This bot is currently a work-in-progress, but has the following commands implemented thus far:
/ping: replies with "Pong!"/membercount: replies with the server's name and how many members it has./addgiveablerole: add a role to the server list of self-grantable roles./removegiveablerole: remove a role from the server list of self-grantable roles./selfrole add: allows you to give yourself a role from a list determined by the server!/selfrole remove: allows you to remove a role from yourself, from a list determined by the server!
-
Install Node.js. Instructions on how to install Node on your system: Downloading and Installing Node.js and npm
-
Install Docker. Download (with operating system options) is at the bottom of this page: Docker Desktop
-
Create a
.envfile inside the project's folder, and have it contain the following:DISCORD_TOKEN=token DISCORD_GUILD_ID=guild_id POSTGRES_HOST=hostname POSTGRES_USER=username POSTGRES_PASSWORD=password PGADMIN_DEFAULT_EMAIL=admin@admin.com PGADMIN_DEFAULT_PASSWORD=password -
Create a Discord application on the Discord Developer Portal.
-
Get your token and guild id.
- For your token: Navigate to the "Bot" page under Settings, and click "Reset Token" under "TOKEN". Keep it on hand (and safe)! We will need it shortly.
- For your guild id: Navigate to the server you want to use as a testing ground, and right click its name. Then, click "Copy Server ID".
-
Replace
tokenandguild_idin the.envfile with the token, client id, and guild id you retrieved. -
Install packages by running
npm iin the project's folder. -
Add your bot to your server. Instructions are here: Adding your bot to servers
-
Register the slash commands in your guild by running
npm run deploy.
You can run the bot in a few different ways:
- Development Mode
- Run
npm run dev. - This will automatically restart the bot every time you update its code.
- Run
- Normal Mode
- Run
docker compose --profile db up -d. - This will start the PostgreSQL database which the bot relies on.
- Run
npm run build. - This will build the
distfolder (containing the transpiled JavaScript files) from thesrcfolder. - Run
npm start. - This will start the bot itself!
- Run
- Containerized Normal Mode
- Run
bash docker-start.sh. - This will build a Docker image, and then start the Discord bot in a Docker container!
- Run