@magicyan/discord 1.4.11 → 1.5.1

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 +812 -481
  37. package/dist/index.d.mts +812 -481
  38. package/dist/index.d.ts +812 -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 as ContainerComponentBuilder$1, 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,621 @@ 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 ContainerComponentBuilder = Exclude<ContainerComponentBuilder$1, ActionRowBuilder> | ActionRowBuilder<MessageActionRowComponentBuilder>;
233
+ type CreateComponentsReturn<IsContainer> = IsContainer extends true ? ContainerComponentBuilder[] : (ContainerComponentBuilder | ContainerBuilder)[];
234
+ type CreateComponentsData<IsContainer> = IsContainer extends true ? ComponentData : ComponentData | ContainerBuilder;
235
+ declare function createComponents<IsContainer extends boolean = false, Data extends CreateComponentsData<IsContainer> = CreateComponentsData<IsContainer>>(...data: (Data | Data[])[]): CreateComponentsReturn<IsContainer>;
236
+
237
+ type ContainerColor = (string & {}) | ColorResolvable;
238
+ type ContainerInComponentType = ComponentType.TextDisplay | ComponentType.ActionRow | ComponentType.Section | ComponentType.Separator | ComponentType.MediaGallery | ComponentType.File;
239
+ type ContainerType = ContainerBuilder | ContainerPlusBuilder | ContainerComponent;
240
+ interface ContainerData extends Omit<ContainerComponentData, "accentColor" | "type" | "components"> {
241
+ accentColor?: ContainerColor | null;
242
+ components?: ComponentData[];
243
+ from?: ContainerType | Message;
244
+ fromIndex?: number;
245
+ }
246
+ declare class ContainerPlusBuilder extends ContainerBuilder {
247
+ constructor(data?: ContainerData);
248
+ /**
249
+ * Sets the accent color of the container.
250
+ *
251
+ * If a color is provided, it resolves and sets the accent color accordingly.
252
+ * If no color or `null` is provided, it clears the accent color.
253
+ *
254
+ * @param color - The color to set as the accent color, or `null` to clear it.
255
+ * @returns The current instance for chaining.
256
+ *
257
+ * @example
258
+ * container.setColor("#ff0000"); // Sets the accent color to red.
259
+ * container.setColor(null); // Clears the accent color.
260
+ */
261
+ setColor(color?: ContainerColor | null): this;
262
+ /**
263
+ * Replaces or removes a component at the specified index in the container.
264
+ *
265
+ * If `data` is provided, it replaces the component at the given index with the new component(s).
266
+ * If `null` is provided, it removes the component at that index.
267
+ *
268
+ * @param index - The index of the component to replace or remove.
269
+ * @param data - The new component data to set, or `null` to remove the component.
270
+ * @returns The current instance for chaining.
271
+ *
272
+ * @example
273
+ * container.setComponent(0, new ButtonBuilder({ label: "Click" }));
274
+ * container.setComponent(1, null); // Removes the component at index 1.
275
+ */
276
+ setComponent(index: number, data: ComponentData | null): this;
277
+ /**
278
+ * Retrieves a component from the container at the specified index, optionally filtering by component type.
279
+ *
280
+ * When the `type` is specified, it filters components by that type and returns the one at the given index.
281
+ * If `type` is omitted, it returns the component at the index without filtering.
282
+ *
283
+ * @param index - The index of the component to retrieve.
284
+ * @param type - (Optional) The type of component to filter by.
285
+ * @returns The component builder if found; otherwise `undefined`.
286
+ *
287
+ * @example
288
+ * const button = container.componentAt(0, ComponentType.ActionRow);
289
+ * const firstComponent = container.componentAt(0);
290
+ */
291
+ componentAt(index: number): ContainerComponentBuilder$1 | undefined;
292
+ componentAt(index: number, type: ComponentType.TextDisplay): TextDisplayBuilder | undefined;
293
+ componentAt(index: number, type: ComponentType.ActionRow): ActionRowBuilder | undefined;
294
+ componentAt(index: number, type: ComponentType.Separator): SeparatorBuilder | undefined;
295
+ componentAt(index: number, type: ComponentType.MediaGallery): MediaGalleryBuilder | undefined;
296
+ componentAt(index: number, type: ComponentType.File): FileBuilder | undefined;
297
+ }
298
+ /**
299
+ * Creates one or multiple {@link ContainerPlusBuilder} components with optional accent color and child components.
300
+ *
301
+ * This function supports two main usage patterns:
302
+ * 1. Passing a `ContainerData` object with optional `array` flag:
303
+ * - If `array` is `true` and `from` is a message, returns an array of containers extracted from the message components.
304
+ * - If `array` is `true` without a message `from`, returns an array with one container.
305
+ * - Otherwise, returns a single container.
306
+ * 2. Passing an accent color (string, number, or RGB tuple) directly, followed by one or more components.
307
+ *
308
+ * The container can include various types of components such as:
309
+ * - `string` (converted to {@link TextDisplayBuilder})
310
+ * - {@link TextDisplayBuilder}
311
+ * - {@link ActionRowBuilder}
312
+ * - {@link ButtonBuilder}
313
+ * - {@link SectionBuilder}
314
+ * - {@link MediaGalleryBuilder}
315
+ * - {@link FileBuilder}
316
+ * - {@link SeparatorBuilder}
317
+ * - Discord attachments (treated as media galleries)
318
+ *
319
+ * @param data - A `ContainerData` object (with optional `array` and `from` properties) or a color value.
320
+ * @param items - When `data` is a color, this is the list of components to include in the container.
321
+ *
322
+ * @returns Either a single {@link ContainerPlusBuilder} or an array of them, depending on the `array` flag and `from` property.
323
+ *
324
+ * @example
325
+ * // Create a single container with accent color and components
326
+ * const container = createContainer({
327
+ * accentColor: "#ff5733",
328
+ * components: ["Welcome!"]
329
+ * });
330
+ *
331
+ * @example
332
+ * // Create multiple containers extracted from a message
333
+ * const containers = createContainer({
334
+ * array: true,
335
+ * from: message
336
+ * });
337
+ *
338
+ * @example
339
+ * // Create container by passing color and components separately
340
+ * const container = createContainer("Blue",
341
+ * new TextDisplayBuilder().setText("Notice"),
342
+ * new SeparatorBuilder()
343
+ * );
344
+ */
345
+ declare function createContainer(data: ContainerData & {
346
+ array?: boolean;
347
+ }): ContainerPlusBuilder;
348
+ declare function createContainer(data: ContainerData & {
349
+ array?: true;
350
+ }): ContainerPlusBuilder[];
351
+ declare function createContainer(data: ColorResolvable | string, ...components: (ComponentData | ComponentData[])[]): ContainerPlusBuilder;
352
+
353
+ type FileSource = string | Attachment | AttachmentBuilder;
354
+ interface CreateFileOptions extends Omit<APIUnfurledMediaItem, "url"> {
355
+ spoiler?: boolean;
356
+ }
357
+ /**
358
+ * Creates a {@link FileBuilder} from an {@link AttachmentBuilder} or an attachment reference string.
359
+ *
360
+ * If the `source` is an {@link AttachmentBuilder}, it automatically prefixes the file name with `"attachment://"`.
361
+ * If the `source` is a string, it must already be a valid attachment reference in the format `"attachment://filename.ext"`.
362
+ *
363
+ * You can optionally provide file metadata through the `options` parameter, such as dimensions
364
+ * or whether the file should be marked as a spoiler.
365
+ *
366
+ * @param source - The source of the file. Must be an {@link AttachmentBuilder} or an attachment reference string.
367
+ * @param options - Optional metadata for the file, such as `width`, `height`, `spoiler`, and `size`.
368
+ *
369
+ * @returns A {@link FileBuilder} ready to be used inside a message component.
370
+ *
371
+ * @example
372
+ * // Creating a file from an AttachmentBuilder
373
+ * const attachment = new AttachmentBuilder("path/to/image.png");
374
+ * const file = createFile(attachment);
375
+ *
376
+ * @example
377
+ * // Creating a file from an attachment reference string
378
+ * const file = createFile("attachment://image.png");
379
+ *
380
+ * @example
381
+ * // Creating a file with additional options like marking it as a spoiler
382
+ * const file = createFile("attachment://secret.png", { spoiler: true });
383
+ */
384
+ declare function createFile(source: FileSource, options?: CreateFileOptions): FileBuilder;
385
+
386
+ type MediaGallerySource = MediaGalleryItemData | string | Attachment | AttachmentBuilder | null | undefined;
387
+ /**
388
+ * Creates a {@link MediaGalleryBuilder} instance with a collection of media items, which can be images, attachments, or URLs.
389
+ *
390
+ * This function allows you to add multiple media items to a gallery, where each item can be a URL,
391
+ * an {@link Attachment}, or an {@link AttachmentBuilder}. It processes each item and adds it to the gallery,
392
+ * converting it into the appropriate format for rendering.
393
+ *
394
+ * **Parameters:**
395
+ * - `items`: An array of media items to be added to the gallery. Each item can be:
396
+ * - A {@link MediaGalleryItemData} object, which includes media information such as URLs.
397
+ * - A string URL pointing to an external resource (e.g., an image URL).
398
+ * - An {@link Attachment} or {@link AttachmentBuilder}, which are Discord attachments.
399
+ *
400
+ * @param items - The media items to be added to the gallery. Each item is processed and converted into a format suitable for the gallery.
401
+ *
402
+ * @returns A {@link MediaGalleryBuilder} instance populated with the specified media items.
403
+ *
404
+ * @example
405
+ * // Creating a media gallery with URLs and an attachment
406
+ * const gallery = createMediaGallery(
407
+ * "https://example.com/image1.png",
408
+ * new AttachmentBuilder("image2.png", { name: "image2.png" }),
409
+ * { media: { url: "https://example.com/image3.png" } }
410
+ * );
411
+ *
412
+ * @example
413
+ * // Creating a media gallery with only attachments
414
+ * const gallery = createMediaGallery(
415
+ * new AttachmentBuilder("file1.png", { name: "file1.png" }),
416
+ * new AttachmentBuilder("file2.png", { name: "file2.png" })
417
+ * );
418
+ *
419
+ * @example
420
+ * // Creating a media gallery with mixed media types (URL and attachment)
421
+ * const gallery = createMediaGallery(
422
+ * "https://example.com/image1.png",
423
+ * new AttachmentBuilder("image2.png", { name: "image2.png" })
424
+ * );
425
+ *
426
+ */
427
+ declare function createMediaGallery(...items: (MediaGallerySource | MediaGallerySource[])[]): MediaGalleryBuilder;
428
+
429
+ /**
430
+ * Creates an {@link ActionRowBuilder} containing one or more UI components.
431
+ *
432
+ * This function accepts individual components or arrays of components, flattens them,
433
+ * and returns an action row builder suitable for use in Discord messages.
434
+ * It's designed to support any component builder type that extends {@link AnyComponentBuilder}.
435
+ *
436
+ * ---
437
+ * While this function supports any valid message component (such as buttons, select menus, etc.),
438
+ * the examples below demonstrate common use cases using {@link ButtonBuilder} and {@link StringSelectMenuBuilder}.
439
+ *
440
+ * @typeParam Component - A type extending {@link AnyComponentBuilder}, such as a button or select menu builder.
441
+ *
442
+ * @param components - A variadic list of component instances or arrays of component instances to include in the row.
443
+ *
444
+ * @returns An {@link ActionRowBuilder} instance containing all provided components.
445
+ *
446
+ * @example
447
+ * // Create a row with two buttons
448
+ * const row = createRow(
449
+ * new ButtonBuilder({ customId: "a", label: "A", style: ButtonStyle.Success }),
450
+ * new ButtonBuilder({ customId: "b", label: "B", style: ButtonStyle.Primary }),
451
+ * new ButtonBuilder({ customId: "c", label: "C", style: ButtonStyle.Danger })
452
+ * );
453
+ *
454
+ * @example
455
+ * // Create a row with a string select menu
456
+ * const row = createRow(
457
+ * new StringSelectMenuBuilder({
458
+ * customId: "choose",
459
+ * placeholder: "Make a selection",
460
+ * options: [
461
+ * { label: "Option 1", value: "opt1" },
462
+ * { label: "Option 2", value: "opt2" },
463
+ * { label: "Option 3", value: "opt3" },
464
+ * ]
465
+ * })
466
+ * );
467
+ */
468
+ declare function createRow<Component extends AnyComponentBuilder>(...components: (Component | Component[])[]): ActionRowBuilder<Component>;
469
+
470
+ type ThumbnailData = Partial<Omit<ThumbnailComponentData, "type">> | Attachment | AttachmentBuilder | string;
471
+ /**
472
+ * Creates a {@link ThumbnailBuilder} from a URL, an attachment, or partial thumbnail data.
473
+ *
474
+ * This function helps create a thumbnail component for a container.
475
+ * It supports different input formats, such as a direct URL string,
476
+ * an {@link AttachmentBuilder}, an {@link Attachment}, or a partial {@link ThumbnailComponentData}.
477
+ *
478
+ * **Important:**
479
+ * - If providing a string, it must either be a valid URL or a reference to an attachment using the `attachment://filename.ext` format.
480
+ *
481
+ * @param data - The thumbnail source: a URL, an attachment builder, an attachment, or partial thumbnail data.
482
+ *
483
+ * @returns A {@link ThumbnailBuilder} instance populated with the provided data.
484
+ *
485
+ * @example
486
+ * // Creating a thumbnail from a URL
487
+ * const thumbnail = createThumbnail("https://example.com/image.png");
488
+ *
489
+ * @example
490
+ * // Creating a thumbnail from partial data
491
+ * const thumbnail = createThumbnail({
492
+ * media: { url: "attachment://image.png" },
493
+ * spoiler: true
494
+ * });
495
+ */
496
+ declare function createThumbnail(data: ThumbnailData): ThumbnailBuilder;
497
+
498
+ type SectionThumbnailAccessory = ThumbnailBuilder | ThumbnailData;
499
+ type SectionButtonAccessory = ButtonBuilder | Partial<ButtonComponentData>;
500
+ type SectionAccessory = SectionThumbnailAccessory | SectionButtonAccessory;
501
+ type SectionAccessoryData = {
502
+ accessory: SectionAccessory;
503
+ button?: never;
504
+ thumbnail?: never;
505
+ } | {
506
+ button: SectionButtonAccessory;
507
+ thumbnail?: never;
508
+ accessory?: never;
509
+ } | {
510
+ thumbnail: SectionThumbnailAccessory;
511
+ button?: never;
512
+ accessory?: never;
513
+ };
514
+ type SectionData = SectionAccessoryData & {
515
+ content: string | string[];
516
+ };
517
+ /**
518
+ * Creates a {@link SectionBuilder} component with customizable text content and a single visual accessory.
519
+ *
520
+ * This function allows you to generate a section with content (as a string or an array of strings)
521
+ * and optionally include a single accessory, which can be a button or a thumbnail.
522
+ * You can provide the accessory in multiple forms: a builder instance, a plain data object, or a URL string (for thumbnails).
523
+ *
524
+ * ---
525
+ * ### Overloads:
526
+ *
527
+ * 1. `createSection(content, accessory)`
528
+ * Pass content as a string and an accessory separately.
529
+ *
530
+ * 2. `createSection({ content, accessory | button | thumbnail })`
531
+ * Pass an object with full configuration, using only one of the accessory types.
532
+ *
533
+ * ---
534
+ *
535
+ * @param content - The main content of the section. Only used in overload 1.
536
+ * @param accessory - A {@link ButtonBuilder}, {@link ThumbnailBuilder}, or raw data used to build the accessory. Only used in overload 1.
537
+ *
538
+ * @param data - An object in overload 2 containing:
539
+ * - `content`: A string or array of strings for display.
540
+ * - `accessory`: (optional) A single accessory, either a button or thumbnail.
541
+ * - `button`: (optional) A {@link ButtonBuilder} or partial button data. Mutually exclusive with `thumbnail` and `accessory`.
542
+ * - `thumbnail`: (optional) A {@link ThumbnailBuilder}, {@link ThumbnailData}, or image URL. Mutually exclusive with `button` and `accessory`.
543
+ *
544
+ * @returns A configured {@link SectionBuilder} instance with the provided content and accessory.
545
+ *
546
+ * @example
547
+ * // Overload 1: Using content and accessory separately
548
+ * const section = createSection(
549
+ * "Hello World",
550
+ * new ButtonBuilder({ customId: "click", label: "Click", style: ButtonStyle.Success })
551
+ * );
552
+ *
553
+ * @example
554
+ * // Overload 2: Using content and thumbnail URL via `thumbnail`
555
+ * const section = createSection({
556
+ * content: "Here's an image section",
557
+ * thumbnail: "https://example.com/image.png"
558
+ * });
559
+ *
560
+ * @example
561
+ * // Overload 2: Using content and button via `accessory`
562
+ * const section = createSection({
563
+ * content: "Button section",
564
+ * accessory: new ButtonBuilder({ customId: "id", label: "Press", style: ButtonStyle.Primary });
565
+ * });
566
+ */
567
+ declare function createSection(content: string, accessory: SectionAccessory): SectionBuilder;
568
+ declare function createSection(data: SectionData): SectionBuilder;
569
+
570
+ interface SeparatorData {
571
+ divider?: boolean;
572
+ large?: boolean;
573
+ }
574
+ /**
575
+ * Creates a {@link SeparatorBuilder} component with configurable visibility and spacing.
576
+ *
577
+ * This function generates a separator component that can be customized for:
578
+ * - Visibility (`divider`: whether the visual divider line is shown).
579
+ * - Spacing (`large`: whether to use large or small spacing).
580
+ *
581
+ * It accepts parameters in two formats:
582
+ *
583
+ * **1. As an object:**
584
+ * @param data - An optional object with the following properties:
585
+ * - `divider` (boolean, optional): Whether the divider is visible. Defaults to `true`.
586
+ * - `large` (boolean, optional): Whether to use large spacing. Defaults to `false`.
587
+ *
588
+ * **2. As positional arguments:**
589
+ * @param large - Whether to use large spacing. Defaults to `false`.
590
+ * @param divider - Whether the divider is visible. Defaults to `true`.
591
+ *
592
+ * @returns A {@link SeparatorBuilder} instance with the specified configuration.
593
+ *
594
+ * @example
595
+ * // Using object syntax with default options
596
+ * const separator = createSeparator();
597
+ *
598
+ * @example
599
+ * // Using object syntax to disable the divider and enable large spacing
600
+ * const separator = createSeparator({ divider: false, large: true });
601
+ *
602
+ * @example
603
+ * // Using positional arguments: large spacing, visible divider
604
+ * const separator = createSeparator(true, true);
605
+ *
606
+ * @example
607
+ * // Using positional arguments: small spacing, hidden divider
608
+ * const separator = createSeparator(false, false);
609
+ */
610
+ declare function createSeparator(large?: boolean, divider?: boolean): SeparatorBuilder;
611
+ declare function createSeparator(data?: SeparatorData): SeparatorBuilder;
612
+
613
+ /**
614
+ * Creates a {@link TextDisplayBuilder} with the given content and optional ID.
615
+ *
616
+ * This function simplifies the creation of text display components for a container,
617
+ * allowing you to set the text content and optionally assign a custom ID.
618
+ *
619
+ * @param content - The text content to display.
620
+ * @param id - An optional numeric ID for the text component.
621
+ *
622
+ * @returns A new {@link TextDisplayBuilder} instance containing the provided content and ID.
623
+ *
624
+ * @example
625
+ * // Creating a simple text display component
626
+ * const textDisplay = createTextDisplay("Hello World!");
627
+ *
628
+ * @example
629
+ * // Creating a text display component with a custom ID
630
+ * const textDisplay = createTextDisplay("Welcome!", 123);
631
+ */
632
+ declare function createTextDisplay(content: string, id?: number): TextDisplayBuilder;
633
+
634
+ type ThumbAreaThumbnail = SectionThumbnailAccessory | null | undefined;
635
+ type ThumbAreaData = {
636
+ content: string;
637
+ thumbnail?: ThumbAreaThumbnail;
638
+ };
639
+ /**
640
+ * Creates either a {@link SectionBuilder} or a {@link TextDisplayBuilder} based on the presence of a thumbnail.
641
+ *
642
+ * If a thumbnail is provided, this function will return a {@link SectionBuilder} with the content and thumbnail.
643
+ * Otherwise, it will return a {@link TextDisplayBuilder} with only the provided content.
644
+ *
645
+ * ---
646
+ * **Overloads:**
647
+ * - Provide `content` and optional `thumbnail` as separate parameters.
648
+ * - Provide a single object with `content` and optional `thumbnail` properties.
649
+ *
650
+ * @param content - The text content to be displayed.
651
+ * @param thumbnail - (Optional) A thumbnail to include. If provided, a section will be created; otherwise, a simple text display.
652
+ *
653
+ * @param data - An object containing `content` and optional `thumbnail` properties.
654
+ *
655
+ * @returns A {@link SectionBuilder} if a thumbnail is provided, otherwise a {@link TextDisplayBuilder}.
656
+ *
657
+ * @example
658
+ * // Using positional parameters with a thumbnail
659
+ * const thumbSection = createThumbArea("Welcome!", "https://example.com/image.png");
660
+ *
661
+ * @example
662
+ * // Using an object without a thumbnail
663
+ * const textOnly = createThumbArea({ content: "Just text here" });
664
+ *
665
+ * @example
666
+ * // Using an object with a thumbnail
667
+ * const thumbSection = createThumbArea({
668
+ * content: "Check this out!",
669
+ * thumbnail: "https://example.com/image.png"
670
+ * });
671
+ */
672
+ declare function createThumbArea(content: string, thumbnail?: ThumbAreaThumbnail): SectionBuilder | TextDisplayBuilder;
673
+ declare function createThumbArea(data: ThumbAreaData): SectionBuilder | TextDisplayBuilder;
674
+
62
675
  type EmbedPlusAssetData = string | Attachment | AttachmentBuilder | EmbedAssetData | undefined | null;
63
676
  type EmbedAssetOptions = Omit<EmbedAssetData, "url">;
64
677
  declare function createEmbedAsset(source: EmbedPlusAssetData, options?: EmbedAssetOptions): EmbedAssetData | undefined;
@@ -205,548 +818,266 @@ interface CreateEmbedFilesOptions {
205
818
  */
206
819
  declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
207
820
 
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
821
  /**
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.
822
+ * Checks whether the given value is an {@link Attachment} or an {@link AttachmentBuilder}.
401
823
  *
402
- * @param data - The thumbnail source: a URL, an attachment builder, an attachment, or partial thumbnail data.
824
+ * This function returns `true` if the value is an instance of either class,
825
+ * or if it structurally matches by constructor name (useful across module boundaries).
403
826
  *
404
- * @returns A {@link ThumbnailBuilder} instance populated with the provided data.
827
+ * @param value - The value to check.
828
+ * @returns `true` if the value is an attachment or attachment builder, otherwise `false`.
405
829
  *
406
830
  * @example
407
- * // Creating a thumbnail from a URL
408
- * const thumbnail = createThumbnail("https://example.com/image.png");
831
+ * import { Attachment, AttachmentBuilder } from "discord.js";
409
832
  *
410
- * @example
411
- * // Creating a thumbnail from partial data
412
- * const thumbnail = createThumbnail({
413
- * media: { url: "attachment://image.png" },
414
- * spoiler: true
415
- * });
833
+ * function handle(input: Attachment | AttachmentBuilder | unknown) {
834
+ * if (isAttachment(input)) {
835
+ * console.log("Attachment name:", input.name);
836
+ * }
837
+ * }
416
838
  */
417
- declare function createThumbnail(data: ThumbnailData): ThumbnailBuilder;
839
+ declare function isAttachment(value: unknown): value is Attachment | AttachmentBuilder;
418
840
 
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.
841
+ /**
842
+ * Checks whether the given value is a {@link Message}.
450
843
  *
451
- * 2. `createSection({ content, accessory | button | thumbnail })`
452
- * Pass an object with full configuration, using only one of the accessory types.
844
+ * This function returns `true` if the value is an instance of `Message`
845
+ * or if it structurally resembles a `Message` object.
453
846
  *
454
- * ---
847
+ * @param value - The value to check.
848
+ * @returns `true` if the value is a `Message`, otherwise `false`.
455
849
  *
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.
850
+ * @example
851
+ * import type { Message, Interaction } from "discord.js";
458
852
  *
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`.
853
+ * function handle(input: Message | Interaction | unknown) {
854
+ * if (isMessage(input)) {
855
+ * console.log("This is a message with ID:", input.id);
856
+ * }
857
+ * }
858
+ */
859
+ declare function isMessage(value: unknown): value is Message;
860
+
861
+ /**
862
+ * Checks whether the given value is a {@link ButtonBuilder}.
464
863
  *
465
- * @returns A configured {@link SectionBuilder} instance with the provided content and accessory.
864
+ * This function returns `true` if the value is an instance of `ButtonBuilder`,
865
+ * or if it structurally matches by constructor name.
466
866
  *
467
- * @example
468
- * // Overload 1: Using content and accessory separately
469
- * const section = createSection("Hello World", new ButtonBuilder().setLabel("Click"));
867
+ * @param value - The value to check.
868
+ * @returns `true` if the value is a `ButtonBuilder`, otherwise `false`.
470
869
  *
471
870
  * @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
- * });
871
+ * import { ButtonBuilder } from "discord.js";
477
872
  *
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
- * });
873
+ * function handle(input: ButtonBuilder | unknown) {
874
+ * if (isButtonBuilder(input)) {
875
+ * input.setLabel("Click me!");
876
+ * }
877
+ * }
484
878
  */
485
- declare function createSection(content: string, accessory: SectionAccessory): SectionBuilder;
486
- declare function createSection(data: SectionData): SectionBuilder;
879
+ declare function isButtonBuilder(value: unknown): value is ButtonBuilder;
487
880
 
488
881
  /**
489
- * Creates a {@link TextDisplayBuilder} with the given content and optional ID.
882
+ * Checks whether the given value is a {@link ContainerBuilder}.
490
883
  *
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.
884
+ * This function returns `true` if the value is an instance of `ContainerBuilder`,
885
+ * or if it structurally matches by constructor name.
496
886
  *
497
- * @returns A new {@link TextDisplayBuilder} instance containing the provided content and ID.
887
+ * @param value - The value to check.
888
+ * @returns `true` if the value is a `ContainerBuilder`, otherwise `false`.
498
889
  *
499
890
  * @example
500
- * // Creating a simple text display component
501
- * const textDisplay = createTextDisplay("Hello World!");
891
+ * import { ContainerBuilder } from "discord.js";
502
892
  *
503
- * @example
504
- * // Creating a text display component with a custom ID
505
- * const textDisplay = createTextDisplay("Welcome!", 123);
893
+ * function handle(input: ContainerBuilder | unknown) {
894
+ * if (isContainerBuilder(input)) {
895
+ * input.setAccentColor(0x2ecc71);
896
+ * }
897
+ * }
506
898
  */
507
- declare function createTextDisplay(content: string, id?: number): TextDisplayBuilder;
899
+ declare function isContainerBuilder(value: unknown): value is ContainerBuilder;
508
900
 
509
- type ThumbAreaThumbnail = SectionThumbnailAccessory | null | undefined;
510
- type ThumbAreaData = {
511
- content: string;
512
- thumbnail?: ThumbAreaThumbnail;
513
- };
514
901
  /**
515
- * Creates either a {@link SectionBuilder} or a {@link TextDisplayBuilder} based on the presence of a thumbnail.
902
+ * Checks whether the given value is a {@link MediaGalleryBuilder}.
516
903
  *
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.
904
+ * This function returns `true` if the value is an instance of `MediaGalleryBuilder`,
905
+ * or if it structurally matches by constructor name.
519
906
  *
520
- * ---
521
- * **Overloads:**
522
- * - Provide `content` and optional `thumbnail` as separate parameters.
523
- * - Provide a single object with `content` and optional `thumbnail` properties.
907
+ * @param value - The value to check.
908
+ * @returns `true` if the value is a `MediaGalleryBuilder`, otherwise `false`.
524
909
  *
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.
910
+ * @example
911
+ * import type { MediaGalleryBuilder } from "discord.js";
527
912
  *
528
- * @param data - An object containing `content` and optional `thumbnail` properties.
913
+ * function handle(input: MediaGalleryBuilder | unknown) {
914
+ * if (isMediaGalleryBuilder(input)) {
915
+ * input.addItems({ media: { url: "https://example.com/image.png" } });
916
+ * }
917
+ * }
918
+ */
919
+ declare function isMediaGalleryBuilder(value: unknown): value is MediaGalleryBuilder;
920
+ /**
921
+ * Checks whether the given value is a {@link MediaGalleryItemBuilder}.
529
922
  *
530
- * @returns A {@link SectionBuilder} if a thumbnail is provided, otherwise a {@link TextDisplayBuilder}.
923
+ * This function returns `true` if the value is an instance of `MediaGalleryItemBuilder`,
924
+ * or if it structurally matches by constructor name.
531
925
  *
532
- * @example
533
- * // Using positional parameters with a thumbnail
534
- * const thumbSection = createThumbArea("Welcome!", "https://example.com/image.png");
926
+ * @param value - The value to check.
927
+ * @returns `true` if the value is a `MediaGalleryItemBuilder`, otherwise `false`.
535
928
  *
536
929
  * @example
537
- * // Using an object without a thumbnail
538
- * const textOnly = createThumbArea({ content: "Just text here" });
930
+ * import type { MediaGalleryItemBuilder } from "discord.js";
931
+ *
932
+ * function handle(input: MediaGalleryItemBuilder | unknown) {
933
+ * if (isMediaGalleryItemBuilder(input)) {
934
+ * input.setURL("https://example.com/image.png");
935
+ * }
936
+ * }
937
+ */
938
+ declare function isMediaGalleryItemBuilder(value: unknown): value is MediaGalleryItemBuilder;
939
+
940
+ /**
941
+ * Checks whether the given value is a {@link ModalBuilder}.
942
+ *
943
+ * This function returns `true` if the value is an instance of `ModalBuilder`,
944
+ * or if it structurally matches by constructor name.
945
+ *
946
+ * @param value - The value to check.
947
+ * @returns `true` if the value is a `ModalBuilder`, otherwise `false`.
539
948
  *
540
949
  * @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
- * });
950
+ * import type { ModalBuilder } from "discord.js";
951
+ *
952
+ * function handle(input: ModalBuilder | unknown) {
953
+ * if (isModalBuilder(input)) {
954
+ * input.setTitle("User Feedback");
955
+ * }
956
+ * }
546
957
  */
547
- declare function createThumbArea(content: string, thumbnail?: ThumbAreaThumbnail): SectionBuilder | TextDisplayBuilder;
548
- declare function createThumbArea(data: ThumbAreaData): SectionBuilder | TextDisplayBuilder;
958
+ declare function isModalBuilder(value: unknown): value is ModalBuilder;
549
959
 
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)[];
960
+ type AnySelectMenuBuilder = StringSelectMenuBuilder | UserSelectMenuBuilder | RoleSelectMenuBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder;
961
+ declare function isStringSelectMenuBuilder(value: unknown): value is StringSelectMenuBuilder;
962
+ declare function isUserSelectMenuBuilder(value: unknown): value is UserSelectMenuBuilder;
963
+ declare function isRoleSelectMenuBuilder(value: unknown): value is RoleSelectMenuBuilder;
964
+ declare function isChannelSelectMenuBuilder(value: unknown): value is ChannelSelectMenuBuilder;
965
+ declare function isMentionableSelectMenuBuilder(value: unknown): value is MentionableSelectMenuBuilder;
966
+ declare function isAnySelectMenuBuilder(value: unknown): value is AnySelectMenuBuilder;
553
967
 
554
- type ContainerColor = (string & {}) | ColorResolvable;
555
- interface ContainerData extends Omit<ContainerComponentData, "accentColor" | "type" | "components"> {
556
- accentColor?: ContainerColor;
557
- components: ComponentData[];
558
- }
559
968
  /**
560
- * Creates a {@link ContainerBuilder} component with optional accent color and a set of child components.
969
+ * Checks whether the given value is an {@link ActionRowBuilder}, optionally filtered by component type.
561
970
  *
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.
971
+ * This function returns `true` if the value is an `ActionRowBuilder` instance or structurally matches one.
972
+ * You can optionally specify a component type to check whether the row contains components of that type.
565
973
  *
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)
974
+ * @param value - The value to check.
975
+ * @param withComponents - (Optional) Filter by component type: `"selects"`, `"buttons"`, or `"inputs"`.
976
+ * @returns `true` if the value is an `ActionRowBuilder`, and optionally contains components of the specified type.
577
977
  *
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.
978
+ * @example
979
+ * import type { ActionRowBuilder, ButtonBuilder } from "discord.js";
580
980
  *
581
- * @returns A {@link ContainerBuilder} instance with all components and styles applied.
981
+ * function handle(input: unknown) {
982
+ * if (isActionRowBuilder(input, "buttons")) {
983
+ * console.log("Action row with buttons:", input.components.length);
984
+ * }
985
+ * }
582
986
  *
583
987
  * @example
584
- * // Using ContainerData object
585
- * const container = createContainer({
586
- * accentColor: "#ff5733",
587
- * components: ["Welcome to the app!"]
588
- * });
988
+ * import type { AnySelectMenuBuilder } from "discord.js";
589
989
  *
590
- * @example
591
- * // Using color and components as separate arguments
592
- * const container = createContainer("Red",
593
- * new TextDisplayBuilder().setText("Alert!"),
594
- * new SeparatorBuilder()
595
- * );
990
+ * function handleSelectRow(row: unknown) {
991
+ * if (isActionRowBuilder(row, "selects")) {
992
+ * console.log("Row contains select menus.");
993
+ * }
994
+ * }
995
+ */
996
+ declare function isActionRowBuilder(value: unknown): value is ActionRowBuilder;
997
+ declare function isActionRowBuilder(value: unknown, withComponents: "selects"): value is ActionRowBuilder<AnySelectMenuBuilder>;
998
+ declare function isActionRowBuilder(value: unknown, withComponents: "buttons"): value is ActionRowBuilder<ButtonBuilder>;
999
+ declare function isActionRowBuilder(value: unknown, withComponents: "inputs"): value is ActionRowBuilder<TextInputBuilder>;
1000
+
1001
+ /**
1002
+ * Checks whether the given value is a {@link SectionBuilder}.
1003
+ *
1004
+ * This function returns `true` if the value is an instance of `SectionBuilder`,
1005
+ * or if it structurally matches by constructor name.
1006
+ *
1007
+ * @param value - The value to check.
1008
+ * @returns `true` if the value is a `SectionBuilder`, otherwise `false`.
596
1009
  *
597
1010
  * @example
598
- * // Using RGB tuple
599
- * const container = createContainer([255, 0, 0], "Red alert");
1011
+ * import type { SectionBuilder } from "discord.js";
1012
+ *
1013
+ * function handle(input: SectionBuilder | unknown) {
1014
+ * if (isSectionBuilder(input)) {
1015
+ * console.log("SectionBuilder accessory:", input.accessory);
1016
+ * }
1017
+ * }
600
1018
  */
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>;
1019
+ declare function isSectionBuilder(value: unknown): value is SectionBuilder;
704
1020
 
705
- type FindRoleFilter = (role: Role) => boolean;
706
1021
  /**
1022
+ * Checks whether the given value is a {@link SeparatorBuilder}.
707
1023
  *
708
- * @param guild Discord guild
1024
+ * This function returns `true` if the value is an instance of `SeparatorBuilder`,
1025
+ * or if it structurally matches by constructor name.
709
1026
  *
710
- * ```ts
711
- * const memberRole = findRole(guild).byName("Member");
712
- * const adminRole = findRole(guild).byHexColor("#ff5454");
713
- * const leaderRole = findRole(guild).byId("537818031728885771");
714
- * ```
1027
+ * @param value - The value to check.
1028
+ * @returns `true` if the value is a `SeparatorBuilder`, otherwise `false`.
1029
+ *
1030
+ * @example
1031
+ * import { SeparatorBuilder } from "discord.js";
1032
+ *
1033
+ * function handle(input: SeparatorBuilder | unknown) {
1034
+ * if (isSeparatorBuilder(input)) {
1035
+ * console.log("SeparatorBuilder detected");
1036
+ * input.setDivider(false);
1037
+ * }
1038
+ * }
715
1039
  */
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
- };
1040
+ declare function isSeparatorBuilder(value: unknown): value is SeparatorBuilder;
723
1041
 
724
1042
  /**
1043
+ * Checks whether the given value is a {@link TextDisplayBuilder}.
725
1044
  *
726
- * @param mention Discord mentionable string
727
- * @returns mentionable id or null
1045
+ * This function returns `true` if the value is an instance of `TextDisplayBuilder`,
1046
+ * or if it structurally matches by constructor name.
728
1047
  *
729
- * ```ts
730
- * const user = "<@264620632644255745>";
731
- * const channel = "<#1068689068256403457>";
732
- * const role = "<@&929925182796226632>";
1048
+ * @param value - The value to check.
1049
+ * @returns `true` if the value is a `TextDisplayBuilder`, otherwise `false`.
733
1050
  *
734
- * extractMentionId(user) // 264620632644255745
735
- * extractMentionId(channel) // 1068689068256403457
736
- * extractMentionId(role) // 929925182796226632
737
- * ```
1051
+ * @example
1052
+ * import type { TextDisplayBuilder } from "discord.js";
1053
+ *
1054
+ * function handle(input: TextDisplayBuilder | unknown) {
1055
+ * if (isTextDisplayBuilder(input)) {
1056
+ * console.log("TextDisplayBuilder content:", input.data.content);
1057
+ * }
1058
+ * }
738
1059
  */
739
- declare function extractMentionId(mention: string): string | null;
1060
+ declare function isTextDisplayBuilder(value: unknown): value is TextDisplayBuilder;
740
1061
 
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;
1062
+ /**
1063
+ * Checks whether the given value is a {@link TextInputBuilder}.
1064
+ *
1065
+ * This function returns `true` if the value is an instance of `TextInputBuilder`,
1066
+ * or if it structurally matches by constructor name.
1067
+ *
1068
+ * @param value - The value to check.
1069
+ * @returns `true` if the value is a `TextInputBuilder`, otherwise `false`.
1070
+ *
1071
+ * @example
1072
+ * import { TextInputBuilder } from "discord.js";
1073
+ *
1074
+ * function handle(input: TextInputBuilder | unknown) {
1075
+ * if (isTextInputBuilder(input)) {
1076
+ * console.log("TextInputBuilder value:", input.data.value);
1077
+ * }
1078
+ * }
1079
+ */
1080
+ declare function isTextInputBuilder(value: unknown): value is TextInputBuilder;
750
1081
 
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 };
1082
+ 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 };
1083
+ export type { AnyEmbedData, AnySelectMenuBuilder, ComponentBuildersData, ComponentData, ContainerColor, ContainerComponentBuilder, ContainerData, ContainerInComponentType, CreateComponentData, CreateModalData, EmbedPlusAssetData, EmbedPlusAuthorData, EmbedPlusColorData, EmbedPlusData, EmbedPlusFooterData, EmbedPlusProperty, MagicComponentData, MediaGallerySource, ModalFieldsData, ModalFieldsRecord, SectionAccessory, SectionAccessoryData, SectionButtonAccessory, SectionData, SectionThumbnailAccessory, SeparatorData, ThumbAreaData, ThumbAreaThumbnail, ThumbnailData };