diff --git a/package-lock.json b/package-lock.json index ccffa068a7..88e2c8d070 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@prisma/client": "^5.13.0", + "@types/module-alias": "^2.0.4", "@types/node": "^20.12.7", "axios": "^1.5.0", "canvacord": "^6.0.2", @@ -22,6 +23,7 @@ "i18next": "^23.5.1", "i18next-fs-backend": "^2.3.1", "magmastream": "^2.4.0", + "module-alias": "^2.2.3", "moment": "^2.29.1", "mongoose": "^7.5.2", "on-finished": "^2.4.1", @@ -1275,6 +1277,11 @@ "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", "dev": true }, + "node_modules/@types/module-alias": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/module-alias/-/module-alias-2.0.4.tgz", + "integrity": "sha512-5+G/QXO/DvHZw60FjvbDzO4JmlD/nG5m2/vVGt25VN1eeP3w2bCoks1Wa7VuptMPM1TxJdx6RjO70N9Fw0nZPA==" + }, "node_modules/@types/node": { "version": "20.12.8", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz", @@ -4221,6 +4228,11 @@ "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==" }, + "node_modules/module-alias": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/module-alias/-/module-alias-2.2.3.tgz", + "integrity": "sha512-23g5BFj4zdQL/b6tor7Ji+QY4pEfNH784BMslY9Qb0UnJWRAt+lQGLYmRaM0KDBwIG23ffEBELhZDP2rhi9f/Q==" + }, "node_modules/moment": { "version": "2.30.1", "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", diff --git a/package.json b/package.json index d2eff1b32d..b8e38f05d0 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,9 @@ "version": "1.0.0", "description": "This is my first Discord bot made using [discord.js](https://github.com/discordjs/discord.js)", "main": "dist/index.js", + "_moduleAliases": { + "@structures": "./dist/structures/index.js" + }, "scripts": { "build": "tsc", "prestart": "npm run build", @@ -27,6 +30,7 @@ "homepage": "https://github.com/Spiderjockey02/Discord-Bot#readme", "dependencies": { "@prisma/client": "^5.13.0", + "@types/module-alias": "^2.0.4", "@types/node": "^20.12.7", "axios": "^1.5.0", "canvacord": "^6.0.2", @@ -39,6 +43,7 @@ "i18next": "^23.5.1", "i18next-fs-backend": "^2.3.1", "magmastream": "^2.4.0", + "module-alias": "^2.2.3", "moment": "^2.29.1", "mongoose": "^7.5.2", "on-finished": "^2.4.1", diff --git a/src/index.ts b/src/index.ts index a04cd546d0..fdbb532cd7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,9 @@ // Dependencies +import 'module-alias/register'; import { Logger } from './utils'; import { ShardingManager } from 'discord.js'; import { validateConfig } from './scripts/verify-config'; -import config from './config'; +// import config from './config'; const logger = new Logger(); (async () => { @@ -22,8 +23,8 @@ const logger = new Logger(); logger.log('=-=-=-=-=-=-=- Loading shard(s) -=-=-=-=-=-=-='); try { await manager.spawn(); - } catch (err: any) { - logger.error(`Error loading shards: ${err.message}`); + } catch (err: unknown) { + logger.error(`Error loading shards: ${(err as Error).message}`); } // Emitted when a shard is created diff --git a/tsconfig.json b/tsconfig.json index da69619042..b14071f60e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,6 @@ { "compileOnSave": true, "compilerOptions": { - "baseUrl": ".", - "paths": { - "@middleware/*": ["./src/middleware/*"], - }, "rootDir": "./src", "types": ["node"], "outDir": "./dist", @@ -31,7 +27,11 @@ "allowSyntheticDefaultImports": true, "experimentalDecorators": true, "verbatimModuleSyntax": false, - "resolveJsonModule": true + "resolveJsonModule": true, + "baseUrl": "./src", + "paths": { + "@structures": ["./structures/index"], + }, }, "exclude": ["node_modules"], }