@wolfstar/http-framework 5.0.0-next-20260919094537 → 5.0.0
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/README.md +15 -2
- package/dist/esm/auto-imports.d.ts +1 -1
- package/dist/esm/config.d.ts +1 -1
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/index.d.ts +2320 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +174 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{resolve-Blb-IcFd.d.ts → resolve-B0J5V4xC.d.ts} +10 -9
- package/dist/esm/{resolve-Blb-IcFd.d.ts.map → resolve-B0J5V4xC.d.ts.map} +1 -1
- package/package.json +1 -7
- package/dist/esm/Client-Mni9tJr6.d.ts +0 -2300
- package/dist/esm/Client-Mni9tJr6.d.ts.map +0 -1
- package/dist/esm/fetch.d.ts +0 -26
- package/dist/esm/fetch.d.ts.map +0 -1
- package/dist/esm/fetch.js +0 -75
- package/dist/esm/fetch.js.map +0 -1
- package/dist/esm/security-CDI6548c.js +0 -99
- package/dist/esm/security-CDI6548c.js.map +0 -1
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,2322 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { AliasPiece, AliasPieceOptions, AliasStore, Container, LoaderError, LoaderPieceContext, LoaderPieceContext as LoaderPieceContext$1, LoaderStrategy, MissingExportsError, Piece, Piece as Piece$1, PieceContext, PieceOptions, PieceOptions as PieceOptions$1, 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, ApplicationCommandType, InteractionType, PermissionFlagsBits, 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
|
+
import { ChokidarOptions } from "chokidar";
|
|
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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export declare function transformInteraction<T extends NonNullObject>(resolved: APIInteractionDataResolved, options: readonly APIApplicationCommandInteractionDataOption[]): InteractionArguments<T>;
|
|
245
|
+
export 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
|
+
export declare function transformAutocompleteInteraction<T extends NonNullObject>(resolved: APIInteractionDataResolved, options: readonly APIApplicationCommandInteractionDataOption[]): AutocompleteInteractionArguments<T>;
|
|
256
|
+
export 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
|
+
export declare function extractTopLevelOptions(options: readonly APIApplicationCommandInteractionDataOption[]): ExtractedOptions;
|
|
263
|
+
export interface ExtractedOptions {
|
|
264
|
+
subCommandGroup: APIApplicationCommandInteractionDataSubcommandGroupOption | null;
|
|
265
|
+
subCommand: APIApplicationCommandInteractionDataSubcommandOption | null;
|
|
266
|
+
options: readonly APIApplicationCommandInteractionDataBasicOption[];
|
|
267
|
+
}
|
|
268
|
+
export declare function transformUserInteraction(data: APIUserApplicationCommandInteractionData): TransformedArguments.User;
|
|
269
|
+
export declare function transformMessageInteraction(data: APIMessageApplicationCommandInteractionData): TransformedArguments.Message;
|
|
270
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export 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
|
+
export declare namespace ApplicationCommandRegistryEntry {
|
|
536
|
+
type Command = Exclude<RESTPostAPIApplicationCommandsJSONBody, RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody>;
|
|
537
|
+
}
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/lib/interactions/shared/ApplicationCommandRegistry.d.ts
|
|
540
|
+
export 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
|
+
export 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
|
+
export declare namespace ApplicationCommandRegistry {
|
|
660
|
+
interface SetupOptions {
|
|
661
|
+
rest: REST;
|
|
662
|
+
clientId: Snowflake;
|
|
663
|
+
authPrefix?: RequestAuthPrefix;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
export declare const applicationCommandRegistry: ApplicationCommandRegistry;
|
|
667
|
+
//#endregion
|
|
668
|
+
//#region src/lib/interactions/shared/CommandRegistry.d.ts
|
|
669
|
+
/**
|
|
670
|
+
* A per-command registry passed to {@linkcode Command.registerApplicationCommands}, allowing commands to be
|
|
671
|
+
* registered imperatively, without relying on decorators.
|
|
672
|
+
*
|
|
673
|
+
* @remarks This is the decorator-free equivalent of {@link RegisterCommand}, {@link RegisterSubcommand},
|
|
674
|
+
* {@link RegisterSubcommandGroup}, {@link RegisterMessageCommand}, {@link RegisterUserCommand}, and
|
|
675
|
+
* {@link RestrictGuildIds}; both approaches can be used interchangeably as they share the same underlying
|
|
676
|
+
* {@linkcode ApplicationCommandRegistryEntry}.
|
|
677
|
+
* @since 3.1.0
|
|
678
|
+
*/
|
|
679
|
+
export declare class CommandRegistry<Options extends Command.Options = Command.Options> {
|
|
680
|
+
#private;
|
|
681
|
+
constructor(target: typeof Command<Options>);
|
|
682
|
+
/**
|
|
683
|
+
* Registers the chat input (slash) command for this command.
|
|
684
|
+
*
|
|
685
|
+
* @since 3.1.0
|
|
686
|
+
* @param data - The command data.
|
|
687
|
+
* @returns This registry, for chaining.
|
|
688
|
+
* @example
|
|
689
|
+
* ```typescript
|
|
690
|
+
* public override registerApplicationCommands(registry: Command.Registry) {
|
|
691
|
+
* registry.registerChatInputCommand((builder) =>
|
|
692
|
+
* builder.setName('ping').setDescription('A simple ping pong command')
|
|
693
|
+
* );
|
|
694
|
+
* }
|
|
695
|
+
* ```
|
|
696
|
+
*/
|
|
697
|
+
registerChatInputCommand(data: ChatInputCommandResolver.CommandData): this;
|
|
698
|
+
/**
|
|
699
|
+
* Registers a subcommand for the chat input command of this command.
|
|
700
|
+
*
|
|
701
|
+
* @since 3.1.0
|
|
702
|
+
* @param data - The subcommand data.
|
|
703
|
+
* @param method - The name of the method that handles this subcommand.
|
|
704
|
+
* @param groupName - The name of the subcommand group this subcommand belongs to, if any.
|
|
705
|
+
* @returns This registry, for chaining.
|
|
706
|
+
*/
|
|
707
|
+
registerSubcommand(data: ChatInputCommandResolver.SubcommandData, method: string, groupName?: string | null): this;
|
|
708
|
+
/**
|
|
709
|
+
* Registers a subcommand group for the chat input command of this command.
|
|
710
|
+
*
|
|
711
|
+
* @since 3.1.0
|
|
712
|
+
* @param data - The subcommand group data.
|
|
713
|
+
* @param method - The name of the method that handles this subcommand group, if any.
|
|
714
|
+
* @returns This registry, for chaining.
|
|
715
|
+
*/
|
|
716
|
+
registerSubcommandGroup(data: ChatInputCommandResolver.SubcommandGroupData, method?: string | null): this;
|
|
717
|
+
/**
|
|
718
|
+
* Registers a context menu command for this command.
|
|
719
|
+
*
|
|
720
|
+
* @since 3.1.0
|
|
721
|
+
* @param data - The command data.
|
|
722
|
+
* @param type - The type of context menu command to register.
|
|
723
|
+
* @param method - The name of the method that handles this context menu command, if any.
|
|
724
|
+
* @returns This registry, for chaining.
|
|
725
|
+
*/
|
|
726
|
+
registerContextMenuCommand(data: ContextMenuCommandResolver.CommandData, type: ApplicationCommandType.Message | ApplicationCommandType.User, method?: string | null): this;
|
|
727
|
+
/**
|
|
728
|
+
* Registers a "Message" context menu command for this command.
|
|
729
|
+
*
|
|
730
|
+
* @since 3.1.0
|
|
731
|
+
* @param data - The command data.
|
|
732
|
+
* @param method - The name of the method that handles this context menu command, if any.
|
|
733
|
+
* @returns This registry, for chaining.
|
|
734
|
+
*/
|
|
735
|
+
registerMessageCommand(data: ContextMenuCommandResolver.CommandData, method?: string | null): this;
|
|
736
|
+
/**
|
|
737
|
+
* Registers a "User" context menu command for this command.
|
|
738
|
+
*
|
|
739
|
+
* @since 3.1.0
|
|
740
|
+
* @param data - The command data.
|
|
741
|
+
* @param method - The name of the method that handles this context menu command, if any.
|
|
742
|
+
* @returns This registry, for chaining.
|
|
743
|
+
*/
|
|
744
|
+
registerUserCommand(data: ContextMenuCommandResolver.CommandData, method?: string | null): this;
|
|
745
|
+
/**
|
|
746
|
+
* Restricts this command to the given guild IDs, so it is only registered there instead of globally.
|
|
747
|
+
*
|
|
748
|
+
* @since 3.1.0
|
|
749
|
+
* @param guildIds - The guild IDs to restrict this command to.
|
|
750
|
+
* @returns This registry, for chaining.
|
|
751
|
+
*/
|
|
752
|
+
setGuildIds(guildIds: readonly string[]): this;
|
|
753
|
+
}
|
|
754
|
+
//#endregion
|
|
755
|
+
//#region src/lib/interactions/utils/util-types.d.ts
|
|
756
|
+
type DiscordResult<T> = Result<T, DiscordError>;
|
|
757
|
+
type AsyncDiscordResult<T> = Promise<DiscordResult<T>>;
|
|
758
|
+
type AddFiles<T> = T & {
|
|
759
|
+
files?: RawFile[];
|
|
760
|
+
};
|
|
761
|
+
type AbortError = Error & {
|
|
762
|
+
name: 'AbortError';
|
|
763
|
+
};
|
|
764
|
+
type DiscordError = HTTPError | DiscordAPIError | AbortError;
|
|
765
|
+
type NonPingInteraction = Exclude<APIInteraction, APIPingInteraction>;
|
|
766
|
+
//#endregion
|
|
767
|
+
//#region src/lib/interactions/structures/common/symbols.d.ts
|
|
768
|
+
declare const Data: unique symbol;
|
|
769
|
+
declare const Response$1: unique symbol;
|
|
770
|
+
//#endregion
|
|
771
|
+
//#region src/lib/interactions/structures/interactions/base/BaseInteraction.d.ts
|
|
772
|
+
export type BaseInteractionType = Exclude<APIInteraction, APIPingInteraction>;
|
|
773
|
+
export declare abstract class BaseInteraction<T extends BaseInteractionType = BaseInteractionType> {
|
|
774
|
+
protected readonly [Data]: T;
|
|
775
|
+
protected readonly [Response$1]: ServerResponse;
|
|
776
|
+
constructor(response: ServerResponse, data: T);
|
|
777
|
+
get replied(): boolean;
|
|
778
|
+
/**
|
|
779
|
+
* The ID of the interaction.
|
|
780
|
+
*/
|
|
781
|
+
get id(): T['id'];
|
|
782
|
+
/**
|
|
783
|
+
* The type of the interaction.
|
|
784
|
+
*/
|
|
785
|
+
get type(): T['type'];
|
|
786
|
+
/**
|
|
787
|
+
* Bitwise set of permissions the app or bot has within the channel the interaction was sent from.
|
|
788
|
+
*/
|
|
789
|
+
get app_permissions(): T['app_permissions'];
|
|
790
|
+
/**
|
|
791
|
+
* Bitwise set of permissions the app or bot has within the channel the interaction was sent from.
|
|
792
|
+
*
|
|
793
|
+
* @seealso {@link app_permissions} for the raw data.
|
|
794
|
+
*/
|
|
795
|
+
get applicationPermissions(): bigint | undefined;
|
|
796
|
+
/**
|
|
797
|
+
* The ID of the application the interaction is for.
|
|
798
|
+
*/
|
|
799
|
+
get application_id(): T['application_id'];
|
|
800
|
+
/**
|
|
801
|
+
* The ID of the application the interaction is for.
|
|
802
|
+
*
|
|
803
|
+
* @seealso {@link application_id} for the raw data.
|
|
804
|
+
*/
|
|
805
|
+
get applicationId(): T['application_id'];
|
|
806
|
+
/**
|
|
807
|
+
* Mapping of installation contexts that the interaction was authorized for
|
|
808
|
+
* to related user or guild IDs.
|
|
809
|
+
*/
|
|
810
|
+
get authorizing_integration_owners(): T['authorizing_integration_owners'];
|
|
811
|
+
/**
|
|
812
|
+
* Mapping of installation contexts that the interaction was authorized for
|
|
813
|
+
* to related user or guild IDs.
|
|
814
|
+
*
|
|
815
|
+
* @seealso {@link authorizing_integration_owners} for the raw data.
|
|
816
|
+
*/
|
|
817
|
+
get authorizingIntegrationOwners(): T['authorizing_integration_owners'];
|
|
818
|
+
/**
|
|
819
|
+
* The channel of the interaction.
|
|
820
|
+
*/
|
|
821
|
+
get channel(): T['channel'];
|
|
822
|
+
/**
|
|
823
|
+
* The channel the interaction was sent from.
|
|
824
|
+
* @deprecated Use {@link channel}.id instead.
|
|
825
|
+
*/
|
|
826
|
+
get channel_id(): T['channel_id'];
|
|
827
|
+
/**
|
|
828
|
+
* The channel the interaction was sent from.
|
|
829
|
+
* @deprecated Use {@link channel}.id instead.
|
|
830
|
+
*
|
|
831
|
+
* @seealso {@link channel_id} for the raw data.
|
|
832
|
+
*/
|
|
833
|
+
get channelId(): T['channel_id'];
|
|
834
|
+
/**
|
|
835
|
+
* Context where the interaction was triggered from.
|
|
836
|
+
*/
|
|
837
|
+
get context(): T['context'];
|
|
838
|
+
/**
|
|
839
|
+
* The command data payload.
|
|
840
|
+
*/
|
|
841
|
+
get data(): T['data'];
|
|
842
|
+
/**
|
|
843
|
+
* For monetized apps, any entitlements for the invoking user, representing
|
|
844
|
+
* access to premium SKUs.
|
|
845
|
+
*/
|
|
846
|
+
get entitlements(): T['entitlements'];
|
|
847
|
+
/**
|
|
848
|
+
* The guild the interaction was sent from.
|
|
849
|
+
*/
|
|
850
|
+
get guild_id(): T['guild_id'];
|
|
851
|
+
/**
|
|
852
|
+
* The guild the interaction was sent from.
|
|
853
|
+
*
|
|
854
|
+
* @seealso {@link guild_id} for the raw data.
|
|
855
|
+
*/
|
|
856
|
+
get guildId(): T['guild_id'];
|
|
857
|
+
/**
|
|
858
|
+
* The guild's preferred locale, if invoked in a guild.
|
|
859
|
+
*/
|
|
860
|
+
get guild_locale(): T['guild_locale'];
|
|
861
|
+
/**
|
|
862
|
+
* The guild's preferred locale, if invoked in a guild.
|
|
863
|
+
*
|
|
864
|
+
* @seealso {@link guild_locale} for the raw data.
|
|
865
|
+
*/
|
|
866
|
+
get guildLocale(): T['guild_locale'];
|
|
867
|
+
/**
|
|
868
|
+
* The selected language of the invoking user.
|
|
869
|
+
*/
|
|
870
|
+
get locale(): T['locale'];
|
|
871
|
+
/**
|
|
872
|
+
* Guild member data for the invoking user, including permissions.
|
|
873
|
+
*
|
|
874
|
+
* **This is only sent when an interaction is invoked in a guild**.
|
|
875
|
+
*/
|
|
876
|
+
get member(): T['member'];
|
|
877
|
+
/**
|
|
878
|
+
* A continuation token for responding to the interaction.
|
|
879
|
+
*/
|
|
880
|
+
get token(): T['token'];
|
|
881
|
+
/**
|
|
882
|
+
* User object for the invoking user.
|
|
883
|
+
*/
|
|
884
|
+
get user(): import("discord-api-types/v10").APIUser;
|
|
885
|
+
/**
|
|
886
|
+
* Read-only property, always `1`.
|
|
887
|
+
*/
|
|
888
|
+
get version(): T['version'];
|
|
889
|
+
/**
|
|
890
|
+
* Determines whether or not the interaction was sent from a guild.
|
|
891
|
+
* @returns The casted interaction type.
|
|
892
|
+
*/
|
|
893
|
+
inGuild(): this is InGuild<this>;
|
|
894
|
+
/**
|
|
895
|
+
* Fetches the channel the interaction was sent from.
|
|
896
|
+
* @returns The fetched channel.
|
|
897
|
+
* @remarks **This requires REST to have a token.**
|
|
898
|
+
* @seealso {@link channel}.
|
|
899
|
+
*/
|
|
900
|
+
fetchChannel(): Promise<Result.Err<Error> | DiscordResult<APIChannel>>;
|
|
901
|
+
/**
|
|
902
|
+
* Fetches the channel the interaction was sent from.
|
|
903
|
+
* @returns The fetched channel.
|
|
904
|
+
* @remarks **This requires REST to have a token.**
|
|
905
|
+
*/
|
|
906
|
+
fetchGuild(): Promise<Result.Err<Error> | DiscordResult<APIGuild>>;
|
|
907
|
+
protected _sendReply(data: NonNullObject): Promise<void>;
|
|
908
|
+
}
|
|
909
|
+
export type InGuild<T extends BaseInteraction> = T & {
|
|
910
|
+
get guild_id(): NonNullable<T['guild_id']>;
|
|
911
|
+
get guildId(): NonNullable<T['guildId']>;
|
|
912
|
+
get guild_locale(): NonNullable<T['guild_locale']>;
|
|
913
|
+
get guildLocale(): NonNullable<T['guildLocale']>;
|
|
914
|
+
get member(): NonNullable<T['member']>;
|
|
915
|
+
};
|
|
916
|
+
//#endregion
|
|
917
|
+
//#region src/lib/interactions/structures/interactions/base/common.d.ts
|
|
918
|
+
export type AutocompleteResponseData = APIApplicationCommandAutocompleteResponse;
|
|
919
|
+
export type AutocompleteResponseOptions = AutocompleteResponseData['data'];
|
|
920
|
+
export type MessageResponseData = APIInteractionResponseChannelMessageWithSource;
|
|
921
|
+
export type MessageResponseOptions = MessageResponseData['data'];
|
|
922
|
+
export type DeferResponseData = APIInteractionResponseDeferredChannelMessageWithSource;
|
|
923
|
+
export type DeferResponseOptions = DeferResponseData['data'];
|
|
924
|
+
export type ModalResponseData = APIModalInteractionResponse;
|
|
925
|
+
export type ModalResponseOptions = ModalResponseData['data'];
|
|
926
|
+
export type FollowupOptions = AddFiles<RESTPostAPIInteractionFollowupJSONBody>;
|
|
927
|
+
export type DeferUpdateResult = APIInteractionResponseDeferredMessageUpdate;
|
|
928
|
+
export type UpdateData = APIInteractionResponseUpdateMessage;
|
|
929
|
+
export type UpdateOptions = UpdateData['data'];
|
|
930
|
+
//#endregion
|
|
931
|
+
//#region src/lib/interactions/structures/interactions/AutocompleteInteraction.d.ts
|
|
932
|
+
declare class AutocompleteInteraction$1 extends BaseInteraction<AutocompleteInteraction$1.Type> {
|
|
933
|
+
/**
|
|
934
|
+
* Responds to the interaction with an autocomplete result.
|
|
935
|
+
* @param data The data to be sent.
|
|
936
|
+
*/
|
|
937
|
+
reply(data: AutocompleteResponseOptions): Promise<void>;
|
|
938
|
+
/**
|
|
939
|
+
* Responds to the interaction with an empty autocomplete result.
|
|
940
|
+
*/
|
|
941
|
+
replyEmpty(): Promise<void>;
|
|
942
|
+
}
|
|
943
|
+
declare namespace AutocompleteInteraction$1 {
|
|
944
|
+
type Type = APIApplicationCommandAutocompleteInteraction;
|
|
945
|
+
}
|
|
946
|
+
//#endregion
|
|
947
|
+
//#region src/lib/interactions/structures/interactions/base/CommandInteraction.d.ts
|
|
948
|
+
export type BaseCommandInteractionType = APIChatInputApplicationCommandInteraction | APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction;
|
|
949
|
+
export declare class CommandInteraction<T extends BaseCommandInteractionType> extends BaseInteraction<T> {
|
|
950
|
+
/**
|
|
951
|
+
* Responds to the interaction with a message.
|
|
952
|
+
* @param data The data to be sent.
|
|
953
|
+
*/
|
|
954
|
+
reply(data: MessageResponseOptions): Promise<PartialMessage<this>>;
|
|
955
|
+
/**
|
|
956
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
957
|
+
* @param data The data to be sent, if any.
|
|
958
|
+
*/
|
|
959
|
+
defer(data?: DeferResponseOptions): Promise<PartialMessage<this>>;
|
|
960
|
+
/**
|
|
961
|
+
* Responds to the interaction with a popup modal.
|
|
962
|
+
* @param data The data to be sent.
|
|
963
|
+
*/
|
|
964
|
+
showModal(data: ModalResponseOptions): Promise<void>;
|
|
965
|
+
/**
|
|
966
|
+
* Sends a follow-up message.
|
|
967
|
+
* @param data The data to be sent.
|
|
968
|
+
*/
|
|
969
|
+
followup({ files, ...body }: FollowupOptions): AsyncDiscordResult<Message<this>>;
|
|
970
|
+
}
|
|
971
|
+
//#endregion
|
|
972
|
+
//#region src/lib/interactions/structures/interactions/ChatInputCommandInteraction.d.ts
|
|
973
|
+
export declare class ChatInputCommandInteraction extends CommandInteraction<ChatInputCommandInteraction.Type> {}
|
|
974
|
+
export declare namespace ChatInputCommandInteraction {
|
|
975
|
+
type Type = APIChatInputApplicationCommandInteraction;
|
|
976
|
+
}
|
|
977
|
+
//#endregion
|
|
978
|
+
//#region src/lib/interactions/structures/interactions/base/MessageComponentInteraction.d.ts
|
|
979
|
+
export type MessageComponentInteractionType = APIMessageComponentButtonInteraction | APIMessageComponentSelectMenuInteraction;
|
|
980
|
+
export declare abstract class MessageComponentInteraction<T extends MessageComponentInteractionType> extends BaseInteraction<T> {
|
|
981
|
+
/**
|
|
982
|
+
* The message the interaction was attached to.
|
|
983
|
+
*/
|
|
984
|
+
get message(): import("discord-api-types/v10").APIMessage;
|
|
985
|
+
/**
|
|
986
|
+
* ACK a button interaction and update it to a loading state.
|
|
987
|
+
*/
|
|
988
|
+
deferUpdate(): Promise<PartialMessage<this>>;
|
|
989
|
+
/**
|
|
990
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
991
|
+
* @param data The data to be sent, if any.
|
|
992
|
+
*/
|
|
993
|
+
update(data?: UpdateOptions): Promise<PartialMessage<this>>;
|
|
994
|
+
/**
|
|
995
|
+
* Responds to the interaction with a message.
|
|
996
|
+
* @param data The data to be sent.
|
|
997
|
+
*/
|
|
998
|
+
reply(data: MessageResponseOptions): Promise<PartialMessage<this>>;
|
|
999
|
+
/**
|
|
1000
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
1001
|
+
* @param data The data to be sent, if any.
|
|
1002
|
+
*/
|
|
1003
|
+
defer(data?: DeferResponseOptions): Promise<PartialMessage<this>>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Responds to the interaction with a popup modal.
|
|
1006
|
+
* @param data The data to be sent.
|
|
1007
|
+
*/
|
|
1008
|
+
showModal(data: ModalResponseOptions): Promise<void>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Sends a follow-up message.
|
|
1011
|
+
* @param data The data to be sent.
|
|
1012
|
+
*/
|
|
1013
|
+
followup({ files, ...body }: FollowupOptions): AsyncDiscordResult<Message<this>>;
|
|
1014
|
+
}
|
|
1015
|
+
//#endregion
|
|
1016
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentButtonInteraction.d.ts
|
|
1017
|
+
export declare class MessageComponentButtonInteraction extends MessageComponentInteraction<MessageComponentButtonInteraction.Type> {}
|
|
1018
|
+
export declare namespace MessageComponentButtonInteraction {
|
|
1019
|
+
type Type = APIMessageComponentButtonInteraction;
|
|
1020
|
+
}
|
|
1021
|
+
//#endregion
|
|
1022
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentChannelSelectInteraction.d.ts
|
|
1023
|
+
export declare class MessageComponentChannelSelectInteraction extends MessageComponentInteraction<MessageComponentChannelSelectInteraction.Type> {
|
|
1024
|
+
/**
|
|
1025
|
+
* Gets the IDs of the selected channels.
|
|
1026
|
+
*/
|
|
1027
|
+
get ids(): Snowflake[];
|
|
1028
|
+
/**
|
|
1029
|
+
* Creates a collection with all the selected channels.
|
|
1030
|
+
*
|
|
1031
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.keys}.
|
|
1032
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.values}.
|
|
1033
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.entries}.
|
|
1034
|
+
*/
|
|
1035
|
+
get channels(): Collection<Snowflake, MessageComponentChannelSelectInteraction.Value>;
|
|
1036
|
+
/**
|
|
1037
|
+
* Returns an iterator of the selected channel IDs.
|
|
1038
|
+
*
|
|
1039
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.ids}.
|
|
1040
|
+
*/
|
|
1041
|
+
keys(): IterableIterator<Snowflake>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Returns an iterator of the selected channels.
|
|
1044
|
+
*
|
|
1045
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.channels}.
|
|
1046
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.keys}.
|
|
1047
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.entries}.
|
|
1048
|
+
*/
|
|
1049
|
+
values(): IterableIterator<MessageComponentChannelSelectInteraction.Value>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Returns an iterator of [ID, Channel] pairs.
|
|
1052
|
+
*
|
|
1053
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.channels}.
|
|
1054
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.keys}.
|
|
1055
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.values}.
|
|
1056
|
+
*/
|
|
1057
|
+
entries(): IterableIterator<[Snowflake, MessageComponentChannelSelectInteraction.Value]>;
|
|
1058
|
+
}
|
|
1059
|
+
export declare namespace MessageComponentChannelSelectInteraction {
|
|
1060
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageChannelSelectInteractionData>;
|
|
1061
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
1062
|
+
export type Value = TransformedArguments.Channel;
|
|
1063
|
+
export {};
|
|
1064
|
+
}
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentMentionableSelectInteraction.d.ts
|
|
1067
|
+
export declare class MessageComponentMentionableSelectInteraction extends MessageComponentInteraction<MessageComponentMentionableSelectInteraction.Type> {
|
|
1068
|
+
/**
|
|
1069
|
+
* Gets the IDs of the selected users and roles.
|
|
1070
|
+
*/
|
|
1071
|
+
get ids(): Snowflake[];
|
|
1072
|
+
/**
|
|
1073
|
+
* Creates a collection with all the selected users.
|
|
1074
|
+
*
|
|
1075
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
1076
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.values}.
|
|
1077
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.entries}.
|
|
1078
|
+
*/
|
|
1079
|
+
get users(): Collection<Snowflake, MessageComponentMentionableSelectInteraction.ValueUser>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Creates a collection with all the selected roles.
|
|
1082
|
+
*
|
|
1083
|
+
* @note The collection will always be empty if the interaction came from direct messages.
|
|
1084
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
1085
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.values}.
|
|
1086
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.entries}.
|
|
1087
|
+
*/
|
|
1088
|
+
get roles(): Collection<Snowflake, APIRole>;
|
|
1089
|
+
/**
|
|
1090
|
+
* Creates a collection with all the selected users, members, and roles.
|
|
1091
|
+
*
|
|
1092
|
+
* @note The collection will always be empty if the interaction came from direct messages.
|
|
1093
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
1094
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.values}.
|
|
1095
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.entries}.
|
|
1096
|
+
*/
|
|
1097
|
+
get mentionables(): Collection<Snowflake, MessageComponentMentionableSelectInteraction.Value>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Returns an iterator of the selected users and roles IDs.
|
|
1100
|
+
*
|
|
1101
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.ids}.
|
|
1102
|
+
*/
|
|
1103
|
+
keys(): IterableIterator<Snowflake>;
|
|
1104
|
+
/**
|
|
1105
|
+
* Returns an iterator of the selected users, members, and roles.
|
|
1106
|
+
*
|
|
1107
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.users}.
|
|
1108
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.roles}.
|
|
1109
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
1110
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.entries}.
|
|
1111
|
+
*/
|
|
1112
|
+
values(): IterableIterator<MessageComponentMentionableSelectInteraction.Value>;
|
|
1113
|
+
/**
|
|
1114
|
+
* Returns an iterator of [ID, Mentionable] pairs.
|
|
1115
|
+
*
|
|
1116
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.users}.
|
|
1117
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.roles}.
|
|
1118
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.keys}.
|
|
1119
|
+
* @seealso {@link MessageComponentMentionableSelectInteraction.values}.
|
|
1120
|
+
*/
|
|
1121
|
+
entries(): IterableIterator<[Snowflake, MessageComponentMentionableSelectInteraction.Value]>;
|
|
1122
|
+
}
|
|
1123
|
+
export declare namespace MessageComponentMentionableSelectInteraction {
|
|
1124
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageMentionableSelectInteractionData>;
|
|
1125
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
1126
|
+
export type Value = ValueUser | {
|
|
1127
|
+
id: string;
|
|
1128
|
+
role: TransformedArguments.Role;
|
|
1129
|
+
} | {
|
|
1130
|
+
id: string;
|
|
1131
|
+
};
|
|
1132
|
+
export type ValueUser = {
|
|
1133
|
+
id: string;
|
|
1134
|
+
} & TransformedArguments.User;
|
|
1135
|
+
export {};
|
|
1136
|
+
}
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentRoleSelectInteraction.d.ts
|
|
1139
|
+
export declare class MessageComponentRoleSelectInteraction extends MessageComponentInteraction<MessageComponentRoleSelectInteraction.Type> {
|
|
1140
|
+
/**
|
|
1141
|
+
* Gets the IDs of the selected roles.
|
|
1142
|
+
*/
|
|
1143
|
+
get ids(): Snowflake[];
|
|
1144
|
+
/**
|
|
1145
|
+
* Creates a collection with all the selected roles.
|
|
1146
|
+
*
|
|
1147
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.keys}.
|
|
1148
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.values}.
|
|
1149
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.entries}.
|
|
1150
|
+
*/
|
|
1151
|
+
get roles(): Collection<Snowflake, MessageComponentRoleSelectInteraction.Value>;
|
|
1152
|
+
/**
|
|
1153
|
+
* Returns an iterator of the selected role IDs.
|
|
1154
|
+
*
|
|
1155
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.ids}.
|
|
1156
|
+
*/
|
|
1157
|
+
keys(): IterableIterator<Snowflake>;
|
|
1158
|
+
/**
|
|
1159
|
+
* Returns an iterator of the selected channels.
|
|
1160
|
+
*
|
|
1161
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.roles}.
|
|
1162
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.keys}.
|
|
1163
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.entries}.
|
|
1164
|
+
*/
|
|
1165
|
+
values(): IterableIterator<MessageComponentRoleSelectInteraction.Value>;
|
|
1166
|
+
/**
|
|
1167
|
+
* Returns an iterator of [ID, Role] pairs.
|
|
1168
|
+
*
|
|
1169
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.roles}.
|
|
1170
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.keys}.
|
|
1171
|
+
* @seealso {@link MessageComponentRoleSelectInteraction.values}.
|
|
1172
|
+
*/
|
|
1173
|
+
entries(): IterableIterator<[Snowflake, MessageComponentRoleSelectInteraction.Value]>;
|
|
1174
|
+
}
|
|
1175
|
+
export declare namespace MessageComponentRoleSelectInteraction {
|
|
1176
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageRoleSelectInteractionData>;
|
|
1177
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
1178
|
+
export type Value = TransformedArguments.Role;
|
|
1179
|
+
export {};
|
|
1180
|
+
}
|
|
1181
|
+
//#endregion
|
|
1182
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentStringSelectInteraction.d.ts
|
|
1183
|
+
export declare class MessageComponentStringSelectInteraction extends MessageComponentInteraction<MessageComponentStringSelectInteraction.Type> {
|
|
1184
|
+
get values(): string[];
|
|
1185
|
+
}
|
|
1186
|
+
export declare namespace MessageComponentStringSelectInteraction {
|
|
1187
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageStringSelectInteractionData>;
|
|
1188
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
1189
|
+
export {};
|
|
1190
|
+
}
|
|
1191
|
+
//#endregion
|
|
1192
|
+
//#region src/lib/interactions/structures/interactions/MessageComponentUserSelectInteraction.d.ts
|
|
1193
|
+
export declare class MessageComponentUserSelectInteraction extends MessageComponentInteraction<MessageComponentUserSelectInteraction.Type> {
|
|
1194
|
+
/**
|
|
1195
|
+
* Gets the IDs of the selected users.
|
|
1196
|
+
*/
|
|
1197
|
+
get ids(): Snowflake[];
|
|
1198
|
+
/**
|
|
1199
|
+
* Creates a collection with all the selected users.
|
|
1200
|
+
*
|
|
1201
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.keys}.
|
|
1202
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.values}.
|
|
1203
|
+
* @seealso {@link MessageComponentChannelSelectInteraction.entries}.
|
|
1204
|
+
*/
|
|
1205
|
+
get users(): Collection<Snowflake, MessageComponentUserSelectInteraction.Value>;
|
|
1206
|
+
/**
|
|
1207
|
+
* Returns an iterator of the selected user IDs.
|
|
1208
|
+
*
|
|
1209
|
+
* @seealso {@link MessageComponentUserSelectInteraction.ids}.
|
|
1210
|
+
*/
|
|
1211
|
+
keys(): IterableIterator<Snowflake>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Returns an iterator of the selected users.
|
|
1214
|
+
*
|
|
1215
|
+
* @seealso {@link MessageComponentUserSelectInteraction.users}.
|
|
1216
|
+
* @seealso {@link MessageComponentUserSelectInteraction.keys}.
|
|
1217
|
+
* @seealso {@link MessageComponentUserSelectInteraction.entries}.
|
|
1218
|
+
*/
|
|
1219
|
+
values(): IterableIterator<MessageComponentUserSelectInteraction.Value>;
|
|
1220
|
+
/**
|
|
1221
|
+
* Returns an iterator of [ID, User] pairs.
|
|
1222
|
+
*
|
|
1223
|
+
* @seealso {@link MessageComponentUserSelectInteraction.channels}.
|
|
1224
|
+
* @seealso {@link MessageComponentUserSelectInteraction.keys}.
|
|
1225
|
+
* @seealso {@link MessageComponentUserSelectInteraction.values}.
|
|
1226
|
+
*/
|
|
1227
|
+
entries(): IterableIterator<[Snowflake, MessageComponentUserSelectInteraction.Value]>;
|
|
1228
|
+
}
|
|
1229
|
+
export declare namespace MessageComponentUserSelectInteraction {
|
|
1230
|
+
type Base = APIBaseInteraction<InteractionType.MessageComponent, APIMessageUserSelectInteractionData>;
|
|
1231
|
+
export type Type = Base & Required<Pick<Base, 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message'>>;
|
|
1232
|
+
export type Value = TransformedArguments.User;
|
|
1233
|
+
export {};
|
|
1234
|
+
}
|
|
1235
|
+
//#endregion
|
|
1236
|
+
//#region src/lib/interactions/structures/interactions/MessageContextMenuCommandInteraction.d.ts
|
|
1237
|
+
export declare class MessageContextMenuCommandInteraction extends CommandInteraction<MessageContextMenuCommandInteraction.Type> {}
|
|
1238
|
+
export declare namespace MessageContextMenuCommandInteraction {
|
|
1239
|
+
type Type = APIMessageApplicationCommandInteraction;
|
|
1240
|
+
}
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region src/lib/interactions/structures/interactions/ModalSubmitInteraction.d.ts
|
|
1243
|
+
export declare class ModalSubmitInteraction extends BaseInteraction<ModalSubmitInteraction.Type> {
|
|
1244
|
+
/**
|
|
1245
|
+
* The message the interaction was attached to, if any.
|
|
1246
|
+
*/
|
|
1247
|
+
get message(): import("discord-api-types/v10").APIMessage | undefined;
|
|
1248
|
+
/**
|
|
1249
|
+
* ACK a button interaction and update it to a loading state.
|
|
1250
|
+
*/
|
|
1251
|
+
deferUpdate(): Promise<PartialMessage<this>>;
|
|
1252
|
+
/**
|
|
1253
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
1254
|
+
* @param data The data to be sent, if any.
|
|
1255
|
+
*/
|
|
1256
|
+
update(data?: UpdateOptions): Promise<PartialMessage<this>>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Responds to the interaction with a message.
|
|
1259
|
+
* @param data The data to be sent.
|
|
1260
|
+
*/
|
|
1261
|
+
reply(data: MessageResponseOptions): Promise<PartialMessage<this>>;
|
|
1262
|
+
/**
|
|
1263
|
+
* ACK an interaction and edit a response later. The user sees a loading state.
|
|
1264
|
+
* @param data The data to be sent, if any.
|
|
1265
|
+
*/
|
|
1266
|
+
defer(data?: DeferResponseOptions): Promise<PartialMessage<this>>;
|
|
1267
|
+
/**
|
|
1268
|
+
* Sends a follow-up message.
|
|
1269
|
+
* @param data The data to be sent.
|
|
1270
|
+
*/
|
|
1271
|
+
followup({ files, ...body }: FollowupOptions): AsyncDiscordResult<Message<this>>;
|
|
1272
|
+
}
|
|
1273
|
+
export declare namespace ModalSubmitInteraction {
|
|
1274
|
+
type Type = APIModalSubmitInteraction;
|
|
1275
|
+
}
|
|
1276
|
+
//#endregion
|
|
1277
|
+
//#region src/lib/interactions/structures/interactions/UserContextMenuCommandInteraction.d.ts
|
|
1278
|
+
export declare class UserContextMenuCommandInteraction extends CommandInteraction<UserContextMenuCommandInteraction.Type> {}
|
|
1279
|
+
export declare namespace UserContextMenuCommandInteraction {
|
|
1280
|
+
type Type = APIUserApplicationCommandInteraction;
|
|
1281
|
+
}
|
|
1282
|
+
//#endregion
|
|
1283
|
+
//#region src/lib/interactions/structures/interactions/index.d.ts
|
|
1284
|
+
export declare namespace Interactions {
|
|
1285
|
+
type Autocomplete = AutocompleteInteraction$1;
|
|
1286
|
+
type ChatInputCommand = ChatInputCommandInteraction;
|
|
1287
|
+
type MessageContextMenuCommand = MessageContextMenuCommandInteraction;
|
|
1288
|
+
type UserContextMenuCommand = UserContextMenuCommandInteraction;
|
|
1289
|
+
type MessageComponentButton = MessageComponentButtonInteraction;
|
|
1290
|
+
type MessageComponentChannelSelect = MessageComponentChannelSelectInteraction;
|
|
1291
|
+
type MessageComponentMentionableSelect = MessageComponentMentionableSelectInteraction;
|
|
1292
|
+
type MessageComponentRoleSelect = MessageComponentRoleSelectInteraction;
|
|
1293
|
+
type MessageComponentStringSelect = MessageComponentStringSelectInteraction;
|
|
1294
|
+
type MessageComponentUserSelect = MessageComponentUserSelectInteraction;
|
|
1295
|
+
type MessageComponentSelectMenu = MessageComponentChannelSelect | MessageComponentMentionableSelect | MessageComponentRoleSelect | MessageComponentStringSelect | MessageComponentUserSelect;
|
|
1296
|
+
type ModalSubmit = ModalSubmitInteraction;
|
|
1297
|
+
type MessageComponent = MessageComponentButton | MessageComponentSelectMenu | ModalSubmit;
|
|
1298
|
+
type ContextMenuCommand = MessageContextMenuCommand | UserContextMenuCommand;
|
|
1299
|
+
type ApplicationCommand = ChatInputCommand | ContextMenuCommand;
|
|
1300
|
+
type Any = Autocomplete | ChatInputCommand | MessageContextMenuCommand | UserContextMenuCommand | MessageComponentButton | MessageComponentSelectMenu | ModalSubmit;
|
|
1301
|
+
}
|
|
1302
|
+
type Interaction$1 = Interactions.Any;
|
|
1303
|
+
//#endregion
|
|
1304
|
+
//#region src/lib/interactions/structures/Message.d.ts
|
|
1305
|
+
export declare class PartialMessage<I extends BaseInteraction = BaseInteraction> {
|
|
1306
|
+
readonly interaction: I;
|
|
1307
|
+
constructor(interaction: I);
|
|
1308
|
+
/**
|
|
1309
|
+
* The ID of the message.
|
|
1310
|
+
*/
|
|
1311
|
+
get id(): string;
|
|
1312
|
+
/**
|
|
1313
|
+
* The thread, if the message started one.
|
|
1314
|
+
*/
|
|
1315
|
+
get thread(): APIChannel | undefined;
|
|
1316
|
+
/**
|
|
1317
|
+
* Retrieves the message from Discord, returns a clone of the instance.
|
|
1318
|
+
*/
|
|
1319
|
+
get(): AsyncDiscordResult<Message>;
|
|
1320
|
+
/**
|
|
1321
|
+
* Updates the message, returns a clone of the instance.
|
|
1322
|
+
* @param data The data to be sent.
|
|
1323
|
+
*/
|
|
1324
|
+
update({ files, ...body }: UpdateResponseOptions): AsyncDiscordResult<Message>;
|
|
1325
|
+
/**
|
|
1326
|
+
* Deletes the message.
|
|
1327
|
+
*/
|
|
1328
|
+
delete(): AsyncDiscordResult<this>;
|
|
1329
|
+
}
|
|
1330
|
+
export type UpdateResponseResult = RESTPatchAPIInteractionOriginalResponseResult;
|
|
1331
|
+
export type UpdateResponseOptions = AddFiles<RESTPatchAPIInteractionOriginalResponseJSONBody>;
|
|
1332
|
+
export declare class Message<I extends BaseInteraction = BaseInteraction> extends PartialMessage<I> {
|
|
1333
|
+
private readonly [Data];
|
|
1334
|
+
constructor(interaction: I, data: APIMessage);
|
|
1335
|
+
/**
|
|
1336
|
+
* The ID of the message.
|
|
1337
|
+
*
|
|
1338
|
+
* @raw
|
|
1339
|
+
*/
|
|
1340
|
+
get id(): string;
|
|
1341
|
+
/**
|
|
1342
|
+
* The ID of the channel the message is from.
|
|
1343
|
+
*
|
|
1344
|
+
* @raw
|
|
1345
|
+
* @seealso {@link channelId} for the camelCase property.
|
|
1346
|
+
*/
|
|
1347
|
+
get channel_id(): APIMessage['channel_id'];
|
|
1348
|
+
/**
|
|
1349
|
+
* The ID of the channel the message is from.
|
|
1350
|
+
*/
|
|
1351
|
+
get channelId(): APIMessage['channel_id'];
|
|
1352
|
+
/**
|
|
1353
|
+
* The author of this message (only a valid user in the case where the message is generated by a user or bot user)
|
|
1354
|
+
*
|
|
1355
|
+
* If the message is generated by a webhook, the author object corresponds to the webhook's id,
|
|
1356
|
+
* username, and avatar. You can tell if a message is generated by a webhook by checking for the {@link webhookId} property
|
|
1357
|
+
*
|
|
1358
|
+
* @raw
|
|
1359
|
+
* @seealso {@link https://discord.com/developers/docs/resources/user#user-object}
|
|
1360
|
+
*/
|
|
1361
|
+
get author(): APIMessage['author'];
|
|
1362
|
+
/**
|
|
1363
|
+
* The contents of the message.
|
|
1364
|
+
*
|
|
1365
|
+
* @raw
|
|
1366
|
+
*/
|
|
1367
|
+
get content(): APIMessage['content'];
|
|
1368
|
+
/**
|
|
1369
|
+
* The timestamp the message was sent at.
|
|
1370
|
+
*
|
|
1371
|
+
* @raw
|
|
1372
|
+
* @seealso {@link createdTimestamp} for the parsed timestamp.
|
|
1373
|
+
* @seealso {@link createdAt} for the Date instance created from the parsed timestamp.
|
|
1374
|
+
*/
|
|
1375
|
+
get timestamp(): APIMessage['timestamp'];
|
|
1376
|
+
/**
|
|
1377
|
+
* The timestamp the message was sent at.
|
|
1378
|
+
*
|
|
1379
|
+
* @seealso {@link timestamp} for the raw data.
|
|
1380
|
+
*/
|
|
1381
|
+
get createdTimestamp(): number;
|
|
1382
|
+
/**
|
|
1383
|
+
* The {@link Date} version of {@link createdTimestamp}.
|
|
1384
|
+
*/
|
|
1385
|
+
get createdAt(): Date;
|
|
1386
|
+
/**
|
|
1387
|
+
* The timestamp the message was edited at, `null` if it was never edited.
|
|
1388
|
+
*
|
|
1389
|
+
* @raw
|
|
1390
|
+
* @seealso {@link editedTimestamp} for the parsed timestamp.
|
|
1391
|
+
* @seealso {@link editedAt} for the Date instance created from the parsed timestamp.
|
|
1392
|
+
*/
|
|
1393
|
+
get edited_timestamp(): APIMessage['edited_timestamp'];
|
|
1394
|
+
/**
|
|
1395
|
+
* The timestamp the message was edited at, `null` if it was never edited.
|
|
1396
|
+
*/
|
|
1397
|
+
get editedTimestamp(): number | null;
|
|
1398
|
+
/**
|
|
1399
|
+
* The {@link Date} version of {@link editedTimestamp}.
|
|
1400
|
+
*/
|
|
1401
|
+
get editedAt(): Date | null;
|
|
1402
|
+
/**
|
|
1403
|
+
* Whether or not the message is a TTS message.
|
|
1404
|
+
*
|
|
1405
|
+
* @raw
|
|
1406
|
+
*/
|
|
1407
|
+
get tts(): APIMessage['tts'];
|
|
1408
|
+
/**
|
|
1409
|
+
* Whether or not the message mentioned everyone.
|
|
1410
|
+
*
|
|
1411
|
+
* @raw
|
|
1412
|
+
* @seealso {@link mention_everyone} for the camelCase property.
|
|
1413
|
+
*/
|
|
1414
|
+
get mention_everyone(): APIMessage['mention_everyone'];
|
|
1415
|
+
/**
|
|
1416
|
+
* Whether or not the message mentioned everyone.
|
|
1417
|
+
*
|
|
1418
|
+
* @seealso {@link mention_everyone} for the raw data.
|
|
1419
|
+
*/
|
|
1420
|
+
get mentionEveryone(): APIMessage['mention_everyone'];
|
|
1421
|
+
/**
|
|
1422
|
+
* The users specifically mentioned in the message.
|
|
1423
|
+
*
|
|
1424
|
+
* @raw
|
|
1425
|
+
* @seealso {@link https://discord.com/developers/docs/resources/user#user-object}
|
|
1426
|
+
*/
|
|
1427
|
+
get mentions(): APIMessage['mentions'];
|
|
1428
|
+
/**
|
|
1429
|
+
* The roles specifically mentioned in the message.
|
|
1430
|
+
*
|
|
1431
|
+
* @raw
|
|
1432
|
+
* @seealso {@link https://discord.com/developers/docs/topics/permissions#role-object}
|
|
1433
|
+
*/
|
|
1434
|
+
get mention_roles(): APIMessage['mention_roles'];
|
|
1435
|
+
/**
|
|
1436
|
+
* The roles specifically mentioned in the message.
|
|
1437
|
+
*
|
|
1438
|
+
* @seealso {@link https://discord.com/developers/docs/topics/permissions#role-object}
|
|
1439
|
+
* @seealso {@link mention_roles} for the raw data.
|
|
1440
|
+
*/
|
|
1441
|
+
get mentionRoles(): APIMessage['mention_roles'];
|
|
1442
|
+
/**
|
|
1443
|
+
* The channels specifically mentioned in this message.
|
|
1444
|
+
*
|
|
1445
|
+
* Not all channel mentions in a message will appear in {@link mentionChannels}:
|
|
1446
|
+
* - Only textual channels that are visible to everyone in a lurkable guild will ever be included.
|
|
1447
|
+
* - Only crossposted messages (via Channel Following) currently include {@link mentionChannels} at all.
|
|
1448
|
+
*
|
|
1449
|
+
* @raw
|
|
1450
|
+
* @seealso {@link mentionChannels} for the camelCase property with an empty array default.
|
|
1451
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#channel-mention-object}
|
|
1452
|
+
*/
|
|
1453
|
+
get mention_channels(): APIMessage['mention_channels'];
|
|
1454
|
+
/**
|
|
1455
|
+
* The channels specifically mentioned in this message.
|
|
1456
|
+
*
|
|
1457
|
+
* Not all channel mentions in a message will appear in {@link mentionChannels}:
|
|
1458
|
+
* - Only textual channels that are visible to everyone in a lurkable guild will ever be included.
|
|
1459
|
+
* - Only crossposted messages (via Channel Following) currently include {@link mentionChannels} at all.
|
|
1460
|
+
*
|
|
1461
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#channel-mention-object}
|
|
1462
|
+
*/
|
|
1463
|
+
get mentionChannels(): APIMessage['mention_channels'];
|
|
1464
|
+
/**
|
|
1465
|
+
* A nonce that can be used for optimistic message sending (up to 25 characters).
|
|
1466
|
+
*
|
|
1467
|
+
* @raw
|
|
1468
|
+
*/
|
|
1469
|
+
get nonce(): APIMessage['nonce'];
|
|
1470
|
+
/**
|
|
1471
|
+
* Whether or not the message is pinned.
|
|
1472
|
+
*
|
|
1473
|
+
* @raw
|
|
1474
|
+
*/
|
|
1475
|
+
get pinned(): APIMessage['pinned'];
|
|
1476
|
+
/**
|
|
1477
|
+
* The attached files.
|
|
1478
|
+
*
|
|
1479
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#attachment-object}
|
|
1480
|
+
*/
|
|
1481
|
+
get attachments(): APIMessage['attachments'];
|
|
1482
|
+
/**
|
|
1483
|
+
* The embedded content.
|
|
1484
|
+
*
|
|
1485
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#embed-object}
|
|
1486
|
+
*/
|
|
1487
|
+
get embeds(): APIMessage['embeds'];
|
|
1488
|
+
/**
|
|
1489
|
+
* The reactions the message has.
|
|
1490
|
+
*
|
|
1491
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#reaction-object}
|
|
1492
|
+
*/
|
|
1493
|
+
get reactions(): APIMessage['reactions'];
|
|
1494
|
+
/**
|
|
1495
|
+
* The webhook ID.
|
|
1496
|
+
*/
|
|
1497
|
+
get webhook_id(): APIMessage['webhook_id'];
|
|
1498
|
+
/**
|
|
1499
|
+
* The webhook ID.
|
|
1500
|
+
*
|
|
1501
|
+
* @seealso {@link webhook_id} for the raw data.
|
|
1502
|
+
*/
|
|
1503
|
+
get webhookId(): string | null;
|
|
1504
|
+
/**
|
|
1505
|
+
* The message's type.
|
|
1506
|
+
*
|
|
1507
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#message-object-message-types}
|
|
1508
|
+
*/
|
|
1509
|
+
get type(): import("discord-api-types/v10").MessageType;
|
|
1510
|
+
/**
|
|
1511
|
+
* The thread, if the message started one.
|
|
1512
|
+
*/
|
|
1513
|
+
get thread(): APIChannel | undefined;
|
|
1514
|
+
/**
|
|
1515
|
+
* The message flags combined as a bitfield.
|
|
1516
|
+
*
|
|
1517
|
+
* @seealso {@link https://discord.com/developers/docs/resources/channel#message-object-message-flags}
|
|
1518
|
+
* @seealso {@link https://en.wikipedia.org/wiki/Bit_field}
|
|
1519
|
+
*/
|
|
1520
|
+
get flags(): import("discord-api-types/v10").MessageFlags | undefined;
|
|
1521
|
+
/**
|
|
1522
|
+
* The message's components, such as buttons, action rows, or other interactive components.
|
|
1523
|
+
*/
|
|
1524
|
+
get components(): import("discord-api-types/v10").APIMessageTopLevelComponent[];
|
|
1525
|
+
/**
|
|
1526
|
+
* The stickers the message contains, if any.
|
|
1527
|
+
*/
|
|
1528
|
+
get sticker_items(): import("discord-api-types/v10").APIStickerItem[] | undefined;
|
|
1529
|
+
/**
|
|
1530
|
+
* The stickers the message contains, if any.
|
|
1531
|
+
*
|
|
1532
|
+
* @seealso {@link sticker_items} for the raw data.
|
|
1533
|
+
*/
|
|
1534
|
+
get stickerItems(): import("discord-api-types/v10").APIStickerItem[];
|
|
1535
|
+
}
|
|
1536
|
+
//#endregion
|
|
1537
|
+
//#region src/lib/interactions/utils/util.d.ts
|
|
1538
|
+
export declare function makeInteraction<T extends BaseInteractionType>(response: ServerResponse, interaction: T): TransformRaw<T>;
|
|
1539
|
+
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;
|
|
1540
|
+
//#endregion
|
|
1541
|
+
//#region src/lib/interactions/router/CommandRouter.d.ts
|
|
1542
|
+
/**
|
|
1543
|
+
* Represents a command router that handles routing of interactions for a specific command.
|
|
1544
|
+
*
|
|
1545
|
+
* @since 2.0.0
|
|
1546
|
+
* @template Options - The options type for the command.
|
|
1547
|
+
*/
|
|
1548
|
+
export declare class CommandRouter<Options extends Command.Options = Command.Options> {
|
|
1549
|
+
#private;
|
|
1550
|
+
constructor(command: Command<Options>);
|
|
1551
|
+
/**
|
|
1552
|
+
* The name of the registered chat input command for this command, if any.
|
|
1553
|
+
*
|
|
1554
|
+
* @since 2.0.0
|
|
1555
|
+
*/
|
|
1556
|
+
get chatInputName(): string | null;
|
|
1557
|
+
/**
|
|
1558
|
+
* The names of the registered context menu commands for this command, if any.
|
|
1559
|
+
*
|
|
1560
|
+
* @since 2.0.0
|
|
1561
|
+
*/
|
|
1562
|
+
get contextMenuNames(): string[];
|
|
1563
|
+
/**
|
|
1564
|
+
* Routes a chat input interaction based on the provided data.
|
|
1565
|
+
*
|
|
1566
|
+
* @since 2.0.0
|
|
1567
|
+
* @param data - The data of the chat input interaction.
|
|
1568
|
+
* @returns The mapped command name or `null` if no mapping is found.
|
|
1569
|
+
*/
|
|
1570
|
+
routeChatInputInteraction(data: APIChatInputApplicationCommandInteractionData): string | null;
|
|
1571
|
+
/**
|
|
1572
|
+
* Routes a context menu interaction based on the provided data.
|
|
1573
|
+
*
|
|
1574
|
+
* @since 2.0.0
|
|
1575
|
+
* @param data - The data for the context menu interaction.
|
|
1576
|
+
* @returns The result of the context menu interaction, or null if no result is found.
|
|
1577
|
+
*/
|
|
1578
|
+
routeContextMenuInteraction(data: APIContextMenuInteractionData): string | null;
|
|
1579
|
+
}
|
|
1580
|
+
//#endregion
|
|
1581
|
+
//#region src/lib/structures/Command.d.ts
|
|
1582
|
+
export declare abstract class Command<Options extends Command.Options = Command.Options> extends Piece$1<Options, 'commands'> {
|
|
1583
|
+
/**
|
|
1584
|
+
* The router for the command.
|
|
1585
|
+
* @since 2.0.0
|
|
1586
|
+
*/
|
|
1587
|
+
readonly router: CommandRouter<Options>;
|
|
1588
|
+
constructor(context: Command.LoaderContext, options?: Options);
|
|
1589
|
+
/**
|
|
1590
|
+
* Gets the registry for this command.
|
|
1591
|
+
*
|
|
1592
|
+
* @returns The registry for this command, or `null` if it is not registered.
|
|
1593
|
+
*/
|
|
1594
|
+
get registry(): ApplicationCommandRegistryEntry | null;
|
|
1595
|
+
/**
|
|
1596
|
+
* Registers this command's application commands imperatively, without relying on decorators.
|
|
1597
|
+
*
|
|
1598
|
+
* @remarks This is invoked once, synchronously, from the base {@linkcode Command} constructor, right before this
|
|
1599
|
+
* command's router is built, and therefore before any subclass field initializers or subclass constructor body have
|
|
1600
|
+
* run. Because of this it must be declared as a method (not a class-field arrow function, which would not yet be
|
|
1601
|
+
* assigned at this point and would be silently skipped) and it must not read subclass instance state, which is still
|
|
1602
|
+
* uninitialized; it should register commands using only the provided `registry`. This matches the static, class-level
|
|
1603
|
+
* nature of the decorators: it is the decorator-free equivalent of {@link RegisterCommand} and its siblings, and a
|
|
1604
|
+
* command should use either this method or the decorators, not both.
|
|
1605
|
+
* @since 3.1.0
|
|
1606
|
+
* @param registry - The registry to register this command's application commands with.
|
|
1607
|
+
* @example
|
|
1608
|
+
* ```typescript
|
|
1609
|
+
* import { Command } from '@wolfstar/http-framework';
|
|
1610
|
+
*
|
|
1611
|
+
* export class UserCommand extends Command {
|
|
1612
|
+
* public override registerApplicationCommands(registry: Command.Registry) {
|
|
1613
|
+
* registry.registerChatInputCommand((builder) =>
|
|
1614
|
+
* builder.setName('ping').setDescription('Runs a network connection test with me')
|
|
1615
|
+
* );
|
|
1616
|
+
* }
|
|
1617
|
+
*
|
|
1618
|
+
* public override chatInputRun(interaction: Command.ChatInputInteraction) {
|
|
1619
|
+
* return interaction.reply({ content: 'Pong!' });
|
|
1620
|
+
* }
|
|
1621
|
+
* }
|
|
1622
|
+
* ```
|
|
1623
|
+
*/
|
|
1624
|
+
registerApplicationCommands?(registry: Command.Registry): unknown;
|
|
1625
|
+
/**
|
|
1626
|
+
* Responds to the chat input command for this command
|
|
1627
|
+
*
|
|
1628
|
+
* @param interaction - The interaction to be handled.
|
|
1629
|
+
* @param args - The parsed arguments for this autocomplete interaction.
|
|
1630
|
+
*/
|
|
1631
|
+
chatInputRun(interaction: Command.ApplicationCommandInteraction, args: NonNullObject): Awaitable<unknown>;
|
|
1632
|
+
/**
|
|
1633
|
+
* Responds to an auto completable option for this command
|
|
1634
|
+
*
|
|
1635
|
+
* @param interaction - The interaction to be handled.
|
|
1636
|
+
* @param args - The parsed arguments for this autocomplete interaction.
|
|
1637
|
+
* @returns The response to the autocomplete interaction.
|
|
1638
|
+
*/
|
|
1639
|
+
autocompleteRun(interaction: Command.AutocompleteInteraction, args: Command.AutocompleteArguments<any>): Awaitable<unknown>;
|
|
1640
|
+
}
|
|
1641
|
+
export declare namespace Command {
|
|
1642
|
+
type AutocompleteInteraction = Interactions.Autocomplete;
|
|
1643
|
+
type AutocompleteArguments<T extends object> = AutocompleteInteractionArguments<T>;
|
|
1644
|
+
type ChatInputInteraction = Interactions.ChatInputCommand;
|
|
1645
|
+
type UserInteraction = Interactions.UserContextMenuCommand;
|
|
1646
|
+
type MessageInteraction = Interactions.MessageContextMenuCommand;
|
|
1647
|
+
type ContextMenuInteraction = Interactions.ContextMenuCommand;
|
|
1648
|
+
type ApplicationCommandInteraction = Interactions.ApplicationCommand;
|
|
1649
|
+
type Interaction = ChatInputInteraction | AutocompleteInteraction | UserInteraction | MessageInteraction;
|
|
1650
|
+
type InteractionData = Interaction['data'];
|
|
1651
|
+
type Registry = CommandRegistry;
|
|
1652
|
+
/** @deprecated Use {@linkcode LoaderContext} instead. */
|
|
1653
|
+
type Context = LoaderContext;
|
|
1654
|
+
type LoaderContext = Piece$1.LoaderContext<'commands'>;
|
|
1655
|
+
type JSON = Piece$1.JSON;
|
|
1656
|
+
type LocationJSON = Piece$1.LocationJSON;
|
|
1657
|
+
type Options = Piece$1.Options;
|
|
1658
|
+
}
|
|
1659
|
+
//#endregion
|
|
1660
|
+
//#region src/lib/structures/InteractionHandler.d.ts
|
|
1661
|
+
export declare abstract class InteractionHandler<Options extends InteractionHandler.Options = InteractionHandler.Options> extends Piece$1<Options, 'interaction-handlers'> {
|
|
1662
|
+
constructor(context: InteractionHandler.LoaderContext, options?: Options);
|
|
1663
|
+
abstract run(interaction: InteractionHandler.Interaction, customIdValue: unknown): Awaited<unknown>;
|
|
1664
|
+
}
|
|
1665
|
+
export declare namespace InteractionHandler {
|
|
1666
|
+
type ButtonInteraction = Interactions.MessageComponentButton;
|
|
1667
|
+
type SelectMenuInteraction = Interactions.MessageComponentSelectMenu;
|
|
1668
|
+
type ModalInteraction = Interactions.ModalSubmit;
|
|
1669
|
+
type MessageComponentInteraction = Interactions.MessageComponent;
|
|
1670
|
+
type ContextMenuInteraction = Interactions.ContextMenuCommand;
|
|
1671
|
+
type ApplicationCommandInteraction = Interactions.ApplicationCommand;
|
|
1672
|
+
type Interaction = Interactions.MessageComponent;
|
|
1673
|
+
type InteractionData = Interaction['data'];
|
|
1674
|
+
/** @deprecated Use {@linkcode LoaderContext} instead. */
|
|
1675
|
+
type Context = LoaderContext;
|
|
1676
|
+
type LoaderContext = Piece$1.LoaderContext<'interaction-handlers'>;
|
|
1677
|
+
type JSON = Piece$1.JSON;
|
|
1678
|
+
type LocationJSON = Piece$1.LocationJSON;
|
|
1679
|
+
type Options = Piece$1.Options;
|
|
1680
|
+
}
|
|
1681
|
+
//#endregion
|
|
1682
|
+
//#region src/lib/types/Enums.d.ts
|
|
1683
|
+
export declare enum PluginHook {
|
|
1684
|
+
PreGenericsInitialization = "preGenericsInitialization",
|
|
1685
|
+
PreInitialization = "preInitialization",
|
|
1686
|
+
PostInitialization = "postInitialization",
|
|
1687
|
+
PreLoad = "preLoad",
|
|
1688
|
+
PostListen = "postListen"
|
|
1689
|
+
}
|
|
1690
|
+
//#endregion
|
|
1691
|
+
//#region src/lib/ClientEvents.d.ts
|
|
1692
|
+
export interface ClientEventCommandContext {
|
|
1693
|
+
command: Command;
|
|
1694
|
+
interaction: APIApplicationCommandInteraction;
|
|
1695
|
+
response: ServerResponse;
|
|
1696
|
+
}
|
|
1697
|
+
export interface ClientEventAutocompleteContext {
|
|
1698
|
+
command: Command;
|
|
1699
|
+
interaction: APIApplicationCommandAutocompleteInteraction;
|
|
1700
|
+
response: ServerResponse;
|
|
1701
|
+
}
|
|
1702
|
+
export interface ClientEventInteractionHandlerContext {
|
|
1703
|
+
handler: InteractionHandler;
|
|
1704
|
+
interaction: APIMessageComponentInteraction | APIModalSubmitInteraction;
|
|
1705
|
+
response: ServerResponse;
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* The name of every event emitted by the {@link Client}, mirroring the keys of {@link ClientEvents}.
|
|
1709
|
+
*
|
|
1710
|
+
* @remarks
|
|
1711
|
+
* Each member's value is the plain event name, so they are interchangeable with the string literals
|
|
1712
|
+
* accepted by `Client#on`, `Client#emit`, and {@link Listener.Options.event}.
|
|
1713
|
+
*
|
|
1714
|
+
* @example
|
|
1715
|
+
* ```typescript
|
|
1716
|
+
* client.on(Events.CommandError, (error, context) => console.error(context.command.name, error));
|
|
1717
|
+
* ```
|
|
1718
|
+
*
|
|
1719
|
+
* @since 3.4.0
|
|
1720
|
+
*/
|
|
1721
|
+
export declare enum Events {
|
|
1722
|
+
Error = "error",
|
|
1723
|
+
PluginLoaded = "pluginLoaded",
|
|
1724
|
+
CommandNameMissing = "commandNameMissing",
|
|
1725
|
+
CommandNameUnknown = "commandNameUnknown",
|
|
1726
|
+
CommandMethodUnknown = "commandMethodUnknown",
|
|
1727
|
+
CommandRun = "commandRun",
|
|
1728
|
+
CommandSuccess = "commandSuccess",
|
|
1729
|
+
CommandError = "commandError",
|
|
1730
|
+
CommandFinish = "commandFinish",
|
|
1731
|
+
AutocompleteRun = "autocompleteRun",
|
|
1732
|
+
AutocompleteSuccess = "autocompleteSuccess",
|
|
1733
|
+
AutocompleteError = "autocompleteError",
|
|
1734
|
+
AutocompleteFinish = "autocompleteFinish",
|
|
1735
|
+
InteractionHandlerNameInvalid = "interactionHandlerNameInvalid",
|
|
1736
|
+
InteractionHandlerNameUnknown = "interactionHandlerNameUnknown",
|
|
1737
|
+
InteractionHandlerRun = "interactionHandlerRun",
|
|
1738
|
+
InteractionHandlerSuccess = "interactionHandlerSuccess",
|
|
1739
|
+
InteractionHandlerError = "interactionHandlerError",
|
|
1740
|
+
InteractionHandlerFinish = "interactionHandlerFinish",
|
|
1741
|
+
HmrStart = "hmrStart",
|
|
1742
|
+
HmrStop = "hmrStop",
|
|
1743
|
+
HmrPiecesLoaded = "hmrPiecesLoaded",
|
|
1744
|
+
HmrPieceReloaded = "hmrPieceReloaded",
|
|
1745
|
+
HmrPieceUnloaded = "hmrPieceUnloaded",
|
|
1746
|
+
HmrError = "hmrError"
|
|
1747
|
+
}
|
|
1748
|
+
export interface ClientEvents {
|
|
1749
|
+
error: [error: unknown];
|
|
1750
|
+
/**
|
|
1751
|
+
* Emitted after a plugin hook runs, providing the hook's {@link PluginHook} and the plugin's name
|
|
1752
|
+
* (or `undefined` when the registering plugin did not provide one).
|
|
1753
|
+
*
|
|
1754
|
+
* @remarks
|
|
1755
|
+
* The `PreGenericsInitialization`, `PreInitialization`, and `PostInitialization` hooks run
|
|
1756
|
+
* synchronously inside the `Client` constructor, so their emissions fire before `new Client()`
|
|
1757
|
+
* returns. A listener attached afterwards cannot observe them (not even one added by a subclass,
|
|
1758
|
+
* whose constructor body only runs after `super()` has already executed those hooks), so only the
|
|
1759
|
+
* `PreLoad` (during `Client#load`) and `PostListen` (during `Client#listen`) emissions are
|
|
1760
|
+
* observable. To react to the constructor-phase hooks, use the plugin hooks themselves.
|
|
1761
|
+
*/
|
|
1762
|
+
pluginLoaded: [hook: PluginHook, name: string | undefined];
|
|
1763
|
+
commandNameMissing: [interaction: APIApplicationCommandAutocompleteInteraction, response: ServerResponse];
|
|
1764
|
+
commandNameUnknown: [interaction: APIApplicationCommandInteraction | APIApplicationCommandAutocompleteInteraction, response: ServerResponse];
|
|
1765
|
+
commandMethodUnknown: [context: ClientEventCommandContext];
|
|
1766
|
+
commandRun: [context: ClientEventCommandContext];
|
|
1767
|
+
commandSuccess: [context: ClientEventCommandContext, value: unknown];
|
|
1768
|
+
commandError: [error: unknown, context: ClientEventCommandContext];
|
|
1769
|
+
commandFinish: [context: ClientEventCommandContext];
|
|
1770
|
+
autocompleteRun: [context: ClientEventAutocompleteContext];
|
|
1771
|
+
autocompleteSuccess: [context: ClientEventAutocompleteContext, value: unknown];
|
|
1772
|
+
autocompleteError: [error: unknown, context: ClientEventAutocompleteContext];
|
|
1773
|
+
autocompleteFinish: [context: ClientEventAutocompleteContext];
|
|
1774
|
+
interactionHandlerNameInvalid: [interaction: APIMessageComponentInteraction | APIModalSubmitInteraction, response: ServerResponse];
|
|
1775
|
+
interactionHandlerNameUnknown: [interaction: APIMessageComponentInteraction | APIModalSubmitInteraction, response: ServerResponse];
|
|
1776
|
+
interactionHandlerRun: [context: ClientEventInteractionHandlerContext];
|
|
1777
|
+
interactionHandlerSuccess: [context: ClientEventInteractionHandlerContext, value: unknown];
|
|
1778
|
+
interactionHandlerError: [error: unknown, context: ClientEventInteractionHandlerContext];
|
|
1779
|
+
interactionHandlerFinish: [context: ClientEventInteractionHandlerContext];
|
|
1780
|
+
/**
|
|
1781
|
+
* Emitted when the Hot Module Reloader starts watching, with the list of watched store paths.
|
|
1782
|
+
*
|
|
1783
|
+
* @since 3.3.0
|
|
1784
|
+
*/
|
|
1785
|
+
hmrStart: [paths: string[]];
|
|
1786
|
+
/**
|
|
1787
|
+
* Emitted when the Hot Module Reloader stops watching and all of its watchers have been closed.
|
|
1788
|
+
*
|
|
1789
|
+
* @since 3.3.0
|
|
1790
|
+
*/
|
|
1791
|
+
hmrStop: [];
|
|
1792
|
+
/**
|
|
1793
|
+
* Emitted when the Hot Module Reloader loads the pieces of a newly created file.
|
|
1794
|
+
*
|
|
1795
|
+
* @since 3.3.0
|
|
1796
|
+
*/
|
|
1797
|
+
hmrPiecesLoaded: [pieces: Piece$1[], path: string];
|
|
1798
|
+
/**
|
|
1799
|
+
* Emitted when the Hot Module Reloader reloads an already loaded piece after its file changed.
|
|
1800
|
+
*
|
|
1801
|
+
* @since 3.3.0
|
|
1802
|
+
*/
|
|
1803
|
+
hmrPieceReloaded: [piece: Piece$1, path: string];
|
|
1804
|
+
/**
|
|
1805
|
+
* Emitted when the Hot Module Reloader unloads a piece after its file was deleted.
|
|
1806
|
+
*
|
|
1807
|
+
* @since 3.3.0
|
|
1808
|
+
*/
|
|
1809
|
+
hmrPieceUnloaded: [piece: Piece$1, path: string];
|
|
1810
|
+
/**
|
|
1811
|
+
* Emitted when the Hot Module Reloader fails to load, reload, or unload the pieces of a file. The error is not
|
|
1812
|
+
* rethrown: saving the file again retries the operation.
|
|
1813
|
+
*
|
|
1814
|
+
* @since 3.3.0
|
|
1815
|
+
*/
|
|
1816
|
+
hmrError: [error: unknown, path: string];
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* The name of any of the events emitted by the {@link Client}, either as a plain string literal or as an
|
|
1820
|
+
* {@link Events} member.
|
|
1821
|
+
*
|
|
1822
|
+
* @since 3.4.0
|
|
1823
|
+
*/
|
|
1824
|
+
export type ClientEventName = keyof ClientEvents;
|
|
1825
|
+
export type MappedClientEvents = { [K in keyof ClientEvents]: ClientEvents[K]; };
|
|
1826
|
+
//#endregion
|
|
1827
|
+
//#region src/lib/hmr/HotModuleReloader.d.ts
|
|
1828
|
+
/**
|
|
1829
|
+
* Hot Module Reloading for every {@link Store} registered in {@link container.stores}.
|
|
1830
|
+
*
|
|
1831
|
+
* @remarks The reloader watches each store's registered paths and reacts to file system events by loading, reloading,
|
|
1832
|
+
* and unloading the affected pieces in place, without restarting the process. It is a development-only utility: watching
|
|
1833
|
+
* the file system in production adds overhead and reloads code that is not supposed to change, which is why it is
|
|
1834
|
+
* opt-in.
|
|
1835
|
+
* @since 3.3.0
|
|
1836
|
+
* @example
|
|
1837
|
+
* ```typescript
|
|
1838
|
+
* const client = new Client({ hmr: { enabled: process.env.NODE_ENV !== 'production' } });
|
|
1839
|
+
* await client.load();
|
|
1840
|
+
* ```
|
|
1841
|
+
*/
|
|
1842
|
+
export declare class HotModuleReloader {
|
|
1843
|
+
#private;
|
|
1844
|
+
/**
|
|
1845
|
+
* The options this reloader was constructed with.
|
|
1846
|
+
*
|
|
1847
|
+
* @since 3.3.0
|
|
1848
|
+
*/
|
|
1849
|
+
readonly options: HotModuleReloader.Options;
|
|
1850
|
+
constructor(options?: HotModuleReloader.Options);
|
|
1851
|
+
/**
|
|
1852
|
+
* Whether the reloader is currently watching for changes.
|
|
1853
|
+
*
|
|
1854
|
+
* @since 3.3.0
|
|
1855
|
+
*/
|
|
1856
|
+
get running(): boolean;
|
|
1857
|
+
/**
|
|
1858
|
+
* The paths currently being watched, one entry per store path.
|
|
1859
|
+
*
|
|
1860
|
+
* @since 3.3.0
|
|
1861
|
+
*/
|
|
1862
|
+
get paths(): readonly string[];
|
|
1863
|
+
/**
|
|
1864
|
+
* Starts watching every path registered in every store.
|
|
1865
|
+
*
|
|
1866
|
+
* @remarks This is a no-op when {@link HotModuleReloader.Options.enabled} is `false`, when the reloader is already
|
|
1867
|
+
* running, or when no store has registered paths. `chokidar` is imported lazily, so applications that never enable
|
|
1868
|
+
* HMR do not pay for loading it.
|
|
1869
|
+
* @since 3.3.0
|
|
1870
|
+
* @returns This instance, for chaining.
|
|
1871
|
+
*/
|
|
1872
|
+
start(): Promise<this>;
|
|
1873
|
+
/**
|
|
1874
|
+
* Stops watching for changes and closes every watcher.
|
|
1875
|
+
*
|
|
1876
|
+
* @remarks Calling this on a reloader that is not running is a no-op. Already loaded pieces are left untouched.
|
|
1877
|
+
* @since 3.3.0
|
|
1878
|
+
*/
|
|
1879
|
+
stop(): Promise<void>;
|
|
1880
|
+
/**
|
|
1881
|
+
* Handles a file being added to, or modified in, one of the store's paths, reloading the piece it defines when it is
|
|
1882
|
+
* already loaded, and loading it otherwise.
|
|
1883
|
+
*
|
|
1884
|
+
* @since 3.3.0
|
|
1885
|
+
* @param store - The store the path belongs to.
|
|
1886
|
+
* @param path - The full path of the file that changed.
|
|
1887
|
+
*/
|
|
1888
|
+
protected handlePieceUpdate(store: Store$1<Piece$1>, path: string): Promise<void>;
|
|
1889
|
+
/**
|
|
1890
|
+
* Handles a file being removed from one of the store's paths, unloading the piece it defined.
|
|
1891
|
+
*
|
|
1892
|
+
* @since 3.3.0
|
|
1893
|
+
* @param store - The store the path belongs to.
|
|
1894
|
+
* @param path - The full path of the file that was deleted.
|
|
1895
|
+
*/
|
|
1896
|
+
protected handlePieceDelete(store: Store$1<Piece$1>, path: string): Promise<void>;
|
|
1897
|
+
/**
|
|
1898
|
+
* Handles an error thrown while (re)loading or unloading a piece.
|
|
1899
|
+
*
|
|
1900
|
+
* @remarks Errors are never rethrown: a broken file must not take the process down, the user is expected to fix it
|
|
1901
|
+
* and save again, which triggers a new reload.
|
|
1902
|
+
* @since 3.3.0
|
|
1903
|
+
* @param error - The error that was thrown.
|
|
1904
|
+
* @param path - The full path of the file that was being processed.
|
|
1905
|
+
*/
|
|
1906
|
+
protected handleError(error: unknown, path: string): void;
|
|
1907
|
+
}
|
|
1908
|
+
export interface HMROptions extends ChokidarOptions {
|
|
1909
|
+
/**
|
|
1910
|
+
* Whether Hot Module Reloading is enabled.
|
|
1911
|
+
*
|
|
1912
|
+
* @default true
|
|
1913
|
+
*/
|
|
1914
|
+
enabled?: boolean;
|
|
1915
|
+
/**
|
|
1916
|
+
* Whether the reloader should refrain from writing to the console. Events are always emitted on the
|
|
1917
|
+
* {@link Client} regardless of this option.
|
|
1918
|
+
*
|
|
1919
|
+
* @default false
|
|
1920
|
+
*/
|
|
1921
|
+
silent?: boolean;
|
|
1922
|
+
}
|
|
1923
|
+
export declare namespace HotModuleReloader {
|
|
1924
|
+
type Options = HMROptions;
|
|
1925
|
+
}
|
|
1926
|
+
//#endregion
|
|
1927
|
+
//#region src/lib/components/IIdParser.d.ts
|
|
1928
|
+
export interface IIdParser {
|
|
1929
|
+
run(customId: string): IdParserRead | null;
|
|
1930
|
+
}
|
|
1931
|
+
export interface IdParserRead {
|
|
1932
|
+
name: string;
|
|
1933
|
+
content: unknown;
|
|
1934
|
+
}
|
|
1935
|
+
//#endregion
|
|
1936
|
+
//#region src/lib/plugins/symbols.d.ts
|
|
1937
|
+
export declare const preGenericsInitialization: unique symbol;
|
|
1938
|
+
export declare const preInitialization: unique symbol;
|
|
1939
|
+
export declare const postInitialization: unique symbol;
|
|
1940
|
+
export declare const preLoad: unique symbol;
|
|
1941
|
+
export declare const postListen: unique symbol;
|
|
1942
|
+
//#endregion
|
|
1943
|
+
//#region src/lib/plugins/Plugin.d.ts
|
|
1944
|
+
/**
|
|
1945
|
+
* The base class for all plugins. Plugins hook into the {@link Client}'s lifecycle by defining static
|
|
1946
|
+
* methods keyed by the plugin symbols. Use {@link PluginManager.use} (via `Client.use`) to register a plugin.
|
|
1947
|
+
*
|
|
1948
|
+
* @since 2.4.0
|
|
1949
|
+
*/
|
|
1950
|
+
export declare abstract class Plugin {
|
|
1951
|
+
static [preGenericsInitialization]?: (this: Client, options: ClientOptions) => void;
|
|
1952
|
+
static [preInitialization]?: (this: Client, options: ClientOptions) => void;
|
|
1953
|
+
static [postInitialization]?: (this: Client, options: ClientOptions) => void;
|
|
1954
|
+
static [preLoad]?: (this: Client, options: ClientOptions) => Awaitable<void>;
|
|
1955
|
+
static [postListen]?: (this: Client, options: ClientOptions) => Awaitable<void>;
|
|
1956
|
+
}
|
|
1957
|
+
//#endregion
|
|
1958
|
+
//#region src/lib/plugins/PluginManager.d.ts
|
|
1959
|
+
export type AsyncPluginHooks = PluginHook.PreLoad | PluginHook.PostListen;
|
|
1960
|
+
export interface HttpFrameworkPluginAsyncHook {
|
|
1961
|
+
(this: Client, options: ClientOptions): Awaitable<unknown>;
|
|
1962
|
+
}
|
|
1963
|
+
export type SyncPluginHooks = Exclude<PluginHook, AsyncPluginHooks>;
|
|
1964
|
+
export interface HttpFrameworkPluginHook {
|
|
1965
|
+
(this: Client, options: ClientOptions): unknown;
|
|
1966
|
+
}
|
|
1967
|
+
export interface HttpFrameworkPluginHookEntry<T = HttpFrameworkPluginHook | HttpFrameworkPluginAsyncHook> {
|
|
1968
|
+
hook: T;
|
|
1969
|
+
type: PluginHook;
|
|
1970
|
+
name?: string;
|
|
1971
|
+
}
|
|
1972
|
+
export declare class PluginManager {
|
|
1973
|
+
readonly registry: Set<HttpFrameworkPluginHookEntry<HttpFrameworkPluginAsyncHook | HttpFrameworkPluginHook>>;
|
|
1974
|
+
registerHook(hook: HttpFrameworkPluginHook, type: SyncPluginHooks, name?: string): this;
|
|
1975
|
+
registerHook(hook: HttpFrameworkPluginAsyncHook, type: AsyncPluginHooks, name?: string): this;
|
|
1976
|
+
registerPreGenericsInitializationHook(hook: HttpFrameworkPluginHook, name?: string): this;
|
|
1977
|
+
registerPreInitializationHook(hook: HttpFrameworkPluginHook, name?: string): this;
|
|
1978
|
+
registerPostInitializationHook(hook: HttpFrameworkPluginHook, name?: string): this;
|
|
1979
|
+
registerPreLoadHook(hook: HttpFrameworkPluginAsyncHook, name?: string): this;
|
|
1980
|
+
registerPostListenHook(hook: HttpFrameworkPluginAsyncHook, name?: string): this;
|
|
1981
|
+
use(plugin: typeof Plugin): this;
|
|
1982
|
+
values(): Generator<HttpFrameworkPluginHookEntry, void, unknown>;
|
|
1983
|
+
values(hook: SyncPluginHooks): Generator<HttpFrameworkPluginHookEntry<HttpFrameworkPluginHook>, void, unknown>;
|
|
1984
|
+
values(hook: AsyncPluginHooks): Generator<HttpFrameworkPluginHookEntry<HttpFrameworkPluginAsyncHook>, void, unknown>;
|
|
1985
|
+
}
|
|
1986
|
+
//#endregion
|
|
1987
|
+
//#region src/lib/structures/InteractionHandlerStore.d.ts
|
|
1988
|
+
export declare class InteractionHandlerStore extends Store$1<InteractionHandler, 'interaction-handlers'> {
|
|
1989
|
+
constructor();
|
|
1990
|
+
runHandler(response: ServerResponse, interaction: APIMessageComponentInteraction | APIModalSubmitInteraction): Promise<ServerResponse>;
|
|
1991
|
+
}
|
|
1992
|
+
//#endregion
|
|
1993
|
+
//#region src/lib/structures/Listener.d.ts
|
|
1994
|
+
export declare abstract class Listener<Options extends Listener.Options = Listener.Options> extends Piece$1<Options, 'listeners'> {
|
|
1995
|
+
emitter: Listener.Emitter;
|
|
1996
|
+
event: string;
|
|
1997
|
+
protected _listener: (...args: readonly any[]) => unknown;
|
|
1998
|
+
constructor(context: Listener.LoaderContext, options: Options);
|
|
1999
|
+
abstract run(...args: readonly any[]): Awaitable<unknown>;
|
|
2000
|
+
}
|
|
2001
|
+
export declare namespace Listener {
|
|
2002
|
+
/** @deprecated Use {@linkcode LoaderContext} instead. */
|
|
2003
|
+
type Context = LoaderContext;
|
|
2004
|
+
type LoaderContext = Piece$1.LoaderContext<'listeners'>;
|
|
2005
|
+
type JSON = Piece$1.JSON;
|
|
2006
|
+
type LocationJSON = Piece$1.LocationJSON;
|
|
2007
|
+
interface Options extends Piece$1.Options {
|
|
2008
|
+
emitter: Emitter | { [K in keyof Container]: Container[K] extends Emitter ? K : never; }[keyof Container];
|
|
2009
|
+
event?: string;
|
|
2010
|
+
}
|
|
2011
|
+
interface Emitter {
|
|
2012
|
+
on(eventName: string, listener: (...args: any[]) => void): this;
|
|
2013
|
+
once(eventName: string, listener: (...args: any[]) => void): this;
|
|
2014
|
+
off(eventName: string, listener: (...args: any[]) => void): this;
|
|
2015
|
+
setMaxListeners(n: number): this;
|
|
2016
|
+
getMaxListeners(): number;
|
|
2017
|
+
emit(eventName: string, ...args: any[]): boolean;
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
//#endregion
|
|
2021
|
+
//#region src/lib/structures/ListenerStore.d.ts
|
|
2022
|
+
export declare class ListenerStore extends Store$1<Listener, 'listeners'> {
|
|
2023
|
+
constructor();
|
|
2024
|
+
}
|
|
2025
|
+
//#endregion
|
|
2026
|
+
//#region src/lib/utils/logger/ILogger.d.ts
|
|
2027
|
+
/**
|
|
2028
|
+
* The available log levels, ordered from the most verbose to the least. A {@link ILogger} only writes the entries
|
|
2029
|
+
* whose level is greater than or equal to its configured one, which makes {@link LogLevel.None} a way to silence
|
|
2030
|
+
* every entry.
|
|
2031
|
+
*
|
|
2032
|
+
* @since 3.4.0
|
|
2033
|
+
*/
|
|
2034
|
+
export declare enum LogLevel {
|
|
2035
|
+
/**
|
|
2036
|
+
* The lowest level, used for very fine-grained information such as per-interaction traces.
|
|
2037
|
+
*/
|
|
2038
|
+
Trace = 10,
|
|
2039
|
+
/**
|
|
2040
|
+
* The level used for information that is useful while developing, but noisy in production.
|
|
2041
|
+
*/
|
|
2042
|
+
Debug = 20,
|
|
2043
|
+
/**
|
|
2044
|
+
* The default level, used for lifecycle information such as the HTTP server starting.
|
|
2045
|
+
*/
|
|
2046
|
+
Info = 30,
|
|
2047
|
+
/**
|
|
2048
|
+
* The level used for recoverable issues that should be looked at.
|
|
2049
|
+
*/
|
|
2050
|
+
Warn = 40,
|
|
2051
|
+
/**
|
|
2052
|
+
* The level used for errors that were handled but interrupted an operation.
|
|
2053
|
+
*/
|
|
2054
|
+
Error = 50,
|
|
2055
|
+
/**
|
|
2056
|
+
* The level used for errors the process cannot recover from.
|
|
2057
|
+
*/
|
|
2058
|
+
Fatal = 60,
|
|
2059
|
+
/**
|
|
2060
|
+
* A level no entry can reach, silencing the logger entirely.
|
|
2061
|
+
*/
|
|
2062
|
+
None = 100
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* The contract every logger must fulfill to be usable as `container.logger`.
|
|
2066
|
+
*
|
|
2067
|
+
* The framework ships a minimal {@link Logger} that writes to the console, and expects richer implementations
|
|
2068
|
+
* (file transports, structured output, and alike) to be provided by a plugin through
|
|
2069
|
+
* {@link ClientLoggerOptions.instance}.
|
|
2070
|
+
*
|
|
2071
|
+
* @since 3.4.0
|
|
2072
|
+
*/
|
|
2073
|
+
export interface ILogger {
|
|
2074
|
+
/**
|
|
2075
|
+
* Whether or not the logger writes entries at the given level.
|
|
2076
|
+
* @param level The level to check for.
|
|
2077
|
+
*/
|
|
2078
|
+
has(level: LogLevel): boolean;
|
|
2079
|
+
/**
|
|
2080
|
+
* Writes the values at {@link LogLevel.Trace} level.
|
|
2081
|
+
* @param values The values to log.
|
|
2082
|
+
*/
|
|
2083
|
+
trace(...values: readonly unknown[]): void;
|
|
2084
|
+
/**
|
|
2085
|
+
* Writes the values at {@link LogLevel.Debug} level.
|
|
2086
|
+
* @param values The values to log.
|
|
2087
|
+
*/
|
|
2088
|
+
debug(...values: readonly unknown[]): void;
|
|
2089
|
+
/**
|
|
2090
|
+
* Writes the values at {@link LogLevel.Info} level.
|
|
2091
|
+
* @param values The values to log.
|
|
2092
|
+
*/
|
|
2093
|
+
info(...values: readonly unknown[]): void;
|
|
2094
|
+
/**
|
|
2095
|
+
* Writes the values at {@link LogLevel.Warn} level.
|
|
2096
|
+
* @param values The values to log.
|
|
2097
|
+
*/
|
|
2098
|
+
warn(...values: readonly unknown[]): void;
|
|
2099
|
+
/**
|
|
2100
|
+
* Writes the values at {@link LogLevel.Error} level.
|
|
2101
|
+
* @param values The values to log.
|
|
2102
|
+
*/
|
|
2103
|
+
error(...values: readonly unknown[]): void;
|
|
2104
|
+
/**
|
|
2105
|
+
* Writes the values at {@link LogLevel.Fatal} level.
|
|
2106
|
+
* @param values The values to log.
|
|
2107
|
+
*/
|
|
2108
|
+
fatal(...values: readonly unknown[]): void;
|
|
2109
|
+
/**
|
|
2110
|
+
* Writes the values at the given level, skipping them when {@link ILogger.has} returns `false`.
|
|
2111
|
+
* @param level The level to write the values at.
|
|
2112
|
+
* @param values The values to log.
|
|
2113
|
+
*/
|
|
2114
|
+
write(level: LogLevel, ...values: readonly unknown[]): void;
|
|
2115
|
+
}
|
|
2116
|
+
//#endregion
|
|
2117
|
+
//#region src/lib/utils/security.d.ts
|
|
2118
|
+
type Key = webcrypto.CryptoKey;
|
|
2119
|
+
//#endregion
|
|
2120
|
+
//#region src/lib/Client.d.ts
|
|
2121
|
+
export declare class Client extends AsyncEventEmitter<MappedClientEvents> {
|
|
2122
|
+
#private;
|
|
2123
|
+
server: Server;
|
|
2124
|
+
/**
|
|
2125
|
+
* The Hot Module Reloader, set by {@link Client#load} when {@link ClientOptions.hmr} is enabled, and `null`
|
|
2126
|
+
* otherwise.
|
|
2127
|
+
*
|
|
2128
|
+
* @since 3.3.0
|
|
2129
|
+
*/
|
|
2130
|
+
hmr: HotModuleReloader | null;
|
|
2131
|
+
/**
|
|
2132
|
+
* The logger the client and the framework internals write to. It defaults to a {@link Logger} writing to the
|
|
2133
|
+
* console, and can be replaced with any {@link ILogger} through {@link ClientLoggerOptions.instance}, which is
|
|
2134
|
+
* how a logger plugin swaps the built-in implementation for a richer one.
|
|
2135
|
+
*
|
|
2136
|
+
* @since 3.4.0
|
|
2137
|
+
*/
|
|
2138
|
+
readonly logger: ILogger;
|
|
2139
|
+
readonly id: string;
|
|
2140
|
+
readonly options: ClientOptions;
|
|
2141
|
+
readonly bodySizeLimit: number;
|
|
2142
|
+
readonly httpReplyOnError: boolean;
|
|
2143
|
+
constructor(options?: ClientOptions);
|
|
2144
|
+
/**
|
|
2145
|
+
* The plugin manager, holding every registered plugin hook.
|
|
2146
|
+
*
|
|
2147
|
+
* @since 2.4.0
|
|
2148
|
+
*/
|
|
2149
|
+
static readonly plugins: PluginManager;
|
|
2150
|
+
/**
|
|
2151
|
+
* Registers a plugin onto the {@link Client}, applying all of its hooks.
|
|
2152
|
+
*
|
|
2153
|
+
* @since 2.4.0
|
|
2154
|
+
* @param plugin The plugin to register.
|
|
2155
|
+
*/
|
|
2156
|
+
static use(plugin: typeof Plugin): typeof Client;
|
|
2157
|
+
/**
|
|
2158
|
+
* Gets the application command registry.
|
|
2159
|
+
*
|
|
2160
|
+
* @since 2.0.0
|
|
2161
|
+
* @returns The application command registry.
|
|
2162
|
+
*/
|
|
2163
|
+
get registry(): ApplicationCommandRegistry;
|
|
2164
|
+
/**
|
|
2165
|
+
* Loads all the commands.
|
|
2166
|
+
* @param options The load options.
|
|
2167
|
+
*/
|
|
2168
|
+
load(options?: LoadOptions): Promise<void>;
|
|
2169
|
+
/**
|
|
2170
|
+
* Starts the HTTP server, listening for HTTP interactions.
|
|
2171
|
+
* @param options The listen options.
|
|
2172
|
+
*/
|
|
2173
|
+
listen({ serverOptions, postPath, port, address, ...listenOptions }: ListenOptions): Promise<void>;
|
|
2174
|
+
/**
|
|
2175
|
+
* Handles a single Web `Request`/`Response` interaction — the exact same signature verification, routing and
|
|
2176
|
+
* replies `listen()`'s `node:http` server runs, `handleRawHttpMessage` called exactly the way it calls it on
|
|
2177
|
+
* every request — without binding a port. This is `node:http`'s replacement whenever something else (Nitro, a
|
|
2178
|
+
* Worker, `Bun.serve`) owns the actual listener instead of `Client`: build a `Request` from whatever that
|
|
2179
|
+
* transport gives you and hand it here.
|
|
2180
|
+
*
|
|
2181
|
+
* The Discord public key given at construction is imported once and reused across every call, the same lifetime
|
|
2182
|
+
* `listen()` gives its own signing key.
|
|
2183
|
+
* @param request The interaction request.
|
|
2184
|
+
* @param options The fetch options.
|
|
2185
|
+
*/
|
|
2186
|
+
fetch(request: Request, options?: FetchOptions): Promise<Response>;
|
|
2187
|
+
protected handleRawHttpMessage(request: IncomingMessage, response: ServerResponse, path: string, key: Key): Promise<ServerResponse<IncomingMessage>>;
|
|
2188
|
+
protected handleHttpMessage(interaction: Exclude<APIInteraction, APIPrimaryEntryPointCommandInteraction>, response: ServerResponse): Promise<ServerResponse>;
|
|
2189
|
+
}
|
|
2190
|
+
export interface ClientOptions {
|
|
2191
|
+
/**
|
|
2192
|
+
* The public key from Discord, available under "General Information" after opening an application from
|
|
2193
|
+
* [Discord's applications](https://discord.com/developers/applications).
|
|
2194
|
+
*
|
|
2195
|
+
* @default process.env.DISCORD_PUBLIC_KEY
|
|
2196
|
+
*/
|
|
2197
|
+
discordPublicKey?: string;
|
|
2198
|
+
/**
|
|
2199
|
+
* The Discord token used for authenticating requests outside of interaction responses.
|
|
2200
|
+
*
|
|
2201
|
+
* @default process.env.DISCORD_TOKEN
|
|
2202
|
+
*/
|
|
2203
|
+
discordToken?: string;
|
|
2204
|
+
/**
|
|
2205
|
+
* The options to be passed to the underlying REST library.
|
|
2206
|
+
*/
|
|
2207
|
+
restOptions?: Partial<RESTOptions>;
|
|
2208
|
+
/**
|
|
2209
|
+
* The body size limit in bytes.
|
|
2210
|
+
* @default 1024 * 1024 // (1 MiB)
|
|
2211
|
+
*/
|
|
2212
|
+
bodySizeLimit?: number;
|
|
2213
|
+
/**
|
|
2214
|
+
* Whether to reply with a 500 status code to Discord if an error occurs while processing an interaction.
|
|
2215
|
+
* @default true
|
|
2216
|
+
*/
|
|
2217
|
+
httpReplyOnError?: boolean;
|
|
2218
|
+
/**
|
|
2219
|
+
* The ID of the client.
|
|
2220
|
+
*
|
|
2221
|
+
* @default process.env.DISCORD_CLIENT_ID ?? Buffer.from(token.split('.')[0], 'base64').toString()
|
|
2222
|
+
*/
|
|
2223
|
+
clientId?: string;
|
|
2224
|
+
/**
|
|
2225
|
+
* The prefix to use for authentication in REST calls.
|
|
2226
|
+
* @default 'Bot'
|
|
2227
|
+
* @since 2.0.0
|
|
2228
|
+
*/
|
|
2229
|
+
authPrefix?: RequestAuthPrefix;
|
|
2230
|
+
/**
|
|
2231
|
+
* The Hot Module Reloading options. When {@link HMROptions.enabled} is `true`, {@link Client#load} starts a
|
|
2232
|
+
* {@link HotModuleReloader} that watches every store path and reloads pieces as their files change.
|
|
2233
|
+
*
|
|
2234
|
+
* @remarks HMR is meant for development only, keep it disabled in production.
|
|
2235
|
+
* @default undefined // HMR is not started
|
|
2236
|
+
* @since 3.3.0
|
|
2237
|
+
*/
|
|
2238
|
+
hmr?: HMROptions;
|
|
2239
|
+
/**
|
|
2240
|
+
* The options for {@link Client#logger}, which is also exposed as `container.logger`.
|
|
2241
|
+
*
|
|
2242
|
+
* @since 3.4.0
|
|
2243
|
+
*/
|
|
2244
|
+
logger?: ClientLoggerOptions;
|
|
2245
|
+
}
|
|
2246
|
+
export interface ClientLoggerOptions {
|
|
2247
|
+
/**
|
|
2248
|
+
* The lowest {@link LogLevel} the built-in {@link Logger} writes. Ignored when
|
|
2249
|
+
* {@link ClientLoggerOptions.instance} is set.
|
|
2250
|
+
*
|
|
2251
|
+
* @default LogLevel.Info
|
|
2252
|
+
* @since 3.4.0
|
|
2253
|
+
*/
|
|
2254
|
+
level?: LogLevel;
|
|
2255
|
+
/**
|
|
2256
|
+
* The {@link ILogger} to use instead of the built-in {@link Logger}. Plugins set this from a
|
|
2257
|
+
* {@link PluginHook.PreGenericsInitialization} hook to extend the framework's logging.
|
|
2258
|
+
*
|
|
2259
|
+
* @default undefined // a new Logger is created
|
|
2260
|
+
* @since 3.4.0
|
|
2261
|
+
*/
|
|
2262
|
+
instance?: ILogger;
|
|
2263
|
+
}
|
|
2264
|
+
export interface LoadOptions {
|
|
2265
|
+
/**
|
|
2266
|
+
* The base user directory, if set to `null`, the library will not call {@link StoreRegistry.registerPath},
|
|
2267
|
+
* meaning that you will need to manually set each folder for each store. Please read the aforementioned method's
|
|
2268
|
+
* documentation for more information.
|
|
2269
|
+
*/
|
|
2270
|
+
baseUserDirectory?: string | null;
|
|
2271
|
+
}
|
|
2272
|
+
export interface ListenOptions extends Omit<ListenOptions$1, 'path' | 'readableAll' | 'writableAll'> {
|
|
2273
|
+
/**
|
|
2274
|
+
* The port at which the server will listen for requests.
|
|
2275
|
+
*/
|
|
2276
|
+
port: number;
|
|
2277
|
+
/**
|
|
2278
|
+
* The address at which the server will be started.
|
|
2279
|
+
*/
|
|
2280
|
+
address?: string;
|
|
2281
|
+
/**
|
|
2282
|
+
* The path the HTTP server will listen to.
|
|
2283
|
+
* @default process.env.HTTP_POST_PATH ?? '/'
|
|
2284
|
+
*/
|
|
2285
|
+
postPath?: `/${string}`;
|
|
2286
|
+
/**
|
|
2287
|
+
* The options to pass to the `createServer` function.
|
|
2288
|
+
*/
|
|
2289
|
+
serverOptions?: ServerOptions;
|
|
2290
|
+
}
|
|
2291
|
+
export interface FetchOptions {
|
|
2292
|
+
/**
|
|
2293
|
+
* The path interactions are posted to.
|
|
2294
|
+
* @default process.env.HTTP_POST_PATH ?? '/'
|
|
2295
|
+
*/
|
|
2296
|
+
postPath?: string;
|
|
2297
|
+
}
|
|
2298
|
+
export declare namespace Client {
|
|
2299
|
+
type Options = ClientOptions;
|
|
2300
|
+
type LoggerOptions = ClientLoggerOptions;
|
|
2301
|
+
type PieceLoadOptions = LoadOptions;
|
|
2302
|
+
type ServerListenOptions = ListenOptions;
|
|
2303
|
+
type ServerFetchOptions = FetchOptions;
|
|
2304
|
+
}
|
|
2305
|
+
declare module '@sapphire/pieces' {
|
|
2306
|
+
interface StoreRegistryEntries {
|
|
2307
|
+
commands: CommandStore;
|
|
2308
|
+
'interaction-handlers': InteractionHandlerStore;
|
|
2309
|
+
listeners: ListenerStore;
|
|
2310
|
+
}
|
|
2311
|
+
interface Container {
|
|
2312
|
+
client: Client;
|
|
2313
|
+
idParser: IIdParser;
|
|
2314
|
+
rest: REST;
|
|
2315
|
+
applicationCommandRegistry: ApplicationCommandRegistry;
|
|
2316
|
+
logger: ILogger;
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
//#endregion
|
|
4
2320
|
//#region src/lib/api/HttpCodes.d.ts
|
|
5
2321
|
export declare enum HttpCodes {
|
|
6
2322
|
/**
|
|
@@ -1033,5 +3349,5 @@ export declare class Logger implements ILogger {
|
|
|
1033
3349
|
*/
|
|
1034
3350
|
export type LoggerConsoleMethod = 'debug' | 'error' | 'info' | 'trace' | 'warn';
|
|
1035
3351
|
//#endregion
|
|
1036
|
-
export { type AbortError, type AddFiles, AliasPiece, type AliasPieceOptions, AliasStore,
|
|
3352
|
+
export { type AbortError, type AddFiles, AliasPiece, type AliasPieceOptions, AliasStore, type AsyncDiscordResult, AutocompleteInteraction$1 as AutocompleteInteraction, type DiscordError, type DiscordResult, Interaction$1 as Interaction, LoaderError, type LoaderPieceContext, MessageComponentStringSelectInteraction as MessageComponentSelectMenuInteraction, MissingExportsError, type NonPingInteraction, Piece, type PieceContext, type PieceOptions, Store, type StoreOptions, StoreRegistry, type StoreRegistryEntries, container };
|
|
1037
3353
|
//# sourceMappingURL=index.d.ts.map
|