val stats: check whether the user included # when using the comand or no

這個提交存在於:
Ayden Jahola 2024-10-06 00:56:33 +01:00
父節點 455ae98287
當前提交 d29050fa1e
資料庫中找不到此簽署所對應的金鑰
GPG 金鑰 ID: 71DD90AE4AE92742

查看文件

@ -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,
});
}
}
},