-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
46 lines (34 loc) · 1.16 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { ChatInputCommandInteraction, Client, ClientEvents, SlashCommandBuilder } from 'discord.js';
export interface Config {
token: string,
database: ConfigDatabase,
}
interface ConfigDatabase {
host: string,
port: number,
user: string,
pass: string,
name: string,
}
// Unpopular opinion, I like using classes for commands.
export abstract class Command {
public id!: string;
public client!: Client;
public commandData: SlashCommandBuilder | Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>;
public filePath: string | undefined;
protected constructor(appCommandData: SlashCommandBuilder | Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>) {
this.commandData = appCommandData;
}
abstract execute(interaction: ChatInputCommandInteraction): Promise<void>;
}
export abstract class Event {
public eventName: keyof ClientEvents;
public filePath: string | undefined;
public client!: Client;
public once: boolean;
protected constructor(eventName: keyof ClientEvents, once: boolean = false) {
this.eventName = eventName;
this.once = once;
}
abstract execute(...args: unknown[]): Promise<void>
}