Fix: Modify load-commands.ts to support js
All checks were successful
release-tag / release-image (push) Successful in 1m48s
All checks were successful
release-tag / release-image (push) Successful in 1m48s
This commit is contained in:
@@ -15,8 +15,8 @@ export const config = {
|
||||
mongodb: {
|
||||
host: process.env.MONGODB_HOST ?? '127.0.0.1',
|
||||
port: process.env.MONGODB_PORT ?? 27017,
|
||||
user: process.env.MONGODB_USER ?? 'mafuyu',
|
||||
pass: process.env.MONGODB_PASS ?? 'mafuyu',
|
||||
user: process.env.MONGODB_USER ?? 'mafuyu',
|
||||
pass: process.env.MONGODB_PASS ?? 'mafuyu',
|
||||
db: process.env.MONGODB_DB ?? 'mafuyu',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -10,7 +10,9 @@ export async function loadCommands(client: ExtendedClient): Promise<Array<string
|
||||
const commands: Array<string> = [];
|
||||
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<Array<string
|
||||
}
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user