This commit is contained in:
VALOU3336
2024-02-14 08:24:51 +01:00
7 changed files with 80 additions and 54 deletions
+8 -11
View File
@@ -1,14 +1,11 @@
const { Events, InteractionType } = require("discord.js")
const { Events, InteractionType } = require("discord.js");
module.exports = {
name :Events.InteractionCreate,
async run(client, interaction) {
if(interaction.type === InteractionType.ApplicationCommand) {
const command = client.commands.get(interaction.commandName);
await command.execute(interaction, client);
};
name: Events.InteractionCreate,
async run(client, interaction) {
if (interaction.type === InteractionType.ApplicationCommand) {
const command = client.commands.get(interaction.commandName);
await command.execute(interaction, client);
}
};
},
};
-23
View File
@@ -1,23 +0,0 @@
module.exports = {
name: 'messageCreate',
async execute(client, message) {
const prefix = '!'; // Assurez-vous que le préfixe est défini ici aussi
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
// Si la commande n'existe pas, ne faites rien
if (!client.commands.has(commandName)) return;
const command = client.commands.get(commandName);
try {
command.execute(client, message, args);
} catch (error) {
console.error(error);
message.reply('Il y a eu une erreur lors de l\'exécution de cette commande.');
}
},
};
+6 -13
View File
@@ -1,15 +1,8 @@
const { Events, ActivityType } = require("discord.js")
const { Events, ActivityType } = require("discord.js");
module.exports = {
name : Events.ClientReady,
async execute(client) {
//if (client.commands && Array.isArray(client.commands)) {
// client.application.commands.set(client.commands.map(command => command.data));
//} else {
//console.error('Les commandes du client sont manquantes ou mal formatées');
//}
console.log(`${client.user.username} est en ligne`);
},
name: Events.ClientReady,
async run(client) {
}
};