mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2024-11-22 08:45:55 +00:00
val stats: check whether the user included # when using the comand or no
This commit is contained in:
parent
455ae98287
commit
d29050fa1e
1 changed files with 20 additions and 6 deletions
|
@ -43,6 +43,16 @@ module.exports = {
|
||||||
),
|
),
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
const username = interaction.options.getString("username");
|
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 statsType = interaction.options.getString("stats_type");
|
||||||
const includeWeapons = interaction.options.getBoolean("include_weapons");
|
const includeWeapons = interaction.options.getBoolean("include_weapons");
|
||||||
const includeMaps = interaction.options.getBoolean("include_maps");
|
const includeMaps = interaction.options.getBoolean("include_maps");
|
||||||
|
@ -193,13 +203,17 @@ module.exports = {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error fetching player stats:", error);
|
console.error("Error fetching player stats:", error);
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
return interaction.editReply(
|
return interaction.followUp({
|
||||||
`Error: ${error.response.data.message || error.response.statusText}`
|
content: `Error: ${
|
||||||
);
|
error.response.data.message || error.response.statusText
|
||||||
|
}`,
|
||||||
|
ephemeral: true,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return interaction.editReply(
|
return interaction.followUp({
|
||||||
"An error occurred while fetching player stats."
|
content: "An error occurred while fetching player stats.",
|
||||||
);
|
ephemeral: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue