ajoute messageCreate

This commit is contained in:
VALOU3336
2024-02-14 08:19:27 +01:00
parent 7469ee4736
commit 576f5eb05b
6 changed files with 86 additions and 24 deletions
+24
View File
@@ -25,4 +25,28 @@ module.exports = (client) => {
const totalCommands = loadCommands('../commands');
console.log(`Commands => ${totalCommands} commandes préfixées chargées sur le bot`);
client.on('messageCreate', async message => {
//const botId = client.user.id;
//const guildId = message.guild.id;
//const prefix = botTokens.coins[botId].prefix;
const prefix = '!';
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
if (!client.commands.has(commandName)) return;
const command = client.commands.get(commandName)
//|| client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
if (command) {
//const permissionLevel = await getPermissionLevel(message.member, client, guildId);
//console.log(permissionLevel, permissions[command.name])
//if (permissionLevel >= permissions[command.name]) {
command.execute(message, args, client);
//} else {
// return message.reply("Vous n'avez pas accès à cette commande.");
// }
}
});
}