League Banner is a Discord bot that automatically bans people playing League of Legends (but it can be configured to ban people playing other games too).
To prepare your environment, you will need Node.js. Download and install Node.js 16.17.0.
Make sure you have the latest version of Yarn installed. This can be done by opening the Command Prompt and typing the following in:
npm install -g yarn
Download the project files into a folder. Open a terminal and navigate to that folder (in Windows this can be done by navigating to the folder in the File Explorer > Shift-Right Click > Open in Command Prompt). Run the following command to install dependencies:
yarn install
Configuration is done through environment variables.
This is managed in the .env
file.
The project comes with a .env.template
that you can use as a template.
Simply make a duplicate of it and rename it to .env
.
From there, you have the following options:
Name | Description | Default Value |
---|---|---|
DISCORD_TOKEN |
The bot's access token. This can be found in Discord's developer portal | [empty] |
BANNED_NAMES |
The names of games that should be banned. This is a comma separated list and case insensitive, so you could have a list that looks like: League of Legends, Valorant, Legends of Runeterra . |
League of Legends |
BAN_REASON |
The reason to give for the ban. | You aren't allowed to play League of Legends. |
- Create a bot to interact with the Discord API.
- Click the "New Application" button
- Put in the bot's information
- Click on the "Bot" tab on the right-hand side of the screen
- Click the "Add Bot" button
- Click the "Yes, do it!" button
- Under the "Privileged Gateway Intents" section, enable the "PRESENCE INTENT" and "SERVER MEMBERS INTENT" options
- Disable the "PUBLIC BOT" option
- Click on the "Reset Token" button and then click the "Yes, do it!" button
- Copy the token and put it into your
.env
file mentioned in the Configuring section
- Copy the token and put it into your
To invite your bot to your server, follow this tutorial.
Once you have everything prepared, you can start the bot by running the following in a command line:
yarn start
It is possible that you set up the bot and it doesn't ban some people. This is most likely because it cannot ban them. In this case, make sure the bot has at least one role that is above the roles of everyone that you want it to be able to ban. I.e. don't put the bot's role at the bottom of the list.