Giter Club home page Giter Club logo

lol-ranks-bot's Introduction

lol-ranks-bot

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.

VS Code ESLint Prettier License: CC BY-NC 4.0

Prerequisites

Before you begin, ensure you have met the following requirements:

  • For local development:
    • Node.js (v16.0 or higher)
    • NPM (usually comes with Node.js)
  • For server deployment:
    • Node.js (v16.0 or higher)
    • Docker and Docker Compose (for Docker deployment)
    • PM2 (for PM2 deployment)

Local Development Setup

Follow these steps to set up the bot for development purposes on your local machine:

  1. Install Node.js (v16.0 or higher) and NPM from Node.js official website.
  2. Clone the repository:
    • Open your terminal.
    • 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.
  3. Install dependencies by running npm install.
  4. Adjust the config values by editing config.json.
  5. Start the bot by running npm run-script start.

Server Deployment

Docker Deployment

To deploy the bot on a server using Docker, follow these steps:

  1. Install Docker and Docker Compose on your server. Follow the official Docker guide for installation instructions.
  2. Clone the repository (see Local Development Setup step 2).
  3. Adjust the config values by editing config.json.
  4. Run docker compose up -d to build the Docker image and start the bot in detached mode.
  5. To stop the bot, run docker compose down.

PM2 Deployment

To deploy the bot on a server using PM2, follow these steps:

  1. Install Node.js (v16.0 or higher) and NPM on your server.
  2. Install PM2 globally by running npm install pm2 -g.
  3. Clone the repository (see Local Development Setup step 2).
  4. Install dependencies by running npm install.
  5. Adjust the config values by editing config.json.
  6. Start the bot using PM2 by running pm2 start index.js --name lol-ranks-bot.
  7. To ensure PM2 restarts the bot after reboots, run pm2 save

How the Bot Works

  • 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.

Settings

  • channels = Set the ID of the channels that will be used for the Bot to send the messages

    • help - Default channel to help members with bot-related issues (optional)
  • 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 the locales folder (name only, no extension)

  • eloRoleLanguage = Select your rank role language

  • verifiedRoleLanguage = Select your verified role language

  • enableCronJob = Enables automatic update of ranks every X time, defined in cronTab

  • cronTab = Defines how often the ranks will be updated if enableCronJob is true

  • 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 Challenger Icon) 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)

LICENSE

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Creative Commons License

lol-ranks-bot's People

Contributors

dependabot[bot] avatar raidalthalus avatar rogerwindberg avatar rtbgg avatar simwai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.