Dex
Dex
DIAdiscord.js - Imagine an app
Created by Dex on 10/20/2024 in #djs-questions
Any1 knows why i might be getting this error ?
export default function loadEvents(client: any) {
const ascii = require("ascii-table");
const fs = require("fs");
const table = new ascii().setHeading("Events", "Status");
const folders = fs.readdirSync("./src/Events");

for (const folder of folders) {
const files = fs
.readdirSync(`../Events/${folder}`)
.filter((file: any) => file.endsWith(".js"));

for (const file of files) {
const event = require(`../Events/${folder}/${file}`);
if (event.rest) {
if (event.once) {
client.rest.once(event.name, (...args: any) =>
event.execute(...args, client)
);
} else {
client.rest.on(event.name, (...args: any) =>
event.execute(...args, client)
);
}
} else {
if (event.once) {
client.once(event.name, (...args: any) => event.execute(...args, client));
} else {
client.on(event.name, (...args: any) => event.execute(...args, client));
}
}
table.addRow(file, "loaded");
continue;
}
}
return console.log(table.toString(), "\nLoaded events");
}
export default function loadEvents(client: any) {
const ascii = require("ascii-table");
const fs = require("fs");
const table = new ascii().setHeading("Events", "Status");
const folders = fs.readdirSync("./src/Events");

for (const folder of folders) {
const files = fs
.readdirSync(`../Events/${folder}`)
.filter((file: any) => file.endsWith(".js"));

for (const file of files) {
const event = require(`../Events/${folder}/${file}`);
if (event.rest) {
if (event.once) {
client.rest.once(event.name, (...args: any) =>
event.execute(...args, client)
);
} else {
client.rest.on(event.name, (...args: any) =>
event.execute(...args, client)
);
}
} else {
if (event.once) {
client.once(event.name, (...args: any) => event.execute(...args, client));
} else {
client.on(event.name, (...args: any) => event.execute(...args, client));
}
}
table.addRow(file, "loaded");
continue;
}
}
return console.log(table.toString(), "\nLoaded events");
}
6 replies
DIAdiscord.js - Imagine an app
Created by Dex on 10/20/2024 in #djs-questions
Any1 knows why i might be getting this error ?
No description
6 replies
DIAdiscord.js - Imagine an app
Created by Dex on 10/20/2024 in #djs-questions
Any1 knows why i might be getting this error ?
No description
6 replies