@magicyan/discord 1.4.11 → 1.5.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.
Files changed (44) hide show
  1. package/dist/functions/components/components.cjs +2 -2
  2. package/dist/functions/components/components.mjs +2 -2
  3. package/dist/functions/components/container.cjs +71 -61
  4. package/dist/functions/components/container.mjs +72 -63
  5. package/dist/functions/components/file.cjs +3 -5
  6. package/dist/functions/components/file.mjs +4 -6
  7. package/dist/functions/embeds/assets.cjs +4 -4
  8. package/dist/functions/embeds/assets.mjs +4 -4
  9. package/dist/guards/attachment.cjs +7 -1
  10. package/dist/guards/attachment.mjs +7 -1
  11. package/dist/guards/components/button.cjs +10 -0
  12. package/dist/guards/components/button.mjs +8 -0
  13. package/dist/guards/components/container.cjs +10 -0
  14. package/dist/guards/components/container.mjs +8 -0
  15. package/dist/guards/components/gallery.cjs +14 -0
  16. package/dist/guards/components/gallery.mjs +11 -0
  17. package/dist/guards/components/modal.cjs +10 -0
  18. package/dist/guards/components/modal.mjs +8 -0
  19. package/dist/guards/components/row.cjs +18 -0
  20. package/dist/guards/components/row.mjs +16 -0
  21. package/dist/guards/components/section.cjs +10 -0
  22. package/dist/guards/components/section.mjs +8 -0
  23. package/dist/guards/components/selectmenu.cjs +30 -0
  24. package/dist/guards/components/selectmenu.mjs +23 -0
  25. package/dist/guards/components/separator.cjs +10 -0
  26. package/dist/guards/components/separator.mjs +8 -0
  27. package/dist/guards/components/textdisplay.cjs +10 -0
  28. package/dist/guards/components/textdisplay.mjs +8 -0
  29. package/dist/guards/components/textinput.cjs +10 -0
  30. package/dist/guards/components/textinput.mjs +8 -0
  31. package/dist/guards/message.cjs +17 -0
  32. package/dist/guards/message.mjs +15 -0
  33. package/dist/guards/utils.cjs +9 -0
  34. package/dist/guards/utils.mjs +7 -0
  35. package/dist/index.cjs +70 -45
  36. package/dist/index.d.cts +811 -481
  37. package/dist/index.d.mts +811 -481
  38. package/dist/index.d.ts +811 -481
  39. package/dist/index.mjs +29 -20
  40. package/package.json +1 -1
  41. package/dist/guards/button.cjs +0 -9
  42. package/dist/guards/button.mjs +0 -7
  43. package/dist/guards/selectmenu.cjs +0 -9
  44. package/dist/guards/selectmenu.mjs +0 -7
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { GatewayIntentBits, Partials, Attachment, AttachmentBuilder, EmbedAssetData, Guild, GuildMember, User, ClientUser, ImageURLOptions, EmbedFooterData, ColorResolvable, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, ComponentEmojiResolvable, ButtonBuilder, ActionRowBuilder, LinkButtonComponentData, AnyComponentBuilder, FileBuilder, APIUnfurledMediaItem, MediaGalleryItemData, MediaGalleryBuilder, SeparatorBuilder, ThumbnailComponentData, ThumbnailBuilder, ButtonComponentData, SectionBuilder, TextDisplayBuilder, MessageActionRowComponentBuilder, ContainerBuilder, ContainerComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitInteraction, ModalSubmitFields, Collection, TextInputComponent, ModalBuilder, TextInputStyle, TextInputComponentData, GuildEmoji, GuildTextBasedChannel, Message, Role, WebhookClientOptions, WebhookClient, WebhookClientData, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, ChannelSelectMenuBuilder, MentionableSelectMenuBuilder } from 'discord.js';
2
+ import { GatewayIntentBits, Partials, ChannelType, Guild, CommandInteractionOption, Client, ApplicationCommand, GuildEmoji, GuildMember, GuildTextBasedChannel, Message, ActionRowBuilder, TextInputBuilder, ModalSubmitInteraction, ModalSubmitFields, Collection, TextInputComponent, ModalBuilder, TextInputStyle, TextInputComponentData, Role, WebhookClientOptions, WebhookClient, WebhookClientData, ComponentEmojiResolvable, ButtonBuilder, LinkButtonComponentData, Attachment, AttachmentBuilder, MessageActionRowComponentBuilder, TextDisplayBuilder, SeparatorBuilder, FileBuilder, SectionBuilder, MediaGalleryBuilder, ContainerBuilder, ContainerComponentBuilder, ColorResolvable, ComponentType, ContainerComponentData, ContainerComponent, APIUnfurledMediaItem, MediaGalleryItemData, AnyComponentBuilder, ThumbnailComponentData, ThumbnailBuilder, ButtonComponentData, EmbedAssetData, User, ClientUser, ImageURLOptions, EmbedFooterData, APIEmbed, Embed, EmbedData, EmbedBuilder, AttachmentData, MediaGalleryItemBuilder, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, ChannelSelectMenuBuilder, MentionableSelectMenuBuilder } from 'discord.js';
3
3
  export * from '@magicyan/core';
4
4
 
5
5
  declare const chars: {
@@ -57,8 +57,620 @@ declare const Separator: {
57
57
  readonly Hidden: discord_js.SeparatorBuilder;
58
58
  };
59
59
 
60
+ type GuildChannelType = Exclude<ChannelType, ChannelType.DM>;
61
+ type FindChannelFilter<T extends GuildChannelType> = (channel: GetChannelType<T>) => boolean;
62
+ type GetChannelType<Type extends GuildChannelType> = Extract<NonNullable<CommandInteractionOption<"cached">["channel"]>, {
63
+ type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread ? ChannelType.PublicThread | ChannelType.AnnouncementThread : Type;
64
+ }>;
65
+ declare function findChannel<Type extends GuildChannelType = ChannelType.GuildText>(guild: Guild, type?: Type): {
66
+ byId(id: string): GetChannelType<Type> | undefined;
67
+ byName(name: string, and?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
68
+ byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
69
+ inCategoryId(id: string): {
70
+ byId(id: string): GetChannelType<Type> | undefined;
71
+ byName(name: string, and?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
72
+ byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
73
+ };
74
+ inCategoryName(name: string): {
75
+ byId(id: string): GetChannelType<Type> | undefined;
76
+ byName(name: string, and?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
77
+ byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
78
+ };
79
+ };
80
+ interface ChannelUrlInfo {
81
+ channelId?: string;
82
+ guildId?: string;
83
+ }
84
+ declare function getChannelUrlInfo(url: string): ChannelUrlInfo;
85
+
86
+ type FindCommandFilter = (command: ApplicationCommand) => boolean;
87
+ declare function findCommand(guildOrClient: Guild | Client<true>): {
88
+ byName(name: string, and?: FindCommandFilter): ApplicationCommand<{
89
+ guild: discord_js.GuildResolvable;
90
+ }> | undefined;
91
+ byId(id: string): ApplicationCommand<{
92
+ guild: discord_js.GuildResolvable;
93
+ }> | undefined;
94
+ byFilter(filter: FindCommandFilter): ApplicationCommand<{
95
+ guild: discord_js.GuildResolvable;
96
+ }> | undefined;
97
+ };
98
+ interface CommandMentionData {
99
+ id: string;
100
+ name: string;
101
+ }
102
+ declare function commandMention(command: CommandMentionData, group?: string, subcommand?: string): string;
103
+ declare function commandMention(command: CommandMentionData, subcommand?: string): string;
104
+
105
+ type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
106
+ declare function findEmoji(guildOrClient: Guild | Client): {
107
+ byName(name: string, animated?: boolean, and?: FindEmojiFilter): GuildEmoji | undefined;
108
+ byId(id: string, animated?: boolean): GuildEmoji | undefined;
109
+ byFilter(filter: FindEmojiFilter): GuildEmoji | undefined;
110
+ };
111
+
112
+ type FindMemberFilter = (member: GuildMember) => boolean;
113
+ declare function findMember(guild: Guild): {
114
+ byGlobalName(globalName: string, and?: FindMemberFilter): GuildMember | undefined;
115
+ byNickname(nickname: string, and?: FindMemberFilter): GuildMember | undefined;
116
+ byUsername(username: string, and?: FindMemberFilter): GuildMember | undefined;
117
+ byDisplayName(displayName: string, and?: FindMemberFilter): GuildMember | undefined;
118
+ byId(id: string): GuildMember | undefined;
119
+ byFilter(filter: FindMemberFilter): GuildMember | undefined;
120
+ };
121
+
122
+ type FindMessageFilter = (role: Message<true>) => boolean;
123
+ declare function findMessage(channel: GuildTextBasedChannel): {
124
+ all(limit?: number): Promise<Message<boolean>[]>;
125
+ byId(id: string): Message<true> | undefined;
126
+ byContent(): {
127
+ equals(content: string, ignoreCase?: boolean): Message<true> | undefined;
128
+ include(content: string, ignoreCase?: boolean): Message<true> | undefined;
129
+ };
130
+ byFilter(filter: FindMessageFilter): Message<true> | undefined;
131
+ };
132
+ type MessageURLInfo = {
133
+ channelId: string;
134
+ guildId: string;
135
+ messageId: string;
136
+ } | {
137
+ messageId?: undefined;
138
+ channelId?: string;
139
+ guildId?: string;
140
+ };
141
+ declare function getMessageURLInfo(url: string): MessageURLInfo;
142
+ declare function fetchMessageFromURL(guild: Guild, url: string): Promise<Message<true> | null>;
143
+ declare function fetchMessageFromURL(client: Client | Client, url: string): Promise<Message | null>;
144
+
60
145
  declare function setMobileStatus(): void;
61
146
 
147
+ type TextInputData = Omit<TextInputComponentData, "type">;
148
+ interface ModalFieldData extends Omit<TextInputData, "style"> {
149
+ style?: TextInputStyle;
150
+ }
151
+ declare function createModalInput(data: ModalFieldData): ActionRowBuilder<TextInputBuilder>;
152
+ type ModalFieldsData = Record<string, Omit<ModalFieldData, "customId">>;
153
+ declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
154
+ type ModalFieldsRecord<K extends string> = Record<K, string>;
155
+ declare function modalFieldsToRecord<K extends string = string>(fields: ModalSubmitInteraction | ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord<K>;
156
+ interface CreateModalData {
157
+ title?: string;
158
+ customId: string;
159
+ components: ModalFieldsData;
160
+ }
161
+ declare function createModal(data: CreateModalData): ModalBuilder;
162
+
163
+ /**
164
+ *
165
+ * @param mention Discord mentionable string
166
+ * @returns mentionable id or null
167
+ *
168
+ * ```ts
169
+ * const user = "<@264620632644255745>";
170
+ * const channel = "<#1068689068256403457>";
171
+ * const role = "<@&929925182796226632>";
172
+ *
173
+ * extractMentionId(user) // 264620632644255745
174
+ * extractMentionId(channel) // 1068689068256403457
175
+ * extractMentionId(role) // 929925182796226632
176
+ * ```
177
+ */
178
+ declare function extractMentionId(mention: string): string | null;
179
+
180
+ type FindRoleFilter = (role: Role) => boolean;
181
+ /**
182
+ *
183
+ * @param guild Discord guild
184
+ *
185
+ * ```ts
186
+ * const memberRole = findRole(guild).byName("Member");
187
+ * const adminRole = findRole(guild).byHexColor("#ff5454");
188
+ * const leaderRole = findRole(guild).byId("537818031728885771");
189
+ * ```
190
+ */
191
+ declare function findRole(guild: Guild): {
192
+ byColor(color: number, and?: FindRoleFilter): Role | undefined;
193
+ byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
194
+ byName(name: string, and?: FindRoleFilter): Role | undefined;
195
+ byId(id: string): Role | undefined;
196
+ byFilter(filter: FindRoleFilter): Role | undefined;
197
+ };
198
+
199
+ declare function createWebhookClient(url: string, options?: WebhookClientOptions): WebhookClient | null;
200
+ declare function createWebhookClient(data: WebhookClientData, options?: WebhookClientOptions): WebhookClient | null;
201
+
202
+ interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
203
+ }
204
+ declare function createLinkButton(link: string, label?: string, emoji?: ComponentEmojiResolvable): ButtonBuilder;
205
+ declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
206
+ /**
207
+ * Wraps buttons into multiple {@link ActionRowBuilder} instances with a maximum number of buttons per row.
208
+ *
209
+ * This function takes a list of {@link ButtonBuilder} instances (or arrays of them) and groups them into
210
+ * multiple `ActionRowBuilder<ButtonBuilder>` objects, ensuring that each row contains no more than the specified
211
+ * number of buttons.
212
+ *
213
+ * @param maxItemsPerRow - The maximum number of buttons to include in each row.
214
+ * @param buttons - A variadic list of {@link ButtonBuilder} instances or arrays of them to be wrapped.
215
+ *
216
+ * @returns An array of {@link ActionRowBuilder} instances, each containing up to `maxItemsPerRow` buttons.
217
+ *
218
+ * @example
219
+ * const button1 = new ButtonBuilder({ customId: "a", label: "A", style: ButtonStyle.Success });
220
+ * const button2 = new ButtonBuilder({ customId: "b", label: "B", style: ButtonStyle.Primary });
221
+ * const button3 = new ButtonBuilder({ customId: "c", label: "C", style: ButtonStyle.Danger });
222
+ *
223
+ * const rows = wrapButtons(2, button1, button2, button3);
224
+ * // Result: Two rows, the first with [button1, button2], the second with [button3]
225
+ */
226
+ declare function wrapButtons(maxItemsPerRow: number, ...buttons: (ButtonBuilder | ButtonBuilder[])[]): ActionRowBuilder<ButtonBuilder>[];
227
+
228
+ type MagicComponentData = string | Attachment | AttachmentBuilder | MessageActionRowComponentBuilder;
229
+ type ComponentBuildersData = TextDisplayBuilder | SeparatorBuilder | FileBuilder | SectionBuilder | MediaGalleryBuilder | ActionRowBuilder<MessageActionRowComponentBuilder>;
230
+ type ComponentData = ComponentBuildersData | MagicComponentData | null | undefined | boolean;
231
+ type CreateComponentData = ComponentData | ContainerBuilder;
232
+ type CreateComponentsReturn<IsContainer> = IsContainer extends true ? ContainerComponentBuilder[] : (ContainerComponentBuilder | ContainerBuilder)[];
233
+ type CreateComponentsData<IsContainer> = IsContainer extends true ? ComponentData : ComponentData | ContainerBuilder;
234
+ declare function createComponents<IsContainer extends boolean = false, Data extends CreateComponentsData<IsContainer> = CreateComponentsData<IsContainer>>(...data: (Data | Data[])[]): CreateComponentsReturn<IsContainer>;
235
+
236
+ type ContainerColor = (string & {}) | ColorResolvable;
237
+ type ContainerInComponentType = ComponentType.TextDisplay | ComponentType.ActionRow | ComponentType.Section | ComponentType.Separator | ComponentType.MediaGallery | ComponentType.File;
238
+ type ContainerType = ContainerBuilder | ContainerPlusBuilder | ContainerComponent;
239
+ interface ContainerData extends Omit<ContainerComponentData, "accentColor" | "type" | "components"> {
240
+ accentColor?: ContainerColor | null;
241
+ components?: ComponentData[];
242
+ from?: ContainerType | Message;
243
+ fromIndex?: number;
244
+ }
245
+ declare class ContainerPlusBuilder extends ContainerBuilder {
246
+ constructor(data?: ContainerData);
247
+ /**
248
+ * Sets the accent color of the container.
249
+ *
250
+ * If a color is provided, it resolves and sets the accent color accordingly.
251
+ * If no color or `null` is provided, it clears the accent color.
252
+ *
253
+ * @param color - The color to set as the accent color, or `null` to clear it.
254
+ * @returns The current instance for chaining.
255
+ *
256
+ * @example
257
+ * container.setColor("#ff0000"); // Sets the accent color to red.
258
+ * container.setColor(null); // Clears the accent color.
259
+ */
260
+ setColor(color?: ContainerColor | null): this;
261
+ /**
262
+ * Replaces or removes a component at the specified index in the container.
263
+ *
264
+ * If `data` is provided, it replaces the component at the given index with the new component(s).
265
+ * If `null` is provided, it removes the component at that index.
266
+ *
267
+ * @param index - The index of the component to replace or remove.
268
+ * @param data - The new component data to set, or `null` to remove the component.
269
+ * @returns The current instance for chaining.
270
+ *
271
+ * @example
272
+ * container.setComponent(0, new ButtonBuilder({ label: "Click" }));
273
+ * container.setComponent(1, null); // Removes the component at index 1.
274
+ */
275
+ setComponent(index: number, data: ComponentData | null): this;
276
+ /**
277
+ * Retrieves a component from the container at the specified index, optionally filtering by component type.
278
+ *
279
+ * When the `type` is specified, it filters components by that type and returns the one at the given index.
280
+ * If `type` is omitted, it returns the component at the index without filtering.
281
+ *
282
+ * @param index - The index of the component to retrieve.
283
+ * @param type - (Optional) The type of component to filter by.
284
+ * @returns The component builder if found; otherwise `undefined`.
285
+ *
286
+ * @example
287
+ * const button = container.componentAt(0, ComponentType.ActionRow);
288
+ * const firstComponent = container.componentAt(0);
289
+ */
290
+ componentAt(index: number): ContainerComponentBuilder | undefined;
291
+ componentAt(index: number, type: ComponentType.TextDisplay): TextDisplayBuilder | undefined;
292
+ componentAt(index: number, type: ComponentType.ActionRow): ActionRowBuilder | undefined;
293
+ componentAt(index: number, type: ComponentType.Separator): SeparatorBuilder | undefined;
294
+ componentAt(index: number, type: ComponentType.MediaGallery): MediaGalleryBuilder | undefined;
295
+ componentAt(index: number, type: ComponentType.File): FileBuilder | undefined;
296
+ }
297
+ /**
298
+ * Creates one or multiple {@link ContainerPlusBuilder} components with optional accent color and child components.
299
+ *
300
+ * This function supports two main usage patterns:
301
+ * 1. Passing a `ContainerData` object with optional `array` flag:
302
+ * - If `array` is `true` and `from` is a message, returns an array of containers extracted from the message components.
303
+ * - If `array` is `true` without a message `from`, returns an array with one container.
304
+ * - Otherwise, returns a single container.
305
+ * 2. Passing an accent color (string, number, or RGB tuple) directly, followed by one or more components.
306
+ *
307
+ * The container can include various types of components such as:
308
+ * - `string` (converted to {@link TextDisplayBuilder})
309
+ * - {@link TextDisplayBuilder}
310
+ * - {@link ActionRowBuilder}
311
+ * - {@link ButtonBuilder}
312
+ * - {@link SectionBuilder}
313
+ * - {@link MediaGalleryBuilder}
314
+ * - {@link FileBuilder}
315
+ * - {@link SeparatorBuilder}
316
+ * - Discord attachments (treated as media galleries)
317
+ *
318
+ * @param data - A `ContainerData` object (with optional `array` and `from` properties) or a color value.
319
+ * @param items - When `data` is a color, this is the list of components to include in the container.
320
+ *
321
+ * @returns Either a single {@link ContainerPlusBuilder} or an array of them, depending on the `array` flag and `from` property.
322
+ *
323
+ * @example
324
+ * // Create a single container with accent color and components
325
+ * const container = createContainer({
326
+ * accentColor: "#ff5733",
327
+ * components: ["Welcome!"]
328
+ * });
329
+ *
330
+ * @example
331
+ * // Create multiple containers extracted from a message
332
+ * const containers = createContainer({
333
+ * array: true,
334
+ * from: message
335
+ * });
336
+ *
337
+ * @example
338
+ * // Create container by passing color and components separately
339
+ * const container = createContainer("Blue",
340
+ * new TextDisplayBuilder().setText("Notice"),
341
+ * new SeparatorBuilder()
342
+ * );
343
+ */
344
+ declare function createContainer(data: ContainerData & {
345
+ array?: boolean;
346
+ }): ContainerPlusBuilder;
347
+ declare function createContainer(data: ContainerData & {
348
+ array?: true;
349
+ }): ContainerPlusBuilder[];
350
+ declare function createContainer(data: ColorResolvable | string, ...components: (ComponentData | ComponentData[])[]): ContainerPlusBuilder;
351
+
352
+ type FileSource = string | Attachment | AttachmentBuilder;
353
+ interface CreateFileOptions extends Omit<APIUnfurledMediaItem, "url"> {
354
+ spoiler?: boolean;
355
+ }
356
+ /**
357
+ * Creates a {@link FileBuilder} from an {@link AttachmentBuilder} or an attachment reference string.
358
+ *
359
+ * If the `source` is an {@link AttachmentBuilder}, it automatically prefixes the file name with `"attachment://"`.
360
+ * If the `source` is a string, it must already be a valid attachment reference in the format `"attachment://filename.ext"`.
361
+ *
362
+ * You can optionally provide file metadata through the `options` parameter, such as dimensions
363
+ * or whether the file should be marked as a spoiler.
364
+ *
365
+ * @param source - The source of the file. Must be an {@link AttachmentBuilder} or an attachment reference string.
366
+ * @param options - Optional metadata for the file, such as `width`, `height`, `spoiler`, and `size`.
367
+ *
368
+ * @returns A {@link FileBuilder} ready to be used inside a message component.
369
+ *
370
+ * @example
371
+ * // Creating a file from an AttachmentBuilder
372
+ * const attachment = new AttachmentBuilder("path/to/image.png");
373
+ * const file = createFile(attachment);
374
+ *
375
+ * @example
376
+ * // Creating a file from an attachment reference string
377
+ * const file = createFile("attachment://image.png");
378
+ *
379
+ * @example
380
+ * // Creating a file with additional options like marking it as a spoiler
381
+ * const file = createFile("attachment://secret.png", { spoiler: true });
382
+ */
383
+ declare function createFile(source: FileSource, options?: CreateFileOptions): FileBuilder;
384
+
385
+ type MediaGallerySource = MediaGalleryItemData | string | Attachment | AttachmentBuilder | null | undefined;
386
+ /**
387
+ * Creates a {@link MediaGalleryBuilder} instance with a collection of media items, which can be images, attachments, or URLs.
388
+ *
389
+ * This function allows you to add multiple media items to a gallery, where each item can be a URL,
390
+ * an {@link Attachment}, or an {@link AttachmentBuilder}. It processes each item and adds it to the gallery,
391
+ * converting it into the appropriate format for rendering.
392
+ *
393
+ * **Parameters:**
394
+ * - `items`: An array of media items to be added to the gallery. Each item can be:
395
+ * - A {@link MediaGalleryItemData} object, which includes media information such as URLs.
396
+ * - A string URL pointing to an external resource (e.g., an image URL).
397
+ * - An {@link Attachment} or {@link AttachmentBuilder}, which are Discord attachments.
398
+ *
399
+ * @param items - The media items to be added to the gallery. Each item is processed and converted into a format suitable for the gallery.
400
+ *
401
+ * @returns A {@link MediaGalleryBuilder} instance populated with the specified media items.
402
+ *
403
+ * @example
404
+ * // Creating a media gallery with URLs and an attachment
405
+ * const gallery = createMediaGallery(
406
+ * "https://example.com/image1.png",
407
+ * new AttachmentBuilder("image2.png", { name: "image2.png" }),
408
+ * { media: { url: "https://example.com/image3.png" } }
409
+ * );
410
+ *
411
+ * @example
412
+ * // Creating a media gallery with only attachments
413
+ * const gallery = createMediaGallery(
414
+ * new AttachmentBuilder("file1.png", { name: "file1.png" }),
415
+ * new AttachmentBuilder("file2.png", { name: "file2.png" })
416
+ * );
417
+ *
418
+ * @example
419
+ * // Creating a media gallery with mixed media types (URL and attachment)
420
+ * const gallery = createMediaGallery(
421
+ * "https://example.com/image1.png",
422
+ * new AttachmentBuilder("image2.png", { name: "image2.png" })
423
+ * );
424
+ *
425
+ */
426
+ declare function createMediaGallery(...items: (MediaGallerySource | MediaGallerySource[])[]): MediaGalleryBuilder;
427
+
428
+ /**
429
+ * Creates an {@link ActionRowBuilder} containing one or more UI components.
430
+ *
431
+ * This function accepts individual components or arrays of components, flattens them,
432
+ * and returns an action row builder suitable for use in Discord messages.
433
+ * It's designed to support any component builder type that extends {@link AnyComponentBuilder}.
434
+ *
435
+ * ---
436
+ * While this function supports any valid message component (such as buttons, select menus, etc.),
437
+ * the examples below demonstrate common use cases using {@link ButtonBuilder} and {@link StringSelectMenuBuilder}.
438
+ *
439
+ * @typeParam Component - A type extending {@link AnyComponentBuilder}, such as a button or select menu builder.
440
+ *
441
+ * @param components - A variadic list of component instances or arrays of component instances to include in the row.
442
+ *
443
+ * @returns An {@link ActionRowBuilder} instance containing all provided components.
444
+ *
445
+ * @example
446
+ * // Create a row with two buttons
447
+ * const row = createRow(
448
+ * new ButtonBuilder({ customId: "a", label: "A", style: ButtonStyle.Success }),
449
+ * new ButtonBuilder({ customId: "b", label: "B", style: ButtonStyle.Primary }),
450
+ * new ButtonBuilder({ customId: "c", label: "C", style: ButtonStyle.Danger })
451
+ * );
452
+ *
453
+ * @example
454
+ * // Create a row with a string select menu
455
+ * const row = createRow(
456
+ * new StringSelectMenuBuilder({
457
+ * customId: "choose",
458
+ * placeholder: "Make a selection",
459
+ * options: [
460
+ * { label: "Option 1", value: "opt1" },
461
+ * { label: "Option 2", value: "opt2" },
462
+ * { label: "Option 3", value: "opt3" },
463
+ * ]
464
+ * })
465
+ * );
466
+ */
467
+ declare function createRow<Component extends AnyComponentBuilder>(...components: (Component | Component[])[]): ActionRowBuilder<Component>;
468
+
469
+ type ThumbnailData = Partial<Omit<ThumbnailComponentData, "type">> | Attachment | AttachmentBuilder | string;
470
+ /**
471
+ * Creates a {@link ThumbnailBuilder} from a URL, an attachment, or partial thumbnail data.
472
+ *
473
+ * This function helps create a thumbnail component for a container.
474
+ * It supports different input formats, such as a direct URL string,
475
+ * an {@link AttachmentBuilder}, an {@link Attachment}, or a partial {@link ThumbnailComponentData}.
476
+ *
477
+ * **Important:**
478
+ * - If providing a string, it must either be a valid URL or a reference to an attachment using the `attachment://filename.ext` format.
479
+ *
480
+ * @param data - The thumbnail source: a URL, an attachment builder, an attachment, or partial thumbnail data.
481
+ *
482
+ * @returns A {@link ThumbnailBuilder} instance populated with the provided data.
483
+ *
484
+ * @example
485
+ * // Creating a thumbnail from a URL
486
+ * const thumbnail = createThumbnail("https://example.com/image.png");
487
+ *
488
+ * @example
489
+ * // Creating a thumbnail from partial data
490
+ * const thumbnail = createThumbnail({
491
+ * media: { url: "attachment://image.png" },
492
+ * spoiler: true
493
+ * });
494
+ */
495
+ declare function createThumbnail(data: ThumbnailData): ThumbnailBuilder;
496
+
497
+ type SectionThumbnailAccessory = ThumbnailBuilder | ThumbnailData;
498
+ type SectionButtonAccessory = ButtonBuilder | Partial<ButtonComponentData>;
499
+ type SectionAccessory = SectionThumbnailAccessory | SectionButtonAccessory;
500
+ type SectionAccessoryData = {
501
+ accessory: SectionAccessory;
502
+ button?: never;
503
+ thumbnail?: never;
504
+ } | {
505
+ button: SectionButtonAccessory;
506
+ thumbnail?: never;
507
+ accessory?: never;
508
+ } | {
509
+ thumbnail: SectionThumbnailAccessory;
510
+ button?: never;
511
+ accessory?: never;
512
+ };
513
+ type SectionData = SectionAccessoryData & {
514
+ content: string | string[];
515
+ };
516
+ /**
517
+ * Creates a {@link SectionBuilder} component with customizable text content and a single visual accessory.
518
+ *
519
+ * This function allows you to generate a section with content (as a string or an array of strings)
520
+ * and optionally include a single accessory, which can be a button or a thumbnail.
521
+ * You can provide the accessory in multiple forms: a builder instance, a plain data object, or a URL string (for thumbnails).
522
+ *
523
+ * ---
524
+ * ### Overloads:
525
+ *
526
+ * 1. `createSection(content, accessory)`
527
+ * Pass content as a string and an accessory separately.
528
+ *
529
+ * 2. `createSection({ content, accessory | button | thumbnail })`
530
+ * Pass an object with full configuration, using only one of the accessory types.
531
+ *
532
+ * ---
533
+ *
534
+ * @param content - The main content of the section. Only used in overload 1.
535
+ * @param accessory - A {@link ButtonBuilder}, {@link ThumbnailBuilder}, or raw data used to build the accessory. Only used in overload 1.
536
+ *
537
+ * @param data - An object in overload 2 containing:
538
+ * - `content`: A string or array of strings for display.
539
+ * - `accessory`: (optional) A single accessory, either a button or thumbnail.
540
+ * - `button`: (optional) A {@link ButtonBuilder} or partial button data. Mutually exclusive with `thumbnail` and `accessory`.
541
+ * - `thumbnail`: (optional) A {@link ThumbnailBuilder}, {@link ThumbnailData}, or image URL. Mutually exclusive with `button` and `accessory`.
542
+ *
543
+ * @returns A configured {@link SectionBuilder} instance with the provided content and accessory.
544
+ *
545
+ * @example
546
+ * // Overload 1: Using content and accessory separately
547
+ * const section = createSection(
548
+ * "Hello World",
549
+ * new ButtonBuilder({ customId: "click", label: "Click", style: ButtonStyle.Success })
550
+ * );
551
+ *
552
+ * @example
553
+ * // Overload 2: Using content and thumbnail URL via `thumbnail`
554
+ * const section = createSection({
555
+ * content: "Here's an image section",
556
+ * thumbnail: "https://example.com/image.png"
557
+ * });
558
+ *
559
+ * @example
560
+ * // Overload 2: Using content and button via `accessory`
561
+ * const section = createSection({
562
+ * content: "Button section",
563
+ * accessory: new ButtonBuilder({ customId: "id", label: "Press", style: ButtonStyle.Primary });
564
+ * });
565
+ */
566
+ declare function createSection(content: string, accessory: SectionAccessory): SectionBuilder;
567
+ declare function createSection(data: SectionData): SectionBuilder;
568
+
569
+ interface SeparatorData {
570
+ divider?: boolean;
571
+ large?: boolean;
572
+ }
573
+ /**
574
+ * Creates a {@link SeparatorBuilder} component with configurable visibility and spacing.
575
+ *
576
+ * This function generates a separator component that can be customized for:
577
+ * - Visibility (`divider`: whether the visual divider line is shown).
578
+ * - Spacing (`large`: whether to use large or small spacing).
579
+ *
580
+ * It accepts parameters in two formats:
581
+ *
582
+ * **1. As an object:**
583
+ * @param data - An optional object with the following properties:
584
+ * - `divider` (boolean, optional): Whether the divider is visible. Defaults to `true`.
585
+ * - `large` (boolean, optional): Whether to use large spacing. Defaults to `false`.
586
+ *
587
+ * **2. As positional arguments:**
588
+ * @param large - Whether to use large spacing. Defaults to `false`.
589
+ * @param divider - Whether the divider is visible. Defaults to `true`.
590
+ *
591
+ * @returns A {@link SeparatorBuilder} instance with the specified configuration.
592
+ *
593
+ * @example
594
+ * // Using object syntax with default options
595
+ * const separator = createSeparator();
596
+ *
597
+ * @example
598
+ * // Using object syntax to disable the divider and enable large spacing
599
+ * const separator = createSeparator({ divider: false, large: true });
600
+ *
601
+ * @example
602
+ * // Using positional arguments: large spacing, visible divider
603
+ * const separator = createSeparator(true, true);
604
+ *
605
+ * @example
606
+ * // Using positional arguments: small spacing, hidden divider
607
+ * const separator = createSeparator(false, false);
608
+ */
609
+ declare function createSeparator(large?: boolean, divider?: boolean): SeparatorBuilder;
610
+ declare function createSeparator(data?: SeparatorData): SeparatorBuilder;
611
+
612
+ /**
613
+ * Creates a {@link TextDisplayBuilder} with the given content and optional ID.
614
+ *
615
+ * This function simplifies the creation of text display components for a container,
616
+ * allowing you to set the text content and optionally assign a custom ID.
617
+ *
618
+ * @param content - The text content to display.
619
+ * @param id - An optional numeric ID for the text component.
620
+ *
621
+ * @returns A new {@link TextDisplayBuilder} instance containing the provided content and ID.
622
+ *
623
+ * @example
624
+ * // Creating a simple text display component
625
+ * const textDisplay = createTextDisplay("Hello World!");
626
+ *
627
+ * @example
628
+ * // Creating a text display component with a custom ID
629
+ * const textDisplay = createTextDisplay("Welcome!", 123);
630
+ */
631
+ declare function createTextDisplay(content: string, id?: number): TextDisplayBuilder;
632
+
633
+ type ThumbAreaThumbnail = SectionThumbnailAccessory | null | undefined;
634
+ type ThumbAreaData = {
635
+ content: string;
636
+ thumbnail?: ThumbAreaThumbnail;
637
+ };
638
+ /**
639
+ * Creates either a {@link SectionBuilder} or a {@link TextDisplayBuilder} based on the presence of a thumbnail.
640
+ *
641
+ * If a thumbnail is provided, this function will return a {@link SectionBuilder} with the content and thumbnail.
642
+ * Otherwise, it will return a {@link TextDisplayBuilder} with only the provided content.
643
+ *
644
+ * ---
645
+ * **Overloads:**
646
+ * - Provide `content` and optional `thumbnail` as separate parameters.
647
+ * - Provide a single object with `content` and optional `thumbnail` properties.
648
+ *
649
+ * @param content - The text content to be displayed.
650
+ * @param thumbnail - (Optional) A thumbnail to include. If provided, a section will be created; otherwise, a simple text display.
651
+ *
652
+ * @param data - An object containing `content` and optional `thumbnail` properties.
653
+ *
654
+ * @returns A {@link SectionBuilder} if a thumbnail is provided, otherwise a {@link TextDisplayBuilder}.
655
+ *
656
+ * @example
657
+ * // Using positional parameters with a thumbnail
658
+ * const thumbSection = createThumbArea("Welcome!", "https://example.com/image.png");
659
+ *
660
+ * @example
661
+ * // Using an object without a thumbnail
662
+ * const textOnly = createThumbArea({ content: "Just text here" });
663
+ *
664
+ * @example
665
+ * // Using an object with a thumbnail
666
+ * const thumbSection = createThumbArea({
667
+ * content: "Check this out!",
668
+ * thumbnail: "https://example.com/image.png"
669
+ * });
670
+ */
671
+ declare function createThumbArea(content: string, thumbnail?: ThumbAreaThumbnail): SectionBuilder | TextDisplayBuilder;
672
+ declare function createThumbArea(data: ThumbAreaData): SectionBuilder | TextDisplayBuilder;
673
+
62
674
  type EmbedPlusAssetData = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
63
675
  type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
64
676
  declare function createEmbedAsset(source: EmbedPlusAssetData, options?: EmbedAssetOptions): EmbedAssetData | undefined;
@@ -205,548 +817,266 @@ interface CreateEmbedFilesOptions {
205
817
  */
206
818
  declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
207
819
 
208
- interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
209
- }
210
- declare function createLinkButton(link: string, label?: string, emoji?: ComponentEmojiResolvable): ButtonBuilder;
211
- declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
212
- /**
213
- * Wraps buttons into multiple {@link ActionRowBuilder} instances with a maximum number of buttons per row.
214
- *
215
- * This function takes a list of {@link ButtonBuilder} instances (or arrays of them) and groups them into
216
- * multiple `ActionRowBuilder<ButtonBuilder>` objects, ensuring that each row contains no more than the specified
217
- * number of buttons.
218
- *
219
- * @param maxItemsPerRow - The maximum number of buttons to include in each row.
220
- * @param buttons - A variadic list of {@link ButtonBuilder} instances or arrays of them to be wrapped.
221
- *
222
- * @returns An array of {@link ActionRowBuilder} instances, each containing up to `maxItemsPerRow` buttons.
223
- *
224
- * @example
225
- * const button1 = new ButtonBuilder().setLabel("A").setCustomId("a").setStyle(ButtonStyle.Primary);
226
- * const button2 = new ButtonBuilder().setLabel("B").setCustomId("b").setStyle(ButtonStyle.Primary);
227
- * const button3 = new ButtonBuilder().setLabel("C").setCustomId("c").setStyle(ButtonStyle.Primary);
228
- *
229
- * const rows = wrapButtons(2, button1, button2, button3);
230
- * // Result: Two rows, the first with [button1, button2], the second with [button3]
231
- */
232
- declare function wrapButtons(maxItemsPerRow: number, ...buttons: (ButtonBuilder | ButtonBuilder[])[]): ActionRowBuilder<ButtonBuilder>[];
233
-
234
- /**
235
- * Creates an {@link ActionRowBuilder} containing one or more UI components.
236
- *
237
- * This function accepts individual components or arrays of components, flattens them,
238
- * and returns an action row builder suitable for use in Discord messages.
239
- * It's designed to support any component builder type that extends {@link AnyComponentBuilder}.
240
- *
241
- * ---
242
- * While this function supports any valid message component (such as buttons, select menus, etc.),
243
- * the examples below demonstrate common use cases using {@link ButtonBuilder} and {@link StringSelectMenuBuilder}.
244
- *
245
- * @typeParam Component - A type extending {@link AnyComponentBuilder}, such as a button or select menu builder.
246
- *
247
- * @param components - A variadic list of component instances or arrays of component instances to include in the row.
248
- *
249
- * @returns An {@link ActionRowBuilder} instance containing all provided components.
250
- *
251
- * @example
252
- * // Create a row with two buttons
253
- * const row = createRow(
254
- * new ButtonBuilder().setCustomId("yes").setLabel("Yes").setStyle(ButtonStyle.Success),
255
- * new ButtonBuilder().setCustomId("no").setLabel("No").setStyle(ButtonStyle.Danger)
256
- * );
257
- *
258
- * @example
259
- * // Create a row with a string select menu
260
- * const row = createRow([
261
- * new StringSelectMenuBuilder()
262
- * .setCustomId("choose")
263
- * .setPlaceholder("Make a selection")
264
- * .addOptions(
265
- * { label: "Option 1", value: "opt1" },
266
- * { label: "Option 2", value: "opt2" }
267
- * )
268
- * ]);
269
- */
270
- declare function createRow<Component extends AnyComponentBuilder>(...components: (Component | Component[])[]): ActionRowBuilder<Component>;
271
-
272
- type FileSource = string | Attachment | AttachmentBuilder;
273
- interface CreateFileOptions extends Omit<APIUnfurledMediaItem, "url"> {
274
- spoiler?: boolean;
275
- }
276
- /**
277
- * Creates a {@link FileBuilder} from an {@link AttachmentBuilder} or an attachment reference string.
278
- *
279
- * If the `source` is an {@link AttachmentBuilder}, it automatically prefixes the file name with `"attachment://"`.
280
- * If the `source` is a string, it must already be a valid attachment reference in the format `"attachment://filename.ext"`.
281
- *
282
- * You can optionally provide file metadata through the `options` parameter, such as dimensions
283
- * or whether the file should be marked as a spoiler.
284
- *
285
- * @param source - The source of the file. Must be an {@link AttachmentBuilder} or an attachment reference string.
286
- * @param options - Optional metadata for the file, such as `width`, `height`, `spoiler`, and `size`.
287
- *
288
- * @returns A {@link FileBuilder} ready to be used inside a message component.
289
- *
290
- * @example
291
- * // Creating a file from an AttachmentBuilder
292
- * const attachmentBuilder = new AttachmentBuilder("path/to/image.png");
293
- * const file = createFile(attachmentBuilder);
294
- *
295
- * @example
296
- * // Creating a file from an attachment reference string
297
- * const file = createFile("attachment://image.png");
298
- *
299
- * @example
300
- * // Creating a file with additional options like marking it as a spoiler
301
- * const file = createFile("attachment://secret.png", { spoiler: true });
302
- */
303
- declare function createFile(source: FileSource, options?: CreateFileOptions): FileBuilder;
304
-
305
- type MediaGallerySource = MediaGalleryItemData | string | Attachment | AttachmentBuilder | null | undefined;
306
- /**
307
- * Creates a {@link MediaGalleryBuilder} instance with a collection of media items, which can be images, attachments, or URLs.
308
- *
309
- * This function allows you to add multiple media items to a gallery, where each item can be a URL,
310
- * an {@link Attachment}, or an {@link AttachmentBuilder}. It processes each item and adds it to the gallery,
311
- * converting it into the appropriate format for rendering.
312
- *
313
- * **Parameters:**
314
- * - `items`: An array of media items to be added to the gallery. Each item can be:
315
- * - A {@link MediaGalleryItemData} object, which includes media information such as URLs.
316
- * - A string URL pointing to an external resource (e.g., an image URL).
317
- * - An {@link Attachment} or {@link AttachmentBuilder}, which are Discord attachments.
318
- *
319
- * @param items - The media items to be added to the gallery. Each item is processed and converted into a format suitable for the gallery.
320
- *
321
- * @returns A {@link MediaGalleryBuilder} instance populated with the specified media items.
322
- *
323
- * @example
324
- * // Creating a media gallery with URLs and an attachment
325
- * const gallery = createMediaGallery(
326
- * "https://example.com/image1.png",
327
- * new AttachmentBuilder("image2.png", { name: "image2.png" }),
328
- * { media: { url: "https://example.com/image3.png" } }
329
- * );
330
- *
331
- * @example
332
- * // Creating a media gallery with only attachments
333
- * const gallery = createMediaGallery(
334
- * new AttachmentBuilder("file1.png", { name: "file1.png" }),
335
- * new AttachmentBuilder("file2.png", { name: "file2.png" })
336
- * );
337
- *
338
- * @example
339
- * // Creating a media gallery with mixed media types (URL and attachment)
340
- * const gallery = createMediaGallery(
341
- * "https://example.com/image1.png",
342
- * new AttachmentBuilder("image2.png", { name: "image2.png" })
343
- * );
344
- *
345
- */
346
- declare function createMediaGallery(...items: (MediaGallerySource | MediaGallerySource[])[]): MediaGalleryBuilder;
347
-
348
- interface SeparatorData {
349
- divider?: boolean;
350
- large?: boolean;
351
- }
352
- /**
353
- * Creates a {@link SeparatorBuilder} component with configurable visibility and spacing.
354
- *
355
- * This function generates a separator component that can be customized for:
356
- * - Visibility (`divider`: whether the visual divider line is shown).
357
- * - Spacing (`large`: whether to use large or small spacing).
358
- *
359
- * It accepts parameters in two formats:
360
- *
361
- * **1. As an object:**
362
- * @param data - An optional object with the following properties:
363
- * - `divider` (boolean, optional): Whether the divider is visible. Defaults to `true`.
364
- * - `large` (boolean, optional): Whether to use large spacing. Defaults to `false`.
365
- *
366
- * **2. As positional arguments:**
367
- * @param large - Whether to use large spacing. Defaults to `false`.
368
- * @param divider - Whether the divider is visible. Defaults to `true`.
369
- *
370
- * @returns A {@link SeparatorBuilder} instance with the specified configuration.
371
- *
372
- * @example
373
- * // Using object syntax with default options
374
- * const separator = createSeparator();
375
- *
376
- * @example
377
- * // Using object syntax to disable the divider and enable large spacing
378
- * const separator = createSeparator({ divider: false, large: true });
379
- *
380
- * @example
381
- * // Using positional arguments: large spacing, visible divider
382
- * const separator = createSeparator(true, true);
383
- *
384
- * @example
385
- * // Using positional arguments: small spacing, hidden divider
386
- * const separator = createSeparator(false, false);
387
- */
388
- declare function createSeparator(large?: boolean, divider?: boolean): SeparatorBuilder;
389
- declare function createSeparator(data?: SeparatorData): SeparatorBuilder;
390
-
391
- type ThumbnailData = Partial<Omit<ThumbnailComponentData, "type">> | Attachment | AttachmentBuilder | string;
392
820
  /**
393
- * Creates a {@link ThumbnailBuilder} from a URL, an attachment, or partial thumbnail data.
394
- *
395
- * This function helps create a thumbnail component for a container.
396
- * It supports different input formats, such as a direct URL string,
397
- * an {@link AttachmentBuilder}, an {@link Attachment}, or a partial {@link ThumbnailComponentData}.
398
- *
399
- * **Important:**
400
- * - If providing a string, it must either be a valid URL or a reference to an attachment using the `attachment://filename.ext` format.
821
+ * Checks whether the given value is an {@link Attachment} or an {@link AttachmentBuilder}.
401
822
  *
402
- * @param data - The thumbnail source: a URL, an attachment builder, an attachment, or partial thumbnail data.
823
+ * This function returns `true` if the value is an instance of either class,
824
+ * or if it structurally matches by constructor name (useful across module boundaries).
403
825
  *
404
- * @returns A {@link ThumbnailBuilder} instance populated with the provided data.
826
+ * @param value - The value to check.
827
+ * @returns `true` if the value is an attachment or attachment builder, otherwise `false`.
405
828
  *
406
829
  * @example
407
- * // Creating a thumbnail from a URL
408
- * const thumbnail = createThumbnail("https://example.com/image.png");
830
+ * import { Attachment, AttachmentBuilder } from "discord.js";
409
831
  *
410
- * @example
411
- * // Creating a thumbnail from partial data
412
- * const thumbnail = createThumbnail({
413
- * media: { url: "attachment://image.png" },
414
- * spoiler: true
415
- * });
832
+ * function handle(input: Attachment | AttachmentBuilder | unknown) {
833
+ * if (isAttachment(input)) {
834
+ * console.log("Attachment name:", input.name);
835
+ * }
836
+ * }
416
837
  */
417
- declare function createThumbnail(data: ThumbnailData): ThumbnailBuilder;
838
+ declare function isAttachment(value: unknown): value is Attachment | AttachmentBuilder;
418
839
 
419
- type SectionThumbnailAccessory = ThumbnailBuilder | ThumbnailData;
420
- type SectionButtonAccessory = ButtonBuilder | Partial<ButtonComponentData>;
421
- type SectionAccessory = SectionThumbnailAccessory | SectionButtonAccessory;
422
- type SectionAccessoryData = {
423
- accessory: SectionAccessory;
424
- button?: never;
425
- thumbnail?: never;
426
- } | {
427
- button: SectionButtonAccessory;
428
- thumbnail?: never;
429
- accessory?: never;
430
- } | {
431
- thumbnail: SectionThumbnailAccessory;
432
- button?: never;
433
- accessory?: never;
434
- };
435
- type SectionData = SectionAccessoryData & {
436
- content: string | string[];
437
- };
438
- /**
439
- * Creates a {@link SectionBuilder} component with customizable text content and a single visual accessory.
440
- *
441
- * This function allows you to generate a section with content (as a string or an array of strings)
442
- * and optionally include a single accessory, which can be a button or a thumbnail.
443
- * You can provide the accessory in multiple forms: a builder instance, a plain data object, or a URL string (for thumbnails).
444
- *
445
- * ---
446
- * ### Overloads:
447
- *
448
- * 1. `createSection(content, accessory)`
449
- * Pass content as a string and an accessory separately.
840
+ /**
841
+ * Checks whether the given value is a {@link Message}.
450
842
  *
451
- * 2. `createSection({ content, accessory | button | thumbnail })`
452
- * Pass an object with full configuration, using only one of the accessory types.
843
+ * This function returns `true` if the value is an instance of `Message`
844
+ * or if it structurally resembles a `Message` object.
453
845
  *
454
- * ---
846
+ * @param value - The value to check.
847
+ * @returns `true` if the value is a `Message`, otherwise `false`.
455
848
  *
456
- * @param content - The main content of the section. Only used in overload 1.
457
- * @param accessory - A {@link ButtonBuilder}, {@link ThumbnailBuilder}, or raw data used to build the accessory. Only used in overload 1.
849
+ * @example
850
+ * import type { Message, Interaction } from "discord.js";
458
851
  *
459
- * @param data - An object in overload 2 containing:
460
- * - `content`: A string or array of strings for display.
461
- * - `accessory`: (optional) A single accessory, either a button or thumbnail.
462
- * - `button`: (optional) A {@link ButtonBuilder} or partial button data. Mutually exclusive with `thumbnail` and `accessory`.
463
- * - `thumbnail`: (optional) A {@link ThumbnailBuilder}, {@link ThumbnailData}, or image URL. Mutually exclusive with `button` and `accessory`.
852
+ * function handle(input: Message | Interaction | unknown) {
853
+ * if (isMessage(input)) {
854
+ * console.log("This is a message with ID:", input.id);
855
+ * }
856
+ * }
857
+ */
858
+ declare function isMessage(value: unknown): value is Message;
859
+
860
+ /**
861
+ * Checks whether the given value is a {@link ButtonBuilder}.
464
862
  *
465
- * @returns A configured {@link SectionBuilder} instance with the provided content and accessory.
863
+ * This function returns `true` if the value is an instance of `ButtonBuilder`,
864
+ * or if it structurally matches by constructor name.
466
865
  *
467
- * @example
468
- * // Overload 1: Using content and accessory separately
469
- * const section = createSection("Hello World", new ButtonBuilder().setLabel("Click"));
866
+ * @param value - The value to check.
867
+ * @returns `true` if the value is a `ButtonBuilder`, otherwise `false`.
470
868
  *
471
869
  * @example
472
- * // Overload 2: Using content and thumbnail URL via `thumbnail`
473
- * const section = createSection({
474
- * content: "Here's an image section",
475
- * thumbnail: "https://example.com/image.png"
476
- * });
870
+ * import { ButtonBuilder } from "discord.js";
477
871
  *
478
- * @example
479
- * // Overload 2: Using content and button via `accessory`
480
- * const section = createSection({
481
- * content: "Button section",
482
- * accessory: new ButtonBuilder().setCustomId("id").setLabel("Press").setStyle(ButtonStyle.Primary)
483
- * });
872
+ * function handle(input: ButtonBuilder | unknown) {
873
+ * if (isButtonBuilder(input)) {
874
+ * input.setLabel("Click me!");
875
+ * }
876
+ * }
484
877
  */
485
- declare function createSection(content: string, accessory: SectionAccessory): SectionBuilder;
486
- declare function createSection(data: SectionData): SectionBuilder;
878
+ declare function isButtonBuilder(value: unknown): value is ButtonBuilder;
487
879
 
488
880
  /**
489
- * Creates a {@link TextDisplayBuilder} with the given content and optional ID.
881
+ * Checks whether the given value is a {@link ContainerBuilder}.
490
882
  *
491
- * This function simplifies the creation of text display components for a container,
492
- * allowing you to set the text content and optionally assign a custom ID.
493
- *
494
- * @param content - The text content to display.
495
- * @param id - An optional numeric ID for the text component.
883
+ * This function returns `true` if the value is an instance of `ContainerBuilder`,
884
+ * or if it structurally matches by constructor name.
496
885
  *
497
- * @returns A new {@link TextDisplayBuilder} instance containing the provided content and ID.
886
+ * @param value - The value to check.
887
+ * @returns `true` if the value is a `ContainerBuilder`, otherwise `false`.
498
888
  *
499
889
  * @example
500
- * // Creating a simple text display component
501
- * const textDisplay = createTextDisplay("Hello World!");
890
+ * import { ContainerBuilder } from "discord.js";
502
891
  *
503
- * @example
504
- * // Creating a text display component with a custom ID
505
- * const textDisplay = createTextDisplay("Welcome!", 123);
892
+ * function handle(input: ContainerBuilder | unknown) {
893
+ * if (isContainerBuilder(input)) {
894
+ * input.setAccentColor(0x2ecc71);
895
+ * }
896
+ * }
506
897
  */
507
- declare function createTextDisplay(content: string, id?: number): TextDisplayBuilder;
898
+ declare function isContainerBuilder(value: unknown): value is ContainerBuilder;
508
899
 
509
- type ThumbAreaThumbnail = SectionThumbnailAccessory | null | undefined;
510
- type ThumbAreaData = {
511
- content: string;
512
- thumbnail?: ThumbAreaThumbnail;
513
- };
514
900
  /**
515
- * Creates either a {@link SectionBuilder} or a {@link TextDisplayBuilder} based on the presence of a thumbnail.
901
+ * Checks whether the given value is a {@link MediaGalleryBuilder}.
516
902
  *
517
- * If a thumbnail is provided, this function will return a {@link SectionBuilder} with the content and thumbnail.
518
- * Otherwise, it will return a {@link TextDisplayBuilder} with only the provided content.
903
+ * This function returns `true` if the value is an instance of `MediaGalleryBuilder`,
904
+ * or if it structurally matches by constructor name.
519
905
  *
520
- * ---
521
- * **Overloads:**
522
- * - Provide `content` and optional `thumbnail` as separate parameters.
523
- * - Provide a single object with `content` and optional `thumbnail` properties.
906
+ * @param value - The value to check.
907
+ * @returns `true` if the value is a `MediaGalleryBuilder`, otherwise `false`.
524
908
  *
525
- * @param content - The text content to be displayed.
526
- * @param thumbnail - (Optional) A thumbnail to include. If provided, a section will be created; otherwise, a simple text display.
909
+ * @example
910
+ * import type { MediaGalleryBuilder } from "discord.js";
527
911
  *
528
- * @param data - An object containing `content` and optional `thumbnail` properties.
912
+ * function handle(input: MediaGalleryBuilder | unknown) {
913
+ * if (isMediaGalleryBuilder(input)) {
914
+ * input.addItems({ media: { url: "https://example.com/image.png" } });
915
+ * }
916
+ * }
917
+ */
918
+ declare function isMediaGalleryBuilder(value: unknown): value is MediaGalleryBuilder;
919
+ /**
920
+ * Checks whether the given value is a {@link MediaGalleryItemBuilder}.
529
921
  *
530
- * @returns A {@link SectionBuilder} if a thumbnail is provided, otherwise a {@link TextDisplayBuilder}.
922
+ * This function returns `true` if the value is an instance of `MediaGalleryItemBuilder`,
923
+ * or if it structurally matches by constructor name.
531
924
  *
532
- * @example
533
- * // Using positional parameters with a thumbnail
534
- * const thumbSection = createThumbArea("Welcome!", "https://example.com/image.png");
925
+ * @param value - The value to check.
926
+ * @returns `true` if the value is a `MediaGalleryItemBuilder`, otherwise `false`.
535
927
  *
536
928
  * @example
537
- * // Using an object without a thumbnail
538
- * const textOnly = createThumbArea({ content: "Just text here" });
929
+ * import type { MediaGalleryItemBuilder } from "discord.js";
930
+ *
931
+ * function handle(input: MediaGalleryItemBuilder | unknown) {
932
+ * if (isMediaGalleryItemBuilder(input)) {
933
+ * input.setURL("https://example.com/image.png");
934
+ * }
935
+ * }
936
+ */
937
+ declare function isMediaGalleryItemBuilder(value: unknown): value is MediaGalleryItemBuilder;
938
+
939
+ /**
940
+ * Checks whether the given value is a {@link ModalBuilder}.
941
+ *
942
+ * This function returns `true` if the value is an instance of `ModalBuilder`,
943
+ * or if it structurally matches by constructor name.
944
+ *
945
+ * @param value - The value to check.
946
+ * @returns `true` if the value is a `ModalBuilder`, otherwise `false`.
539
947
  *
540
948
  * @example
541
- * // Using an object with a thumbnail
542
- * const thumbSection = createThumbArea({
543
- * content: "Check this out!",
544
- * thumbnail: "https://example.com/image.png"
545
- * });
949
+ * import type { ModalBuilder } from "discord.js";
950
+ *
951
+ * function handle(input: ModalBuilder | unknown) {
952
+ * if (isModalBuilder(input)) {
953
+ * input.setTitle("User Feedback");
954
+ * }
955
+ * }
546
956
  */
547
- declare function createThumbArea(content: string, thumbnail?: ThumbAreaThumbnail): SectionBuilder | TextDisplayBuilder;
548
- declare function createThumbArea(data: ThumbAreaData): SectionBuilder | TextDisplayBuilder;
957
+ declare function isModalBuilder(value: unknown): value is ModalBuilder;
549
958
 
550
- type ComponentData = TextDisplayBuilder | SeparatorBuilder | FileBuilder | SectionBuilder | MediaGalleryBuilder | ActionRowBuilder<MessageActionRowComponentBuilder> | MessageActionRowComponentBuilder | Attachment | AttachmentBuilder | string | null | undefined | boolean;
551
- type CreateComponentData = ComponentData | ContainerBuilder;
552
- declare function createComponents(...data: (CreateComponentData | CreateComponentData[])[]): (SeparatorBuilder | TextDisplayBuilder | FileBuilder | SectionBuilder | MediaGalleryBuilder | ActionRowBuilder<MessageActionRowComponentBuilder> | ContainerBuilder)[];
959
+ type AnySelectMenuBuilder = StringSelectMenuBuilder | UserSelectMenuBuilder | RoleSelectMenuBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder;
960
+ declare function isStringSelectMenuBuilder(value: unknown): value is StringSelectMenuBuilder;
961
+ declare function isUserSelectMenuBuilder(value: unknown): value is UserSelectMenuBuilder;
962
+ declare function isRoleSelectMenuBuilder(value: unknown): value is RoleSelectMenuBuilder;
963
+ declare function isChannelSelectMenuBuilder(value: unknown): value is ChannelSelectMenuBuilder;
964
+ declare function isMentionableSelectMenuBuilder(value: unknown): value is MentionableSelectMenuBuilder;
965
+ declare function isAnySelectMenuBuilder(value: unknown): value is AnySelectMenuBuilder;
553
966
 
554
- type ContainerColor = (string & {}) | ColorResolvable;
555
- interface ContainerData extends Omit<ContainerComponentData, "accentColor" | "type" | "components"> {
556
- accentColor?: ContainerColor;
557
- components: ComponentData[];
558
- }
559
967
  /**
560
- * Creates a {@link ContainerBuilder} component with optional accent color and a set of child components.
968
+ * Checks whether the given value is an {@link ActionRowBuilder}, optionally filtered by component type.
561
969
  *
562
- * This function can be used in two ways:
563
- * 1. By passing an object with `accentColor` and `components` properties.
564
- * 2. By passing the `accentColor` directly followed by a list of components.
970
+ * This function returns `true` if the value is an `ActionRowBuilder` instance or structurally matches one.
971
+ * You can optionally specify a component type to check whether the row contains components of that type.
565
972
  *
566
- * The container can include various types of components such as:
567
- * - `string` (converted to `TextDisplayBuilder`)
568
- * - {@link TextDisplayBuilder}
569
- * - {@link ActionRowBuilder}
570
- * - Arrays of components (converted to an action row)
571
- * - {@link ButtonBuilder}
572
- * - {@link SectionBuilder}
573
- * - {@link MediaGalleryBuilder}
574
- * - {@link FileBuilder}
575
- * - {@link SeparatorBuilder}
576
- * - Discord attachments (treated as media galleries)
973
+ * @param value - The value to check.
974
+ * @param withComponents - (Optional) Filter by component type: `"selects"`, `"buttons"`, or `"inputs"`.
975
+ * @returns `true` if the value is an `ActionRowBuilder`, and optionally contains components of the specified type.
577
976
  *
578
- * @param data - Either a `ContainerData` object containing `accentColor` and `components`, or the accent color directly.
579
- * @param components - When using the overload with accent color as the first parameter, this is the list of components to include in the container.
977
+ * @example
978
+ * import type { ActionRowBuilder, ButtonBuilder } from "discord.js";
580
979
  *
581
- * @returns A {@link ContainerBuilder} instance with all components and styles applied.
980
+ * function handle(input: unknown) {
981
+ * if (isActionRowBuilder(input, "buttons")) {
982
+ * console.log("Action row with buttons:", input.components.length);
983
+ * }
984
+ * }
582
985
  *
583
986
  * @example
584
- * // Using ContainerData object
585
- * const container = createContainer({
586
- * accentColor: "#ff5733",
587
- * components: ["Welcome to the app!"]
588
- * });
987
+ * import type { AnySelectMenuBuilder } from "discord.js";
589
988
  *
590
- * @example
591
- * // Using color and components as separate arguments
592
- * const container = createContainer("Red",
593
- * new TextDisplayBuilder().setText("Alert!"),
594
- * new SeparatorBuilder()
595
- * );
989
+ * function handleSelectRow(row: unknown) {
990
+ * if (isActionRowBuilder(row, "selects")) {
991
+ * console.log("Row contains select menus.");
992
+ * }
993
+ * }
994
+ */
995
+ declare function isActionRowBuilder(value: unknown): value is ActionRowBuilder;
996
+ declare function isActionRowBuilder(value: unknown, withComponents: "selects"): value is ActionRowBuilder<AnySelectMenuBuilder>;
997
+ declare function isActionRowBuilder(value: unknown, withComponents: "buttons"): value is ActionRowBuilder<ButtonBuilder>;
998
+ declare function isActionRowBuilder(value: unknown, withComponents: "inputs"): value is ActionRowBuilder<TextInputBuilder>;
999
+
1000
+ /**
1001
+ * Checks whether the given value is a {@link SectionBuilder}.
1002
+ *
1003
+ * This function returns `true` if the value is an instance of `SectionBuilder`,
1004
+ * or if it structurally matches by constructor name.
1005
+ *
1006
+ * @param value - The value to check.
1007
+ * @returns `true` if the value is a `SectionBuilder`, otherwise `false`.
596
1008
  *
597
1009
  * @example
598
- * // Using RGB tuple
599
- * const container = createContainer([255, 0, 0], "Red alert");
1010
+ * import type { SectionBuilder } from "discord.js";
1011
+ *
1012
+ * function handle(input: SectionBuilder | unknown) {
1013
+ * if (isSectionBuilder(input)) {
1014
+ * console.log("SectionBuilder accessory:", input.accessory);
1015
+ * }
1016
+ * }
600
1017
  */
601
- declare function createContainer(data: ContainerData): ContainerBuilder;
602
- declare function createContainer(data: ColorResolvable | string, ...components: (ComponentData | ComponentData[])[]): ContainerBuilder;
603
-
604
- type GuildChannelType = Exclude<ChannelType, ChannelType.DM>;
605
- type FindChannelFilter<T extends GuildChannelType> = (channel: GetChannelType<T>) => boolean;
606
- type GetChannelType<Type extends GuildChannelType> = Extract<NonNullable<CommandInteractionOption<"cached">["channel"]>, {
607
- type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread ? ChannelType.PublicThread | ChannelType.AnnouncementThread : Type;
608
- }>;
609
- declare function findChannel<Type extends GuildChannelType = ChannelType.GuildText>(guild: Guild, type?: Type): {
610
- byId(id: string): GetChannelType<Type> | undefined;
611
- byName(name: string, and?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
612
- byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
613
- inCategoryId(id: string): {
614
- byId(id: string): GetChannelType<Type> | undefined;
615
- byName(name: string, and?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
616
- byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
617
- };
618
- inCategoryName(name: string): {
619
- byId(id: string): GetChannelType<Type> | undefined;
620
- byName(name: string, and?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
621
- byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
622
- };
623
- };
624
- interface ChannelUrlInfo {
625
- channelId?: string;
626
- guildId?: string;
627
- }
628
- declare function getChannelUrlInfo(url: string): ChannelUrlInfo;
629
-
630
- type FindCommandFilter = (command: ApplicationCommand) => boolean;
631
- declare function findCommand(guildOrClient: Guild | Client<true>): {
632
- byName(name: string, and?: FindCommandFilter): ApplicationCommand<{
633
- guild: discord_js.GuildResolvable;
634
- }> | undefined;
635
- byId(id: string): ApplicationCommand<{
636
- guild: discord_js.GuildResolvable;
637
- }> | undefined;
638
- byFilter(filter: FindCommandFilter): ApplicationCommand<{
639
- guild: discord_js.GuildResolvable;
640
- }> | undefined;
641
- };
642
- interface CommandMentionData {
643
- id: string;
644
- name: string;
645
- }
646
- declare function commandMention(command: CommandMentionData, group?: string, subcommand?: string): string;
647
- declare function commandMention(command: CommandMentionData, subcommand?: string): string;
648
-
649
- type TextInputData = Omit<TextInputComponentData, "type">;
650
- interface ModalFieldData extends Omit<TextInputData, "style"> {
651
- style?: TextInputStyle;
652
- }
653
- declare function createModalInput(data: ModalFieldData): ActionRowBuilder<TextInputBuilder>;
654
- type ModalFieldsData = Record<string, Omit<ModalFieldData, "customId">>;
655
- declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
656
- type ModalFieldsRecord<K extends string> = Record<K, string>;
657
- declare function modalFieldsToRecord<K extends string = string>(fields: ModalSubmitInteraction | ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord<K>;
658
- interface CreateModalData {
659
- title?: string;
660
- customId: string;
661
- components: ModalFieldsData;
662
- }
663
- declare function createModal(data: CreateModalData): ModalBuilder;
664
-
665
- type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
666
- declare function findEmoji(guildOrClient: Guild | Client): {
667
- byName(name: string, animated?: boolean, and?: FindEmojiFilter): GuildEmoji | undefined;
668
- byId(id: string, animated?: boolean): GuildEmoji | undefined;
669
- byFilter(filter: FindEmojiFilter): GuildEmoji | undefined;
670
- };
671
-
672
- type FindMemberFilter = (member: GuildMember) => boolean;
673
- declare function findMember(guild: Guild): {
674
- byGlobalName(globalName: string, and?: FindMemberFilter): GuildMember | undefined;
675
- byNickname(nickname: string, and?: FindMemberFilter): GuildMember | undefined;
676
- byUsername(username: string, and?: FindMemberFilter): GuildMember | undefined;
677
- byDisplayName(displayName: string, and?: FindMemberFilter): GuildMember | undefined;
678
- byId(id: string): GuildMember | undefined;
679
- byFilter(filter: FindMemberFilter): GuildMember | undefined;
680
- };
681
-
682
- type FindMessageFilter = (role: Message<true>) => boolean;
683
- declare function findMessage(channel: GuildTextBasedChannel): {
684
- all(limit?: number): Promise<Message<boolean>[]>;
685
- byId(id: string): Message<true> | undefined;
686
- byContent(): {
687
- equals(content: string, ignoreCase?: boolean): Message<true> | undefined;
688
- include(content: string, ignoreCase?: boolean): Message<true> | undefined;
689
- };
690
- byFilter(filter: FindMessageFilter): Message<true> | undefined;
691
- };
692
- type MessageURLInfo = {
693
- channelId: string;
694
- guildId: string;
695
- messageId: string;
696
- } | {
697
- messageId?: undefined;
698
- channelId?: string;
699
- guildId?: string;
700
- };
701
- declare function getMessageURLInfo(url: string): MessageURLInfo;
702
- declare function fetchMessageFromURL(guild: Guild, url: string): Promise<Message<true> | null>;
703
- declare function fetchMessageFromURL(client: Client | Client, url: string): Promise<Message | null>;
1018
+ declare function isSectionBuilder(value: unknown): value is SectionBuilder;
704
1019
 
705
- type FindRoleFilter = (role: Role) => boolean;
706
1020
  /**
1021
+ * Checks whether the given value is a {@link SeparatorBuilder}.
707
1022
  *
708
- * @param guild Discord guild
1023
+ * This function returns `true` if the value is an instance of `SeparatorBuilder`,
1024
+ * or if it structurally matches by constructor name.
709
1025
  *
710
- * ```ts
711
- * const memberRole = findRole(guild).byName("Member");
712
- * const adminRole = findRole(guild).byHexColor("#ff5454");
713
- * const leaderRole = findRole(guild).byId("537818031728885771");
714
- * ```
1026
+ * @param value - The value to check.
1027
+ * @returns `true` if the value is a `SeparatorBuilder`, otherwise `false`.
1028
+ *
1029
+ * @example
1030
+ * import { SeparatorBuilder } from "discord.js";
1031
+ *
1032
+ * function handle(input: SeparatorBuilder | unknown) {
1033
+ * if (isSeparatorBuilder(input)) {
1034
+ * console.log("SeparatorBuilder detected");
1035
+ * input.setDivider(false);
1036
+ * }
1037
+ * }
715
1038
  */
716
- declare function findRole(guild: Guild): {
717
- byColor(color: number, and?: FindRoleFilter): Role | undefined;
718
- byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
719
- byName(name: string, and?: FindRoleFilter): Role | undefined;
720
- byId(id: string): Role | undefined;
721
- byFilter(filter: FindRoleFilter): Role | undefined;
722
- };
1039
+ declare function isSeparatorBuilder(value: unknown): value is SeparatorBuilder;
723
1040
 
724
1041
  /**
1042
+ * Checks whether the given value is a {@link TextDisplayBuilder}.
725
1043
  *
726
- * @param mention Discord mentionable string
727
- * @returns mentionable id or null
1044
+ * This function returns `true` if the value is an instance of `TextDisplayBuilder`,
1045
+ * or if it structurally matches by constructor name.
728
1046
  *
729
- * ```ts
730
- * const user = "<@264620632644255745>";
731
- * const channel = "<#1068689068256403457>";
732
- * const role = "<@&929925182796226632>";
1047
+ * @param value - The value to check.
1048
+ * @returns `true` if the value is a `TextDisplayBuilder`, otherwise `false`.
733
1049
  *
734
- * extractMentionId(user) // 264620632644255745
735
- * extractMentionId(channel) // 1068689068256403457
736
- * extractMentionId(role) // 929925182796226632
737
- * ```
1050
+ * @example
1051
+ * import type { TextDisplayBuilder } from "discord.js";
1052
+ *
1053
+ * function handle(input: TextDisplayBuilder | unknown) {
1054
+ * if (isTextDisplayBuilder(input)) {
1055
+ * console.log("TextDisplayBuilder content:", input.data.content);
1056
+ * }
1057
+ * }
738
1058
  */
739
- declare function extractMentionId(mention: string): string | null;
1059
+ declare function isTextDisplayBuilder(value: unknown): value is TextDisplayBuilder;
740
1060
 
741
- declare function createWebhookClient(url: string, options?: WebhookClientOptions): WebhookClient | null;
742
- declare function createWebhookClient(data: WebhookClientData, options?: WebhookClientOptions): WebhookClient | null;
743
-
744
- declare function isAttachment(value: unknown): value is Attachment | AttachmentBuilder;
745
-
746
- type AnySelectMenuBuilder = StringSelectMenuBuilder | UserSelectMenuBuilder | RoleSelectMenuBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder;
747
- declare function isAnySelectMenuBuilder(value: unknown): value is AnySelectMenuBuilder;
748
-
749
- declare function isButtonBuilder(value: unknown): value is ButtonBuilder;
1061
+ /**
1062
+ * Checks whether the given value is a {@link TextInputBuilder}.
1063
+ *
1064
+ * This function returns `true` if the value is an instance of `TextInputBuilder`,
1065
+ * or if it structurally matches by constructor name.
1066
+ *
1067
+ * @param value - The value to check.
1068
+ * @returns `true` if the value is a `TextInputBuilder`, otherwise `false`.
1069
+ *
1070
+ * @example
1071
+ * import { TextInputBuilder } from "discord.js";
1072
+ *
1073
+ * function handle(input: TextInputBuilder | unknown) {
1074
+ * if (isTextInputBuilder(input)) {
1075
+ * console.log("TextInputBuilder value:", input.data.value);
1076
+ * }
1077
+ * }
1078
+ */
1079
+ declare function isTextInputBuilder(value: unknown): value is TextInputBuilder;
750
1080
 
751
- export { CustomItents, CustomPartials, EmbedLimit, EmbedPlusBuilder, Separator, chars, commandMention, createComponents, createContainer, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createFile, createLinkButton, createMediaGallery, createModal, createModalFields, createModalInput, createRow, createSection, createSeparator, createTextDisplay, createThumbArea, createThumbnail, createWebhookClient, extractMentionId, fetchMessageFromURL, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageURLInfo, isAnySelectMenuBuilder, isAttachment, isButtonBuilder, modalFieldsToRecord, setMobileStatus, wrapButtons };
752
- export type { AnyEmbedData, AnySelectMenuBuilder, ComponentData, ContainerColor, ContainerData, CreateComponentData, CreateModalData, EmbedPlusAssetData, EmbedPlusAuthorData, EmbedPlusColorData, EmbedPlusData, EmbedPlusFooterData, EmbedPlusProperty, MediaGallerySource, ModalFieldsData, ModalFieldsRecord, SectionAccessory, SectionAccessoryData, SectionButtonAccessory, SectionData, SectionThumbnailAccessory, SeparatorData, ThumbAreaData, ThumbAreaThumbnail, ThumbnailData };
1081
+ export { ContainerPlusBuilder, CustomItents, CustomPartials, EmbedLimit, EmbedPlusBuilder, Separator, chars, commandMention, createComponents, createContainer, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createFile, createLinkButton, createMediaGallery, createModal, createModalFields, createModalInput, createRow, createSection, createSeparator, createTextDisplay, createThumbArea, createThumbnail, createWebhookClient, extractMentionId, fetchMessageFromURL, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageURLInfo, isActionRowBuilder, isAnySelectMenuBuilder, isAttachment, isButtonBuilder, isChannelSelectMenuBuilder, isContainerBuilder, isMediaGalleryBuilder, isMediaGalleryItemBuilder, isMentionableSelectMenuBuilder, isMessage, isModalBuilder, isRoleSelectMenuBuilder, isSectionBuilder, isSeparatorBuilder, isStringSelectMenuBuilder, isTextDisplayBuilder, isTextInputBuilder, isUserSelectMenuBuilder, modalFieldsToRecord, setMobileStatus, wrapButtons };
1082
+ export type { AnyEmbedData, AnySelectMenuBuilder, ComponentBuildersData, ComponentData, ContainerColor, ContainerData, ContainerInComponentType, CreateComponentData, CreateModalData, EmbedPlusAssetData, EmbedPlusAuthorData, EmbedPlusColorData, EmbedPlusData, EmbedPlusFooterData, EmbedPlusProperty, MagicComponentData, MediaGallerySource, ModalFieldsData, ModalFieldsRecord, SectionAccessory, SectionAccessoryData, SectionButtonAccessory, SectionData, SectionThumbnailAccessory, SeparatorData, ThumbAreaData, ThumbAreaThumbnail, ThumbnailData };