@wolfstar/http-framework 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +144 -0
- package/dist/esm/index.d.ts +2225 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +3354 -0
- package/dist/esm/index.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,2225 @@
|
|
|
1
|
+
import { AliasPiece, AliasPieceOptions, AliasStore, Container, LoaderError, LoaderPieceContext, LoaderStrategy, MissingExportsError, Piece, Piece as Piece$1, PieceContext, PieceOptions, Store, Store as Store$1, StoreOptions, StoreRegistry, StoreRegistryEntries, container } from "@sapphire/pieces";
|
|
2
|
+
import { DiscordAPIError, HTTPError, REST, RESTOptions, RawFile, RequestData } from "@discordjs/rest";
|
|
3
|
+
import { Awaitable, NonNullObject } from "@sapphire/utilities";
|
|
4
|
+
import { AsyncEventEmitter } from "@vladfrangu/async_event_emitter";
|
|
5
|
+
import { APIApplicationCommandAutocompleteInteraction, APIApplicationCommandAutocompleteResponse, APIApplicationCommandInteraction, APIApplicationCommandInteractionDataBasicOption, APIApplicationCommandInteractionDataOption, APIApplicationCommandInteractionDataSubcommandGroupOption, APIApplicationCommandInteractionDataSubcommandOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, APIAttachment, APIBaseInteraction, APIChannel, APIChatInputApplicationCommandInteraction, APIChatInputApplicationCommandInteractionData, APIContextMenuInteractionData, APIGuild, APIInteraction, APIInteractionDataResolved, APIInteractionDataResolvedChannel, APIInteractionDataResolvedGuildMember, APIInteractionResponseChannelMessageWithSource, APIInteractionResponseDeferredChannelMessageWithSource, APIInteractionResponseDeferredMessageUpdate, APIInteractionResponseUpdateMessage, APIMessage, APIMessageApplicationCommandInteraction, APIMessageApplicationCommandInteractionData, APIMessageChannelSelectInteractionData, APIMessageComponentButtonInteraction, APIMessageComponentInteraction, APIMessageComponentSelectMenuInteraction, APIMessageMentionableSelectInteractionData, APIMessageRoleSelectInteractionData, APIMessageStringSelectInteractionData, APIMessageUserSelectInteractionData, APIModalInteractionResponse, APIModalSubmitInteraction, APIPingInteraction, APIPrimaryEntryPointCommandInteraction, APIRole, APIUser, APIUserApplicationCommandInteraction, APIUserApplicationCommandInteractionData, ApplicationCommandOptionType, InteractionType, RESTPatchAPIInteractionOriginalResponseJSONBody, RESTPatchAPIInteractionOriginalResponseResult, RESTPostAPIApplicationCommandsJSONBody, RESTPostAPIChatInputApplicationCommandsJSONBody, RESTPostAPIContextMenuApplicationCommandsJSONBody, RESTPostAPIInteractionFollowupJSONBody, RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody, RESTPutAPIApplicationCommandsResult, RESTPutAPIApplicationGuildCommandsResult, Snowflake } from "discord-api-types/v10";
|
|
6
|
+
import { IncomingMessage, Server, ServerOptions, ServerResponse } from "node:http";
|
|
7
|
+
import { Result } from "@sapphire/result";
|
|
8
|
+
import { Collection } from "@discordjs/collection";
|
|
9
|
+
import { ContextMenuCommandBuilder, ContextMenuCommandType, SlashCommandBuilder, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder } from "@discordjs/builders";
|
|
10
|
+
import { JSONEncodable } from "@discordjs/util";
|
|
11
|
+
import { webcrypto } from "node:crypto";
|
|
12
|
+
import { ListenOptions as ListenOptions$1 } from "node:net";
|
|
13
|
+
|
|
14
|
+
//#region src/lib/utils/internals.d.ts
|
|
15
|
+
type Void = void;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/lib/interactions/resolvers/ChatInputCommandResolver.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* The command resolver for chat input commands.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
declare class ChatInputCommandResolver implements JSONEncodable<ChatInputCommandResolver.ResolvedCommand> {
|
|
23
|
+
#private;
|
|
24
|
+
/**
|
|
25
|
+
* Sets the command data for the ChatInputCommandResolver.
|
|
26
|
+
*
|
|
27
|
+
* @param data - The command data to set.
|
|
28
|
+
* @returns The instance of ChatInputCommandResolver.
|
|
29
|
+
*/
|
|
30
|
+
setCommand(data: ChatInputCommandResolver.CommandData): this;
|
|
31
|
+
/**
|
|
32
|
+
* Adds a subcommand group to the ChatInputCommandResolver.
|
|
33
|
+
*
|
|
34
|
+
* @param data - The data of the subcommand group.
|
|
35
|
+
* @param method - The method associated with the subcommand group (optional).
|
|
36
|
+
* @returns The updated ChatInputCommandResolver instance.
|
|
37
|
+
*/
|
|
38
|
+
addSubcommandGroup(data: ChatInputCommandResolver.SubcommandGroupData, method?: string | null): this;
|
|
39
|
+
/**
|
|
40
|
+
* Adds a subcommand to the ChatInputCommandResolver.
|
|
41
|
+
*
|
|
42
|
+
* @param data - The data of the subcommand.
|
|
43
|
+
* @param method - The method of the subcommand (optional).
|
|
44
|
+
* @param groupName - The group name of the subcommand (optional).
|
|
45
|
+
* @returns The updated ChatInputCommandResolver instance.
|
|
46
|
+
*/
|
|
47
|
+
addSubcommand(data: ChatInputCommandResolver.SubcommandData, method?: string | null, groupName?: string | null): this;
|
|
48
|
+
/**
|
|
49
|
+
* Converts the ChatInputCommandResolver instance to a JSON representation.
|
|
50
|
+
*
|
|
51
|
+
* @returns The JSON representation of the ChatInputCommandResolver instance.
|
|
52
|
+
*/
|
|
53
|
+
toJSON(): ChatInputCommandResolver.ResolvedCommand;
|
|
54
|
+
}
|
|
55
|
+
declare namespace ChatInputCommandResolver {
|
|
56
|
+
type CommandDataResolvable = Omit<ResolvedCommand, 'type'> | JSONEncodable<ResolvedCommand>;
|
|
57
|
+
type CommandData = CommandDataResolvable | ((builder: SlashCommandBuilder) => CommandDataResolvable | Void);
|
|
58
|
+
type SubcommandGroupDataResolvable = Omit<ResolvedSubcommandGroup, 'type'> | JSONEncodable<ResolvedSubcommandGroup>;
|
|
59
|
+
type SubcommandGroupData = SubcommandGroupDataResolvable | ((builder: SlashCommandSubcommandGroupBuilder) => SubcommandGroupDataResolvable | Void);
|
|
60
|
+
type SubcommandDataResolvable = Omit<ResolvedSubcommand, 'type'> | JSONEncodable<ResolvedSubcommand>;
|
|
61
|
+
type SubcommandData = SubcommandDataResolvable | ((builder: SlashCommandSubcommandBuilder) => SubcommandDataResolvable | Void);
|
|
62
|
+
type ResolvedCommand = RESTPostAPIChatInputApplicationCommandsJSONBody;
|
|
63
|
+
type ResolvedSubcommandGroup = APIApplicationCommandSubcommandGroupOption;
|
|
64
|
+
type ResolvedSubcommand = APIApplicationCommandSubcommandOption;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/lib/interactions/decorators/RegisterCommand.d.ts
|
|
68
|
+
/**
|
|
69
|
+
* Registers a command for the chat input.
|
|
70
|
+
*
|
|
71
|
+
* @template Options - The options type for the command.
|
|
72
|
+
* @param data - The command data.
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* import { Command, RegisterCommand } from '@wolfstar/http-framework';
|
|
76
|
+
*
|
|
77
|
+
* (at)RegisterCommand({
|
|
78
|
+
* name: 'ping',
|
|
79
|
+
* description: 'A simple ping pong command'
|
|
80
|
+
* })
|
|
81
|
+
* export class UserCommand extends Command {
|
|
82
|
+
* public async run(interaction: Command.ChatInputInteraction) {
|
|
83
|
+
* return interaction.reply('Pong!');
|
|
84
|
+
* }
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
declare function RegisterCommand<Options extends Command.Options = Command.Options>(data: ChatInputCommandResolver.CommandData): (target: typeof Command<Options>) => void;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/lib/interactions/resolvers/ContextMenuCommandResolver.d.ts
|
|
91
|
+
/**
|
|
92
|
+
* The command resolver for context menu commands.
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
declare class ContextMenuCommandResolver implements JSONEncodable<ContextMenuCommandResolver.ResolvedCommand> {
|
|
96
|
+
#private;
|
|
97
|
+
/**
|
|
98
|
+
* Sets the command data, type, and method for the context menu command resolver.
|
|
99
|
+
*
|
|
100
|
+
* @param data - The command data.
|
|
101
|
+
* @param type - The command type.
|
|
102
|
+
* @param method - The command method (optional).
|
|
103
|
+
* @returns The updated context menu command resolver.
|
|
104
|
+
*/
|
|
105
|
+
setCommand(data: ContextMenuCommandResolver.CommandData, type: ContextMenuCommandType, method?: string | null): this;
|
|
106
|
+
/**
|
|
107
|
+
* Converts the {@linkcode ContextMenuCommandResolver} instance to a JSON representation.
|
|
108
|
+
*
|
|
109
|
+
* @returns The JSON representation of the {@linkcode ContextMenuCommandResolver} instance.
|
|
110
|
+
*/
|
|
111
|
+
toJSON(): ContextMenuCommandResolver.ResolvedCommand;
|
|
112
|
+
}
|
|
113
|
+
declare namespace ContextMenuCommandResolver {
|
|
114
|
+
type CommandDataResolvable = Omit<RESTPostAPIContextMenuApplicationCommandsJSONBody, 'type'> | JSONEncodable<RESTPostAPIContextMenuApplicationCommandsJSONBody>;
|
|
115
|
+
type CommandData = CommandDataResolvable | ((builder: ContextMenuCommandBuilder) => CommandDataResolvable | Void);
|
|
116
|
+
type ResolvedCommand = RESTPostAPIContextMenuApplicationCommandsJSONBody;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/lib/interactions/decorators/RegisterMessageCommand.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* Registers a message command.
|
|
122
|
+
*
|
|
123
|
+
* @template Options - The options type for the command.
|
|
124
|
+
* @param data - The command to register.
|
|
125
|
+
* @returns A method decorator function, does not override the method.
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* export class UserCommand extends Command {
|
|
129
|
+
* (at)RegisterMessageCommand(createData())
|
|
130
|
+
* public run(interaction: Command.MessageInteraction, data: TransformedArguments.Message) {
|
|
131
|
+
* // ...
|
|
132
|
+
* }
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
declare function RegisterMessageCommand<Options extends Command.Options = Command.Options>(data: ContextMenuCommandResolver.CommandData): (target: Command<Options>, method: string) => void;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/lib/interactions/decorators/RegisterSubcommand.d.ts
|
|
139
|
+
/**
|
|
140
|
+
* Registers a subcommand for a chat input command.
|
|
141
|
+
*
|
|
142
|
+
* @remarks This decorator must be used in conjunction with {@link RegisterSubcommand}.
|
|
143
|
+
* @param data - The subcommand data.
|
|
144
|
+
* @param subCommandGroupName - Optional name of the subcommand group.
|
|
145
|
+
* @returns A decorator function that adds the subcommand to the target command.
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* import { Command, RegisterCommand, RegisterSubcommand, RegisterSubcommandGroup } from '@wolfstar/http-framework';
|
|
149
|
+
*
|
|
150
|
+
* (at)RegisterCommand({
|
|
151
|
+
* name: 'ping',
|
|
152
|
+
* description: 'A simple ping pong command'
|
|
153
|
+
* })
|
|
154
|
+
* export class UserCommand extends Command {
|
|
155
|
+
* (at)RegisterSubcommand({
|
|
156
|
+
* name: 'subcommand',
|
|
157
|
+
* description: 'A simple subcommand'
|
|
158
|
+
* })
|
|
159
|
+
* public async run(interaction: Command.ChatInputInteraction) {
|
|
160
|
+
* return interaction.reply('Pong!');
|
|
161
|
+
* }
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
declare function RegisterSubcommand<Options extends Command.Options = Command.Options>(data: ChatInputCommandResolver.SubcommandData, subCommandGroupName?: string | null): (target: Command<Options>, method: string) => void;
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/lib/interactions/decorators/RegisterSubcommandGroup.d.ts
|
|
168
|
+
/**
|
|
169
|
+
* Registers a subcommand group for a chat input command.
|
|
170
|
+
*
|
|
171
|
+
* @remarks This decorator must be used in conjunction with {@link RegisterSubcommand}.
|
|
172
|
+
* @template Options - The options type for the command.
|
|
173
|
+
* @param data - The subcommand group data.
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* import { Command, RegisterCommand, RegisterSubcommand, RegisterSubcommandGroup } from '@wolfstar/http-framework';
|
|
177
|
+
*
|
|
178
|
+
* (at)RegisterCommand({
|
|
179
|
+
* name: 'ping',
|
|
180
|
+
* description: 'A simple ping pong command'
|
|
181
|
+
* })
|
|
182
|
+
* export class UserCommand extends Command {
|
|
183
|
+
* (at)RegisterSubcommandGroup({
|
|
184
|
+
* name: 'subcommand-group',
|
|
185
|
+
* description: 'A simple subcommand group'
|
|
186
|
+
* })
|
|
187
|
+
* (at)RegisterSubcommand(
|
|
188
|
+
* { name: 'subcommand', description: 'A simple subcommand' },
|
|
189
|
+
* 'subcommand-group'
|
|
190
|
+
* )
|
|
191
|
+
* public async run(interaction: Command.ChatInputInteraction) {
|
|
192
|
+
* return interaction.reply('Pong!');
|
|
193
|
+
* }
|
|
194
|
+
* }
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
declare function RegisterSubcommandGroup<Options extends Command.Options = Command.Options>(data: ChatInputCommandResolver.SubcommandGroupData): (target: Command<Options>, method: string) => void;
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/lib/interactions/decorators/RegisterUserCommand.d.ts
|
|
200
|
+
/**
|
|
201
|
+
* Registers a user command.
|
|
202
|
+
*
|
|
203
|
+
* @template Options - The options type for the command.
|
|
204
|
+
* @param data - The command to register.
|
|
205
|
+
* @returns A method decorator function, does not override the method.
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* export class UserCommand extends Command {
|
|
209
|
+
* (at)RegisterUserCommand(createData())
|
|
210
|
+
* public run(interaction: Command.UserInteraction, data: TransformedArguments.User) {
|
|
211
|
+
* // ...
|
|
212
|
+
* }
|
|
213
|
+
* }
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare function RegisterUserCommand<Options extends Command.Options = Command.Options>(data: ContextMenuCommandResolver.CommandData): (target: Command<Options>, method: string) => void;
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/lib/interactions/decorators/RestrictGuildIds.d.ts
|
|
219
|
+
declare const restrictedGuildIdRegistry: Collection<typeof Command<Command.Options>, readonly string[]>;
|
|
220
|
+
/**
|
|
221
|
+
* Decorator that restricts the guild IDs for a command.
|
|
222
|
+
*
|
|
223
|
+
* @param guildIds An array of guild IDs to restrict the command to.
|
|
224
|
+
* @returns A decorator function.
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* import { Command, RegisterCommand, RestrictGuildIds } from '@wolfstar/http-framework';
|
|
228
|
+
*
|
|
229
|
+
* (at)RegisterCommand({
|
|
230
|
+
* name: 'ping',
|
|
231
|
+
* description: 'A simple ping pong command'
|
|
232
|
+
* })
|
|
233
|
+
* (at)RestrictGuildIds(['123456789012345678', '123456789012345679'])
|
|
234
|
+
* export class UserCommand extends Command {
|
|
235
|
+
* public async run(interaction: Command.ChatInputInteraction) {
|
|
236
|
+
* return interaction.reply('Pong!');
|
|
237
|
+
* }
|
|
238
|
+
* }
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
declare function RestrictGuildIds<Options extends Command.Options = Command.Options>(guildIds: readonly string[]): (target: typeof Command<Options>) => void;
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/lib/interactions/resolvers/InteractionOptions.d.ts
|
|
244
|
+
declare function transformInteraction<T extends NonNullObject>(resolved: APIInteractionDataResolved, options: readonly APIApplicationCommandInteractionDataOption[]): InteractionArguments<T>;
|
|
245
|
+
type InteractionArguments<T extends NonNullObject> = T & {
|
|
246
|
+
/**
|
|
247
|
+
* The name of the subcommand that was used by the user, if any.
|
|
248
|
+
*/
|
|
249
|
+
subCommand: string | null;
|
|
250
|
+
/**
|
|
251
|
+
* The name of the subcommand group that was used by the user, if any.
|
|
252
|
+
*/
|
|
253
|
+
subCommandGroup: string | null;
|
|
254
|
+
};
|
|
255
|
+
declare function transformAutocompleteInteraction<T extends NonNullObject>(resolved: APIInteractionDataResolved, options: readonly APIApplicationCommandInteractionDataOption[]): AutocompleteInteractionArguments<T>;
|
|
256
|
+
type AutocompleteInteractionArguments<T extends NonNullObject> = InteractionArguments<T> & {
|
|
257
|
+
/**
|
|
258
|
+
* The name of the argument that is focused, if any.
|
|
259
|
+
*/
|
|
260
|
+
focused: keyof T | null;
|
|
261
|
+
};
|
|
262
|
+
declare function extractTopLevelOptions(options: readonly APIApplicationCommandInteractionDataOption[]): ExtractedOptions;
|
|
263
|
+
interface ExtractedOptions {
|
|
264
|
+
subCommandGroup: APIApplicationCommandInteractionDataSubcommandGroupOption | null;
|
|
265
|
+
subCommand: APIApplicationCommandInteractionDataSubcommandOption | null;
|
|
266
|
+
options: readonly APIApplicationCommandInteractionDataBasicOption[];
|
|
267
|
+
}
|
|
268
|
+
declare function transformUserInteraction(data: APIUserApplicationCommandInteractionData): TransformedArguments.User;
|
|
269
|
+
declare function transformMessageInteraction(data: APIMessageApplicationCommandInteractionData): TransformedArguments.Message;
|
|
270
|
+
declare namespace TransformedArguments {
|
|
271
|
+
interface BasePartial {
|
|
272
|
+
id: string;
|
|
273
|
+
}
|
|
274
|
+
interface Message extends BasePartial {
|
|
275
|
+
message: APIMessage;
|
|
276
|
+
}
|
|
277
|
+
interface User extends BasePartial {
|
|
278
|
+
user: APIUser;
|
|
279
|
+
member: APIInteractionDataResolvedGuildMember | null;
|
|
280
|
+
}
|
|
281
|
+
type Channel = APIInteractionDataResolvedChannel;
|
|
282
|
+
type Role = APIRole;
|
|
283
|
+
type Attachment = APIAttachment;
|
|
284
|
+
type Mentionable = (BasePartial & User) | (BasePartial & {
|
|
285
|
+
channel: Channel;
|
|
286
|
+
}) | (BasePartial & {
|
|
287
|
+
role: Role;
|
|
288
|
+
}) | BasePartial;
|
|
289
|
+
type Any = User | Channel | Role | Mentionable | number | string | boolean | Attachment | PartialAny;
|
|
290
|
+
interface PartialUser extends Omit<User, 'user'> {
|
|
291
|
+
user: User['user'] | null;
|
|
292
|
+
}
|
|
293
|
+
type PartialAttachment = BasePartial;
|
|
294
|
+
type PartialChannel = BasePartial;
|
|
295
|
+
type PartialRole = BasePartial;
|
|
296
|
+
type PartialAny = PartialUser | PartialChannel | PartialRole | PartialAttachment;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* A map of the argument types to their respective resolved values.
|
|
300
|
+
*/
|
|
301
|
+
interface ArgumentTypes {
|
|
302
|
+
[ApplicationCommandOptionType.Attachment]: TransformedArguments.Attachment;
|
|
303
|
+
[ApplicationCommandOptionType.Boolean]: boolean;
|
|
304
|
+
[ApplicationCommandOptionType.Channel]: TransformedArguments.Channel;
|
|
305
|
+
[ApplicationCommandOptionType.Integer]: number;
|
|
306
|
+
[ApplicationCommandOptionType.Mentionable]: TransformedArguments.Mentionable;
|
|
307
|
+
[ApplicationCommandOptionType.Number]: number;
|
|
308
|
+
[ApplicationCommandOptionType.Role]: TransformedArguments.Role;
|
|
309
|
+
[ApplicationCommandOptionType.String]: string;
|
|
310
|
+
[ApplicationCommandOptionType.User]: TransformedArguments.User;
|
|
311
|
+
attachment: this[ApplicationCommandOptionType.Attachment];
|
|
312
|
+
boolean: this[ApplicationCommandOptionType.Boolean];
|
|
313
|
+
channel: this[ApplicationCommandOptionType.Channel];
|
|
314
|
+
integer: this[ApplicationCommandOptionType.Integer];
|
|
315
|
+
mentionable: this[ApplicationCommandOptionType.Mentionable];
|
|
316
|
+
number: this[ApplicationCommandOptionType.Number];
|
|
317
|
+
role: this[ApplicationCommandOptionType.Role];
|
|
318
|
+
string: this[ApplicationCommandOptionType.String];
|
|
319
|
+
user: this[ApplicationCommandOptionType.User];
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Convenience type for creating arguments out of strings.
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* // Using named string:
|
|
327
|
+
* type Options = MakeArguments<{
|
|
328
|
+
* name: 'string';
|
|
329
|
+
* file: 'attachment';
|
|
330
|
+
* }>;
|
|
331
|
+
*
|
|
332
|
+
* // ➥ type Options = {
|
|
333
|
+
* // name: string;
|
|
334
|
+
* // attachment: APIAttachment;
|
|
335
|
+
* // };
|
|
336
|
+
* ```
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```typescript
|
|
340
|
+
* // Using named string:
|
|
341
|
+
* type Options = MakeArguments<{
|
|
342
|
+
* name: ApplicationCommandOptionType.String;
|
|
343
|
+
* file: ApplicationCommandOptionType.Attachment;
|
|
344
|
+
* }>;
|
|
345
|
+
*
|
|
346
|
+
* // ➥ type Options = {
|
|
347
|
+
* // name: string;
|
|
348
|
+
* // attachment: APIAttachment;
|
|
349
|
+
* // };
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
type MakeArguments<T extends Record<string, keyof ArgumentTypes>> = { [K in keyof T]: ArgumentTypes[T[K]] };
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/lib/structures/CommandStoreRouter.d.ts
|
|
355
|
+
/**
|
|
356
|
+
* Represents a router for mapping commands to chat inputs and context menus.
|
|
357
|
+
*
|
|
358
|
+
* @since 2.0.0
|
|
359
|
+
*/
|
|
360
|
+
declare class CommandStoreRouter {
|
|
361
|
+
#private;
|
|
362
|
+
/**
|
|
363
|
+
* Gets the command associated with the given interaction.
|
|
364
|
+
*
|
|
365
|
+
* @since 2.0.0
|
|
366
|
+
* @param interaction - The interaction object.
|
|
367
|
+
* @returns The command associated with the interaction, or null if not found.
|
|
368
|
+
*/
|
|
369
|
+
get(interaction: APIApplicationCommandInteraction): Command<import("@sapphire/pieces").PieceOptions> | null;
|
|
370
|
+
/**
|
|
371
|
+
* Gets the chat input command with the specified name.
|
|
372
|
+
*
|
|
373
|
+
* @since 2.0.0
|
|
374
|
+
* @param name - The name of the chat input command.
|
|
375
|
+
* @returns The chat input command with the specified name, or null if not found.
|
|
376
|
+
*/
|
|
377
|
+
getChatInput(name: string): Command | null;
|
|
378
|
+
/**
|
|
379
|
+
* Gets the context menu command with the specified name.
|
|
380
|
+
*
|
|
381
|
+
* @since 2.0.0
|
|
382
|
+
* @param name - The name of the context menu command.
|
|
383
|
+
* @returns The context menu command with the specified name, or null if not found.
|
|
384
|
+
*/
|
|
385
|
+
getContextMenu(name: string): Command | null;
|
|
386
|
+
/**
|
|
387
|
+
* Adds a chat input mapping.
|
|
388
|
+
*
|
|
389
|
+
* @since 2.0.0
|
|
390
|
+
* @param name - The name of the mapping.
|
|
391
|
+
* @param command - The command to be mapped.
|
|
392
|
+
* @internal
|
|
393
|
+
*/
|
|
394
|
+
addChatInputMapping(name: string, command: Command): void;
|
|
395
|
+
/**
|
|
396
|
+
* Adds a context menu mapping.
|
|
397
|
+
*
|
|
398
|
+
* @since 2.0.0
|
|
399
|
+
* @param name - The name of the mapping.
|
|
400
|
+
* @param command - The command to be mapped.
|
|
401
|
+
* @internal
|
|
402
|
+
*/
|
|
403
|
+
addContextMenuMapping(name: string, command: Command): void;
|
|
404
|
+
/**
|
|
405
|
+
* Removes a chat input mapping.
|
|
406
|
+
*
|
|
407
|
+
* @since 2.0.0
|
|
408
|
+
* @param name - The name of the mapping to be removed.
|
|
409
|
+
* @returns True if the mapping was successfully removed, false otherwise.
|
|
410
|
+
* @internal
|
|
411
|
+
*/
|
|
412
|
+
removeChatInputMapping(name: string): boolean;
|
|
413
|
+
/**
|
|
414
|
+
* Removes a context menu mapping.
|
|
415
|
+
*
|
|
416
|
+
* @since 2.0.0
|
|
417
|
+
* @param name - The name of the mapping to be removed.
|
|
418
|
+
* @returns True if the mapping was successfully removed, false otherwise.
|
|
419
|
+
* @internal
|
|
420
|
+
*/
|
|
421
|
+
removeContextMenuMapping(name: string): boolean;
|
|
422
|
+
}
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/lib/structures/CommandStore.d.ts
|
|
425
|
+
declare class CommandStore extends Store$1<Command, 'commands'> {
|
|
426
|
+
#private;
|
|
427
|
+
/**
|
|
428
|
+
* The router instance for handling commands in the CommandStore.
|
|
429
|
+
*
|
|
430
|
+
* @since 2.0.0
|
|
431
|
+
*/
|
|
432
|
+
router: CommandStoreRouter;
|
|
433
|
+
constructor();
|
|
434
|
+
/**
|
|
435
|
+
* Runs an application command.
|
|
436
|
+
*
|
|
437
|
+
* @since 1.0.0
|
|
438
|
+
* @param response - The server response object.
|
|
439
|
+
* @param interaction - The API application command interaction object.
|
|
440
|
+
* @returns A promise that resolves to the server response.
|
|
441
|
+
*/
|
|
442
|
+
runApplicationCommand(response: ServerResponse, interaction: Exclude<APIApplicationCommandInteraction, APIPrimaryEntryPointCommandInteraction>): Promise<ServerResponse>;
|
|
443
|
+
/**
|
|
444
|
+
* Runs the application command autocomplete.
|
|
445
|
+
*
|
|
446
|
+
* @since 1.0.0
|
|
447
|
+
* @param response - The server response object.
|
|
448
|
+
* @param interaction - The API application command autocomplete interaction object.
|
|
449
|
+
* @returns A promise that resolves to the server response.
|
|
450
|
+
*/
|
|
451
|
+
runApplicationCommandAutocomplete(response: ServerResponse, interaction: APIApplicationCommandAutocompleteInteraction): Promise<ServerResponse>;
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/lib/interactions/shared/ApplicationCommandRegistryEntry.d.ts
|
|
455
|
+
/**
|
|
456
|
+
* Represents an entry in the application command registry.
|
|
457
|
+
*
|
|
458
|
+
* This class provides methods to manage and manipulate application command data.
|
|
459
|
+
*
|
|
460
|
+
* @since 2.0.0
|
|
461
|
+
*/
|
|
462
|
+
declare class ApplicationCommandRegistryEntry implements JSONEncodable<ApplicationCommandRegistryEntry.Command[]> {
|
|
463
|
+
#private;
|
|
464
|
+
/**
|
|
465
|
+
* Retrieves the loaded global ID of the {@linkcode ApplicationCommandRegistryEntry}.
|
|
466
|
+
*
|
|
467
|
+
* @since 2.0.0
|
|
468
|
+
* @returns The loaded global ID of the {@linkcode ApplicationCommandRegistryEntry}, or `null` if it's not set.
|
|
469
|
+
*/
|
|
470
|
+
getGlobalId(): Snowflake | null;
|
|
471
|
+
/**
|
|
472
|
+
* Sets the loaded global ID for the {@linkcode ApplicationCommandRegistryEntry}.
|
|
473
|
+
*
|
|
474
|
+
* @since 2.0.0
|
|
475
|
+
* @param value - The Snowflake value to set as the global ID.
|
|
476
|
+
* @returns The updated {@linkcode ApplicationCommandRegistryEntry} instance.
|
|
477
|
+
*/
|
|
478
|
+
setGlobalId(value: Snowflake): this;
|
|
479
|
+
/**
|
|
480
|
+
* Retrieves the loaded guild ID associated with the given guild ID.
|
|
481
|
+
*
|
|
482
|
+
* @since 2.0.0
|
|
483
|
+
* @param guildId The guild ID to retrieve.
|
|
484
|
+
* @returns The associated guild ID, or null if not found.
|
|
485
|
+
*/
|
|
486
|
+
getGuildId(guildId: Snowflake): Snowflake | null;
|
|
487
|
+
/**
|
|
488
|
+
* Sets the loaded guild ID for the registry entry.
|
|
489
|
+
*
|
|
490
|
+
* @since 2.0.0
|
|
491
|
+
* @param guildId - The guild ID to set.
|
|
492
|
+
* @param value - The value to associate with the guild ID.
|
|
493
|
+
* @returns The updated registry entry.
|
|
494
|
+
*/
|
|
495
|
+
setGuildId(guildId: Snowflake, value: Snowflake): this;
|
|
496
|
+
/**
|
|
497
|
+
* Gets the chat input command resolver.
|
|
498
|
+
*
|
|
499
|
+
* @since 2.0.0
|
|
500
|
+
* @returns The chat input command resolver or `null` if not set.
|
|
501
|
+
*/
|
|
502
|
+
get chatInput(): ChatInputCommandResolver | null;
|
|
503
|
+
/**
|
|
504
|
+
* Gets the context menu commands associated with this registry entry.
|
|
505
|
+
*
|
|
506
|
+
* @since 2.0.0
|
|
507
|
+
* @returns An array of {@linkcode ContextMenuCommandResolver} objects representing the context menu commands.
|
|
508
|
+
*/
|
|
509
|
+
get contextMenu(): ContextMenuCommandResolver[];
|
|
510
|
+
/**
|
|
511
|
+
* Converts the {@linkcode ApplicationCommandRegistryEntry} to a JSON representation.
|
|
512
|
+
*
|
|
513
|
+
* @since 2.0.0
|
|
514
|
+
* @returns An array of Command objects in JSON format.
|
|
515
|
+
*/
|
|
516
|
+
toJSON(): ApplicationCommandRegistryEntry.Command[];
|
|
517
|
+
/**
|
|
518
|
+
* Creates a chat input command resolver.
|
|
519
|
+
* If the resolver has already been created, it returns the existing instance.
|
|
520
|
+
*
|
|
521
|
+
* @since 2.0.0
|
|
522
|
+
* @returns The chat input command resolver.
|
|
523
|
+
* @internal
|
|
524
|
+
*/
|
|
525
|
+
makeChatInput(): ChatInputCommandResolver;
|
|
526
|
+
/**
|
|
527
|
+
* Creates a context menu command resolver and adds it to the context menu.
|
|
528
|
+
*
|
|
529
|
+
* @since 2.0.0
|
|
530
|
+
* @returns The created context menu command resolver.
|
|
531
|
+
* @internal
|
|
532
|
+
*/
|
|
533
|
+
makeContextMenu(): ContextMenuCommandResolver;
|
|
534
|
+
}
|
|
535
|
+
declare namespace ApplicationCommandRegistryEntry {
|
|
536
|
+
type Command = Exclude<RESTPostAPIApplicationCommandsJSONBody, RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody>;
|
|
537
|
+
}
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/lib/interactions/shared/ApplicationCommandRegistry.d.ts
|
|
540
|
+
type RequestAuthPrefix = RequestData['authPrefix'];
|
|
541
|
+
/**
|
|
542
|
+
* Represents a registry for application commands.
|
|
543
|
+
*
|
|
544
|
+
* @remarks This registry is globally available through {@linkcode container.applicationCommandRegistry}.
|
|
545
|
+
* @since 2.0.0
|
|
546
|
+
*/
|
|
547
|
+
declare class ApplicationCommandRegistry implements JSONEncodable<ApplicationCommandRegistryEntry.Command[]> {
|
|
548
|
+
#private;
|
|
549
|
+
get store(): CommandStore;
|
|
550
|
+
/**
|
|
551
|
+
* Sets up the application command registry with the provided options.
|
|
552
|
+
*
|
|
553
|
+
* @since 2.0.0
|
|
554
|
+
* @param options - The setup options for the application command registry.
|
|
555
|
+
* @returns The updated instance of the application command registry.
|
|
556
|
+
*/
|
|
557
|
+
setup(options: Readonly<ApplicationCommandRegistry.SetupOptions>): this;
|
|
558
|
+
/**
|
|
559
|
+
* Retrieves the {@linkcode ApplicationCommandRegistryEntry} associated with the specified command class.
|
|
560
|
+
*
|
|
561
|
+
* @since 2.0.0
|
|
562
|
+
* @template Options - The options type of the command class.
|
|
563
|
+
* @param target - The command class to retrieve the entry for.
|
|
564
|
+
* @returns The {@linkcode ApplicationCommandRegistryEntry} associated with the command class, or null if not found.
|
|
565
|
+
*/
|
|
566
|
+
get<Options extends Command.Options>(target: typeof Command<Options>): ApplicationCommandRegistryEntry | null;
|
|
567
|
+
/**
|
|
568
|
+
* Deletes a command from the registry.
|
|
569
|
+
*
|
|
570
|
+
* @since 2.0.0
|
|
571
|
+
* @template Options - The options type for the command.
|
|
572
|
+
* @param target - The command to delete.
|
|
573
|
+
* @returns True if the command was successfully deleted, false otherwise.
|
|
574
|
+
*/
|
|
575
|
+
delete<Options extends Command.Options>(target: typeof Command<Options>): boolean;
|
|
576
|
+
/**
|
|
577
|
+
* Retrieves or creates an {@linkcode ApplicationCommandRegistryEntry} for the specified command class.
|
|
578
|
+
*
|
|
579
|
+
* @since 2.0.0
|
|
580
|
+
* @template Options - The options type for the command.
|
|
581
|
+
* @param target - The command class to ensure registration for.
|
|
582
|
+
* @returns The application command registry entry for the command.
|
|
583
|
+
*/
|
|
584
|
+
ensure<Options extends Command.Options>(target: typeof Command<Options>): ApplicationCommandRegistryEntry;
|
|
585
|
+
/**
|
|
586
|
+
* Converts the {@linkcode ApplicationCommandRegistryEntry} objects to an array of command objects in JSON format.
|
|
587
|
+
*
|
|
588
|
+
* @since 2.0.0
|
|
589
|
+
* @returns An array of Command objects in JSON format.
|
|
590
|
+
*/
|
|
591
|
+
toJSON(): ApplicationCommandRegistryEntry.Command[];
|
|
592
|
+
/**
|
|
593
|
+
* Loads the commands from the specified base user directory.
|
|
594
|
+
*
|
|
595
|
+
* @since 2.0.0
|
|
596
|
+
* @param baseUserDirectory - The base user directory to load the commands from, define it as `null` to not register
|
|
597
|
+
* a path for the file system loader.
|
|
598
|
+
* @returns A promise that resolves when all the commands are loaded.
|
|
599
|
+
*/
|
|
600
|
+
loadCommands(baseUserDirectory?: string | URL | null): Promise<void>;
|
|
601
|
+
/**
|
|
602
|
+
* Retrieves the loaded chat input commands from the application command registry.
|
|
603
|
+
*
|
|
604
|
+
* @since 2.0.0
|
|
605
|
+
* @returns A collection of chat input commands.
|
|
606
|
+
*/
|
|
607
|
+
getLoadedChatInputCommands(): Collection<string, ApplicationCommandRegistryEntry>;
|
|
608
|
+
/**
|
|
609
|
+
* Retrieves the loaded context menu commands.
|
|
610
|
+
*
|
|
611
|
+
* @since 2.0.0
|
|
612
|
+
* @returns A collection of context menu commands.
|
|
613
|
+
*/
|
|
614
|
+
getLoadedContextMenuCommands(): Collection<string, ApplicationCommandRegistryEntry>;
|
|
615
|
+
/**
|
|
616
|
+
* Retrieves the loaded global commands from the application command registry.
|
|
617
|
+
*
|
|
618
|
+
* @since 2.0.0
|
|
619
|
+
* @returns An array of loaded global commands.
|
|
620
|
+
*/
|
|
621
|
+
getLoadedGlobalCommands(): ApplicationCommandRegistryEntry.Command[];
|
|
622
|
+
/**
|
|
623
|
+
* Retrieves the loaded guild commands from the application command registry.
|
|
624
|
+
*
|
|
625
|
+
* @since 2.0.0
|
|
626
|
+
* @returns A collection of guild commands, where the key is the guild ID and the value is an array of commands.
|
|
627
|
+
*/
|
|
628
|
+
getLoadedGuildCommands(): Collection<Snowflake, ApplicationCommandRegistryEntry.Command[]>;
|
|
629
|
+
/**
|
|
630
|
+
* Registers all the non guild-restricted commands globally.
|
|
631
|
+
*
|
|
632
|
+
* @since 2.0.0
|
|
633
|
+
* @returns The raw result from registering the commands globally.
|
|
634
|
+
*/
|
|
635
|
+
pushGlobalCommands(): Promise<RESTPutAPIApplicationCommandsResult>;
|
|
636
|
+
/**
|
|
637
|
+
* Registers all the non guild-restricted commands in a single guild.
|
|
638
|
+
*
|
|
639
|
+
* @since 2.0.0
|
|
640
|
+
* @param guildId The guild to register the commands at.
|
|
641
|
+
* @returns The raw result from registering the commands in the specified guild.
|
|
642
|
+
*/
|
|
643
|
+
pushGlobalCommandsInGuild(guildId: Snowflake): Promise<RESTPutAPIApplicationGuildCommandsResult>;
|
|
644
|
+
/**
|
|
645
|
+
* Registers all the commands including guild-restricted ones in a single guild.
|
|
646
|
+
*
|
|
647
|
+
* @param guildId The guild to register the commands at.
|
|
648
|
+
* @returns The raw result from registering the commands in the specified guild.
|
|
649
|
+
*/
|
|
650
|
+
pushAllCommandsInGuild(guildId: Snowflake): Promise<RESTPutAPIApplicationGuildCommandsResult>;
|
|
651
|
+
/**
|
|
652
|
+
* Registers all the guild-restricted commands in their respective guilds.
|
|
653
|
+
*
|
|
654
|
+
* @returns The settled promises from all the guild command registrations.
|
|
655
|
+
*/
|
|
656
|
+
pushGuildRestrictedCommands(): Promise<PromiseSettledResult<RESTPutAPIApplicationGuildCommandsResult>[]>;
|
|
657
|
+
private get clientId();
|
|
658
|
+
}
|
|
659
|
+
declare namespace ApplicationCommandRegistry {
|
|
660
|
+
interface SetupOptions {
|
|
661
|
+
rest: REST;
|
|
662
|
+
clientId: Snowflake;
|
|
663
|
+
authPrefix?: RequestAuthPrefix;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
declare const applicationCommandRegistry: ApplicationCommandRegistry;
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/lib/interactions/utils/util-types.d.ts
|
|
669
|
+
type DiscordResult<T> = Result<T, DiscordError>;
|
|
670
|
+
type AsyncDiscordResult<T> = Promise<DiscordResult<T>>;
|
|
671
|
+
type AddFiles<T> = T & {
|
|
672
|
+
files?: RawFile[];
|
|
673
|
+
};
|
|
674
|
+
type AbortError = Error & {
|
|
675
|
+
name: 'AbortError';
|
|
676
|
+
};
|
|
677
|
+
type DiscordError = HTTPError | DiscordAPIError | AbortError;
|
|
678
|
+
type NonPingInteraction = Exclude<APIInteraction, APIPingInteraction>;
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region src/lib/interactions/structures/common/symbols.d.ts
|
|
681
|
+
declare const Data: unique symbol;
|
|
682
|
+
declare const Response: unique symbol;
|
|
683
|
+
//#endregion
|
|
684
|
+
//#region src/lib/interactions/structures/interactions/base/BaseInteraction.d.ts
|
|
685
|
+
type BaseInteractionType = Exclude<APIInteraction, APIPingInteraction>;
|
|
686
|
+
declare abstract class BaseInteraction<T extends BaseInteractionType = BaseInteractionType> {
|
|
687
|
+
protected readonly [Data]: T;
|
|
688
|
+
protected readonly [Response]: ServerResponse;
|
|
689
|
+
constructor(response: ServerResponse, data: T);
|
|
690
|
+
get replied(): boolean;
|
|
691
|
+
/**
|
|
692
|
+
* The ID of the interaction.
|
|
693
|
+
*/
|
|
694
|
+
get id(): T['id'];
|
|
695
|
+
/**
|
|
696
|
+
* The type of the interaction.
|
|
697
|
+
*/
|
|
698
|
+
get type(): T['type'];
|
|
699
|
+
/**
|
|
700
|
+
* Bitwise set of permissions the app or bot has within the channel the interaction was sent from.
|
|
701
|
+
*/
|
|
702
|
+
get app_permissions(): T['app_permissions'];
|
|
703
|
+
/**
|
|
704
|
+
* Bitwise set of permissions the app or bot has within the channel the interaction was sent from.
|
|
705
|
+
*
|
|
706
|
+
* @seealso {@link app_permissions} for the raw data.
|
|
707
|
+
*/
|
|
708
|
+
get applicationPermissions(): bigint | undefined;
|
|
709
|
+
/**
|
|
710
|
+
* The ID of the application the interaction is for.
|
|
711
|
+
*/
|
|
712
|
+
get application_id(): T['application_id'];
|
|
713
|
+
/**
|
|
714
|
+
* The ID of the application the interaction is for.
|
|
715
|
+
*
|
|
716
|
+
* @seealso {@link application_id} for the raw data.
|
|
717
|
+
*/
|
|
718
|
+
get applicationId(): T['application_id'];
|
|
719
|
+
/**
|
|
720
|
+
* Mapping of installation contexts that the interaction was authorized for
|
|
721
|
+
* to related user or guild IDs.
|
|
722
|
+
*/
|
|
723
|
+
get authorizing_integration_owners(): T['authorizing_integration_owners'];
|
|
724
|
+
/**
|
|
725
|
+
* Mapping of installation contexts that the interaction was authorized for
|
|
726
|
+
* to related user or guild IDs.
|
|
727
|
+
*
|
|
728
|
+
* @seealso {@link authorizing_integration_owners} for the raw data.
|
|
729
|
+
*/
|
|
730
|
+
get authorizingIntegrationOwners(): T['authorizing_integration_owners'];
|
|
731
|
+
/**
|
|
732
|
+
* The channel of the interaction.
|
|
733
|
+
*/
|
|
734
|
+
get channel(): T['channel'];
|
|
735
|
+
/**
|
|
736
|
+
* The channel the interaction was sent from.
|
|
737
|
+
* @deprecated Use {@link channel}.id instead.
|
|
738
|
+
*/
|
|
739
|
+
get channel_id(): T['channel_id'];
|
|
740
|
+
/**
|
|
741
|
+
* The channel the interaction was sent from.
|
|
742
|
+
* @deprecated Use {@link channel}.id instead.
|
|
743
|
+
*
|
|
744
|
+
* @seealso {@link channel_id} for the raw data.
|
|
745
|
+
*/
|
|
746
|
+
get channelId(): T['channel_id'];
|
|
747
|
+
/**
|
|
748
|
+
* Context where the interaction was triggered from.
|
|
749
|
+
*/
|
|
750
|
+
get context(): T['context'];
|
|
751
|
+
/**
|
|
752
|
+
* The command data payload.
|
|
753
|
+
*/
|
|
754
|
+
get data(): T['data'];
|
|
755
|
+
/**
|
|
756
|
+
* For monetized apps, any entitlements for the invoking user, representing
|
|
757
|
+
* access to premium SKUs.
|
|
758
|
+
*/
|
|
759
|
+
get entitlements(): T['entitlements'];
|
|
760
|
+
/**
|
|
761
|
+
* The guild the interaction was sent from.
|
|
762
|
+
*/
|
|
763
|
+
get guild_id(): T['guild_id'];
|
|
764
|
+
/**
|
|
765
|
+
* The guild the interaction was sent from.
|
|
766
|
+
*
|
|
767
|
+
* @seealso {@link guild_id} for the raw data.
|
|
768
|
+
*/
|
|
769
|
+
get guildId(): T['guild_id'];
|
|
770
|
+
/**
|
|
771
|
+
* The guild's preferred locale, if invoked in a guild.
|
|
772
|
+
*/
|
|
773
|
+
get guild_locale(): T['guild_locale'];
|
|
774
|
+
/**
|
|
775
|
+
* The guild's preferred locale, if invoked in a guild.
|
|
776
|
+
*
|
|
777
|
+
* @seealso {@link guild_locale} for the raw data.
|
|
778
|
+
*/
|
|
779
|
+
get guildLocale(): T['guild_locale'];
|
|
780
|
+
/**
|
|
781
|
+
* The selected language of the invoking user.
|
|
782
|
+
*/
|
|
783
|
+
get locale(): T['locale'];
|
|
784
|
+
/**
|
|
785
|
+
* Guild member data for the invoking user, including permissions.
|
|
786
|
+
*
|
|
787
|
+
* **This is only sent when an interaction is invoked in a guild**.
|
|
788
|
+
*/
|
|
789
|
+
get member(): T['member'];
|
|
790
|
+
/**
|
|
791
|
+
* A continuation token for responding to the interaction.
|
|
792
|
+
*/
|
|
793
|
+
get token(): T['token'];
|
|
794
|
+
/**
|
|
795
|
+
* User object for the invoking user.
|
|
796
|
+
*/
|
|
797
|
+
get user(): import("discord-api-types/v10").APIUser;
|
|
798
|
+
/**
|
|
799
|
+
* Read-only property, always `1`.
|
|
800
|
+
*/
|
|
801
|
+
get version(): T['version'];
|
|
802
|
+
/**
|
|
803
|
+
* Determines whether or not the interaction was sent from a guild.
|
|
804
|
+
* @returns The casted interaction type.
|
|
805
|
+
*/
|
|
806
|
+
inGuild(): this is InGuild<this>;
|
|
807
|
+
/**
|
|
808
|
+
* Fetches the channel the interaction was sent from.
|
|
809
|
+
* @returns The fetched channel.
|
|
810
|
+
* @remarks **This requires REST to have a token.**
|
|
811
|
+
* @seealso {@link channel}.
|
|
812
|
+
*/
|
|
813
|
+
fetchChannel(): Promise<Result.Err<Error> | DiscordResult<APIChannel>>;
|
|
814
|
+
/**
|
|
815
|
+
* Fetches the channel the interaction was sent from.
|
|
816
|
+
* @returns The fetched channel.
|
|
817
|
+
* @remarks **This requires REST to have a token.**
|
|
818
|
+
*/
|
|
819
|
+
fetchGuild(): Promise<Result.Err<Error> | DiscordResult<APIGuild>>;
|
|
820
|
+
protected _sendReply(data: NonNullObject): Promise<void>;
|
|
821
|
+
}
|
|
822
|
+
type InGuild<T extends BaseInteraction> = T & {
|
|
823
|
+
get guild_id(): NonNullable<T['guild_id']>;
|
|
824
|
+
get guildId(): NonNullable<T['guildId']>;
|
|
825
|
+
get guild_locale(): NonNullable<T['guild_locale']>;
|
|
826
|
+
get guildLocale(): NonNullable<T['guildLocale']>;
|
|
827
|
+
get member(): NonNullable<T['member']>;
|
|
828
|
+
};
|
|
829
|
+
//#endregion
|
|
830
|
+
//#region src/lib/interactions/structures/interactions/base/common.d.ts
|
|
831
|
+
type AutocompleteResponseData = APIApplicationCommandAutocompleteResponse;
|
|
832
|
+
type AutocompleteResponseOptions = AutocompleteResponseData['data'];
|
|
833
|
+
type MessageResponseData = APIInteractionResponseChannelMessageWithSource;
|
|
834
|
+
type MessageResponseOptions = MessageResponseData['data'];
|
|
835
|
+
type DeferResponseData = APIInteractionResponseDeferredChannelMessageWithSource;
|
|
836
|
+
type DeferResponseOptions = DeferResponseData['data'];
|
|
837
|
+
type ModalResponseData = APIModalInteractionResponse;
|
|
838
|
+
type ModalResponseOptions = ModalResponseData['data'];
|
|
839
|
+
type FollowupOptions = AddFiles<RESTPostAPIInteractionFollowupJSONBody>;
|
|
840
|
+
type DeferUpdateResult = APIInteractionResponseDeferredMessageUpdate;
|
|
841
|
+
type UpdateData = APIInteractionResponseUpdateMessage;
|
|
842
|
+
type UpdateOptions = UpdateData['data'];
|
|
843
|
+
//#endregion
|
|
844
|
+
//#region src/lib/interactions/structures/interactions/AutocompleteInteraction.d.ts
|
|
845
|
+
declare class AutocompleteInteraction$1 extends BaseInteraction<AutocompleteInteraction$1.Type> {
|
|
846
|
+
/**
|
|
847
|
+
* Responds to the interaction with an autocomplete result.
|
|
848
|
+
* @param data The data to be sent.
|
|
849
|
+
*/
|
|
850
|
+
reply(data: AutocompleteResponseOptions): Promise<void>;
|
|
851
|
+
/**
|
|
852
|
+
* Responds to the interaction with an empty autocomplete result.
|
|
853
|
+
*/
|
|
854
|
+
replyEmpty(): Promise<void>;
|
|
855
|
+
}
|
|
856
|
+
declare namespace AutocompleteInteraction$1 {
|
|
857
|
+
type Type = APIApplicationCommandAutocompleteInteraction;
|
|
858
|
+
}
|
|
859
|
+
//#endregion
|
|
860
|
+
//#region src/lib/interactions/structures/interactions/base/CommandInteraction.d.ts
|
|
861
|
+
type BaseCommandInteractionType = APIChatInputApplicationCommandInteraction | APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction;
|
|
862
|
+
declare class CommandInteraction<T extends BaseCommandInteractionType> extends BaseInteraction<T> {
|
|
863
|
+
/**
|
|
864
|
+
* Responds to the interaction with a message.
|
|
865
|
+
* @param data The data to be sent.
|
|
866
|
+
*/
|
|
867
|
+
reply(data: MessageResponseOptions): Promise<PartialMessage<this>>;
|
|
868
|
+
/**
|
|
869
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
870
|
+
* @param data The data to be sent, if any.
|
|
871
|
+
*/
|
|
872
|
+
defer(data?: DeferResponseOptions): Promise<PartialMessage<this>>;
|
|
873
|
+
/**
|
|
874
|
+
* Responds to the interaction with a popup modal.
|
|
875
|
+
* @param data The data to be sent.
|
|
876
|
+
*/
|
|
877
|
+
showModal(data: ModalResponseOptions): Promise<void>;
|
|
878
|
+
/**
|
|
879
|
+
* Sends a follow-up message.
|
|
880
|
+
* @param data The data to be sent.
|
|
881
|
+
*/
|
|
882
|
+
followup({
|
|
883
|
+
files,
|
|
884
|
+
...body
|
|
885
|
+
}: FollowupOptions): AsyncDiscordResult<Message<this>>;
|
|
886
|
+
}
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region src/lib/interactions/structures/interactions/ChatInputCommandInteraction.d.ts
|
|
889
|
+
declare class ChatInputCommandInteraction extends CommandInteraction<ChatInputCommandInteraction.Type> {}
|
|
890
|
+
declare namespace ChatInputCommandInteraction {
|
|
891
|
+
type Type = APIChatInputApplicationCommandInteraction;
|
|
892
|
+
}
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region src/lib/interactions/structures/interactions/base/MessageComponentInteraction.d.ts
|
|
895
|
+
type MessageComponentInteractionType = APIMessageComponentButtonInteraction | APIMessageComponentSelectMenuInteraction;
|
|
896
|
+
declare abstract class MessageComponentInteraction<T extends MessageComponentInteractionType> extends BaseInteraction<T> {
|
|
897
|
+
/**
|
|
898
|
+
* The message the interaction was attached to.
|
|
899
|
+
*/
|
|
900
|
+
get message(): import("discord-api-types/v10").APIMessage;
|
|
901
|
+
/**
|
|
902
|
+
* ACK a button interaction and update it to a loading state.
|
|
903
|
+
*/
|
|
904
|
+
deferUpdate(): Promise<PartialMessage<this>>;
|
|
905
|
+
/**
|
|
906
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
907
|
+
* @param data The data to be sent, if any.
|
|
908
|
+
*/
|
|
909
|
+
update(data?: UpdateOptions): Promise<PartialMessage<this>>;
|
|
910
|
+
/**
|
|
911
|
+
* Responds to the interaction with a message.
|
|
912
|
+
* @param data The data to be sent.
|
|
913
|
+
*/
|
|
914
|
+
reply(data: MessageResponseOptions): Promise<PartialMessage<this>>;
|
|
915
|
+
/**
|
|
916
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
917
|
+
* @param data The data to be sent, if any.
|
|
918
|
+
*/
|
|
919
|
+
defer(data?: DeferResponseOptions): Promise<PartialMessage<this>>;
|
|
920
|
+
/**
|
|
921
|
+
* Responds to the interaction with a popup modal.
|
|
922
|
+
* @param data The data to be sent.
|
|
923
|
+
*/
|
|
924
|
+
showModal(data: ModalResponseOptions): Promise<void>;
|
|
925
|
+
/**
|
|
926
|
+
* Sends a follow-up message.
|
|
927
|
+
* @param data The data to be sent.
|
|
928
|
+
*/
|
|
929
|
+
followup({
|
|
930
|
+
files,
|
|
931
|
+
...body
|
|
932
|
+
}: FollowupOptions): AsyncDiscordResult<Message<this>>;
|
|
933
|
+
}
|
|
934
|
+
//#endregion
|
|
935
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentButtonInteraction.d.ts
|
|
936
|
+
declare class MessageComponentButtonInteraction extends MessageComponentInteraction<MessageComponentButtonInteraction.Type> {}
|
|
937
|
+
declare namespace MessageComponentButtonInteraction {
|
|
938
|
+
type Type = APIMessageComponentButtonInteraction;
|
|
939
|
+
}
|
|
940
|
+
//#endregion
|
|
941
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentChannelSelectInteraction.d.ts
|
|
942
|
+
declare class MessageComponentChannelSelectInteraction extends MessageComponentInteraction<MessageComponentChannelSelectInteraction.Type> {
|
|
943
|
+
/**
|
|
944
|
+
* Gets the IDs of the selected channels.
|
|
945
|
+
*/
|
|
946
|
+
get ids(): Snowflake[];
|
|
947
|
+
/**
|
|
948
|
+
* Creates a collection with all the selected channels.
|
|
949
|
+
*
|
|
950
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.keys}.
|
|
951
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.values}.
|
|
952
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.entries}.
|
|
953
|
+
*/
|
|
954
|
+
get channels(): Collection<Snowflake, MessageComponentChannelSelectInteraction.Value>;
|
|
955
|
+
/**
|
|
956
|
+
* Returns an iterator of the selected channel IDs.
|
|
957
|
+
*
|
|
958
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.ids}.
|
|
959
|
+
*/
|
|
960
|
+
keys(): IterableIterator<Snowflake>;
|
|
961
|
+
/**
|
|
962
|
+
* Returns an iterator of the selected channels.
|
|
963
|
+
*
|
|
964
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.channels}.
|
|
965
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.keys}.
|
|
966
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.entries}.
|
|
967
|
+
*/
|
|
968
|
+
values(): IterableIterator<MessageComponentChannelSelectInteraction.Value>;
|
|
969
|
+
/**
|
|
970
|
+
* Returns an iterator of [ID, Channel] pairs.
|
|
971
|
+
*
|
|
972
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.channels}.
|
|
973
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.keys}.
|
|
974
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.values}.
|
|
975
|
+
*/
|
|
976
|
+
entries(): IterableIterator<[Snowflake, MessageComponentChannelSelectInteraction.Value]>;
|
|
977
|
+
}
|
|
978
|
+
declare namespace MessageComponentChannelSelectInteraction {
|
|
979
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageChannelSelectInteractionData>;
|
|
980
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
981
|
+
export type Value = TransformedArguments.Channel;
|
|
982
|
+
export {};
|
|
983
|
+
}
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentMentionableSelectInteraction.d.ts
|
|
986
|
+
declare class MessageComponentMentionableSelectInteraction extends MessageComponentInteraction<MessageComponentMentionableSelectInteraction.Type> {
|
|
987
|
+
/**
|
|
988
|
+
* Gets the IDs of the selected users and roles.
|
|
989
|
+
*/
|
|
990
|
+
get ids(): Snowflake[];
|
|
991
|
+
/**
|
|
992
|
+
* Creates a collection with all the selected users.
|
|
993
|
+
*
|
|
994
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
995
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.values}.
|
|
996
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.entries}.
|
|
997
|
+
*/
|
|
998
|
+
get users(): Collection<Snowflake, MessageComponentMentionableSelectInteraction.ValueUser>;
|
|
999
|
+
/**
|
|
1000
|
+
* Creates a collection with all the selected roles.
|
|
1001
|
+
*
|
|
1002
|
+
* @note The collection will always be empty if the interaction came from direct messages.
|
|
1003
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
1004
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.values}.
|
|
1005
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.entries}.
|
|
1006
|
+
*/
|
|
1007
|
+
get roles(): Collection<Snowflake, APIRole>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Creates a collection with all the selected users, members, and roles.
|
|
1010
|
+
*
|
|
1011
|
+
* @note The collection will always be empty if the interaction came from direct messages.
|
|
1012
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
1013
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.values}.
|
|
1014
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.entries}.
|
|
1015
|
+
*/
|
|
1016
|
+
get mentionables(): Collection<Snowflake, MessageComponentMentionableSelectInteraction.Value>;
|
|
1017
|
+
/**
|
|
1018
|
+
* Returns an iterator of the selected users and roles IDs.
|
|
1019
|
+
*
|
|
1020
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.ids}.
|
|
1021
|
+
*/
|
|
1022
|
+
keys(): IterableIterator<Snowflake>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Returns an iterator of the selected users, members, and roles.
|
|
1025
|
+
*
|
|
1026
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.users}.
|
|
1027
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.roles}.
|
|
1028
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
1029
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.entries}.
|
|
1030
|
+
*/
|
|
1031
|
+
values(): IterableIterator<MessageComponentMentionableSelectInteraction.Value>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Returns an iterator of [ID, Mentionable] pairs.
|
|
1034
|
+
*
|
|
1035
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.users}.
|
|
1036
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.roles}.
|
|
1037
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
1038
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.values}.
|
|
1039
|
+
*/
|
|
1040
|
+
entries(): IterableIterator<[Snowflake, MessageComponentMentionableSelectInteraction.Value]>;
|
|
1041
|
+
}
|
|
1042
|
+
declare namespace MessageComponentMentionableSelectInteraction {
|
|
1043
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageMentionableSelectInteractionData>;
|
|
1044
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
1045
|
+
export type Value = ValueUser | {
|
|
1046
|
+
id: string;
|
|
1047
|
+
role: TransformedArguments.Role;
|
|
1048
|
+
} | {
|
|
1049
|
+
id: string;
|
|
1050
|
+
};
|
|
1051
|
+
export type ValueUser = {
|
|
1052
|
+
id: string;
|
|
1053
|
+
} & TransformedArguments.User;
|
|
1054
|
+
export {};
|
|
1055
|
+
}
|
|
1056
|
+
//#endregion
|
|
1057
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentRoleSelectInteraction.d.ts
|
|
1058
|
+
declare class MessageComponentRoleSelectInteraction extends MessageComponentInteraction<MessageComponentRoleSelectInteraction.Type> {
|
|
1059
|
+
/**
|
|
1060
|
+
* Gets the IDs of the selected roles.
|
|
1061
|
+
*/
|
|
1062
|
+
get ids(): Snowflake[];
|
|
1063
|
+
/**
|
|
1064
|
+
* Creates a collection with all the selected roles.
|
|
1065
|
+
*
|
|
1066
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.keys}.
|
|
1067
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.values}.
|
|
1068
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.entries}.
|
|
1069
|
+
*/
|
|
1070
|
+
get roles(): Collection<Snowflake, MessageComponentRoleSelectInteraction.Value>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Returns an iterator of the selected role IDs.
|
|
1073
|
+
*
|
|
1074
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.ids}.
|
|
1075
|
+
*/
|
|
1076
|
+
keys(): IterableIterator<Snowflake>;
|
|
1077
|
+
/**
|
|
1078
|
+
* Returns an iterator of the selected channels.
|
|
1079
|
+
*
|
|
1080
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.roles}.
|
|
1081
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.keys}.
|
|
1082
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.entries}.
|
|
1083
|
+
*/
|
|
1084
|
+
values(): IterableIterator<MessageComponentRoleSelectInteraction.Value>;
|
|
1085
|
+
/**
|
|
1086
|
+
* Returns an iterator of [ID, Role] pairs.
|
|
1087
|
+
*
|
|
1088
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.roles}.
|
|
1089
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.keys}.
|
|
1090
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.values}.
|
|
1091
|
+
*/
|
|
1092
|
+
entries(): IterableIterator<[Snowflake, MessageComponentRoleSelectInteraction.Value]>;
|
|
1093
|
+
}
|
|
1094
|
+
declare namespace MessageComponentRoleSelectInteraction {
|
|
1095
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageRoleSelectInteractionData>;
|
|
1096
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
1097
|
+
export type Value = TransformedArguments.Role;
|
|
1098
|
+
export {};
|
|
1099
|
+
}
|
|
1100
|
+
//#endregion
|
|
1101
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentStringSelectInteraction.d.ts
|
|
1102
|
+
declare class MessageComponentStringSelectInteraction extends MessageComponentInteraction<MessageComponentStringSelectInteraction.Type> {
|
|
1103
|
+
get values(): string[];
|
|
1104
|
+
}
|
|
1105
|
+
declare namespace MessageComponentStringSelectInteraction {
|
|
1106
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageStringSelectInteractionData>;
|
|
1107
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
1108
|
+
export {};
|
|
1109
|
+
}
|
|
1110
|
+
//#endregion
|
|
1111
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentUserSelectInteraction.d.ts
|
|
1112
|
+
declare class MessageComponentUserSelectInteraction extends MessageComponentInteraction<MessageComponentUserSelectInteraction.Type> {
|
|
1113
|
+
/**
|
|
1114
|
+
* Gets the IDs of the selected users.
|
|
1115
|
+
*/
|
|
1116
|
+
get ids(): Snowflake[];
|
|
1117
|
+
/**
|
|
1118
|
+
* Creates a collection with all the selected users.
|
|
1119
|
+
*
|
|
1120
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.keys}.
|
|
1121
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.values}.
|
|
1122
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.entries}.
|
|
1123
|
+
*/
|
|
1124
|
+
get users(): Collection<Snowflake, MessageComponentUserSelectInteraction.Value>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Returns an iterator of the selected user IDs.
|
|
1127
|
+
*
|
|
1128
|
+
* @seealso {@link MessageComponentUserSelectInteraction.ids}.
|
|
1129
|
+
*/
|
|
1130
|
+
keys(): IterableIterator<Snowflake>;
|
|
1131
|
+
/**
|
|
1132
|
+
* Returns an iterator of the selected users.
|
|
1133
|
+
*
|
|
1134
|
+
* @seealso {@link MessageComponentUserSelectInteraction.users}.
|
|
1135
|
+
* @seealso {@link MessageComponentUserSelectInteraction.keys}.
|
|
1136
|
+
* @seealso {@link MessageComponentUserSelectInteraction.entries}.
|
|
1137
|
+
*/
|
|
1138
|
+
values(): IterableIterator<MessageComponentUserSelectInteraction.Value>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Returns an iterator of [ID, User] pairs.
|
|
1141
|
+
*
|
|
1142
|
+
* @seealso {@link MessageComponentUserSelectInteraction.channels}.
|
|
1143
|
+
* @seealso {@link MessageComponentUserSelectInteraction.keys}.
|
|
1144
|
+
* @seealso {@link MessageComponentUserSelectInteraction.values}.
|
|
1145
|
+
*/
|
|
1146
|
+
entries(): IterableIterator<[Snowflake, MessageComponentUserSelectInteraction.Value]>;
|
|
1147
|
+
}
|
|
1148
|
+
declare namespace MessageComponentUserSelectInteraction {
|
|
1149
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageUserSelectInteractionData>;
|
|
1150
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
1151
|
+
export type Value = TransformedArguments.User;
|
|
1152
|
+
export {};
|
|
1153
|
+
}
|
|
1154
|
+
//#endregion
|
|
1155
|
+
//#region src/lib/interactions/structures/interactions/MessageContextMenuCommandInteraction.d.ts
|
|
1156
|
+
declare class MessageContextMenuCommandInteraction extends CommandInteraction<MessageContextMenuCommandInteraction.Type> {}
|
|
1157
|
+
declare namespace MessageContextMenuCommandInteraction {
|
|
1158
|
+
type Type = APIMessageApplicationCommandInteraction;
|
|
1159
|
+
}
|
|
1160
|
+
//#endregion
|
|
1161
|
+
//#region src/lib/interactions/structures/interactions/ModalSubmitInteraction.d.ts
|
|
1162
|
+
declare class ModalSubmitInteraction extends BaseInteraction<ModalSubmitInteraction.Type> {
|
|
1163
|
+
/**
|
|
1164
|
+
* The message the interaction was attached to, if any.
|
|
1165
|
+
*/
|
|
1166
|
+
get message(): import("discord-api-types/v10").APIMessage | undefined;
|
|
1167
|
+
/**
|
|
1168
|
+
* ACK a button interaction and update it to a loading state.
|
|
1169
|
+
*/
|
|
1170
|
+
deferUpdate(): Promise<PartialMessage<this>>;
|
|
1171
|
+
/**
|
|
1172
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
1173
|
+
* @param data The data to be sent, if any.
|
|
1174
|
+
*/
|
|
1175
|
+
update(data?: UpdateOptions): Promise<PartialMessage<this>>;
|
|
1176
|
+
/**
|
|
1177
|
+
* Responds to the interaction with a message.
|
|
1178
|
+
* @param data The data to be sent.
|
|
1179
|
+
*/
|
|
1180
|
+
reply(data: MessageResponseOptions): Promise<PartialMessage<this>>;
|
|
1181
|
+
/**
|
|
1182
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
1183
|
+
* @param data The data to be sent, if any.
|
|
1184
|
+
*/
|
|
1185
|
+
defer(data?: DeferResponseOptions): Promise<PartialMessage<this>>;
|
|
1186
|
+
/**
|
|
1187
|
+
* Sends a follow-up message.
|
|
1188
|
+
* @param data The data to be sent.
|
|
1189
|
+
*/
|
|
1190
|
+
followup({
|
|
1191
|
+
files,
|
|
1192
|
+
...body
|
|
1193
|
+
}: FollowupOptions): AsyncDiscordResult<Message<this>>;
|
|
1194
|
+
}
|
|
1195
|
+
declare namespace ModalSubmitInteraction {
|
|
1196
|
+
type Type = APIModalSubmitInteraction;
|
|
1197
|
+
}
|
|
1198
|
+
//#endregion
|
|
1199
|
+
//#region src/lib/interactions/structures/interactions/UserContextMenuCommandInteraction.d.ts
|
|
1200
|
+
declare class UserContextMenuCommandInteraction extends CommandInteraction<UserContextMenuCommandInteraction.Type> {}
|
|
1201
|
+
declare namespace UserContextMenuCommandInteraction {
|
|
1202
|
+
type Type = APIUserApplicationCommandInteraction;
|
|
1203
|
+
}
|
|
1204
|
+
//#endregion
|
|
1205
|
+
//#region src/lib/interactions/structures/interactions/index.d.ts
|
|
1206
|
+
declare namespace Interactions {
|
|
1207
|
+
type Autocomplete = AutocompleteInteraction$1;
|
|
1208
|
+
type ChatInputCommand = ChatInputCommandInteraction;
|
|
1209
|
+
type MessageContextMenuCommand = MessageContextMenuCommandInteraction;
|
|
1210
|
+
type UserContextMenuCommand = UserContextMenuCommandInteraction;
|
|
1211
|
+
type MessageComponentButton = MessageComponentButtonInteraction;
|
|
1212
|
+
type MessageComponentChannelSelect = MessageComponentChannelSelectInteraction;
|
|
1213
|
+
type MessageComponentMentionableSelect = MessageComponentMentionableSelectInteraction;
|
|
1214
|
+
type MessageComponentRoleSelect = MessageComponentRoleSelectInteraction;
|
|
1215
|
+
type MessageComponentStringSelect = MessageComponentStringSelectInteraction;
|
|
1216
|
+
type MessageComponentUserSelect = MessageComponentUserSelectInteraction;
|
|
1217
|
+
type MessageComponentSelectMenu = MessageComponentChannelSelect | MessageComponentMentionableSelect | MessageComponentRoleSelect | MessageComponentStringSelect | MessageComponentUserSelect;
|
|
1218
|
+
type ModalSubmit = ModalSubmitInteraction;
|
|
1219
|
+
type MessageComponent = MessageComponentButton | MessageComponentSelectMenu | ModalSubmit;
|
|
1220
|
+
type ContextMenuCommand = MessageContextMenuCommand | UserContextMenuCommand;
|
|
1221
|
+
type ApplicationCommand = ChatInputCommand | ContextMenuCommand;
|
|
1222
|
+
type Any = Autocomplete | ChatInputCommand | MessageContextMenuCommand | UserContextMenuCommand | MessageComponentButton | MessageComponentSelectMenu | ModalSubmit;
|
|
1223
|
+
}
|
|
1224
|
+
type Interaction$1 = Interactions.Any;
|
|
1225
|
+
//#endregion
|
|
1226
|
+
//#region src/lib/interactions/structures/Message.d.ts
|
|
1227
|
+
declare class PartialMessage<I extends BaseInteraction = BaseInteraction> {
|
|
1228
|
+
readonly interaction: I;
|
|
1229
|
+
constructor(interaction: I);
|
|
1230
|
+
/**
|
|
1231
|
+
* The ID of the message.
|
|
1232
|
+
*/
|
|
1233
|
+
get id(): string;
|
|
1234
|
+
/**
|
|
1235
|
+
* The thread, if the message started one.
|
|
1236
|
+
*/
|
|
1237
|
+
get thread(): APIChannel | undefined;
|
|
1238
|
+
/**
|
|
1239
|
+
* Retrieves the message from Discord, returns a clone of the instance.
|
|
1240
|
+
*/
|
|
1241
|
+
get(): AsyncDiscordResult<Message>;
|
|
1242
|
+
/**
|
|
1243
|
+
* Updates the message, returns a clone of the instance.
|
|
1244
|
+
* @param data The data to be sent.
|
|
1245
|
+
*/
|
|
1246
|
+
update({
|
|
1247
|
+
files,
|
|
1248
|
+
...body
|
|
1249
|
+
}: UpdateResponseOptions): AsyncDiscordResult<Message>;
|
|
1250
|
+
/**
|
|
1251
|
+
* Deletes the message.
|
|
1252
|
+
*/
|
|
1253
|
+
delete(): AsyncDiscordResult<this>;
|
|
1254
|
+
}
|
|
1255
|
+
type UpdateResponseResult = RESTPatchAPIInteractionOriginalResponseResult;
|
|
1256
|
+
type UpdateResponseOptions = AddFiles<RESTPatchAPIInteractionOriginalResponseJSONBody>;
|
|
1257
|
+
declare class Message<I extends BaseInteraction = BaseInteraction> extends PartialMessage<I> {
|
|
1258
|
+
private readonly [Data];
|
|
1259
|
+
constructor(interaction: I, data: APIMessage);
|
|
1260
|
+
/**
|
|
1261
|
+
* The ID of the message.
|
|
1262
|
+
*
|
|
1263
|
+
* @raw
|
|
1264
|
+
*/
|
|
1265
|
+
get id(): string;
|
|
1266
|
+
/**
|
|
1267
|
+
* The ID of the channel the message is from.
|
|
1268
|
+
*
|
|
1269
|
+
* @raw
|
|
1270
|
+
* @seealso {@link channelId} for the camelCase property.
|
|
1271
|
+
*/
|
|
1272
|
+
get channel_id(): APIMessage['channel_id'];
|
|
1273
|
+
/**
|
|
1274
|
+
* The ID of the channel the message is from.
|
|
1275
|
+
*/
|
|
1276
|
+
get channelId(): APIMessage['channel_id'];
|
|
1277
|
+
/**
|
|
1278
|
+
* The author of this message (only a valid user in the case where the message is generated by a user or bot user)
|
|
1279
|
+
*
|
|
1280
|
+
* If the message is generated by a webhook, the author object corresponds to the webhook's id,
|
|
1281
|
+
* username, and avatar. You can tell if a message is generated by a webhook by checking for the {@link webhookId} property
|
|
1282
|
+
*
|
|
1283
|
+
* @raw
|
|
1284
|
+
* @seealso {@link https://discord.com/developers/docs/resources/user#user-object}
|
|
1285
|
+
*/
|
|
1286
|
+
get author(): APIMessage['author'];
|
|
1287
|
+
/**
|
|
1288
|
+
* The contents of the message.
|
|
1289
|
+
*
|
|
1290
|
+
* @raw
|
|
1291
|
+
*/
|
|
1292
|
+
get content(): APIMessage['content'];
|
|
1293
|
+
/**
|
|
1294
|
+
* The timestamp the message was sent at.
|
|
1295
|
+
*
|
|
1296
|
+
* @raw
|
|
1297
|
+
* @seealso {@link createdTimestamp} for the parsed timestamp.
|
|
1298
|
+
* @seealso {@link createdAt} for the Date instance created from the parsed timestamp.
|
|
1299
|
+
*/
|
|
1300
|
+
get timestamp(): APIMessage['timestamp'];
|
|
1301
|
+
/**
|
|
1302
|
+
* The timestamp the message was sent at.
|
|
1303
|
+
*
|
|
1304
|
+
* @seealso {@link timestamp} for the raw data.
|
|
1305
|
+
*/
|
|
1306
|
+
get createdTimestamp(): number;
|
|
1307
|
+
/**
|
|
1308
|
+
* The {@link Date} version of {@link createdTimestamp}.
|
|
1309
|
+
*/
|
|
1310
|
+
get createdAt(): Date;
|
|
1311
|
+
/**
|
|
1312
|
+
* The timestamp the message was edited at, `null` if it was never edited.
|
|
1313
|
+
*
|
|
1314
|
+
* @raw
|
|
1315
|
+
* @seealso {@link editedTimestamp} for the parsed timestamp.
|
|
1316
|
+
* @seealso {@link editedAt} for the Date instance created from the parsed timestamp.
|
|
1317
|
+
*/
|
|
1318
|
+
get edited_timestamp(): APIMessage['edited_timestamp'];
|
|
1319
|
+
/**
|
|
1320
|
+
* The timestamp the message was edited at, `null` if it was never edited.
|
|
1321
|
+
*/
|
|
1322
|
+
get editedTimestamp(): number | null;
|
|
1323
|
+
/**
|
|
1324
|
+
* The {@link Date} version of {@link editedTimestamp}.
|
|
1325
|
+
*/
|
|
1326
|
+
get editedAt(): Date | null;
|
|
1327
|
+
/**
|
|
1328
|
+
* Whether or not the message is a TTS message.
|
|
1329
|
+
*
|
|
1330
|
+
* @raw
|
|
1331
|
+
*/
|
|
1332
|
+
get tts(): APIMessage['tts'];
|
|
1333
|
+
/**
|
|
1334
|
+
* Whether or not the message mentioned everyone.
|
|
1335
|
+
*
|
|
1336
|
+
* @raw
|
|
1337
|
+
* @seealso {@link mention_everyone} for the camelCase property.
|
|
1338
|
+
*/
|
|
1339
|
+
get mention_everyone(): APIMessage['mention_everyone'];
|
|
1340
|
+
/**
|
|
1341
|
+
* Whether or not the message mentioned everyone.
|
|
1342
|
+
*
|
|
1343
|
+
* @seealso {@link mention_everyone} for the raw data.
|
|
1344
|
+
*/
|
|
1345
|
+
get mentionEveryone(): APIMessage['mention_everyone'];
|
|
1346
|
+
/**
|
|
1347
|
+
* The users specifically mentioned in the message.
|
|
1348
|
+
*
|
|
1349
|
+
* @raw
|
|
1350
|
+
* @seealso {@link https://discord.com/developers/docs/resources/user#user-object}
|
|
1351
|
+
*/
|
|
1352
|
+
get mentions(): APIMessage['mentions'];
|
|
1353
|
+
/**
|
|
1354
|
+
* The roles specifically mentioned in the message.
|
|
1355
|
+
*
|
|
1356
|
+
* @raw
|
|
1357
|
+
* @seealso {@link https://discord.com/developers/docs/topics/permissions#role-object}
|
|
1358
|
+
*/
|
|
1359
|
+
get mention_roles(): APIMessage['mention_roles'];
|
|
1360
|
+
/**
|
|
1361
|
+
* The roles specifically mentioned in the message.
|
|
1362
|
+
*
|
|
1363
|
+
* @seealso {@link https://discord.com/developers/docs/topics/permissions#role-object}
|
|
1364
|
+
* @seealso {@link mention_roles} for the raw data.
|
|
1365
|
+
*/
|
|
1366
|
+
get mentionRoles(): APIMessage['mention_roles'];
|
|
1367
|
+
/**
|
|
1368
|
+
* The channels specifically mentioned in this message.
|
|
1369
|
+
*
|
|
1370
|
+
* Not all channel mentions in a message will appear in {@link mentionChannels}:
|
|
1371
|
+
* - Only textual channels that are visible to everyone in a lurkable guild will ever be included.
|
|
1372
|
+
* - Only crossposted messages (via Channel Following) currently include {@link mentionChannels} at all.
|
|
1373
|
+
*
|
|
1374
|
+
* @raw
|
|
1375
|
+
* @seealso {@link mentionChannels} for the camelCase property with an empty array default.
|
|
1376
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#channel-mention-object}
|
|
1377
|
+
*/
|
|
1378
|
+
get mention_channels(): APIMessage['mention_channels'];
|
|
1379
|
+
/**
|
|
1380
|
+
* The channels specifically mentioned in this message.
|
|
1381
|
+
*
|
|
1382
|
+
* Not all channel mentions in a message will appear in {@link mentionChannels}:
|
|
1383
|
+
* - Only textual channels that are visible to everyone in a lurkable guild will ever be included.
|
|
1384
|
+
* - Only crossposted messages (via Channel Following) currently include {@link mentionChannels} at all.
|
|
1385
|
+
*
|
|
1386
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#channel-mention-object}
|
|
1387
|
+
*/
|
|
1388
|
+
get mentionChannels(): APIMessage['mention_channels'];
|
|
1389
|
+
/**
|
|
1390
|
+
* A nonce that can be used for optimistic message sending (up to 25 characters).
|
|
1391
|
+
*
|
|
1392
|
+
* @raw
|
|
1393
|
+
*/
|
|
1394
|
+
get nonce(): APIMessage['nonce'];
|
|
1395
|
+
/**
|
|
1396
|
+
* Whether or not the message is pinned.
|
|
1397
|
+
*
|
|
1398
|
+
* @raw
|
|
1399
|
+
*/
|
|
1400
|
+
get pinned(): APIMessage['pinned'];
|
|
1401
|
+
/**
|
|
1402
|
+
* The attached files.
|
|
1403
|
+
*
|
|
1404
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#attachment-object}
|
|
1405
|
+
*/
|
|
1406
|
+
get attachments(): APIMessage['attachments'];
|
|
1407
|
+
/**
|
|
1408
|
+
* The embedded content.
|
|
1409
|
+
*
|
|
1410
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#embed-object}
|
|
1411
|
+
*/
|
|
1412
|
+
get embeds(): APIMessage['embeds'];
|
|
1413
|
+
/**
|
|
1414
|
+
* The reactions the message has.
|
|
1415
|
+
*
|
|
1416
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#reaction-object}
|
|
1417
|
+
*/
|
|
1418
|
+
get reactions(): APIMessage['reactions'];
|
|
1419
|
+
/**
|
|
1420
|
+
* The webhook ID.
|
|
1421
|
+
*/
|
|
1422
|
+
get webhook_id(): APIMessage['webhook_id'];
|
|
1423
|
+
/**
|
|
1424
|
+
* The webhook ID.
|
|
1425
|
+
*
|
|
1426
|
+
* @seealso {@link webhook_id} for the raw data.
|
|
1427
|
+
*/
|
|
1428
|
+
get webhookId(): string | null;
|
|
1429
|
+
/**
|
|
1430
|
+
* The message's type.
|
|
1431
|
+
*
|
|
1432
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#message-object-message-types}
|
|
1433
|
+
*/
|
|
1434
|
+
get type(): import("discord-api-types/v10").MessageType;
|
|
1435
|
+
/**
|
|
1436
|
+
* The thread, if the message started one.
|
|
1437
|
+
*/
|
|
1438
|
+
get thread(): APIChannel | undefined;
|
|
1439
|
+
/**
|
|
1440
|
+
* The message flags combined as a bitfield.
|
|
1441
|
+
*
|
|
1442
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#message-object-message-flags}
|
|
1443
|
+
* @seealso {@link https://en.wikipedia.org/wiki/Bit_field}
|
|
1444
|
+
*/
|
|
1445
|
+
get flags(): import("discord-api-types/v10").MessageFlags | undefined;
|
|
1446
|
+
/**
|
|
1447
|
+
* The message's components, such as buttons, action rows, or other interactive components.
|
|
1448
|
+
*/
|
|
1449
|
+
get components(): import("discord-api-types/v10").APIMessageTopLevelComponent[];
|
|
1450
|
+
/**
|
|
1451
|
+
* The stickers the message contains, if any.
|
|
1452
|
+
*/
|
|
1453
|
+
get sticker_items(): import("discord-api-types/v10").APIStickerItem[] | undefined;
|
|
1454
|
+
/**
|
|
1455
|
+
* The stickers the message contains, if any.
|
|
1456
|
+
*
|
|
1457
|
+
* @seealso {@link sticker_items} for the raw data.
|
|
1458
|
+
*/
|
|
1459
|
+
get stickerItems(): import("discord-api-types/v10").APIStickerItem[];
|
|
1460
|
+
}
|
|
1461
|
+
//#endregion
|
|
1462
|
+
//#region src/lib/interactions/utils/util.d.ts
|
|
1463
|
+
declare function makeInteraction<T extends BaseInteractionType>(response: ServerResponse, interaction: T): TransformRaw<T>;
|
|
1464
|
+
type TransformRaw<T extends BaseInteractionType> = T extends AutocompleteInteraction$1.Type ? AutocompleteInteraction$1 : T extends ChatInputCommandInteraction.Type ? ChatInputCommandInteraction : T extends UserContextMenuCommandInteraction.Type ? UserContextMenuCommandInteraction : T extends MessageContextMenuCommandInteraction.Type ? MessageContextMenuCommandInteraction : T extends MessageComponentButtonInteraction.Type ? MessageComponentButtonInteraction : T extends MessageComponentChannelSelectInteraction.Type ? MessageComponentChannelSelectInteraction : T extends MessageComponentMentionableSelectInteraction.Type ? MessageComponentMentionableSelectInteraction : T extends MessageComponentRoleSelectInteraction.Type ? MessageComponentRoleSelectInteraction : T extends MessageComponentStringSelectInteraction.Type ? MessageComponentStringSelectInteraction : T extends MessageComponentUserSelectInteraction.Type ? MessageComponentUserSelectInteraction : T extends ModalSubmitInteraction.Type ? ModalSubmitInteraction : never;
|
|
1465
|
+
//#endregion
|
|
1466
|
+
//#region src/lib/interactions/router/CommandRouter.d.ts
|
|
1467
|
+
/**
|
|
1468
|
+
* Represents a command router that handles routing of interactions for a specific command.
|
|
1469
|
+
*
|
|
1470
|
+
* @since 2.0.0
|
|
1471
|
+
* @template Options - The options type for the command.
|
|
1472
|
+
*/
|
|
1473
|
+
declare class CommandRouter<Options extends Command.Options = Command.Options> {
|
|
1474
|
+
#private;
|
|
1475
|
+
constructor(command: Command<Options>);
|
|
1476
|
+
/**
|
|
1477
|
+
* The name of the registered chat input command for this command, if any.
|
|
1478
|
+
*
|
|
1479
|
+
* @since 2.0.0
|
|
1480
|
+
*/
|
|
1481
|
+
get chatInputName(): string | null;
|
|
1482
|
+
/**
|
|
1483
|
+
* The names of the registered context menu commands for this command, if any.
|
|
1484
|
+
*
|
|
1485
|
+
* @since 2.0.0
|
|
1486
|
+
*/
|
|
1487
|
+
get contextMenuNames(): string[];
|
|
1488
|
+
/**
|
|
1489
|
+
* Routes a chat input interaction based on the provided data.
|
|
1490
|
+
*
|
|
1491
|
+
* @since 2.0.0
|
|
1492
|
+
* @param data - The data of the chat input interaction.
|
|
1493
|
+
* @returns The mapped command name or `null` if no mapping is found.
|
|
1494
|
+
*/
|
|
1495
|
+
routeChatInputInteraction(data: APIChatInputApplicationCommandInteractionData): string | null;
|
|
1496
|
+
/**
|
|
1497
|
+
* Routes a context menu interaction based on the provided data.
|
|
1498
|
+
*
|
|
1499
|
+
* @since 2.0.0
|
|
1500
|
+
* @param data - The data for the context menu interaction.
|
|
1501
|
+
* @returns The result of the context menu interaction, or null if no result is found.
|
|
1502
|
+
*/
|
|
1503
|
+
routeContextMenuInteraction(data: APIContextMenuInteractionData): string | null;
|
|
1504
|
+
}
|
|
1505
|
+
//#endregion
|
|
1506
|
+
//#region src/lib/structures/Command.d.ts
|
|
1507
|
+
declare abstract class Command<Options extends Command.Options = Command.Options> extends Piece$1<Options, 'commands'> {
|
|
1508
|
+
/**
|
|
1509
|
+
* The router for the command.
|
|
1510
|
+
* @since 2.0.0
|
|
1511
|
+
*/
|
|
1512
|
+
readonly router: CommandRouter<Options>;
|
|
1513
|
+
constructor(context: Command.LoaderContext, options?: Options);
|
|
1514
|
+
/**
|
|
1515
|
+
* Gets the registry for this command.
|
|
1516
|
+
*
|
|
1517
|
+
* @returns The registry for this command, or `null` if it is not registered.
|
|
1518
|
+
*/
|
|
1519
|
+
get registry(): ApplicationCommandRegistryEntry | null;
|
|
1520
|
+
/**
|
|
1521
|
+
* Responds to the chat input command for this command
|
|
1522
|
+
*
|
|
1523
|
+
* @param interaction - The interaction to be handled.
|
|
1524
|
+
* @param args - The parsed arguments for this autocomplete interaction.
|
|
1525
|
+
*/
|
|
1526
|
+
chatInputRun(interaction: Command.ApplicationCommandInteraction, args: NonNullObject): Awaitable<unknown>;
|
|
1527
|
+
/**
|
|
1528
|
+
* Responds to an auto completable option for this command
|
|
1529
|
+
*
|
|
1530
|
+
* @param interaction - The interaction to be handled.
|
|
1531
|
+
* @param args - The parsed arguments for this autocomplete interaction.
|
|
1532
|
+
* @returns The response to the autocomplete interaction.
|
|
1533
|
+
*/
|
|
1534
|
+
autocompleteRun(interaction: Command.AutocompleteInteraction, args: Command.AutocompleteArguments<any>): Awaitable<unknown>;
|
|
1535
|
+
}
|
|
1536
|
+
declare namespace Command {
|
|
1537
|
+
type AutocompleteInteraction = Interactions.Autocomplete;
|
|
1538
|
+
type AutocompleteArguments<T extends object> = AutocompleteInteractionArguments<T>;
|
|
1539
|
+
type ChatInputInteraction = Interactions.ChatInputCommand;
|
|
1540
|
+
type UserInteraction = Interactions.UserContextMenuCommand;
|
|
1541
|
+
type MessageInteraction = Interactions.MessageContextMenuCommand;
|
|
1542
|
+
type ContextMenuInteraction = Interactions.ContextMenuCommand;
|
|
1543
|
+
type ApplicationCommandInteraction = Interactions.ApplicationCommand;
|
|
1544
|
+
type Interaction = ChatInputInteraction | AutocompleteInteraction | UserInteraction | MessageInteraction;
|
|
1545
|
+
type InteractionData = Interaction['data'];
|
|
1546
|
+
/** @deprecated Use {@linkcode LoaderContext} instead. */
|
|
1547
|
+
type Context = LoaderContext;
|
|
1548
|
+
type LoaderContext = Piece$1.LoaderContext<'commands'>;
|
|
1549
|
+
type JSON = Piece$1.JSON;
|
|
1550
|
+
type LocationJSON = Piece$1.LocationJSON;
|
|
1551
|
+
type Options = Piece$1.Options;
|
|
1552
|
+
}
|
|
1553
|
+
//#endregion
|
|
1554
|
+
//#region src/lib/structures/InteractionHandler.d.ts
|
|
1555
|
+
declare abstract class InteractionHandler<Options extends InteractionHandler.Options = InteractionHandler.Options> extends Piece$1<Options, 'interaction-handlers'> {
|
|
1556
|
+
constructor(context: InteractionHandler.LoaderContext, options?: Options);
|
|
1557
|
+
abstract run(interaction: InteractionHandler.Interaction, customIdValue: unknown): Awaited<unknown>;
|
|
1558
|
+
}
|
|
1559
|
+
declare namespace InteractionHandler {
|
|
1560
|
+
type ButtonInteraction = Interactions.MessageComponentButton;
|
|
1561
|
+
type SelectMenuInteraction = Interactions.MessageComponentSelectMenu;
|
|
1562
|
+
type ModalInteraction = Interactions.ModalSubmit;
|
|
1563
|
+
type MessageComponentInteraction = Interactions.MessageComponent;
|
|
1564
|
+
type ContextMenuInteraction = Interactions.ContextMenuCommand;
|
|
1565
|
+
type ApplicationCommandInteraction = Interactions.ApplicationCommand;
|
|
1566
|
+
type Interaction = Interactions.MessageComponent;
|
|
1567
|
+
type InteractionData = Interaction['data'];
|
|
1568
|
+
/** @deprecated Use {@linkcode LoaderContext} instead. */
|
|
1569
|
+
type Context = LoaderContext;
|
|
1570
|
+
type LoaderContext = Piece$1.LoaderContext<'interaction-handlers'>;
|
|
1571
|
+
type JSON = Piece$1.JSON;
|
|
1572
|
+
type LocationJSON = Piece$1.LocationJSON;
|
|
1573
|
+
type Options = Piece$1.Options;
|
|
1574
|
+
}
|
|
1575
|
+
//#endregion
|
|
1576
|
+
//#region src/lib/ClientEvents.d.ts
|
|
1577
|
+
interface ClientEventCommandContext {
|
|
1578
|
+
command: Command;
|
|
1579
|
+
interaction: APIApplicationCommandInteraction;
|
|
1580
|
+
response: ServerResponse;
|
|
1581
|
+
}
|
|
1582
|
+
interface ClientEventAutocompleteContext {
|
|
1583
|
+
command: Command;
|
|
1584
|
+
interaction: APIApplicationCommandAutocompleteInteraction;
|
|
1585
|
+
response: ServerResponse;
|
|
1586
|
+
}
|
|
1587
|
+
interface ClientEventInteractionHandlerContext {
|
|
1588
|
+
handler: InteractionHandler;
|
|
1589
|
+
interaction: APIMessageComponentInteraction | APIModalSubmitInteraction;
|
|
1590
|
+
response: ServerResponse;
|
|
1591
|
+
}
|
|
1592
|
+
interface ClientEvents {
|
|
1593
|
+
error: [error: unknown];
|
|
1594
|
+
commandNameMissing: [interaction: APIApplicationCommandAutocompleteInteraction, response: ServerResponse];
|
|
1595
|
+
commandNameUnknown: [interaction: APIApplicationCommandInteraction | APIApplicationCommandAutocompleteInteraction, response: ServerResponse];
|
|
1596
|
+
commandMethodUnknown: [context: ClientEventCommandContext];
|
|
1597
|
+
commandRun: [context: ClientEventCommandContext];
|
|
1598
|
+
commandSuccess: [context: ClientEventCommandContext, value: unknown];
|
|
1599
|
+
commandError: [error: unknown, context: ClientEventCommandContext];
|
|
1600
|
+
commandFinish: [context: ClientEventCommandContext];
|
|
1601
|
+
autocompleteRun: [context: ClientEventAutocompleteContext];
|
|
1602
|
+
autocompleteSuccess: [context: ClientEventAutocompleteContext, value: unknown];
|
|
1603
|
+
autocompleteError: [error: unknown, context: ClientEventAutocompleteContext];
|
|
1604
|
+
autocompleteFinish: [context: ClientEventAutocompleteContext];
|
|
1605
|
+
interactionHandlerNameInvalid: [interaction: APIMessageComponentInteraction | APIModalSubmitInteraction, response: ServerResponse];
|
|
1606
|
+
interactionHandlerNameUnknown: [interaction: APIMessageComponentInteraction | APIModalSubmitInteraction, response: ServerResponse];
|
|
1607
|
+
interactionHandlerRun: [context: ClientEventInteractionHandlerContext];
|
|
1608
|
+
interactionHandlerSuccess: [context: ClientEventInteractionHandlerContext, value: unknown];
|
|
1609
|
+
interactionHandlerError: [error: unknown, context: ClientEventInteractionHandlerContext];
|
|
1610
|
+
interactionHandlerFinish: [context: ClientEventInteractionHandlerContext];
|
|
1611
|
+
}
|
|
1612
|
+
type MappedClientEvents = { [K in keyof ClientEvents]: ClientEvents[K] };
|
|
1613
|
+
//#endregion
|
|
1614
|
+
//#region src/lib/components/IIdParser.d.ts
|
|
1615
|
+
interface IIdParser {
|
|
1616
|
+
run(customId: string): IdParserRead | null;
|
|
1617
|
+
}
|
|
1618
|
+
interface IdParserRead {
|
|
1619
|
+
name: string;
|
|
1620
|
+
content: unknown;
|
|
1621
|
+
}
|
|
1622
|
+
//#endregion
|
|
1623
|
+
//#region src/lib/structures/InteractionHandlerStore.d.ts
|
|
1624
|
+
declare class InteractionHandlerStore extends Store$1<InteractionHandler, 'interaction-handlers'> {
|
|
1625
|
+
constructor();
|
|
1626
|
+
runHandler(response: ServerResponse, interaction: APIMessageComponentInteraction | APIModalSubmitInteraction): Promise<ServerResponse>;
|
|
1627
|
+
}
|
|
1628
|
+
//#endregion
|
|
1629
|
+
//#region src/lib/structures/Listener.d.ts
|
|
1630
|
+
declare abstract class Listener<Options extends Listener.Options = Listener.Options> extends Piece$1<Options, 'listeners'> {
|
|
1631
|
+
emitter: Listener.Emitter;
|
|
1632
|
+
event: string;
|
|
1633
|
+
protected _listener: (...args: readonly any[]) => unknown;
|
|
1634
|
+
constructor(context: Listener.LoaderContext, options: Options);
|
|
1635
|
+
abstract run(...args: readonly any[]): Awaitable<unknown>;
|
|
1636
|
+
}
|
|
1637
|
+
declare namespace Listener {
|
|
1638
|
+
/** @deprecated Use {@linkcode LoaderContext} instead. */
|
|
1639
|
+
type Context = LoaderContext;
|
|
1640
|
+
type LoaderContext = Piece$1.LoaderContext<'listeners'>;
|
|
1641
|
+
type JSON = Piece$1.JSON;
|
|
1642
|
+
type LocationJSON = Piece$1.LocationJSON;
|
|
1643
|
+
interface Options extends Piece$1.Options {
|
|
1644
|
+
emitter: Emitter | { [K in keyof Container]: Container[K] extends Emitter ? K : never }[keyof Container];
|
|
1645
|
+
event?: string;
|
|
1646
|
+
}
|
|
1647
|
+
interface Emitter {
|
|
1648
|
+
on(eventName: string, listener: (...args: any[]) => void): this;
|
|
1649
|
+
once(eventName: string, listener: (...args: any[]) => void): this;
|
|
1650
|
+
off(eventName: string, listener: (...args: any[]) => void): this;
|
|
1651
|
+
setMaxListeners(n: number): this;
|
|
1652
|
+
getMaxListeners(): number;
|
|
1653
|
+
emit(eventName: string, ...args: any[]): boolean;
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
//#endregion
|
|
1657
|
+
//#region src/lib/structures/ListenerStore.d.ts
|
|
1658
|
+
declare class ListenerStore extends Store$1<Listener, 'listeners'> {
|
|
1659
|
+
constructor();
|
|
1660
|
+
}
|
|
1661
|
+
//#endregion
|
|
1662
|
+
//#region src/lib/utils/security.d.ts
|
|
1663
|
+
type Key = webcrypto.CryptoKey;
|
|
1664
|
+
//#endregion
|
|
1665
|
+
//#region src/lib/Client.d.ts
|
|
1666
|
+
declare class Client extends AsyncEventEmitter<MappedClientEvents> {
|
|
1667
|
+
#private;
|
|
1668
|
+
server: Server;
|
|
1669
|
+
readonly id: string;
|
|
1670
|
+
readonly bodySizeLimit: number;
|
|
1671
|
+
readonly httpReplyOnError: boolean;
|
|
1672
|
+
constructor(options?: ClientOptions);
|
|
1673
|
+
/**
|
|
1674
|
+
* Gets the application command registry.
|
|
1675
|
+
*
|
|
1676
|
+
* @since 2.0.0
|
|
1677
|
+
* @returns The application command registry.
|
|
1678
|
+
*/
|
|
1679
|
+
get registry(): ApplicationCommandRegistry;
|
|
1680
|
+
/**
|
|
1681
|
+
* Loads all the commands.
|
|
1682
|
+
* @param options The load options.
|
|
1683
|
+
*/
|
|
1684
|
+
load(options?: LoadOptions): Promise<void>;
|
|
1685
|
+
/**
|
|
1686
|
+
* Starts the HTTP server, listening for HTTP interactions.
|
|
1687
|
+
* @param options The listen options.
|
|
1688
|
+
*/
|
|
1689
|
+
listen({
|
|
1690
|
+
serverOptions,
|
|
1691
|
+
postPath,
|
|
1692
|
+
port,
|
|
1693
|
+
address,
|
|
1694
|
+
...listenOptions
|
|
1695
|
+
}: ListenOptions): Promise<void>;
|
|
1696
|
+
protected handleRawHttpMessage(request: IncomingMessage, response: ServerResponse, path: string, key: Key): Promise<ServerResponse<IncomingMessage>>;
|
|
1697
|
+
protected handleHttpMessage(interaction: Exclude<APIInteraction, APIPrimaryEntryPointCommandInteraction>, response: ServerResponse): Promise<ServerResponse>;
|
|
1698
|
+
}
|
|
1699
|
+
interface ClientOptions {
|
|
1700
|
+
/**
|
|
1701
|
+
* The public key from Discord, available under "General Information" after opening an application from
|
|
1702
|
+
* [Discord's applications](https://discord.com/developers/applications).
|
|
1703
|
+
*
|
|
1704
|
+
* @default process.env.DISCORD_PUBLIC_KEY
|
|
1705
|
+
*/
|
|
1706
|
+
discordPublicKey?: string;
|
|
1707
|
+
/**
|
|
1708
|
+
* The Discord token used for authenticating requests outside of interaction responses.
|
|
1709
|
+
*
|
|
1710
|
+
* @default process.env.DISCORD_TOKEN
|
|
1711
|
+
*/
|
|
1712
|
+
discordToken?: string;
|
|
1713
|
+
/**
|
|
1714
|
+
* The options to be passed to the underlying REST library.
|
|
1715
|
+
*/
|
|
1716
|
+
restOptions?: Partial<RESTOptions>;
|
|
1717
|
+
/**
|
|
1718
|
+
* The body size limit in bytes.
|
|
1719
|
+
* @default 1024 * 1024 // (1 MiB)
|
|
1720
|
+
*/
|
|
1721
|
+
bodySizeLimit?: number;
|
|
1722
|
+
/**
|
|
1723
|
+
* Whether to reply with a 500 status code to Discord if an error occurs while processing an interaction.
|
|
1724
|
+
* @default true
|
|
1725
|
+
*/
|
|
1726
|
+
httpReplyOnError?: boolean;
|
|
1727
|
+
/**
|
|
1728
|
+
* The ID of the client.
|
|
1729
|
+
*
|
|
1730
|
+
* @default process.env.DISCORD_CLIENT_ID ?? Buffer.from(token.split('.')[0], 'base64').toString()
|
|
1731
|
+
*/
|
|
1732
|
+
clientId?: string;
|
|
1733
|
+
/**
|
|
1734
|
+
* The prefix to use for authentication in REST calls.
|
|
1735
|
+
* @default 'Bot'
|
|
1736
|
+
* @since 2.0.0
|
|
1737
|
+
*/
|
|
1738
|
+
authPrefix?: RequestAuthPrefix;
|
|
1739
|
+
}
|
|
1740
|
+
interface LoadOptions {
|
|
1741
|
+
/**
|
|
1742
|
+
* The base user directory, if set to `null`, the library will not call {@link StoreRegistry.registerPath},
|
|
1743
|
+
* meaning that you will need to manually set each folder for each store. Please read the aforementioned method's
|
|
1744
|
+
* documentation for more information.
|
|
1745
|
+
*/
|
|
1746
|
+
baseUserDirectory?: string | null;
|
|
1747
|
+
}
|
|
1748
|
+
interface ListenOptions extends Omit<ListenOptions$1, 'path' | 'readableAll' | 'writableAll'> {
|
|
1749
|
+
/**
|
|
1750
|
+
* The port at which the server will listen for requests.
|
|
1751
|
+
*/
|
|
1752
|
+
port: number;
|
|
1753
|
+
/**
|
|
1754
|
+
* The address at which the server will be started.
|
|
1755
|
+
*/
|
|
1756
|
+
address?: string;
|
|
1757
|
+
/**
|
|
1758
|
+
* The path the HTTP server will listen to.
|
|
1759
|
+
* @default process.env.HTTP_POST_PATH ?? '/'
|
|
1760
|
+
*/
|
|
1761
|
+
postPath?: `/${string}`;
|
|
1762
|
+
/**
|
|
1763
|
+
* The options to pass to the `createServer` function.
|
|
1764
|
+
*/
|
|
1765
|
+
serverOptions?: ServerOptions;
|
|
1766
|
+
}
|
|
1767
|
+
declare namespace Client {
|
|
1768
|
+
type Options = ClientOptions;
|
|
1769
|
+
type PieceLoadOptions = LoadOptions;
|
|
1770
|
+
type ServerListenOptions = ListenOptions;
|
|
1771
|
+
}
|
|
1772
|
+
declare module '@sapphire/pieces' {
|
|
1773
|
+
interface StoreRegistryEntries {
|
|
1774
|
+
commands: CommandStore;
|
|
1775
|
+
'interaction-handlers': InteractionHandlerStore;
|
|
1776
|
+
listeners: ListenerStore;
|
|
1777
|
+
}
|
|
1778
|
+
interface Container {
|
|
1779
|
+
client: Client;
|
|
1780
|
+
idParser: IIdParser;
|
|
1781
|
+
rest: REST;
|
|
1782
|
+
applicationCommandRegistry: ApplicationCommandRegistry;
|
|
1783
|
+
}
|
|
1784
|
+
} //# sourceMappingURL=Client.d.ts.map
|
|
1785
|
+
//#endregion
|
|
1786
|
+
//#region src/lib/api/HttpCodes.d.ts
|
|
1787
|
+
declare enum HttpCodes {
|
|
1788
|
+
/**
|
|
1789
|
+
* Standard response for successful HTTP requests. The actual response will
|
|
1790
|
+
* depend on the request method used. In a GET request, the response will
|
|
1791
|
+
* contain an entity corresponding to the requested resource. In a POST
|
|
1792
|
+
* request, the response will contain an entity describing or containing the
|
|
1793
|
+
* result of the action.
|
|
1794
|
+
*/
|
|
1795
|
+
OK = 200,
|
|
1796
|
+
/**
|
|
1797
|
+
* The request has been fulfilled, resulting in the creation of a new
|
|
1798
|
+
* resource.
|
|
1799
|
+
*/
|
|
1800
|
+
Created = 201,
|
|
1801
|
+
/**
|
|
1802
|
+
* The request has been accepted for processing, but the processing has not
|
|
1803
|
+
* been completed. The request might or might not be eventually acted upon,
|
|
1804
|
+
* and may be disallowed when processing occurs.
|
|
1805
|
+
*/
|
|
1806
|
+
Accepted = 202,
|
|
1807
|
+
/**
|
|
1808
|
+
* The server is a transforming proxy (e.g. a Web accelerator) that received
|
|
1809
|
+
* a 200 OK from its origin, but is returning a modified version of the
|
|
1810
|
+
* origin's response.
|
|
1811
|
+
*/
|
|
1812
|
+
NonAuthoritativeInformation = 203,
|
|
1813
|
+
/**
|
|
1814
|
+
* The server successfully processed the request, and is not returning any
|
|
1815
|
+
* content.
|
|
1816
|
+
*/
|
|
1817
|
+
NoContent = 204,
|
|
1818
|
+
/**
|
|
1819
|
+
* The server successfully processed the request, asks that the requester
|
|
1820
|
+
* reset its document view, and is not returning any content.
|
|
1821
|
+
*/
|
|
1822
|
+
ResetContent = 205,
|
|
1823
|
+
/**
|
|
1824
|
+
* (RFC 7233) The server is delivering only part of the resource (byte
|
|
1825
|
+
* serving) due to a range header sent by the client. The range header is
|
|
1826
|
+
* used by HTTP clients to enable resuming of interrupted downloads, or
|
|
1827
|
+
* split a download into multiple simultaneous streams.
|
|
1828
|
+
*/
|
|
1829
|
+
PartialContent = 206,
|
|
1830
|
+
/**
|
|
1831
|
+
* (WebDAV; RFC 4918) The message body that follows is by default an XML
|
|
1832
|
+
* message and can contain a number of separate response codes, depending on
|
|
1833
|
+
* how many sub-requests were made.
|
|
1834
|
+
*/
|
|
1835
|
+
MultiStatus = 207,
|
|
1836
|
+
/**
|
|
1837
|
+
* (WebDAV; RFC 5842) The members of a DAV binding have already been
|
|
1838
|
+
* enumerated in a preceding part of the (multistatus) response, and are not
|
|
1839
|
+
* being included again.
|
|
1840
|
+
*/
|
|
1841
|
+
AlreadyReported = 208,
|
|
1842
|
+
/**
|
|
1843
|
+
* (RFC 3229) The server has fulfilled a request for the resource, and the
|
|
1844
|
+
* response is a representation of the result of one or more
|
|
1845
|
+
* instance-manipulations applied to the current instance.
|
|
1846
|
+
*/
|
|
1847
|
+
IMUsed = 226,
|
|
1848
|
+
/**
|
|
1849
|
+
* Indicates multiple options for the resource from which the client may
|
|
1850
|
+
* choose (via agent-driven content negotiation). For example, this code
|
|
1851
|
+
* could be used to present multiple video format options, to list files
|
|
1852
|
+
* with different filename extensions, or to suggest word-sense
|
|
1853
|
+
* disambiguation.
|
|
1854
|
+
*/
|
|
1855
|
+
MultipleChoices = 300,
|
|
1856
|
+
/**
|
|
1857
|
+
* This and all future requests should be directed to the given URI.
|
|
1858
|
+
*/
|
|
1859
|
+
MovedPermanently = 301,
|
|
1860
|
+
/**
|
|
1861
|
+
* (Previously "Moved temporarily") Tells the client to look at (browse to)
|
|
1862
|
+
* another URL. 302 has been superseded by 303 and 307. This is an example
|
|
1863
|
+
* of industry practice contradicting the standard. The HTTP/1.0
|
|
1864
|
+
* specification (RFC 1945) required the client to perform a temporary
|
|
1865
|
+
* redirect (the original describing phrase was "Moved Temporarily"), but
|
|
1866
|
+
* popular browsers implemented 302 with the functionality of a 303 See
|
|
1867
|
+
* Other. Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish
|
|
1868
|
+
* between the two behaviours. However, some Web applications and frameworks
|
|
1869
|
+
* use the 302 status code as if it were the 303.
|
|
1870
|
+
*/
|
|
1871
|
+
Found = 302,
|
|
1872
|
+
/**
|
|
1873
|
+
* The response to the request can be found under another URI using the GET
|
|
1874
|
+
* method. When received in response to a POST (or PUT/DELETE), the client
|
|
1875
|
+
* should presume that the server has received the data and should issue a
|
|
1876
|
+
* new GET request to the given URI.
|
|
1877
|
+
*/
|
|
1878
|
+
SeeOther = 303,
|
|
1879
|
+
/**
|
|
1880
|
+
* (RFC 7232) Indicates that the resource has not been modified since the
|
|
1881
|
+
* version specified by the request headers If-Modified-Since or
|
|
1882
|
+
* If-None-Match. In such case, there is no need to retransmit the resource
|
|
1883
|
+
* since the client still has a previously-downloaded copy.
|
|
1884
|
+
*/
|
|
1885
|
+
NotModified = 304,
|
|
1886
|
+
/**
|
|
1887
|
+
* The requested resource is available only through a proxy, the address for
|
|
1888
|
+
* which is provided in the response. For security reasons, many HTTP
|
|
1889
|
+
* clients (such as Mozilla Firefox and Internet Explorer) do not obey this
|
|
1890
|
+
* status code.
|
|
1891
|
+
*/
|
|
1892
|
+
UseProxy = 305,
|
|
1893
|
+
/**
|
|
1894
|
+
* No longer used. Originally meant "Subsequent requests should use the
|
|
1895
|
+
* specified proxy.".
|
|
1896
|
+
*/
|
|
1897
|
+
SwitchProxy = 306,
|
|
1898
|
+
/**
|
|
1899
|
+
* In this case, the request should be repeated with another URI; however,
|
|
1900
|
+
* future requests should still use the original URI. In contrast to how 302
|
|
1901
|
+
* was historically implemented, the request method is not allowed to be
|
|
1902
|
+
* changed when reissuing the original request. For example, a POST request
|
|
1903
|
+
* should be repeated using another POST request.
|
|
1904
|
+
*/
|
|
1905
|
+
TemporaryRedirect = 307,
|
|
1906
|
+
/**
|
|
1907
|
+
* (RFC 7538) The request and all future requests should be repeated using
|
|
1908
|
+
* another URI. 307 and 308 parallel the behaviors of 302 and 301, but do
|
|
1909
|
+
* not allow the HTTP method to change. So, for example, submitting a form
|
|
1910
|
+
* to a permanently redirected resource may continue smoothly.
|
|
1911
|
+
*/
|
|
1912
|
+
PermanentRedirect = 308,
|
|
1913
|
+
/**
|
|
1914
|
+
* The server cannot or will not process the request due to an apparent
|
|
1915
|
+
* client error (e.g., malformed request syntax, size too large, invalid
|
|
1916
|
+
* request message framing, or deceptive request routing).
|
|
1917
|
+
*/
|
|
1918
|
+
BadRequest = 400,
|
|
1919
|
+
/**
|
|
1920
|
+
* (RFC 7235) Similar to 403 Forbidden, but specifically for use when
|
|
1921
|
+
* authentication is required and has failed or has not yet been provided.
|
|
1922
|
+
* The response must include a WWW-Authenticate header field containing a
|
|
1923
|
+
* challenge applicable to the requested resource. See Basic access
|
|
1924
|
+
* authentication and Digest access authentication. 401 semantically means
|
|
1925
|
+
* "unauthorised", the user does not have valid authentication credentials
|
|
1926
|
+
* for the target resource.
|
|
1927
|
+
*/
|
|
1928
|
+
Unauthorized = 401,
|
|
1929
|
+
/**
|
|
1930
|
+
* Reserved for future use. The original intention was that this code might
|
|
1931
|
+
* be used as part of some form of digital cash or micropayment scheme, as
|
|
1932
|
+
* proposed, for example, by GNU Taler, but that has not yet happened, and
|
|
1933
|
+
* this code is not widely used. Google Developers API uses this status if a
|
|
1934
|
+
* particular developer has exceeded the daily limit on requests. Sipgate
|
|
1935
|
+
* uses this code if an account does not have sufficient funds to start a
|
|
1936
|
+
* call. Shopify uses this code when the store has not paid their fees and
|
|
1937
|
+
* is temporarily disabled. Stripe uses this code for failed payments where
|
|
1938
|
+
* parameters were correct, for example blocked fraudulent payments.
|
|
1939
|
+
*/
|
|
1940
|
+
PaymentRequired = 402,
|
|
1941
|
+
/**
|
|
1942
|
+
* The request contained valid data and was understood by the server, but
|
|
1943
|
+
* the server is refusing action. This may be due to the user not having the
|
|
1944
|
+
* necessary permissions for a resource or needing an account of some sort,
|
|
1945
|
+
* or attempting a prohibited action (e.g. creating a duplicate record
|
|
1946
|
+
* where only one is allowed). This code is also typically used if the
|
|
1947
|
+
* request provided authentication by answering the WWW-Authenticate header
|
|
1948
|
+
* field challenge, but the server did not accept that authentication. The
|
|
1949
|
+
* request should not be repeated.
|
|
1950
|
+
*/
|
|
1951
|
+
Forbidden = 403,
|
|
1952
|
+
/**
|
|
1953
|
+
* The requested resource could not be found but may be available in the
|
|
1954
|
+
* future. Subsequent requests by the client are permissible.
|
|
1955
|
+
*/
|
|
1956
|
+
NotFound = 404,
|
|
1957
|
+
/**
|
|
1958
|
+
* A request method is not supported for the requested resource; for example,
|
|
1959
|
+
* a GET request on a form that requires data to be presented via POST, or a
|
|
1960
|
+
* PUT request on a read-only resource.
|
|
1961
|
+
*/
|
|
1962
|
+
MethodNotAllowed = 405,
|
|
1963
|
+
/**
|
|
1964
|
+
* The requested resource is capable of generating only content not
|
|
1965
|
+
* acceptable according to the Accept headers sent in the request. See Content negotiation.
|
|
1966
|
+
*/
|
|
1967
|
+
NotAcceptable = 406,
|
|
1968
|
+
/**
|
|
1969
|
+
* (RFC 7235) The client must first authenticate itself with the proxy.
|
|
1970
|
+
*/
|
|
1971
|
+
ProxyAuthenticationRequired = 407,
|
|
1972
|
+
/**
|
|
1973
|
+
* The server timed out waiting for the request. According to HTTP
|
|
1974
|
+
* specifications: "The client did not produce a request within the time
|
|
1975
|
+
* that the server was prepared to wait. The client MAY repeat the request
|
|
1976
|
+
* without modifications at any later time."
|
|
1977
|
+
*/
|
|
1978
|
+
RequestTimeout = 408,
|
|
1979
|
+
/**
|
|
1980
|
+
* Indicates that the request could not be processed because of conflict in
|
|
1981
|
+
* the current state of the resource, such as an edit conflict between
|
|
1982
|
+
* multiple simultaneous updates.
|
|
1983
|
+
*/
|
|
1984
|
+
Conflict = 409,
|
|
1985
|
+
/**
|
|
1986
|
+
* Indicates that the resource requested is no longer available and will not
|
|
1987
|
+
* be available again. This should be used when a resource has been
|
|
1988
|
+
* intentionally removed and the resource should be purged. Upon receiving a
|
|
1989
|
+
* 410 status code, the client should not request the resource in the future.
|
|
1990
|
+
* Clients such as search engines should remove the resource from their
|
|
1991
|
+
* indices. Most use cases do not require clients and search engines to
|
|
1992
|
+
* purge the resource, and a "404 Not Found" may be used instead.
|
|
1993
|
+
*/
|
|
1994
|
+
Gone = 410,
|
|
1995
|
+
/**
|
|
1996
|
+
* The request did not specify the length of its content, which is required
|
|
1997
|
+
* by the requested resource.
|
|
1998
|
+
*/
|
|
1999
|
+
LengthRequired = 411,
|
|
2000
|
+
/**
|
|
2001
|
+
* (RFC 7232) The server does not meet one of the preconditions that the
|
|
2002
|
+
* requester put on the request header fields.
|
|
2003
|
+
*/
|
|
2004
|
+
PreconditionFailed = 412,
|
|
2005
|
+
/**
|
|
2006
|
+
* (RFC 7231) The request is larger than the server is willing or able to
|
|
2007
|
+
* process. Previously called "Request Entity Too Large".
|
|
2008
|
+
*/
|
|
2009
|
+
PayloadTooLarge = 413,
|
|
2010
|
+
/**
|
|
2011
|
+
* (RFC 7231) The URI provided was too long for the server to process. Often
|
|
2012
|
+
* the result of too much data being encoded as a query-string of a GET
|
|
2013
|
+
* request, in which case it should be converted to a POST request. Called
|
|
2014
|
+
* "Request-URI Too Long" previously.
|
|
2015
|
+
*/
|
|
2016
|
+
URITooLong = 414,
|
|
2017
|
+
/**
|
|
2018
|
+
* (RFC 7231) The request entity has a media type which the server or
|
|
2019
|
+
* resource does not support. For example, the client uploads an image as
|
|
2020
|
+
* image/svg+xml, but the server requires that images use a different format.
|
|
2021
|
+
*/
|
|
2022
|
+
UnsupportedMediaType = 415,
|
|
2023
|
+
/**
|
|
2024
|
+
* (RFC 7233) The client has asked for a portion of the file (byte serving),
|
|
2025
|
+
* but the server cannot supply that portion. For example, if the client
|
|
2026
|
+
* asked for a part of the file that lies beyond the end of the file. Called
|
|
2027
|
+
* "Requested Range Not Satisfiable" previously.
|
|
2028
|
+
*/
|
|
2029
|
+
RangeNotSatisfiable = 416,
|
|
2030
|
+
/**
|
|
2031
|
+
* The server cannot meet the requirements of the Expect request-header
|
|
2032
|
+
* field.
|
|
2033
|
+
*/
|
|
2034
|
+
ExpectationFailed = 417,
|
|
2035
|
+
/**
|
|
2036
|
+
* (RFC 2324, RFC 7168) This code was defined in 1998 as one of the
|
|
2037
|
+
* traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot
|
|
2038
|
+
* Control Protocol, and is not expected to be implemented by actual HTTP
|
|
2039
|
+
* servers. The RFC specifies this code should be returned by teapots
|
|
2040
|
+
* requested to brew coffee. This HTTP status is used as an Easter egg in
|
|
2041
|
+
* some websites, such as Google.com's I'm a teapot easter egg.
|
|
2042
|
+
*/
|
|
2043
|
+
IAmATeapot = 418,
|
|
2044
|
+
/**
|
|
2045
|
+
* Returned by the Twitter Search and Trends API when the client is being rate limited.
|
|
2046
|
+
* The text is a quote from 'Demolition Man' and the '420' code is likely a reference
|
|
2047
|
+
* to this number's association with marijuana. Other services may wish to implement
|
|
2048
|
+
* the 429 Too Many Requests response code instead.
|
|
2049
|
+
*/
|
|
2050
|
+
EnhanceYourCalm = 420,
|
|
2051
|
+
/**
|
|
2052
|
+
* (RFC 7540) The request was directed at a server that is not able to
|
|
2053
|
+
* produce a response (for example because of connection reuse).
|
|
2054
|
+
*/
|
|
2055
|
+
MisdirectedRequest = 421,
|
|
2056
|
+
/**
|
|
2057
|
+
* (WebDAV; RFC 4918) The request was well-formed but was unable to be
|
|
2058
|
+
* followed due to semantic errors.
|
|
2059
|
+
*/
|
|
2060
|
+
UnprocessableEntity = 422,
|
|
2061
|
+
/**
|
|
2062
|
+
* (WebDAV; RFC 4918) The resource that is being accessed is locked.
|
|
2063
|
+
*/
|
|
2064
|
+
Locked = 423,
|
|
2065
|
+
/**
|
|
2066
|
+
* (WebDAV; RFC 4918) The request failed because it depended on another
|
|
2067
|
+
* request and that request failed (e.g., a PROPPATCH).
|
|
2068
|
+
*/
|
|
2069
|
+
FailedDependency = 424,
|
|
2070
|
+
/**
|
|
2071
|
+
* (RFC 8470) Indicates that the server is unwilling to risk processing a
|
|
2072
|
+
* request that might be replayed.
|
|
2073
|
+
*/
|
|
2074
|
+
TooEarly = 425,
|
|
2075
|
+
/**
|
|
2076
|
+
* The client should switch to a different protocol such as TLS/1.0, given
|
|
2077
|
+
* in the Upgrade header field.
|
|
2078
|
+
*/
|
|
2079
|
+
UpgradeRequired = 426,
|
|
2080
|
+
/**
|
|
2081
|
+
* (RFC 6585) The origin server requires the request to be conditional.
|
|
2082
|
+
* Intended to prevent the 'lost update' problem, where a client GETs a
|
|
2083
|
+
* resource's state, modifies it, and PUTs it back to the server, when
|
|
2084
|
+
* meanwhile a third party has modified the state on the server, leading to
|
|
2085
|
+
* a conflict.
|
|
2086
|
+
*/
|
|
2087
|
+
PreconditionRequired = 428,
|
|
2088
|
+
/**
|
|
2089
|
+
* (RFC 6585) The user has sent too many requests in a given amount of time.
|
|
2090
|
+
* Intended for use with rate-limiting schemes.
|
|
2091
|
+
*/
|
|
2092
|
+
TooManyRequests = 429,
|
|
2093
|
+
/**
|
|
2094
|
+
* (RFC 6585) The server is unwilling to process the request because either
|
|
2095
|
+
* an individual header field, or all the header fields collectively, are
|
|
2096
|
+
* too large.
|
|
2097
|
+
*/
|
|
2098
|
+
RequestHeaderFieldsTooLarge = 431,
|
|
2099
|
+
/**
|
|
2100
|
+
* (RFC 7725) A server operator has received a legal demand to deny access
|
|
2101
|
+
* to a resource or to a set of resources that includes the requested
|
|
2102
|
+
* resource. The code 451 was chosen as a reference to the novel Fahrenheit
|
|
2103
|
+
* 451 (see the Acknowledgements in the RFC).
|
|
2104
|
+
*/
|
|
2105
|
+
UnavailableForLegalReasons = 451,
|
|
2106
|
+
/**
|
|
2107
|
+
* A generic error message, given when an unexpected condition was
|
|
2108
|
+
* encountered and no more specific message is suitable.
|
|
2109
|
+
*/
|
|
2110
|
+
InternalServerError = 500,
|
|
2111
|
+
/**
|
|
2112
|
+
* The server either does not recognize the request method, or it lacks the
|
|
2113
|
+
* ability to fulfil the request. Usually this implies future availability
|
|
2114
|
+
* (e.g., a new feature of a web-service API).
|
|
2115
|
+
*/
|
|
2116
|
+
NotImplemented = 501,
|
|
2117
|
+
/**
|
|
2118
|
+
* The server was acting as a gateway or proxy and received an invalid
|
|
2119
|
+
* response from the upstream server.
|
|
2120
|
+
*/
|
|
2121
|
+
BadGateway = 502,
|
|
2122
|
+
/**
|
|
2123
|
+
* The server cannot handle the request (because it is overloaded or down
|
|
2124
|
+
* for maintenance). Generally, this is a temporary state.
|
|
2125
|
+
*/
|
|
2126
|
+
ServiceUnavailable = 503,
|
|
2127
|
+
/**
|
|
2128
|
+
* The server was acting as a gateway or proxy and did not receive a timely
|
|
2129
|
+
* response from the upstream server.
|
|
2130
|
+
*/
|
|
2131
|
+
GatewayTimeout = 504,
|
|
2132
|
+
/**
|
|
2133
|
+
* The server does not support the HTTP protocol version used in the request.
|
|
2134
|
+
*/
|
|
2135
|
+
HTTPVersionNotSupported = 505,
|
|
2136
|
+
/**
|
|
2137
|
+
* (RFC 2295) Transparent content negotiation for the request results in a
|
|
2138
|
+
* circular reference.
|
|
2139
|
+
*/
|
|
2140
|
+
VariantAlsoNegotiates = 506,
|
|
2141
|
+
/**
|
|
2142
|
+
* (WebDAV; RFC 4918) The server is unable to store the representation
|
|
2143
|
+
* needed to complete the request.
|
|
2144
|
+
*/
|
|
2145
|
+
InsufficientStorage = 507,
|
|
2146
|
+
/**
|
|
2147
|
+
* (WebDAV; RFC 5842) The server detected an infinite loop while processing
|
|
2148
|
+
* the request (sent instead of 208 Already Reported).
|
|
2149
|
+
*/
|
|
2150
|
+
LoopDetected = 508,
|
|
2151
|
+
/**
|
|
2152
|
+
* (RFC 2774) Further extensions to the request are required for the server
|
|
2153
|
+
* to fulfil it.
|
|
2154
|
+
*/
|
|
2155
|
+
NotExtended = 510,
|
|
2156
|
+
/**
|
|
2157
|
+
* (RFC 6585) The client needs to authenticate to gain network access.
|
|
2158
|
+
* Intended for use by intercepting proxies used to control access to the
|
|
2159
|
+
* network (e.g., "captive portals" used to require agreement to Terms of
|
|
2160
|
+
* Service before granting full Internet access via a Wi-Fi hotspot).
|
|
2161
|
+
*/
|
|
2162
|
+
NetworkAuthenticationRequired = 511
|
|
2163
|
+
}
|
|
2164
|
+
//#endregion
|
|
2165
|
+
//#region src/lib/components/StringIdParser.d.ts
|
|
2166
|
+
declare class StringIdParser implements IIdParser {
|
|
2167
|
+
run(customId: string): IdParserRead | null;
|
|
2168
|
+
}
|
|
2169
|
+
//#endregion
|
|
2170
|
+
//#region src/lib/structures/CommandLoaderStrategy.d.ts
|
|
2171
|
+
/**
|
|
2172
|
+
* Represents a strategy for loading and unloading commands.
|
|
2173
|
+
*
|
|
2174
|
+
* @since 2.0.0
|
|
2175
|
+
*/
|
|
2176
|
+
declare class CommandLoaderStrategy extends LoaderStrategy<Command> {
|
|
2177
|
+
/**
|
|
2178
|
+
* Called when a command is loaded.
|
|
2179
|
+
*
|
|
2180
|
+
* @since 2.0.0
|
|
2181
|
+
* @param store - The command store.
|
|
2182
|
+
* @param piece - The command being loaded.
|
|
2183
|
+
* @returns The loaded command.
|
|
2184
|
+
*/
|
|
2185
|
+
onLoad(store: CommandStore, piece: Command): Command<import("@sapphire/pieces").PieceOptions>;
|
|
2186
|
+
/**
|
|
2187
|
+
* Called when a command is unloaded.
|
|
2188
|
+
*
|
|
2189
|
+
* @since 2.0.0
|
|
2190
|
+
* @param store - The command store.
|
|
2191
|
+
* @param piece - The command being unloaded.
|
|
2192
|
+
* @returns The unloaded command.
|
|
2193
|
+
*/
|
|
2194
|
+
onUnload(store: CommandStore, piece: Command): Command<import("@sapphire/pieces").PieceOptions>;
|
|
2195
|
+
}
|
|
2196
|
+
//#endregion
|
|
2197
|
+
//#region src/lib/structures/ListenerLoaderStrategy.d.ts
|
|
2198
|
+
/**
|
|
2199
|
+
* Represents a strategy for loading and unloading listeners.
|
|
2200
|
+
*
|
|
2201
|
+
* @since 2.1.0
|
|
2202
|
+
*/
|
|
2203
|
+
declare class ListenerLoaderStrategy extends LoaderStrategy<Listener> {
|
|
2204
|
+
/**
|
|
2205
|
+
* Called when a listener is loaded.
|
|
2206
|
+
*
|
|
2207
|
+
* @since 2.1.0
|
|
2208
|
+
* @param store - The listener store.
|
|
2209
|
+
* @param piece - The listener being loaded.
|
|
2210
|
+
* @returns The loaded listener.
|
|
2211
|
+
*/
|
|
2212
|
+
onLoad(_store: ListenerStore, piece: Listener): void;
|
|
2213
|
+
/**
|
|
2214
|
+
* Called when a listener is unloaded.
|
|
2215
|
+
*
|
|
2216
|
+
* @since 2.1.0
|
|
2217
|
+
* @param store - The listener store.
|
|
2218
|
+
* @param piece - The listener being unloaded.
|
|
2219
|
+
* @returns The unloaded listener.
|
|
2220
|
+
*/
|
|
2221
|
+
onUnload(_store: ListenerStore, piece: Listener): void;
|
|
2222
|
+
}
|
|
2223
|
+
//#endregion
|
|
2224
|
+
export { type AbortError, type AddFiles, AliasPiece, type AliasPieceOptions, AliasStore, ApplicationCommandRegistry, ApplicationCommandRegistryEntry, ArgumentTypes, type AsyncDiscordResult, AutocompleteInteraction$1 as AutocompleteInteraction, AutocompleteInteractionArguments, AutocompleteResponseData, AutocompleteResponseOptions, BaseCommandInteractionType, BaseInteraction, BaseInteractionType, ChatInputCommandInteraction, Client, ClientEventAutocompleteContext, ClientEventCommandContext, ClientEventInteractionHandlerContext, ClientEvents, ClientOptions, Command, CommandInteraction, CommandLoaderStrategy, CommandRouter, CommandStore, CommandStoreRouter, DeferResponseData, DeferResponseOptions, DeferUpdateResult, type DiscordError, type DiscordResult, ExtractedOptions, FollowupOptions, HttpCodes, IIdParser, IdParserRead, InGuild, Interaction$1 as Interaction, InteractionArguments, InteractionHandler, InteractionHandlerStore, Interactions, ListenOptions, Listener, ListenerLoaderStrategy, ListenerStore, LoadOptions, LoaderError, type LoaderPieceContext, MakeArguments, MappedClientEvents, Message, MessageComponentButtonInteraction, MessageComponentChannelSelectInteraction, MessageComponentInteraction, MessageComponentInteractionType, MessageComponentMentionableSelectInteraction, MessageComponentRoleSelectInteraction, MessageComponentStringSelectInteraction as MessageComponentSelectMenuInteraction, MessageComponentStringSelectInteraction, MessageComponentUserSelectInteraction, MessageContextMenuCommandInteraction, MessageResponseData, MessageResponseOptions, MissingExportsError, ModalResponseData, ModalResponseOptions, ModalSubmitInteraction, type NonPingInteraction, PartialMessage, Piece, type PieceContext, type PieceOptions, RegisterCommand, RegisterMessageCommand, RegisterSubcommand, RegisterSubcommandGroup, RegisterUserCommand, RequestAuthPrefix, RestrictGuildIds, Store, type StoreOptions, StoreRegistry, type StoreRegistryEntries, StringIdParser, TransformedArguments, UpdateData, UpdateOptions, UpdateResponseOptions, UpdateResponseResult, UserContextMenuCommandInteraction, applicationCommandRegistry, container, extractTopLevelOptions, makeInteraction, restrictedGuildIdRegistry, transformAutocompleteInteraction, transformInteraction, transformMessageInteraction, transformUserInteraction };
|
|
2225
|
+
//# sourceMappingURL=index.d.ts.map
|