diff --git a/package.json b/package.json index 666430a..9679776 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Bot discord", "main": "src/index.js", "scripts": { - "main": "tsc && node ./dist/src/index.js", + "main": "tsc && node ./dist/index.js", "debug": "tsnd --respawn ./src/index.ts", "lint": "npx eslint src" }, @@ -26,6 +26,5 @@ "eslint": "^8.20.0", "ts-node-dev": "^2.0.0", "typescript": "^4.7.4" - }, - "type": "module" + } } diff --git a/src/commands/loader.ts b/src/commands/loader.ts index 2330326..a9622cc 100644 --- a/src/commands/loader.ts +++ b/src/commands/loader.ts @@ -7,7 +7,7 @@ export default async (client: Client) => { const rest = new REST({ version: '9' }).setToken(client.token ?? ''); const command_categories = (await readdir('./src/commands')) - .filter(element => !element.endsWith('.js')); + .filter(element => !element.endsWith('.ts')); const commands = ( await Promise.all( diff --git a/src/events/loader.ts b/src/events/loader.ts index ec6abd3..0654070 100644 --- a/src/events/loader.ts +++ b/src/events/loader.ts @@ -3,7 +3,7 @@ import { readdir } from 'fs/promises'; export default async (client: Client) => { const events_categories = (await readdir('./src/events')) - .filter(element => !element.endsWith('.js')); + .filter(element => !element.endsWith('.ts')); events_categories.forEach(async event_category => { // Retrieve events @@ -16,9 +16,9 @@ export default async (client: Client) => { `../events/${event_category}/${event_file}` ); - // Remove .js + // Remove .ts const event_type_ext = event_file.split('.'); - if (event_type_ext.pop() !== 'js') { + if (event_type_ext.pop() !== 'ts') { throw `Unknown file in ${event_category}: ${event_file}`; } const event_type = event_type_ext.join('.');