complete ts migration

This commit is contained in:
Mylloon 2022-07-20 12:48:11 +02:00
parent a1924e411c
commit 721e7dfc87
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 6 additions and 7 deletions

View file

@ -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"
}
}

View file

@ -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(

View file

@ -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('.');