This commit is contained in:
2026-03-15 12:22:42 +01:00
parent cd99275933
commit 311ba5e7f3
558 changed files with 55182 additions and 22981 deletions

View File

@@ -1,36 +1,40 @@
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
const { SlashCommandBuilder, PermissionFlagsBits, MessageFlags } = require('discord.js');
module.exports = {
category: 'dev',
data: new SlashCommandBuilder()
.setName('reload')
.setDescription('Recharge une commande.')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption(option =>
option.setName('command')
.setDescription('La commande à recharger.')
.setRequired(true)),
async execute(interaction) {
if (!interaction.member.permissions.has(PermissionFlagsBits.Administrator)) {
return interaction.reply({ content: '❌ Seuls les administrateurs peuvent utiliser cette commande.', ephemeral: true });
}
category: 'dev',
data: new SlashCommandBuilder()
.setName('reload')
.setDescription('Recharge une commande.')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption(option =>
option.setName('command')
.setDescription('La commande à recharger.')
.setRequired(true)),
async execute(interaction) {
if (!interaction.member.permissions.has(PermissionFlagsBits.Administrator)) {
return interaction.reply({ content: '❌ Seuls les administrateurs peuvent utiliser cette commande.', flags: MessageFlags.Ephemeral });
}
const commandName = interaction.options.getString('command', true).toLowerCase();
const command = interaction.client.commands.get(commandName);
const commandName = interaction.options.getString('command', true).toLowerCase();
const command = interaction.client.commands.get(commandName);
if (!command) {
return interaction.reply({ content: `❌ Aucune commande nommée \`${commandName}\` n'a été trouvée !`, ephemeral: true });
}
if (!command) {
return interaction.reply({ content: `❌ Aucune commande nommée \`${commandName}\` n'a été trouvée !`, flags: MessageFlags.Ephemeral });
}
delete require.cache[require.resolve(`../${command.category}/${command.data.name}.js`)];
try {
// Supprimer du cache
const commandPath = `../${command.category}/${command.data.name}.js`;
delete require.cache[require.resolve(commandPath)];
try {
const newCommand = require(`../${command.category}/${command.data.name}.js`);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply({ content: `✅ Commande \`${newCommand.data.name}\` rechargée avec succès !`, ephemeral: true });
} catch (error) {
console.error(error);
await interaction.reply({ content: `❌ Erreur lors du rechargement de \`${command.data.name}\`:\n\`${error.message}\``, ephemeral: true });
}
},
};
// Recharger
const newCommand = require(commandPath);
interaction.client.commands.set(newCommand.data.name, newCommand);
await interaction.reply({ content: `✅ Commande \`${newCommand.data.name}\` rechargée avec succès !`, flags: MessageFlags.Ephemeral });
} catch (error) {
console.error(error);
await interaction.reply({ content: `❌ Erreur lors du rechargement de \`${command.data.name}\`:\n\`${error.message}\``, flags: MessageFlags.Ephemeral });
}
},
};