-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
typings.ts
112 lines (97 loc) · 3.47 KB
/
typings.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import * as Discord from "discord.js";
declare type i18next = typeof import("i18next");
declare type GuildDB = typeof import("./db/guilds");
declare type UserDB = typeof import("./db/users");
export type ComponentType = "button" | "selectmenu" | "autocomplete" | "modalSubmit"
/**
* @description Modified built-in client with support for command/event handlers.
*/
export interface MainClient extends Discord.Client {
commands: Discord.Collection<string, Command>;
cooldowns: Discord.Collection<string, Discord.Collection<string, number>>;
components: Discord.Collection<string, [Component]>;
dbguild: GuildDB;
dbuser: UserDB;
i18n: i18next;
};
/**
* @description Represents the program command.
*/
export interface Command {
data: Discord.SlashCommandBuilder | Discord.ContextMenuCommandBuilder;
options: {
cooldown?: number,
ownerOnly?: boolean,
devGuildOnly?: boolean,
bot_permissions?: Discord.PermissionResolvable
};
execute(interaction: (Discord.ChatInputCommandInteraction | Discord.ContextMenuCommandInteraction) & { client: MainClient }): void | Promise<void>;
};
/**
* @description Represents a component of the program.
*/
export interface Component {
name: string;
type: ComponentType;
options: {
cooldown?: number;
ownerOnly?: boolean;
devGuildOnly?: boolean;
bot_permissions?: [Discord.PermissionResolvable] | [];
};
execute(interaction: Discord.ButtonInteraction | Discord.AnySelectMenuInteraction | Discord.ModalSubmitInteraction | Discord.AutocompleteInteraction): Promise<void>;
}
/**
* @description Represents a button component of the program.
*/
export interface Button extends Component {
execute(interaction: Discord.ButtonInteraction): Promise<void>;
}
/**
* @description Represents a any select menu component of the program.
*/
export interface SelectMenu extends Component {
execute(interaction: Discord.StringSelectMenuInteraction | Discord.UserSelectMenuInteraction | Discord.MentionableSelectMenuInteraction | Discord.ChannelSelectMenuInteraction | Discord.RoleSelectMenuInteraction): Promise<void>;
}
/**
* @description Represents a string select menu component of the program.
*/
export interface StringSelectMenu extends SelectMenu {
execute(interaction: Discord.StringSelectMenuInteraction): Promise<void>;
}
/**
* @description Represents a user select menu component of the program.
*/
export interface UserSelectMenu extends SelectMenu {
execute(interaction: Discord.UserSelectMenuInteraction): Promise<void>;
}
/**
* @description Represents a mentionable select menu component of the program.
*/
export interface MentionableSelectMenu extends SelectMenu {
execute(interaction: Discord.MentionableSelectMenuInteraction): Promise<void>;
}
/**
* @description Represents a channel select menu component of the program.
*/
export interface ChannelSelectMenu extends SelectMenu {
execute(interaction: Discord.ChannelSelectMenuInteraction): Promise<void>;
}
/**
* @description Represents a role select menu component of the program.
*/
export interface RoleSelectMenu extends SelectMenu {
execute(interaction: Discord.RoleSelectMenuInteraction): Promise<void>;
}
/**
* @description Represents a modal submit component of the program.
*/
export interface Modal extends Component {
execute(interaction: Discord.ModalSubmitInteraction): Promise<void>;
}
/**
* @description Represents a autocomplete component of the program.
*/
export interface Autocomplete extends Component {
execute(interaction: Discord.AutocompleteInteraction): Promise<void>;
}