From 51decf9b6e4b0d0d44078329b5fad46a52d020fa Mon Sep 17 00:00:00 2001 From: ytshih Date: Mon, 2 Sep 2024 01:59:17 +0000 Subject: [PATCH] Fix js support --- init/load-commands.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/init/load-commands.ts b/init/load-commands.ts index bc907ff..4cff8e7 100644 --- a/init/load-commands.ts +++ b/init/load-commands.ts @@ -10,7 +10,9 @@ export async function loadCommands(client: ExtendedClient): Promise = []; for(const folder of commandFolders){ const commandsPath = path.join(foldersPath, folder); - const commandsFiles = readdirSync(commandsPath).filter(file => file.endsWith('.ts')); + const commandsFiles = path.basename(__filename).endsWith('.ts') + ? readdirSync(commandsPath).filter(file => file.endsWith('.ts')) + : readdirSync(commandsPath).filter(file => file.endsWith('.js')); for(const file of commandsFiles){ const filePath = path.join(commandsPath, file); const data = await import(filePath); @@ -22,4 +24,4 @@ export async function loadCommands(client: ExtendedClient): Promise