mirror of
https://github.com/Expand-sys/mcbot
synced 2025-12-15 14:32:13 +11:00
14 lines
No EOL
498 B
JavaScript
14 lines
No EOL
498 B
JavaScript
const { promisify } = require('util');
|
|
const { glob } = require('glob');
|
|
const PG = promisify(glob);
|
|
|
|
module.exports = async (client, Discord) => {
|
|
(await PG(`${process.cwd()}/events/*/*.js`)).map(async (file) => {
|
|
const event = require(file);
|
|
if (event.once) {
|
|
client.once(event.name, (...args) => event.execute(...args, client, Discord));
|
|
} else {
|
|
client.on(event.name, (...args) => event.execute(...args, client, Discord));
|
|
}
|
|
});
|
|
} |