Skip to content

Commit 3374c64

Browse files
committed
feat: ✨ Enhance bot functionality and add testing
This commit introduces several enhancements and a new test suite to improve the bot's functionality and reliability. - Updated `.gitignore` to include the `build` directory, excluding compiled files from version control. - Updated `tsconfig.json` to extend `@sindresorhus/tsconfig`, specify compiler options, include source files, and define an output directory. - Modified `src/events.ts` to handle commands without options, improve error logging, and use `this.i18n` for localization. - Updated `package.json` to include new dependencies, update scripts, and configure AVA for TypeScript testing. - Updated `README.md` to reflect updated Node.js version requirements and minor formatting changes. - Added a new test file `src/tests/data-handlers/api-handler.test.ts` to test the `ApiHandler` class.
1 parent da48da8 commit 3374c64

13 files changed

Lines changed: 894 additions & 435 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ bower_components
3535
.lock-wscript
3636

3737
# Compiled binary addons (https://nodejs.org/api/addons.html)
38-
build/Release
38+
build
3939

4040
# Dependency directories
4141
node_modules/

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# lol-ranks-bot
2+
23
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.
34

45
[![VS Code](https://img.shields.io/badge/IDE-VS%20Code-6A0DAD.svg)](https://code.visualstudio.com/)
@@ -7,16 +8,19 @@ A Discord bot that allows users to verify their League of Legends summoner name
78
[![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-9370DB.svg?style=flat&labelColor=454545&color=9370DB)](https://creativecommons.org/licenses/by-nc/4.0/)
89

910
## Prerequisites
11+
1012
Before you begin, ensure you have met the following requirements:
11-
- Node.js (v16.0 or higher)
12-
- NPM (usually comes with Node.js)
13-
- Docker and Docker Compose (for Docker deployment)
14-
- PM2 (for PM2 deployment)
1513

16-
Install Node.js (v16.0 or higher) and NPM from [Node.js official website](https://nodejs.org/en/download/).<br>
14+
- Node.js (v20.0 or higher)
15+
- NPM (usually comes with Node.js)
16+
- Docker and Docker Compose (for Docker deployment)
17+
- PM2 (for PM2 deployment)
18+
19+
Install Node.js (v20.0 or higher) and NPM from [Node.js official website](https://nodejs.org/en/download/).<br>
1720
Install Docker and Docker Compose on your server. Follow the [official Docker guide](https://docs.docker.com/get-docker/) for installation instructions.
1821

1922
## Local Development Setup
23+
2024
Follow these steps to set up the bot for development purposes on your local machine:
2125

2226
1. Clone the repository:
@@ -31,6 +35,7 @@ Follow these steps to set up the bot for development purposes on your local mach
3135
## Server Deployment
3236

3337
### Docker Deployment
38+
3439
To deploy the bot on a server using Docker, follow these steps:
3540

3641
1. Clone the repository:
@@ -43,6 +48,7 @@ To deploy the bot on a server using Docker, follow these steps:
4348
5. To stop the bot, run `docker compose down`.
4449

4550
### PM2 Deployment
51+
4652
To deploy the bot on a server using PM2, follow these steps:
4753

4854
1. Install PM2 globally by running `npm install pm2 -g`.
@@ -57,6 +63,7 @@ To deploy the bot on a server using PM2, follow these steps:
5763
7. To ensure PM2 restarts the bot after reboots, run `pm2 save`
5864

5965
## How the Bot Works
66+
6067
- Users trigger the verification process by a command in Discord.
6168
- The bot verifies the user's League of Legends summoner name.
6269
- Once verified, the bot checks the user's rank/elo in League of Legends.
@@ -65,6 +72,7 @@ To deploy the bot on a server using PM2, follow these steps:
6572
- The bot does not automatically assign roles to all users; each user must initiate the verification process.
6673

6774
## Settings
75+
6876
- `channels` = Set the ID of the channels that will be used for the Bot to send the messages (optional)
6977
- `help` - Default channel to help members with bot-related issues
7078
- `guildID` = ID of your server ([Tutorial](https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-))
@@ -90,4 +98,5 @@ To deploy the bot on a server using PM2, follow these steps:
9098
- To enable rank icons on messages (like this <img alt="Challenger Icon" style="width:18px" src="https://raw.communitydragon.org/latest/plugins/rcp-fe-lol-static-assets/global/default/images/ranked-mini-crests/challenger.png"/>) you need to add custom emojis on your server ([Tutorial](https://support.discord.com/hc/en-us/articles/360036479811-Custom-Emojis))). 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)
9199

92100
## LICENSE
101+
93102
This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.<br/><br/><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>

locales/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"reply6": "Ich kann keinen Solo Queue Rang für diesen Beschwörernamen finden. Bitte versuche es später nochmals oder kontaktiere den ",
2020
"reply7": "Es gab einen Fehler beim Verarbeiten der Anfrage. Bitte versuche es später nochmals oder kontaktiere den ",
2121
"reply8": "Ich konnte diesen Beschwörernamen nicht finden.",
22+
"reply9": "Sie müssen zuerst Ihr Konto authentifizieren. Bitte verwenden Sie den /rank-Befehl mit Ihrem Beschwörernamen, um zu beginnen.",
2223
"ranks": {
2324
"Unranked": "Unbewertet",
2425
"Iron": "Eisen",

locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"reply6": "I cannot find a solo queue rank for this summoner name. Please try again later or contact the ",
2020
"reply7": "There was an error processing the request. Please try again later or contact the ",
2121
"reply8": "I couldn't find that summoner name.",
22+
"reply9": "You need to authenticate your account first. Please use the /rank command with your summoner name to get started.",
2223
"ranks": {
2324
"Unranked": "Unranked",
2425
"Iron": "Iron",
@@ -33,4 +34,4 @@
3334
"Challenger": "Challenger"
3435
},
3536
"confirm": "Confirm"
36-
}
37+
}

locales/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"reply6": "No puedo encontrar un rango de cola individual para este nombre de invocador. Inténtalo de nuevo más tarde o comunícate con ",
2020
"reply7": "Hubo un error al procesar la solicitud. Vuelva a intentarlo más tarde o comuníquese con el ",
2121
"reply8": "No pude encontrar ese nombre de invocador.",
22+
"reply9": "Necesitas autenticar tu cuenta primero. Por favor usa el comando /rank con tu nombre de invocador para comenzar.",
2223
"ranks": {
2324
"Unranked": "Sin clasificar",
2425
"Iron": "Hierro",

locales/pt.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"reply6": "Não consigo encontrar uma classificação de fila Solo ranqueada para este nome de invocador. Por favor, tente novamente mais tarde ou entre em contato com o ",
2020
"reply7": "Ocorreu um erro ao processar a solicitação. Tente novamente mais tarde ou entre em contato com o ",
2121
"reply8": "Não consegui encontrar esse nome de invocador.",
22+
"reply9": "Você precisa autenticar sua conta primeiro. Por favor, use o comando /rank com seu nome de invocador para começar.",
2223
"ranks": {
2324
"Unranked": "Não ranqueado",
2425
"Iron": "Ferro",

locales/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"reply6": "Я не могу найти ранг одиночной очереди для этого имени призывателя. Повторите попытку позже или свяжитесь ",
2020
"reply7": "Прошла ошибка при обработке запроса. Повторите попытку позже или свяжитесь ",
2121
"reply8": "Я не мог найти это имя призывателя.",
22+
"reply9": "Сначала вам нужно аутентифицировать свою учетную запись. Пожалуйста, используйте команду /rank с именем вашего призывателя, чтобы начать.",
2223
"ranks": {
2324
"Unranked": "без рейтинга",
2425
"Iron": "Железо",

0 commit comments

Comments
 (0)