add commands and events

This commit is contained in:
Tutur33
2024-02-22 22:46:34 +01:00
parent bacdf04b4d
commit 31d7e23f14
7 changed files with 122 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
const { Events } = require("discord.js");
module.exports = {
name: Events.MessageCreate,
async execute(message, client) {
const prefix = "+";
if (message.author.bot) return;
if (!message.content.startsWith(prefix)) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
const command = client.commands.get(commandName);
if (!command) return;
try {
command.execute(message, args);
} catch (error) {
console.error(error);
message.reply("Erreur lors de l'exécution de la commande");
}
}
};
+8
View File
@@ -0,0 +1,8 @@
const { Events, ActivityType } = require("discord.js");
module.exports = {
name: Events.ClientReady,
async execute(client) {
console.log(`le bot ${client.user.tag} est en ligne`)
}
};