move client to module folder

This commit is contained in:
Mylloon 2022-07-26 23:41:29 +02:00
parent fc427fd008
commit b31aef9999
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 42 additions and 38 deletions

41
src/modules/client.ts Normal file
View file

@ -0,0 +1,41 @@
import { Collection } from 'discord.js';
import { SlashCommandBuilder } from '@discordjs/builders';
export {};
declare module 'discord.js' {
// eslint-disable-next-line no-shadow
export interface Client {
/** Store the configuration */
config: {
/** Bot version */
version: string,
/** Bot token from env variable */
token_discord: string | undefined,
/** Default lang used */
default_lang: string
},
/** Store all the slash commands */
commands: {
categories: Collection<
/** Category name */
string,
/** Name of the commands in the category */
string[]
>,
list: Collection<
/** Command name */
string,
/** Command itself */
{
/** Data about the command */
data: SlashCommandBuilder,
/** How the command interact */
interaction: (interaction: CommandInteraction, client: Client) => unknown
}
>,
}
/** Store all the localizations */
locales: Map<string, Map<string, string>>
}
}

View file

@ -1,44 +1,7 @@
import { Client, Collection, Intents } from 'discord.js'; import { Client, Collection, Intents } from 'discord.js';
import { readFileSync } from 'fs'; import { readFileSync } from 'fs';
import { SlashCommandBuilder } from '@discordjs/builders';
import { loadLocales } from './locales'; import { loadLocales } from './locales';
import '../modules/client';
declare module 'discord.js' {
// eslint-disable-next-line no-shadow
export interface Client {
/** Store the configuration */
config: {
/** Bot version */
version: string,
/** Bot token from env variable */
token_discord: string | undefined,
/** Default lang used */
default_lang: string
},
/** Store all the slash commands */
commands: {
categories: Collection<
/** Category name */
string,
/** Name of the commands in the category */
string[]
>,
list: Collection<
/** Command name */
string,
/** Command itself */
{
/** Data about the command */
data: SlashCommandBuilder,
/** How the command interact */
interaction: (interaction: CommandInteraction, client: Client) => unknown
}
>,
}
/** Store all the localizations */
locales: Map<string, Map<string, string>>
}
}
/** Creation of the client and definition of its properties. */ /** Creation of the client and definition of its properties. */
export default async () => { export default async () => {