mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-12 15:56:25 +02:00
ajoute messageCreate
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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.');
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -2,13 +2,13 @@ const { Events, ActivityType } = require("discord.js")
|
||||
module.exports = {
|
||||
|
||||
name : Events.ClientReady,
|
||||
async run(client) {
|
||||
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');
|
||||
}
|
||||
//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`);
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user