A Discord bot that allows users to verify their League of Legends summoner name and assigns roles based on their rank/elo in the game. Users must initiate the verification process themselves, and upon successful verification, the bot will grant them the appropriate rank role within the Discord server.
Before you begin, ensure you have met the following requirements:
- Node.js (v16.0 or higher)
- NPM (usually comes with Node.js)
- Docker and Docker Compose (for Docker deployment)
- PM2 (for PM2 deployment)
Install Node.js (v16.0 or higher) and NPM from Node.js official website.
Install Docker and Docker Compose on your server. Follow the official Docker guide for installation instructions.
Follow these steps to set up the bot for development purposes on your local machine:
- Clone the repository:
- Navigate to the directory where you want to clone the repository.
- Run
git clone https://github.com/simwai/lol-ranks-bot.git
. - Navigate to the cloned directory by running
cd lol-ranks-bot
.
- Install dependencies by running
npm install
. - Copy
config.json.example
and name itconfig.json
. - Adjust the config values by editing
config.json
. - Start the bot by running
npm run-script start
.
To deploy the bot on a server using Docker, follow these steps:
- Clone the repository:
- Navigate to the directory where you want to clone the repository.
- Run
git clone https://github.com/simwai/lol-ranks-bot.git
. - Navigate to the cloned directory by running
cd lol-ranks-bot
.
- Copy
config.json.example
and name itconfig.json
. - Adjust the config values by editing
config.json
. - Run
docker compose up -d
to build the Docker image and start the bot in detached mode. - To stop the bot, run
docker compose down
.
To deploy the bot on a server using PM2, follow these steps:
- Install PM2 globally by running
npm install pm2 -g
. - Clone the repository:
- Navigate to the directory where you want to clone the repository.
- Run
git clone https://github.com/simwai/lol-ranks-bot.git
. - Navigate to the cloned directory by running
cd lol-ranks-bot
.
- Install dependencies by running
npm install
. - Copy
config.json.example
and name itconfig.json
. - Adjust the config values by editing
config.json
. - Start the bot using PM2 by running
pm2 start src/index.js --name lol-ranks-bot
. - To ensure PM2 restarts the bot after reboots, run
pm2 save
- Users trigger the verification process by a command in Discord.
- The bot verifies the user's League of Legends summoner name.
- Once verified, the bot checks the user's rank/elo in League of Legends.
- The bot assigns a corresponding rank role and verified role to the user in the Discord server based on their League of Legends rank/elo.
- The bot keeps the lol ranks of the verified users up-to-date by running periodically.
- The bot does not automatically assign roles to all users; each user must initiate the verification process.
-
channels
= Set the ID of the channels that will be used for the Bot to send the messages (optional)help
- Default channel to help members with bot-related issues
-
guildID
= ID of your server (Tutorial) -
discordToken
= Tokens of your bot, used to authorize API requests and carry all of your bot user’s permissions (Tutorial) -
riotToken
= Riot development API key (Tutorial) -
status
= The Discord bot status -
ranks
= The names of your rank roles on your Discord server -
rankIconNames
= The names of you rank icons on your Discord server -
region
= The LoL API endpoint region -
timeZone
= Your timezone, you can find all timezones here -
language
= Select your general language according to the filename inside thelocales
folder (name only, no extension) -
eloRoleLanguage
= Select your rank role language -
verifiedRoleLanguage
= Select your verified role language -
enableCronJob
= Enables automatic update of ranks everyX
time, defined incronTab
-
cronTab
= Defines how often the ranks will be updated ifenableCronJob
istrue
-
concurrentRequests
= Defines the number of concurrent requests to the API (See Rate Limits after login) -
requestTime
= Set the request time in milliseconds -
setVerifiedRole
= Sets the verified role, when somebody has got an elo role -
enableVerification
= Enables summoner name verification -
enableTierUpdateMessages
= Enable bot to send messages on configured channel for rank up/down -
To enable rank icons on messages (like this ) you need to add custom emojis on your server (Tutorial)). The icons are inside the
assets/img
folder (Please do not change the name of the icons or the bot will not be able to identify them)
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.