An in-house Discord bot that drafts 2 teams and has a MMR system was made for any game that you play 5v5.
/addplayer
-
Adds a player to the list of the players (only players added can use another commands expect: /help). A player starts with 50mmr points.
- options:
- player - Select a user from discord server.
- options:
/lobby
- Creates a lobby, then players can use /join to enter the lobby
/join
- Join a created lobby. When the lobby reaches 10 players, the bot will make the 2 teams equalized based on mmr.
/lobbyresult
-
When a game is defined use /lobbyresult to record the result of the lobby, this will also update mmrs and wins/loses/games of the players of the lobby. The players of the winner team wins 5mmr points, the players of loser team lose 5mmr points.
- options:
- lobbynumber - The number of the lobby we wanna defined the result.
- winnerteam - The team that won the lobby.
- options:
/leave
- Leave from a created lobby joinned before. Notice: you can't leave a lobby alredy in progress.
/playerinfo
- Shows info of a player.
- options:
- player - Select a player from discord server
- options:
/deletelobby
- Deletes a lobby openned (undefined teams) or in progress (defined teams).
- options:
- lobbynumber - The number of the lobby we wanna delete.
- options:
/ranking
- Shows ranking of players based on selected option.
- options:
- option - Select between: Top 10 MMR, Bot 10 MMR, Top 10 Wins or Top 10 Loses
- options:
/allplayers
- Shows all players who have been added to the inhouse.
/help
- Shows commands info.
You need to have node.js installed and a Discord account.
Clone the project.
Install required packages into the project:
npm install
Now copy the .env.example file to .env file to the project:
cp .env.example .env
Now, you need to create a bot in the discord developer portal. Click on New Application and give it a cool name. On the General Information tab copy the APPLICATION ID and past on the CLIENT_ID variable on .env file, like this example:
TOKEN=
CLIENT_ID=0123456789876543210
Now, on the Bot tab, click on "Reset Token" to generate a new Token
.
Copy the token
to the .env file:
Remember, it's crucial not to share this token with anyone else.
The .env
file should be like this example:
TOKEN=EXAMPLE01234TOKEN
CLIENT_ID=0123456789876543210
THIS IS A VERY IMPORTANT STEP:
On the 'OAuth2' tab, under the 'OAuth2 URL Generator' session, select bot and applications.commands. Then, in the 'BOT PERMISSIONS' section, check the Administrator checkbox. This will generate the link to add the bot to a server. Simply paste the generated link into your browser to add the bot to your server.
Now, run the command:
npm start
The bot is now up and running! Head over to your server and enjoy it!
Notice: The bot may take up to 5 minutes to register the commands.
⚠️ This bot cannot operate on multiple servers simultaneously within the same project because the database only works for one server. If you use the bot on more than one server, the data will be messed up.