@magicyan/discord 1.4.10 → 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 (52) hide show
  1. package/dist/functions/components/buttons.cjs +10 -1
  2. package/dist/functions/components/buttons.mjs +10 -1
  3. package/dist/functions/components/components.cjs +3 -6
  4. package/dist/functions/components/components.mjs +3 -6
  5. package/dist/functions/components/container.cjs +71 -66
  6. package/dist/functions/components/container.mjs +72 -68
  7. package/dist/functions/components/file.cjs +3 -5
  8. package/dist/functions/components/file.mjs +4 -6
  9. package/dist/functions/components/gallery.cjs +4 -7
  10. package/dist/functions/components/gallery.mjs +4 -7
  11. package/dist/functions/embeds/assets.cjs +4 -4
  12. package/dist/functions/embeds/assets.mjs +4 -4
  13. package/dist/functions/message.cjs +16 -6
  14. package/dist/functions/message.mjs +15 -6
  15. package/dist/functions/modals.cjs +8 -0
  16. package/dist/functions/modals.mjs +9 -2
  17. package/dist/guards/attachment.cjs +7 -1
  18. package/dist/guards/attachment.mjs +7 -1
  19. package/dist/guards/components/button.cjs +10 -0
  20. package/dist/guards/components/button.mjs +8 -0
  21. package/dist/guards/components/container.cjs +10 -0
  22. package/dist/guards/components/container.mjs +8 -0
  23. package/dist/guards/components/gallery.cjs +14 -0
  24. package/dist/guards/components/gallery.mjs +11 -0
  25. package/dist/guards/components/modal.cjs +10 -0
  26. package/dist/guards/components/modal.mjs +8 -0
  27. package/dist/guards/components/row.cjs +18 -0
  28. package/dist/guards/components/row.mjs +16 -0
  29. package/dist/guards/components/section.cjs +10 -0
  30. package/dist/guards/components/section.mjs +8 -0
  31. package/dist/guards/components/selectmenu.cjs +30 -0
  32. package/dist/guards/components/selectmenu.mjs +23 -0
  33. package/dist/guards/components/separator.cjs +10 -0
  34. package/dist/guards/components/separator.mjs +8 -0
  35. package/dist/guards/components/textdisplay.cjs +10 -0
  36. package/dist/guards/components/textdisplay.mjs +8 -0
  37. package/dist/guards/components/textinput.cjs +10 -0
  38. package/dist/guards/components/textinput.mjs +8 -0
  39. package/dist/guards/message.cjs +17 -0
  40. package/dist/guards/message.mjs +15 -0
  41. package/dist/guards/utils.cjs +9 -0
  42. package/dist/guards/utils.mjs +7 -0
  43. package/dist/index.cjs +72 -45
  44. package/dist/index.d.cts +817 -474
  45. package/dist/index.d.mts +817 -474
  46. package/dist/index.d.ts +817 -474
  47. package/dist/index.mjs +29 -20
  48. package/package.json +1 -1
  49. package/dist/guards/button.cjs +0 -9
  50. package/dist/guards/button.mjs +0 -7
  51. package/dist/guards/selectmenu.cjs +0 -9
  52. package/dist/guards/selectmenu.mjs +0 -7
package/dist/index.d.cts 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, ButtonBuilder, ActionRowBuilder, LinkButtonComponentData, AnyComponentBuilder, FileBuilder, APIUnfurledMediaItem, MediaGalleryBuilder, MediaGalleryItemData, SeparatorBuilder, ThumbnailComponentData, ThumbnailBuilder, ButtonComponentData, SectionBuilder, TextDisplayBuilder, MessageActionRowComponentBuilder, ContainerBuilder, ContainerComponentData, ChannelType, CommandInteractionOption, Client, ApplicationCommand, TextInputBuilder, ModalSubmitInteraction, ModalSubmitFields, Collection, TextInputComponent, 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;
@@ -203,537 +815,268 @@ interface CreateEmbedFilesOptions {
203
815
  /**
204
816
  * Turns any embed image url into an attachment and returns an attachment array
205
817
  */
206
- declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
207
-
208
- interface CreateLinkButtonData extends Omit<LinkButtonComponentData, "style" | "type"> {
209
- }
210
- declare function createLinkButton(data: CreateLinkButtonData): ButtonBuilder;
211
- /**
212
- * Wraps buttons into multiple {@link ActionRowBuilder} instances with a maximum number of buttons per row.
213
- *
214
- * This function takes a list of {@link ButtonBuilder} instances (or arrays of them) and groups them into
215
- * multiple `ActionRowBuilder<ButtonBuilder>` objects, ensuring that each row contains no more than the specified
216
- * number of buttons.
217
- *
218
- * @param maxItemsPerRow - The maximum number of buttons to include in each row.
219
- * @param buttons - A variadic list of {@link ButtonBuilder} instances or arrays of them to be wrapped.
220
- *
221
- * @returns An array of {@link ActionRowBuilder} instances, each containing up to `maxItemsPerRow` buttons.
222
- *
223
- * @example
224
- * const button1 = new ButtonBuilder().setLabel("A").setCustomId("a").setStyle(ButtonStyle.Primary);
225
- * const button2 = new ButtonBuilder().setLabel("B").setCustomId("b").setStyle(ButtonStyle.Primary);
226
- * const button3 = new ButtonBuilder().setLabel("C").setCustomId("c").setStyle(ButtonStyle.Primary);
227
- *
228
- * const rows = wrapButtons(2, button1, button2, button3);
229
- * // Result: Two rows, the first with [button1, button2], the second with [button3]
230
- */
231
- declare function wrapButtons(maxItemsPerRow: number, ...buttons: (ButtonBuilder | ButtonBuilder[])[]): ActionRowBuilder<ButtonBuilder>[];
232
-
233
- /**
234
- * Creates an {@link ActionRowBuilder} containing one or more UI components.
235
- *
236
- * This function accepts individual components or arrays of components, flattens them,
237
- * and returns an action row builder suitable for use in Discord messages.
238
- * It's designed to support any component builder type that extends {@link AnyComponentBuilder}.
239
- *
240
- * ---
241
- * While this function supports any valid message component (such as buttons, select menus, etc.),
242
- * the examples below demonstrate common use cases using {@link ButtonBuilder} and {@link StringSelectMenuBuilder}.
243
- *
244
- * @typeParam Component - A type extending {@link AnyComponentBuilder}, such as a button or select menu builder.
245
- *
246
- * @param components - A variadic list of component instances or arrays of component instances to include in the row.
247
- *
248
- * @returns An {@link ActionRowBuilder} instance containing all provided components.
249
- *
250
- * @example
251
- * // Create a row with two buttons
252
- * const row = createRow(
253
- * new ButtonBuilder().setCustomId("yes").setLabel("Yes").setStyle(ButtonStyle.Success),
254
- * new ButtonBuilder().setCustomId("no").setLabel("No").setStyle(ButtonStyle.Danger)
255
- * );
256
- *
257
- * @example
258
- * // Create a row with a string select menu
259
- * const row = createRow([
260
- * new StringSelectMenuBuilder()
261
- * .setCustomId("choose")
262
- * .setPlaceholder("Make a selection")
263
- * .addOptions(
264
- * { label: "Option 1", value: "opt1" },
265
- * { label: "Option 2", value: "opt2" }
266
- * )
267
- * ]);
268
- */
269
- declare function createRow<Component extends AnyComponentBuilder>(...components: (Component | Component[])[]): ActionRowBuilder<Component>;
270
-
271
- type FileSource = string | Attachment | AttachmentBuilder;
272
- interface CreateFileOptions extends Omit<APIUnfurledMediaItem, "url"> {
273
- spoiler?: boolean;
274
- }
275
- /**
276
- * Creates a {@link FileBuilder} from an {@link AttachmentBuilder} or an attachment reference string.
277
- *
278
- * If the `source` is an {@link AttachmentBuilder}, it automatically prefixes the file name with `"attachment://"`.
279
- * If the `source` is a string, it must already be a valid attachment reference in the format `"attachment://filename.ext"`.
280
- *
281
- * You can optionally provide file metadata through the `options` parameter, such as dimensions
282
- * or whether the file should be marked as a spoiler.
283
- *
284
- * @param source - The source of the file. Must be an {@link AttachmentBuilder} or an attachment reference string.
285
- * @param options - Optional metadata for the file, such as `width`, `height`, `spoiler`, and `size`.
286
- *
287
- * @returns A {@link FileBuilder} ready to be used inside a message component.
288
- *
289
- * @example
290
- * // Creating a file from an AttachmentBuilder
291
- * const attachmentBuilder = new AttachmentBuilder("path/to/image.png");
292
- * const file = createFile(attachmentBuilder);
293
- *
294
- * @example
295
- * // Creating a file from an attachment reference string
296
- * const file = createFile("attachment://image.png");
297
- *
298
- * @example
299
- * // Creating a file with additional options like marking it as a spoiler
300
- * const file = createFile("attachment://secret.png", { spoiler: true });
301
- */
302
- declare function createFile(source: FileSource, options?: CreateFileOptions): FileBuilder;
303
-
304
- type MediaGallerySource = MediaGalleryItemData | string | Attachment | AttachmentBuilder;
305
- /**
306
- * Creates a {@link MediaGalleryBuilder} instance with a collection of media items, which can be images, attachments, or URLs.
307
- *
308
- * This function allows you to add multiple media items to a gallery, where each item can be a URL,
309
- * an {@link Attachment}, or an {@link AttachmentBuilder}. It processes each item and adds it to the gallery,
310
- * converting it into the appropriate format for rendering.
311
- *
312
- * **Parameters:**
313
- * - `items`: An array of media items to be added to the gallery. Each item can be:
314
- * - A {@link MediaGalleryItemData} object, which includes media information such as URLs.
315
- * - A string URL pointing to an external resource (e.g., an image URL).
316
- * - An {@link Attachment} or {@link AttachmentBuilder}, which are Discord attachments.
317
- *
318
- * @param items - The media items to be added to the gallery. Each item is processed and converted into a format suitable for the gallery.
319
- *
320
- * @returns A {@link MediaGalleryBuilder} instance populated with the specified media items.
321
- *
322
- * @example
323
- * // Creating a media gallery with URLs and an attachment
324
- * const gallery = createMediaGallery(
325
- * "https://example.com/image1.png",
326
- * new AttachmentBuilder("image2.png", { name: "image2.png" }),
327
- * { media: { url: "https://example.com/image3.png" } }
328
- * );
329
- *
330
- * @example
331
- * // Creating a media gallery with only attachments
332
- * const gallery = createMediaGallery(
333
- * new AttachmentBuilder("file1.png", { name: "file1.png" }),
334
- * new AttachmentBuilder("file2.png", { name: "file2.png" })
335
- * );
336
- *
337
- * @example
338
- * // Creating a media gallery with mixed media types (URL and attachment)
339
- * const gallery = createMediaGallery(
340
- * "https://example.com/image1.png",
341
- * new AttachmentBuilder("image2.png", { name: "image2.png" })
342
- * );
343
- *
344
- */
345
- declare function createMediaGallery(...items: MediaGallerySource[]): MediaGalleryBuilder;
346
-
347
- interface SeparatorData {
348
- divider?: boolean;
349
- large?: boolean;
350
- }
351
- /**
352
- * Creates a {@link SeparatorBuilder} component with configurable visibility and spacing.
353
- *
354
- * This function generates a separator component that can be customized for:
355
- * - Visibility (`divider`: whether the visual divider line is shown).
356
- * - Spacing (`large`: whether to use large or small spacing).
357
- *
358
- * It accepts parameters in two formats:
359
- *
360
- * **1. As an object:**
361
- * @param data - An optional object with the following properties:
362
- * - `divider` (boolean, optional): Whether the divider is visible. Defaults to `true`.
363
- * - `large` (boolean, optional): Whether to use large spacing. Defaults to `false`.
364
- *
365
- * **2. As positional arguments:**
366
- * @param large - Whether to use large spacing. Defaults to `false`.
367
- * @param divider - Whether the divider is visible. Defaults to `true`.
368
- *
369
- * @returns A {@link SeparatorBuilder} instance with the specified configuration.
370
- *
371
- * @example
372
- * // Using object syntax with default options
373
- * const separator = createSeparator();
374
- *
375
- * @example
376
- * // Using object syntax to disable the divider and enable large spacing
377
- * const separator = createSeparator({ divider: false, large: true });
378
- *
379
- * @example
380
- * // Using positional arguments: large spacing, visible divider
381
- * const separator = createSeparator(true, true);
382
- *
383
- * @example
384
- * // Using positional arguments: small spacing, hidden divider
385
- * const separator = createSeparator(false, false);
386
- */
387
- declare function createSeparator(large?: boolean, divider?: boolean): SeparatorBuilder;
388
- declare function createSeparator(data?: SeparatorData): SeparatorBuilder;
389
-
390
- type ThumbnailData = Partial<Omit<ThumbnailComponentData, "type">> | Attachment | AttachmentBuilder | string;
391
- /**
392
- * Creates a {@link ThumbnailBuilder} from a URL, an attachment, or partial thumbnail data.
393
- *
394
- * This function helps create a thumbnail component for a container.
395
- * It supports different input formats, such as a direct URL string,
396
- * an {@link AttachmentBuilder}, an {@link Attachment}, or a partial {@link ThumbnailComponentData}.
397
- *
398
- * **Important:**
399
- * - If providing a string, it must either be a valid URL or a reference to an attachment using the `attachment://filename.ext` format.
400
- *
401
- * @param data - The thumbnail source: a URL, an attachment builder, an attachment, or partial thumbnail data.
402
- *
403
- * @returns A {@link ThumbnailBuilder} instance populated with the provided data.
404
- *
405
- * @example
406
- * // Creating a thumbnail from a URL
407
- * const thumbnail = createThumbnail("https://example.com/image.png");
408
- *
409
- * @example
410
- * // Creating a thumbnail from partial data
411
- * const thumbnail = createThumbnail({
412
- * media: { url: "attachment://image.png" },
413
- * spoiler: true
414
- * });
415
- */
416
- declare function createThumbnail(data: ThumbnailData): ThumbnailBuilder;
417
-
418
- type SectionThumbnailAccessory = ThumbnailBuilder | ThumbnailData;
419
- type SectionButtonAccessory = ButtonBuilder | Partial<ButtonComponentData>;
420
- type SectionAccessory = SectionThumbnailAccessory | SectionButtonAccessory;
421
- type SectionAccessoryData = {
422
- accessory: SectionAccessory;
423
- button?: never;
424
- thumbnail?: never;
425
- } | {
426
- button: SectionButtonAccessory;
427
- thumbnail?: never;
428
- accessory?: never;
429
- } | {
430
- thumbnail: SectionThumbnailAccessory;
431
- button?: never;
432
- accessory?: never;
433
- };
434
- type SectionData = SectionAccessoryData & {
435
- content: string | string[];
436
- };
818
+ declare function createEmbedFiles(embed: EmbedBuilder, options?: CreateEmbedFilesOptions): AttachmentBuilder[];
819
+
437
820
  /**
438
- * Creates a {@link SectionBuilder} component with customizable text content and a single visual accessory.
821
+ * Checks whether the given value is an {@link Attachment} or an {@link AttachmentBuilder}.
439
822
  *
440
- * This function allows you to generate a section with content (as a string or an array of strings)
441
- * and optionally include a single accessory, which can be a button or a thumbnail.
442
- * You can provide the accessory in multiple forms: a builder instance, a plain data object, or a URL string (for thumbnails).
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).
443
825
  *
444
- * ---
445
- * ### Overloads:
826
+ * @param value - The value to check.
827
+ * @returns `true` if the value is an attachment or attachment builder, otherwise `false`.
446
828
  *
447
- * 1. `createSection(content, accessory)`
448
- * Pass content as a string and an accessory separately.
829
+ * @example
830
+ * import { Attachment, AttachmentBuilder } from "discord.js";
449
831
  *
450
- * 2. `createSection({ content, accessory | button | thumbnail })`
451
- * Pass an object with full configuration, using only one of the accessory types.
832
+ * function handle(input: Attachment | AttachmentBuilder | unknown) {
833
+ * if (isAttachment(input)) {
834
+ * console.log("Attachment name:", input.name);
835
+ * }
836
+ * }
837
+ */
838
+ declare function isAttachment(value: unknown): value is Attachment | AttachmentBuilder;
839
+
840
+ /**
841
+ * Checks whether the given value is a {@link Message}.
452
842
  *
453
- * ---
843
+ * This function returns `true` if the value is an instance of `Message`
844
+ * or if it structurally resembles a `Message` object.
454
845
  *
455
- * @param content - The main content of the section. Only used in overload 1.
456
- * @param accessory - A {@link ButtonBuilder}, {@link ThumbnailBuilder}, or raw data used to build the accessory. Only used in overload 1.
846
+ * @param value - The value to check.
847
+ * @returns `true` if the value is a `Message`, otherwise `false`.
457
848
  *
458
- * @param data - An object in overload 2 containing:
459
- * - `content`: A string or array of strings for display.
460
- * - `accessory`: (optional) A single accessory, either a button or thumbnail.
461
- * - `button`: (optional) A {@link ButtonBuilder} or partial button data. Mutually exclusive with `thumbnail` and `accessory`.
462
- * - `thumbnail`: (optional) A {@link ThumbnailBuilder}, {@link ThumbnailData}, or image URL. Mutually exclusive with `button` and `accessory`.
849
+ * @example
850
+ * import type { Message, Interaction } from "discord.js";
463
851
  *
464
- * @returns A configured {@link SectionBuilder} instance with the provided content 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}.
465
862
  *
466
- * @example
467
- * // Overload 1: Using content and accessory separately
468
- * const section = createSection("Hello World", new ButtonBuilder().setLabel("Click"));
863
+ * This function returns `true` if the value is an instance of `ButtonBuilder`,
864
+ * or if it structurally matches by constructor name.
469
865
  *
470
- * @example
471
- * // Overload 2: Using content and thumbnail URL via `thumbnail`
472
- * const section = createSection({
473
- * content: "Here's an image section",
474
- * thumbnail: "https://example.com/image.png"
475
- * });
866
+ * @param value - The value to check.
867
+ * @returns `true` if the value is a `ButtonBuilder`, otherwise `false`.
476
868
  *
477
869
  * @example
478
- * // Overload 2: Using content and button via `accessory`
479
- * const section = createSection({
480
- * content: "Button section",
481
- * accessory: new ButtonBuilder().setCustomId("id").setLabel("Press").setStyle(ButtonStyle.Primary)
482
- * });
870
+ * import { ButtonBuilder } from "discord.js";
871
+ *
872
+ * function handle(input: ButtonBuilder | unknown) {
873
+ * if (isButtonBuilder(input)) {
874
+ * input.setLabel("Click me!");
875
+ * }
876
+ * }
483
877
  */
484
- declare function createSection(content: string, accessory: SectionAccessory): SectionBuilder;
485
- declare function createSection(data: SectionData): SectionBuilder;
878
+ declare function isButtonBuilder(value: unknown): value is ButtonBuilder;
486
879
 
487
880
  /**
488
- * Creates a {@link TextDisplayBuilder} with the given content and optional ID.
489
- *
490
- * This function simplifies the creation of text display components for a container,
491
- * allowing you to set the text content and optionally assign a custom ID.
881
+ * Checks whether the given value is a {@link ContainerBuilder}.
492
882
  *
493
- * @param content - The text content to display.
494
- * @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.
495
885
  *
496
- * @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`.
497
888
  *
498
889
  * @example
499
- * // Creating a simple text display component
500
- * const textDisplay = createTextDisplay("Hello World!");
890
+ * import { ContainerBuilder } from "discord.js";
501
891
  *
502
- * @example
503
- * // Creating a text display component with a custom ID
504
- * const textDisplay = createTextDisplay("Welcome!", 123);
892
+ * function handle(input: ContainerBuilder | unknown) {
893
+ * if (isContainerBuilder(input)) {
894
+ * input.setAccentColor(0x2ecc71);
895
+ * }
896
+ * }
505
897
  */
506
- declare function createTextDisplay(content: string, id?: number): TextDisplayBuilder;
898
+ declare function isContainerBuilder(value: unknown): value is ContainerBuilder;
507
899
 
508
- type ThumbAreaThumbnail = SectionThumbnailAccessory | null | undefined;
509
- type ThumbAreaData = {
510
- content: string;
511
- thumbnail?: ThumbAreaThumbnail;
512
- };
513
900
  /**
514
- * 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}.
515
902
  *
516
- * If a thumbnail is provided, this function will return a {@link SectionBuilder} with the content and thumbnail.
517
- * 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.
518
905
  *
519
- * ---
520
- * **Overloads:**
521
- * - Provide `content` and optional `thumbnail` as separate parameters.
522
- * - 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`.
523
908
  *
524
- * @param content - The text content to be displayed.
525
- * @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";
526
911
  *
527
- * @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}.
528
921
  *
529
- * @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.
530
924
  *
531
- * @example
532
- * // Using positional parameters with a thumbnail
533
- * 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`.
534
927
  *
535
928
  * @example
536
- * // Using an object without a thumbnail
537
- * 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`.
538
947
  *
539
948
  * @example
540
- * // Using an object with a thumbnail
541
- * const thumbSection = createThumbArea({
542
- * content: "Check this out!",
543
- * thumbnail: "https://example.com/image.png"
544
- * });
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
+ * }
545
956
  */
546
- declare function createThumbArea(content: string, thumbnail?: ThumbAreaThumbnail): SectionBuilder | TextDisplayBuilder;
547
- declare function createThumbArea(data: ThumbAreaData): SectionBuilder | TextDisplayBuilder;
957
+ declare function isModalBuilder(value: unknown): value is ModalBuilder;
548
958
 
549
- type ComponentData = TextDisplayBuilder | SeparatorBuilder | FileBuilder | SectionBuilder | MediaGalleryBuilder | ActionRowBuilder<MessageActionRowComponentBuilder> | MessageActionRowComponentBuilder[] | MessageActionRowComponentBuilder | Attachment | AttachmentBuilder | string | null | undefined | boolean;
550
- type CreateComponentData = ComponentData | ContainerBuilder;
551
- 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;
552
966
 
553
- type ContainerColor = (string & {}) | ColorResolvable;
554
- interface ContainerData extends Omit<ContainerComponentData, "accentColor" | "type" | "components"> {
555
- accentColor?: ContainerColor;
556
- components: ComponentData[];
557
- }
558
967
  /**
559
- * 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.
560
969
  *
561
- * This function can be used in two ways:
562
- * 1. By passing an object with `accentColor` and `components` properties.
563
- * 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.
564
972
  *
565
- * The container can include various types of components such as:
566
- * - `string` (converted to `TextDisplayBuilder`)
567
- * - {@link TextDisplayBuilder}
568
- * - {@link ActionRowBuilder}
569
- * - Arrays of components (converted to an action row)
570
- * - {@link ButtonBuilder}
571
- * - {@link SectionBuilder}
572
- * - {@link MediaGalleryBuilder}
573
- * - {@link FileBuilder}
574
- * - {@link SeparatorBuilder}
575
- * - 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.
576
976
  *
577
- * @param data - Either a `ContainerData` object containing `accentColor` and `components`, or the accent color directly.
578
- * @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";
579
979
  *
580
- * @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
+ * }
581
985
  *
582
986
  * @example
583
- * // Using ContainerData object
584
- * const container = createContainer({
585
- * accentColor: "#ff5733",
586
- * components: ["Welcome to the app!"]
587
- * });
987
+ * import type { AnySelectMenuBuilder } from "discord.js";
588
988
  *
589
- * @example
590
- * // Using color and components as separate arguments
591
- * const container = createContainer("Red",
592
- * new TextDisplayBuilder().setText("Alert!"),
593
- * new SeparatorBuilder()
594
- * );
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`.
595
1008
  *
596
1009
  * @example
597
- * // Using RGB tuple
598
- * 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
+ * }
599
1017
  */
600
- declare function createContainer(data: ContainerData): ContainerBuilder;
601
- declare function createContainer(data: ColorResolvable | string, ...components: (ComponentData | ComponentData[])[]): ContainerBuilder;
602
-
603
- type GuildChannelType = Exclude<ChannelType, ChannelType.DM>;
604
- type FindChannelFilter<T extends GuildChannelType> = (channel: GetChannelType<T>) => boolean;
605
- type GetChannelType<Type extends GuildChannelType> = Extract<NonNullable<CommandInteractionOption<"cached">["channel"]>, {
606
- type: Type extends ChannelType.PublicThread | ChannelType.AnnouncementThread ? ChannelType.PublicThread | ChannelType.AnnouncementThread : Type;
607
- }>;
608
- declare function findChannel<Type extends GuildChannelType = ChannelType.GuildText>(guild: Guild, type?: Type): {
609
- byId(id: string): GetChannelType<Type> | undefined;
610
- byName(name: string, and?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
611
- byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
612
- inCategoryId(id: string): {
613
- byId(id: string): GetChannelType<Type> | undefined;
614
- byName(name: string, and?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
615
- byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
616
- };
617
- inCategoryName(name: string): {
618
- byId(id: string): GetChannelType<Type> | undefined;
619
- byName(name: string, and?: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
620
- byFilter(filter: FindChannelFilter<Type>): GetChannelType<Type> | undefined;
621
- };
622
- };
623
- interface ChannelUrlInfo {
624
- channelId?: string;
625
- guildId?: string;
626
- }
627
- declare function getChannelUrlInfo(url: string): ChannelUrlInfo;
628
-
629
- type FindCommandFilter = (command: ApplicationCommand) => boolean;
630
- declare function findCommand(guildOrClient: Guild | Client<true>): {
631
- byName(name: string, and?: FindCommandFilter): ApplicationCommand<{
632
- guild: discord_js.GuildResolvable;
633
- }> | undefined;
634
- byId(id: string): ApplicationCommand<{
635
- guild: discord_js.GuildResolvable;
636
- }> | undefined;
637
- byFilter(filter: FindCommandFilter): ApplicationCommand<{
638
- guild: discord_js.GuildResolvable;
639
- }> | undefined;
640
- };
641
- interface CommandMentionData {
642
- id: string;
643
- name: string;
644
- }
645
- declare function commandMention(command: CommandMentionData, group?: string, subcommand?: string): string;
646
- declare function commandMention(command: CommandMentionData, subcommand?: string): string;
647
-
648
- type TextInputData = Omit<TextInputComponentData, "type">;
649
- interface ModalFieldData extends Omit<TextInputData, "style"> {
650
- style?: TextInputStyle;
651
- }
652
- declare function createModalInput(data: ModalFieldData): ActionRowBuilder<TextInputBuilder>;
653
- type ModalFieldsData = Record<string, Omit<ModalFieldData, "customId">>;
654
- declare function createModalFields(data: ModalFieldsData): ActionRowBuilder<TextInputBuilder>[];
655
- type ModalFieldsRecord<K extends string> = Record<K, string>;
656
- declare function modalFieldsToRecord<K extends string = string>(fields: ModalSubmitInteraction | ModalSubmitFields | Collection<string, TextInputComponent>): ModalFieldsRecord<K>;
657
-
658
- type FindEmojiFilter = (emoji: GuildEmoji) => boolean;
659
- declare function findEmoji(guildOrClient: Guild | Client): {
660
- byName(name: string, animated?: boolean, and?: FindEmojiFilter): GuildEmoji | undefined;
661
- byId(id: string, animated?: boolean): GuildEmoji | undefined;
662
- byFilter(filter: FindEmojiFilter): GuildEmoji | undefined;
663
- };
664
-
665
- type FindMemberFilter = (member: GuildMember) => boolean;
666
- declare function findMember(guild: Guild): {
667
- byGlobalName(globalName: string, and?: FindMemberFilter): GuildMember | undefined;
668
- byNickname(nickname: string, and?: FindMemberFilter): GuildMember | undefined;
669
- byUsername(username: string, and?: FindMemberFilter): GuildMember | undefined;
670
- byDisplayName(displayName: string, and?: FindMemberFilter): GuildMember | undefined;
671
- byId(id: string): GuildMember | undefined;
672
- byFilter(filter: FindMemberFilter): GuildMember | undefined;
673
- };
674
-
675
- type FindMessageFilter = (role: Message<true>) => boolean;
676
- declare function findMessage(channel: GuildTextBasedChannel): {
677
- all(limit?: number): Promise<Message<boolean>[]>;
678
- byId(id: string): Message<true> | undefined;
679
- byContent(): {
680
- equals(content: string, ignoreCase?: boolean): Message<true> | undefined;
681
- include(content: string, ignoreCase?: boolean): Message<true> | undefined;
682
- };
683
- byFilter(filter: FindMessageFilter): Message<true> | undefined;
684
- };
685
- interface MessageUrlInfo {
686
- messageId?: string;
687
- channelId?: string;
688
- guildId?: string;
689
- }
690
- declare function getMessageUrlInfo(url: string): MessageUrlInfo;
1018
+ declare function isSectionBuilder(value: unknown): value is SectionBuilder;
691
1019
 
692
- type FindRoleFilter = (role: Role) => boolean;
693
1020
  /**
1021
+ * Checks whether the given value is a {@link SeparatorBuilder}.
694
1022
  *
695
- * @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.
696
1025
  *
697
- * ```ts
698
- * const memberRole = findRole(guild).byName("Member");
699
- * const adminRole = findRole(guild).byHexColor("#ff5454");
700
- * const leaderRole = findRole(guild).byId("537818031728885771");
701
- * ```
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
+ * }
702
1038
  */
703
- declare function findRole(guild: Guild): {
704
- byColor(color: number, and?: FindRoleFilter): Role | undefined;
705
- byHexColor(hexColor: string, and?: FindRoleFilter): Role | undefined;
706
- byName(name: string, and?: FindRoleFilter): Role | undefined;
707
- byId(id: string): Role | undefined;
708
- byFilter(filter: FindRoleFilter): Role | undefined;
709
- };
1039
+ declare function isSeparatorBuilder(value: unknown): value is SeparatorBuilder;
710
1040
 
711
1041
  /**
1042
+ * Checks whether the given value is a {@link TextDisplayBuilder}.
712
1043
  *
713
- * @param mention Discord mentionable string
714
- * @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.
715
1046
  *
716
- * ```ts
717
- * const user = "<@264620632644255745>";
718
- * const channel = "<#1068689068256403457>";
719
- * const role = "<@&929925182796226632>";
1047
+ * @param value - The value to check.
1048
+ * @returns `true` if the value is a `TextDisplayBuilder`, otherwise `false`.
720
1049
  *
721
- * extractMentionId(user) // 264620632644255745
722
- * extractMentionId(channel) // 1068689068256403457
723
- * extractMentionId(role) // 929925182796226632
724
- * ```
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
+ * }
725
1058
  */
726
- declare function extractMentionId(mention: string): string | null;
1059
+ declare function isTextDisplayBuilder(value: unknown): value is TextDisplayBuilder;
727
1060
 
728
- declare function createWebhookClient(url: string, options?: WebhookClientOptions): WebhookClient | null;
729
- declare function createWebhookClient(data: WebhookClientData, options?: WebhookClientOptions): WebhookClient | null;
730
-
731
- declare function isAttachment(value: unknown): value is Attachment | AttachmentBuilder;
732
-
733
- type AnySelectMenuBuilder = StringSelectMenuBuilder | UserSelectMenuBuilder | RoleSelectMenuBuilder | ChannelSelectMenuBuilder | MentionableSelectMenuBuilder;
734
- declare function isAnySelectMenuBuilder(value: unknown): value is AnySelectMenuBuilder;
735
-
736
- 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;
737
1080
 
738
- export { CustomItents, CustomPartials, EmbedLimit, EmbedPlusBuilder, Separator, chars, commandMention, createComponents, createContainer, createEmbed, createEmbedAsset, createEmbedAuthor, createEmbedFiles, createEmbedFooter, createFile, createLinkButton, createMediaGallery, createModalFields, createModalInput, createRow, createSection, createSeparator, createTextDisplay, createThumbArea, createThumbnail, createWebhookClient, extractMentionId, findChannel, findCommand, findEmoji, findMember, findMessage, findRole, getChannelUrlInfo, getMessageUrlInfo, isAnySelectMenuBuilder, isAttachment, isButtonBuilder, modalFieldsToRecord, setMobileStatus, wrapButtons };
739
- export type { AnyEmbedData, AnySelectMenuBuilder, ComponentData, ContainerColor, ContainerData, EmbedPlusAssetData, EmbedPlusAuthorData, EmbedPlusColorData, EmbedPlusData, EmbedPlusFooterData, EmbedPlusProperty, 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 };