A Discord bot for organising pickup games.
These instructions will get you a copy of the bot up and running on your local machine for development and testing purposes. Although these steps make use of yarn, npm can be used too.
- Node.js
- yarn (Optional)
- A Discord app token - go here and create a new app, you can then reveal the token on the app's page
Clone this repo
git clone https://github.com/joshramsbottom/pugbot.git
Inside the directory, install required packages
yarn install
Lastly, create a file named .env
, see Setting up .env file for what to put in it
To run the bot in development mode with live reloading
yarn run develop
To compile the source and run manually
yarn run build
yarn start
Pugbot uses environment variables for configuration, these are read from a file named .env
in the root project directory when running the bot. This file should not be checked into version control and should be environment specific.
The contents of the file should be a series of lines containing VAR_NAME=VALUE
where the following variables can be used:
Variable name | Value |
---|---|
TOKEN | Token generated by Discord for your app |
OWNERS | List of Discord user IDs |
PUGS_CHANNEL | Discord channel ID |
PUGS_ANNOUNCEMENT_CHANNEL | Discord channel ID |
PUGS_ROLE | Discord role ID |
TEMP_CHANNEL_LIFETIME | Time to keep temporary pickup game channels (milliseconds) |
TEAM_SIZE | Number of players that make up a team in your chosen game |
IDLE_TIME | Time after user goes AFK in Discord before they are removed from the queue (milliseconds) |
TANK_ROLE | Discord role ID |
DPS_ROLE | Discord role ID |
SUPPORT_ROLE | Discord role ID |
TANK_EMOJI | Discord emoji ID |
An example .env
file might look something like:
TOKEN=<insert token here>
OWNERS=183873160779792385
PUGS_CHANNEL=183878860331286530
PUGS_ANNOUNCEMENT_CHANNEL=40716864976663347
PUGS_ROLE=393869466452099072
TEMP_CHANNEL_LIFETIME=3600000
TEAM_SIZE=6
IDLE_TIME=1200000
TANK_ROLE=402067038278909952
DPS_ROLE=402067250523275266
SUPPORT_ROLE=402067294173396992
TANK_EMOJI=<:tank:406977153884749844>
DPS_EMOJI=<:dps:406977114135330847>
SUPPORT_EMOJI=<:support:406977181789454339>
While getting the ID of most things in Discord (channels, users) normally involves right click > "Copy ID", this does not currently work for roles on a Discord server.
In order to get a role's ID make sure the role is mentionable in server settings, then type this in a channel (note that this will actually also mention users with the role):
\@role_name
Your message should turn into something that looks like this after sending:
<@&402067038278909952>
The numeric part is the ID of the role you mentioned.
This is very similar to getting a role ID from Discord.
Just type the emoji name, including the surrounding :
, preceeded by a \
:
\:emoji_name:
Your message should turn into something that looks like this after sending:
<:emoji_name:406977153884749844>
The entire message including the <>
is the emoji ID.
- discord.js - A powerful JavaScript library for interacting with the Discord API
- Commando - Official command framework for discord.js
- dotenv - Load environment variables from .env file
This project is licensed under the MIT License - see LICENSE for details