Fix file extensions

This commit is contained in:
Marcin Czop 2024-11-19 22:34:48 +01:00
parent 86a677001b
commit 3a6139d38a
No known key found for this signature in database
GPG key ID: 44BCC84471234D0D

View file

@ -32,9 +32,9 @@ class Bot extends Client {
this.login(process.env.TOKEN); this.login(process.env.TOKEN);
this.log.info("Loading commands..."); this.log.info("Loading commands...");
const commandFiles: string[] = await glob(`${__dirname}/commands/**/*.ts`); const commandFiles: string[] = await glob(`${__dirname}/commands/**/*{.ts,.js}`);
console.log(commandFiles);
commandFiles.map(async (fileName: string) => { commandFiles.map(async (fileName: string) => {
console.debug(`Registering command: ${fileName}`);
const filePath = path.resolve(fileName); const filePath = path.resolve(fileName);
const file: Command = await import(filePath); const file: Command = await import(filePath);
this.commands.set(file.name, file); this.commands.set(file.name, file);
@ -42,9 +42,8 @@ class Bot extends Client {
}); });
this.log.info("Loading events..."); this.log.info("Loading events...");
const eventFiles: string[] = await glob(`${__dirname}/events/**/*.ts`); const eventFiles: string[] = await glob(`${__dirname}/events/**/*{.ts,.js}`);
eventFiles.map(async (fileName: string) => { eventFiles.map(async (fileName: string) => {
console.debug(`Registering event: ${fileName}`);
const filePath = path.resolve(fileName); const filePath = path.resolve(fileName);
const file: Event = await import(filePath); const file: Event = await import(filePath);
this.events.set(file.name, file); this.events.set(file.name, file);