fix: limit rank input and change to method
This commit is contained in:
parent
4f99552725
commit
74e482ed90
8
index.js
8
index.js
@ -298,7 +298,7 @@ client.on("messageCreate", async (message) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const args = message.content.toLowerCase.split(" ");
|
||||
const args = message.content.toLowerCase().split(" ");
|
||||
|
||||
if (args[0] === "setrank") {
|
||||
const pickupGuild = client.guilds.cache.get(GUILD_ID);
|
||||
@ -312,6 +312,12 @@ client.on("messageCreate", async (message) => {
|
||||
|
||||
const playerId = player.id;
|
||||
const rank = parseInt(args[2]);
|
||||
if (isNaN(rank) || rank < 0 || rank > 5) {
|
||||
await interaction.reply(
|
||||
`invalid rank ${args[2]}. must be an integer between 0 and 5`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// create rankings.json if it doesn't exist
|
||||
const rankingsPath = path.join(__dirname, "rankings.json");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user