Remove old imports

This commit is contained in:
Tarrgon
2026-06-13 18:21:48 -04:00
parent b153d80e4a
commit 76112fef01
3 changed files with 5 additions and 7 deletions
+2 -2
View File
@@ -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);
}
}
+2 -2
View File
@@ -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.`);
+1 -3
View File
@@ -3,13 +3,11 @@
"strict": true,
"noUnusedLocals": true,
"noImplicitAny": false,
"moduleResolution": "bundler",
"esModuleInterop": true,
"lib": ["ES2021.String"],
"skipLibCheck": true,
"inlineSourceMap": true,
"forceConsistentCasingInFileNames": false
},
}
}