complete ts migration
This commit is contained in:
parent
a1924e411c
commit
721e7dfc87
3 changed files with 6 additions and 7 deletions
|
@ -4,7 +4,7 @@
|
||||||
"description": "Bot discord",
|
"description": "Bot discord",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"main": "tsc && node ./dist/src/index.js",
|
"main": "tsc && node ./dist/index.js",
|
||||||
"debug": "tsnd --respawn ./src/index.ts",
|
"debug": "tsnd --respawn ./src/index.ts",
|
||||||
"lint": "npx eslint src"
|
"lint": "npx eslint src"
|
||||||
},
|
},
|
||||||
|
@ -26,6 +26,5 @@
|
||||||
"eslint": "^8.20.0",
|
"eslint": "^8.20.0",
|
||||||
"ts-node-dev": "^2.0.0",
|
"ts-node-dev": "^2.0.0",
|
||||||
"typescript": "^4.7.4"
|
"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 rest = new REST({ version: '9' }).setToken(client.token ?? '');
|
||||||
|
|
||||||
const command_categories = (await readdir('./src/commands'))
|
const command_categories = (await readdir('./src/commands'))
|
||||||
.filter(element => !element.endsWith('.js'));
|
.filter(element => !element.endsWith('.ts'));
|
||||||
|
|
||||||
const commands = (
|
const commands = (
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { readdir } from 'fs/promises';
|
||||||
|
|
||||||
export default async (client: Client) => {
|
export default async (client: Client) => {
|
||||||
const events_categories = (await readdir('./src/events'))
|
const events_categories = (await readdir('./src/events'))
|
||||||
.filter(element => !element.endsWith('.js'));
|
.filter(element => !element.endsWith('.ts'));
|
||||||
|
|
||||||
events_categories.forEach(async event_category => {
|
events_categories.forEach(async event_category => {
|
||||||
// Retrieve events
|
// Retrieve events
|
||||||
|
@ -16,9 +16,9 @@ export default async (client: Client) => {
|
||||||
`../events/${event_category}/${event_file}`
|
`../events/${event_category}/${event_file}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove .js
|
// Remove .ts
|
||||||
const event_type_ext = event_file.split('.');
|
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}`;
|
throw `Unknown file in ${event_category}: ${event_file}`;
|
||||||
}
|
}
|
||||||
const event_type = event_type_ext.join('.');
|
const event_type = event_type_ext.join('.');
|
||||||
|
|
Loading…
Reference in a new issue