-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
typings.d.ts
266 lines (231 loc) · 6.88 KB
/
typings.d.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
import * as Discord from "discord.js";
/**
* Represents a chat-based Message Command.
*/
export interface LegacyCommand {
/**
* The name of the command.
*/
name: string;
/**
* Aliases or similar names for the command.
*/
aliases?: string[];
/**
* The description of the command.
*/
description?: string;
/**
* The usage of the command.
*/
usage?: string;
/**
* The permissions required by a discord user to run this command.
*/
permissions?: Discord.PermissionResolvable;
/**
* Whether this command is only a guild-based command.
*/
guildOnly?: boolean;
/**
* Whether this command requires arguments.
*/
args?: boolean;
/**
* The cooldown in seconds of this command.
*/
cooldown?: number;
/**
* Whether this command is only a bot owner-based command.
*/
ownerOnly?: boolean;
/**
* The command executor when it is called by the template handler.
* @param message The message that triggered this command.
* @param args The message arguments of the command (seperated by spaces (' ') in an array, this excludes prefix and command/alias itself).
*/
execute(
message: Discord.Message & { client: Client },
args: string[]
): void | Promise<void>;
}
/**
* Represents an Application Command (Slash Command).
*/
export interface SlashInteractionCommand {
/**
* The data of Application Command Interaction (Slash Command).
*/
cooldown?: number;
data: Discord.SlashCommandBuilder;
options: Array<
| Discord.SlashCommandStringOption
| Discord.SlashCommandNumberOption
| Discord.SlashCommandRoleOption
| Discord.SlashCommandUserOption
| Discord.SlashCommandBooleanOption
| Discord.SlashCommandChannelOption
| Discord.SlashCommandIntegerOption
>;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.ChatInputCommandInteraction & { client: Client }
): void | Promise<void>;
}
/**
* Represents a Button Interaction.
*/
export interface ButtonInteractionCommand {
/**
* The custom ID of the button which was interacted with.
*/
id: string;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.ButtonInteraction & { client: Client }
): void | Promise<void>;
}
/**
* Represents a Select Interaction.
*/
export interface SelectInteractionCommand {
/**
* The custom ID of the select (menu option) which was interacted with.
*/
id: string;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.SelectMenuInteraction & { client: Client }
): void | Promise<void>;
}
/**
* The data of Context Menu Interaction Command.
*/
export interface ContextInteractionCommandData {
/**
* The name of the context (menu option) which was interacted with.
*/
name: string;
/**
* The type of the context (menu option) which was interacted with.
* 2: User Based Context Menu Option.
* 3: Message Based Context Menu Option.
*/
type: 2 | 3;
}
/**
* Represents a Context Interaction.
*/
export interface ContextInteractionCommand {
/**
* The data of Context Menu Interaction Command.
*/
data: ContextInteractionCommandData;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.ContextMenuCommandInteraction & { client: Client }
): void | Promise<void>;
}
/**
* Represents a ModalSubmit Interaction.
*/
export interface ModalInteractionCommand {
/**
* The custom ID of the modal (submit) which was interacted with.
*/
id: string;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.ModalSubmitInteraction & { client: Client }
): void | Promise<void>;
}
/**
* Represents a chat-based Trigger Command.
*/
export interface TriggerCommand {
/**
* The names / aliases of the trigger command.
*/
name: string[];
/**
* The command executor when it is called by the template handler.
* @param message The message that triggered this command.
* @param args The message arguments of the command (seperated by spaces (' ') in an array).
*/
execute(
message: Discord.Message & { client: Client },
args: string[]
): void | Promise<void>;
}
/**
* Represents a Autocomplete Interaction.
*/
export interface AutocompleteInteraction {
/**
* The command name of the autocomplete interaction which was interacted with.
*/
name: string;
/**
* The interaction executor when it is called by the template handler.
* @param interaction The interaction that triggered this command.
*/
execute(
interaction: Discord.AutocompleteInteraction & { client: Client }
): void | Promise<void>;
}
/**
* Modified in-built Client that includes support for command/event handlers.
*/
export interface Client extends Discord.Client {
/**
* Represents a collection of chat-based Message Commands.
*/
commands: Discord.Collection<string, LegacyCommand>;
/**
* Represents a collection of Application Commands (Slash Commands).
*/
slashCommands: Discord.Collection<string, SlashInteractionCommand>;
/**
* Represents a collection of Button Interactions.
*/
buttonCommands: Discord.Collection<string, ButtonInteractionCommand>;
/**
* Represents a collection of Select Interactions.
*/
selectCommands: Discord.Collection<string, SelectInteractionCommand>;
/**
* Represents a collection of Context Interactions.
*/
contextCommands: Discord.Collection<string, ContextInteractionCommand>;
/**
* Represents a collection of ModalSubmit Interactions.
*/
modalCommands: Discord.Collection<string, ModalInteractionCommand>;
/**
* Represents cooldown collection for Legacy Commands.
*/
cooldowns: Discord.Collection<string, Discord.Collection<string, number>>;
/**
* Represents a collection of chat-based Trigger Commands.
*/
triggers: Discord.Collection<string, TriggerCommand>;
/**
* Represents a collection of autocomplete interactions.
*/
autocompleteInteractions: Discord.Collection<string, AutocompleteInteraction>;
}