diff options
-rw-r--r-- | commands.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/commands.ts b/commands.ts index e416aad..961000d 100644 --- a/commands.ts +++ b/commands.ts @@ -185,11 +185,10 @@ export function register(cmd: string, data: Command) { const commandFiles = fs .readdirSync("commands") - .filter((filename: string) => filename.endsWith(".js") || filename.endsWith(".ts")) - .map((file: string) => file.replace(/\.js$/gim, "")); + .filter((filename: string) => filename.endsWith(".js") || filename.endsWith(".ts")); for (let i = 0; i < commandFiles.length; i++) { - const cmdName = commandFiles[i]; - const cmd = (await import(`./commands/${cmdName}.js`)).default; - register(cmdName, cmd); + const cmdPath = commandFiles[i]; + const cmd = (await import(`./commands/${cmdPath}`)).default; + register(cmdPath.replace(/\.[jt]s$/gim, ""), cmd); } |