Small fix

This commit is contained in:
2026-01-27 15:05:04 +01:00
parent ca07a0ed3b
commit 41949fe596
12 changed files with 61 additions and 86 deletions
+2 -7
View File
@@ -3,13 +3,12 @@ const { Client, Collection, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
const { loadCommandModules } = require('./loaders/commands');
const { loadEventModules } = require('./loaders/events');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
// Retrieves commands from the command folder
client.commands = new Collection();
const commandsPath = path.join(__dirname, 'commands');
const { commands, invalidCommands } = loadCommandModules(commandsPath);
const eventsPath = path.join(__dirname, 'events');
const eventModules = loadEventModules(eventsPath);
for (const command of commands) {
client.commands.set(command.data.name, command);
@@ -19,10 +18,6 @@ for (const filePath of invalidCommands) {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
// Retrieves events from the events folder
const eventsPath = path.join(__dirname, 'events');
const eventModules = loadEventModules(eventsPath);
for (const { event } of eventModules) {
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));