From d29050fa1e1e688b6c0c222e68bc1cefe4d93c0f Mon Sep 17 00:00:00 2001 From: Ayden Jahola Date: Sun, 6 Oct 2024 00:56:33 +0100 Subject: [PATCH] val stats: check whether the user included # when using the comand or no --- commands/stats/valorant.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/commands/stats/valorant.js b/commands/stats/valorant.js index 9ac6842..5a83544 100644 --- a/commands/stats/valorant.js +++ b/commands/stats/valorant.js @@ -43,6 +43,16 @@ module.exports = { ), async execute(interaction) { const username = interaction.options.getString("username"); + + // Check if username contains '#' + if (!username.includes("#")) { + return interaction.followUp({ + content: + "Error: Please include your tag in the username (e.g., Shitter#1234).", + ephemeral: true, + }); + } + const statsType = interaction.options.getString("stats_type"); const includeWeapons = interaction.options.getBoolean("include_weapons"); const includeMaps = interaction.options.getBoolean("include_maps"); @@ -193,13 +203,17 @@ module.exports = { } catch (error) { console.error("Error fetching player stats:", error); if (error.response) { - return interaction.editReply( - `Error: ${error.response.data.message || error.response.statusText}` - ); + return interaction.followUp({ + content: `Error: ${ + error.response.data.message || error.response.statusText + }`, + ephemeral: true, + }); } else { - return interaction.editReply( - "An error occurred while fetching player stats." - ); + return interaction.followUp({ + content: "An error occurred while fetching player stats.", + ephemeral: true, + }); } } },