Compare commits
2 commits
136fe81b50
...
a1924e411c
Author | SHA1 | Date | |
---|---|---|---|
a1924e411c | |||
261bc96788 |
7 changed files with 922 additions and 107 deletions
|
@ -1,13 +1,16 @@
|
||||||
{
|
{
|
||||||
"extends": "eslint:recommended",
|
|
||||||
"env": {
|
"extends": [
|
||||||
"node": true,
|
"eslint:recommended",
|
||||||
"es6": true
|
"plugin:@typescript-eslint/recommended"
|
||||||
},
|
],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2021,
|
"project": ["./tsconfig.json"]
|
||||||
"sourceType": "module"
|
},
|
||||||
},
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"arrow-spacing": ["warn", { "before": true, "after": true }],
|
"arrow-spacing": ["warn", { "before": true, "after": true }],
|
||||||
"brace-style": ["error"],
|
"brace-style": ["error"],
|
||||||
|
|
971
package-lock.json
generated
971
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -5,7 +5,8 @@
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"main": "tsc && node ./dist/src/index.js",
|
"main": "tsc && node ./dist/src/index.js",
|
||||||
"debug": "tsnd --respawn ./src/index.ts"
|
"debug": "tsnd --respawn ./src/index.ts",
|
||||||
|
"lint": "npx eslint src"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -19,8 +20,10 @@
|
||||||
"discord.js": "^13.8.1"
|
"discord.js": "^13.8.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
||||||
|
"@typescript-eslint/parser": "^5.30.7",
|
||||||
"dotenv": "^16.0.1",
|
"dotenv": "^16.0.1",
|
||||||
"eslint": "^8.13.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"
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Client } from 'discord.js';
|
||||||
import { readdir } from 'fs/promises';
|
import { readdir } from 'fs/promises';
|
||||||
|
|
||||||
export default async (client: Client) => {
|
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('.js'));
|
||||||
|
@ -32,7 +32,7 @@ export default async (client: Client) => {
|
||||||
)
|
)
|
||||||
).flat(2);
|
).flat(2);
|
||||||
|
|
||||||
return await rest.put(Routes.applicationCommands(client.user!.id), {
|
return await rest.put(Routes.applicationCommands(client.user?.id ?? ''), {
|
||||||
body: commands,
|
body: commands,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,7 +17,7 @@ export default async (client: Client) => {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove .js
|
// Remove .js
|
||||||
let event_type_ext = event_file.split('.');
|
const event_type_ext = event_file.split('.');
|
||||||
if (event_type_ext.pop() !== 'js') {
|
if (event_type_ext.pop() !== 'js') {
|
||||||
throw `Unknown file in ${event_category}: ${event_file}`;
|
throw `Unknown file in ${event_category}: ${event_file}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ const run = async () => {
|
||||||
.then(async client => {
|
.then(async client => {
|
||||||
console.log('Client ✅');
|
console.log('Client ✅');
|
||||||
await loadEvents(client)
|
await loadEvents(client)
|
||||||
.then(_ => console.log('Events ✅'))
|
.then(() => console.log('Events ✅'))
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
throw 'Events ❌';
|
throw 'Events ❌';
|
||||||
});
|
});
|
||||||
|
@ -23,14 +23,14 @@ const run = async () => {
|
||||||
await client.login(client.config.token_discord);
|
await client.login(client.config.token_discord);
|
||||||
|
|
||||||
await loadCommands(client)
|
await loadCommands(client)
|
||||||
.then(_ => console.log('Commands ✅'))
|
.then(() => console.log('Commands ✅'))
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
throw 'Commands ❌';
|
throw 'Commands ❌';
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(`Botanique "${client.user!.username}" ${client.config.version} started!`);
|
console.log(`Botanique "${client.user?.username}" ${client.config.version} started!`);
|
||||||
})
|
})
|
||||||
.catch(_ => {
|
.catch(() => {
|
||||||
throw 'Client ❌';
|
throw 'Client ❌';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,16 +4,20 @@ import { SlashCommandBuilder } from '@discordjs/builders';
|
||||||
|
|
||||||
const { version } = JSON.parse(readFileSync('./package.json').toString());
|
const { version } = JSON.parse(readFileSync('./package.json').toString());
|
||||||
|
|
||||||
declare module "discord.js" {
|
declare module 'discord.js' {
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
export interface Client {
|
export interface Client {
|
||||||
config: {
|
config: {
|
||||||
version: any,
|
version: string,
|
||||||
token_discord: any
|
token_discord: string | undefined
|
||||||
},
|
},
|
||||||
commands: Collection<string, {
|
commands: Collection<
|
||||||
data: SlashCommandBuilder,
|
string,
|
||||||
interaction: (interaction: CommandInteraction, client: Client) => any
|
{
|
||||||
}>
|
data: SlashCommandBuilder,
|
||||||
|
interaction: (interaction: CommandInteraction, client: Client) => unknown
|
||||||
|
}
|
||||||
|
>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue