diff --git a/src/utils/commands.ts b/src/utils/commands.ts index 365890d..d8a0aaf 100644 --- a/src/utils/commands.ts +++ b/src/utils/commands.ts @@ -1,7 +1,6 @@ import { Client } from 'discord.js'; import fs from 'fs'; import path from 'path'; -import { pathToFileURL } from 'url'; import { Handler } from '../types'; const ROOT_DIR = path.resolve(__dirname, '..'); @@ -11,7 +10,8 @@ export async function loadHandlersFrom(dir: string, handlerArray: Handler[]): Pr const files = fs.readdirSync(`${ROOT_DIR}/${dir}`).filter(file => file.endsWith('.js') || file.endsWith('.ts')); for (const file of files) { - handlerArray.push((await import(pathToFileURL(`${ROOT_DIR}/${dir}/${file}`).href)).default); + // eslint-disable-next-line @typescript-eslint/no-require-imports + handlerArray.push(require(`${ROOT_DIR}/${dir}/${file}`).default); } } diff --git a/src/utils/refresh-commands.ts b/src/utils/refresh-commands.ts index c4a624d..244f2c0 100644 --- a/src/utils/refresh-commands.ts +++ b/src/utils/refresh-commands.ts @@ -1,7 +1,6 @@ import { Client, REST, RESTPostAPIApplicationCommandsJSONBody, Routes } from 'discord.js'; import fs from 'fs'; import path from 'path'; -import { pathToFileURL } from 'url'; import { config } from '../config'; import { Command } from '../types'; @@ -21,7 +20,8 @@ export async function refreshCommands(client: Client) { for (const [folderName, files] of Object.entries(commandFiles)) { for (const file of files) { const p = `${ROOT_DIR}/${folderName}/${file}`; - const command: Command = (await import(pathToFileURL(p).href)).default; + // eslint-disable-next-line @typescript-eslint/no-require-imports + const command: Command = require(p).default; if (!command) { console.warn(`File at ${p} has no export. Skipping registering.`); diff --git a/tsconfig.json b/tsconfig.json index 98deec1..7f3f53d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,13 +3,11 @@ "strict": true, "noUnusedLocals": true, "noImplicitAny": false, - "moduleResolution": "bundler", "esModuleInterop": true, - "lib": ["ES2021.String"], "skipLibCheck": true, "inlineSourceMap": true, "forceConsistentCasingInFileNames": false - }, + } } \ No newline at end of file