refactor: typescript migration #24
3 changed files with 6 additions and 7 deletions
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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('.');
|
||||
|
|
Loading…
Reference in a new issue