This commit is contained in:
Syxpi
2025-09-28 13:00:01 +02:00
parent c21280d0c0
commit 14d4df5a40
6 changed files with 30 additions and 11 deletions

View File

@@ -11,9 +11,8 @@ module.exports = {
.setDescription('The command to reload.')
.setRequired(true)),
async execute(interaction) {
// Vérification côté bot pour être sûr
if (!interaction.member.permissions.has(PermissionFlagsBits.Administrator)) {
return interaction.reply({ content: '❌ Only administrators can use this command.', ephemeral: true });
return interaction.reply({ content: '❌ Only administrators can use this command.', embeds: [embed] });
}
@@ -21,7 +20,7 @@ module.exports = {
const command = interaction.client.commands.get(commandName);
if (!command) {
return interaction.reply({ content: `There is no command with name \`${commandName}\`!`, ephemeral: true });
return interaction.reply({ content: `There is no command with name \`${commandName}\`!`, embeds: [embed] });
}
delete require.cache[require.resolve(`../${command.category}/${command.data.name}.js`)];
@@ -29,10 +28,10 @@ module.exports = {
try {
const newCommand = require(`../${command.category}/${command.data.name}.js`);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply({ content: `✅ Command \`${newCommand.data.name}\` was reloaded!`, ephemeral: true });
await interaction.reply({ content: `✅ Command \`${newCommand.data.name}\` was reloaded!`, });
} catch (error) {
console.error(error);
await interaction.reply({ content: `❌ Error while reloading \`${command.data.name}\`:\n\`${error.message}\``, ephemeral: true });
await interaction.reply({ content: `❌ Error while reloading \`${command.data.name}\`:\n\`${error.message}\``, embeds: [embed] });
}
},
};