Skip to content

Commit

Permalink
small refactoring
Browse files Browse the repository at this point in the history
small refactoring #2074

small refactoring #2074
  • Loading branch information
BastLast committed Jul 27, 2023
1 parent 52f573e commit 6c08c18
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {CommandInteraction} from "discord.js";
import {Constants} from "../../../../core/Constants";
import {ITestCommand} from "../../../../core/CommandsTest";
import {Players} from "../../../../core/database/game/models/Player";
import {GuildConstants} from "../../../../core/constants/GuildConstants";

export const commandInfo: ITestCommand = {
name: "guildlevel",
Expand Down Expand Up @@ -32,8 +33,8 @@ const guildLevelTestCommand = async (language: string, interaction: CommandInter
throw new Error("Erreur glvl : vous n'êtes pas dans une guilde !");
}
const guildLvl = parseInt(args[0], 10);
if (guildLvl <= 0 || guildLvl > 150) {
throw new Error("Erreur glvl : niveau de guilde invalide ! Fourchette de niveau compris entre 0 et 150.");
if (guildLvl <= 0 || guildLvl > GuildConstants.MAX_LEVEL) {
throw new Error(`Erreur glvl : niveau de guilde invalide ! Fourchette de niveau compris entre 0 et ${GuildConstants.MAX_LEVEL}.`);
}
guild.level = guildLvl;
await guild.save();
Expand Down

0 comments on commit 6c08c18

Please sign in to comment.