-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvents.js
28 lines (22 loc) · 800 Bytes
/
Events.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const { Events } = require("../Validation/EventNames");
module.exports = async (client, PG, Ascii) => {
const Table = new Ascii("Events Loaded");
(await PG(`${process.cwd()}/Events/*/*.js`)).map(async (file) => {
const event = require(file);
if (!Events.includes(event.name) || !event.name) {
const L = file.split("/");
await Table.addRow(
`${event.name || "MISSING"}`,
`⛔ Event Name is either invalid or missing: ${L[6] + `/` + L[7]}`
);
return;
}
if (event.once) {
client.once(event.name, (...args) => event.execute(...args, client));
} else {
client.on(event.name, (...args) => event.execute(...args, client));
}
await Table.addRow(event.name, "✅ Successful");
});
console.log(Table.toString());
};