Add client to listeners

This commit is contained in:
Supositware 2022-08-15 17:23:23 +02:00
parent e176dc113f
commit e1a29c688d

View file

@ -15,6 +15,7 @@ const client = new Client({ intents: [Intents.FLAGS.GUILDS], shards: 'auto' });
client.commands = new Collection();
await loadCommandFromDir('fun');
await loadCommandFromDir('utility');
await loadCommandFromDir('admin');
await loadCommandFromDir('owner');
// Load events
@ -45,10 +46,10 @@ async function loadEventFromDir(dir, listener) {
let event = await import(filePath);
event = event.default;
if (event.once) {
listener.once(event.name, (...args) => event.execute(...args));
listener.once(event.name, (...args) => event.execute(...args, client));
}
else {
listener.on(event.name, (...args) => event.execute(...args));
listener.on(event.name, (...args) => event.execute(...args, client));
}
}
}