seyfert 3.0.1-dev-14631093284.0 → 3.0.1-dev-14656752310.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 (60) hide show
  1. package/lib/api/Routes/webhooks.d.ts +2 -2
  2. package/lib/builders/ActionRow.d.ts +3 -3
  3. package/lib/builders/ActionRow.js +2 -2
  4. package/lib/builders/Button.d.ts +2 -11
  5. package/lib/builders/Button.js +3 -15
  6. package/lib/builders/Container.d.ts +68 -0
  7. package/lib/builders/Container.js +86 -0
  8. package/lib/builders/File.d.ts +37 -0
  9. package/lib/builders/File.js +52 -0
  10. package/lib/builders/MediaGallery.d.ts +80 -0
  11. package/lib/builders/MediaGallery.js +110 -0
  12. package/lib/builders/Section.d.ts +29 -0
  13. package/lib/builders/Section.js +50 -0
  14. package/lib/builders/Separator.d.ts +39 -0
  15. package/lib/builders/Separator.js +54 -0
  16. package/lib/builders/TextDisplay.d.ts +29 -0
  17. package/lib/builders/TextDisplay.js +41 -0
  18. package/lib/builders/Thumbnail.d.ts +43 -0
  19. package/lib/builders/Thumbnail.js +61 -0
  20. package/lib/builders/index.d.ts +10 -4
  21. package/lib/builders/index.js +29 -1
  22. package/lib/builders/types.d.ts +11 -1
  23. package/lib/common/types/write.d.ts +3 -3
  24. package/lib/components/ActionRow.d.ts +1 -1
  25. package/lib/components/BaseComponent.d.ts +27 -2
  26. package/lib/components/Container.d.ts +10 -0
  27. package/lib/components/Container.js +22 -0
  28. package/lib/components/File.d.ts +7 -0
  29. package/lib/components/File.js +16 -0
  30. package/lib/components/MediaGallery.d.ts +6 -0
  31. package/lib/components/MediaGallery.js +13 -0
  32. package/lib/components/Section.d.ts +12 -0
  33. package/lib/components/Section.js +21 -0
  34. package/lib/components/Separator.d.ts +7 -0
  35. package/lib/components/Separator.js +16 -0
  36. package/lib/components/TextDisplay.d.ts +5 -0
  37. package/lib/components/TextDisplay.js +10 -0
  38. package/lib/components/Thumbnail.d.ts +8 -0
  39. package/lib/components/Thumbnail.js +19 -0
  40. package/lib/components/index.d.ts +13 -3
  41. package/lib/components/index.js +27 -0
  42. package/lib/events/hooks/interactions.d.ts +1 -1
  43. package/lib/structures/Interaction.d.ts +1 -1
  44. package/lib/structures/Interaction.js +3 -1
  45. package/lib/structures/Message.d.ts +2 -3
  46. package/lib/structures/Message.js +1 -2
  47. package/lib/structures/Webhook.d.ts +2 -2
  48. package/lib/structures/channels.js +2 -2
  49. package/lib/types/payloads/_interactions/messageComponents.d.ts +1 -2
  50. package/lib/types/payloads/_interactions/modalSubmit.d.ts +1 -2
  51. package/lib/types/payloads/_interactions/responses.d.ts +1 -2
  52. package/lib/types/payloads/channel.d.ts +11 -332
  53. package/lib/types/payloads/channel.js +9 -111
  54. package/lib/types/payloads/components.d.ts +489 -0
  55. package/lib/types/payloads/components.js +148 -0
  56. package/lib/types/payloads/index.d.ts +1 -0
  57. package/lib/types/payloads/index.js +1 -0
  58. package/lib/types/rest/channel.d.ts +3 -3
  59. package/lib/types/rest/webhook.d.ts +12 -4
  60. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { RESTDeleteAPIWebhookResult, RESTDeleteAPIWebhookWithTokenMessageResult, RESTDeleteAPIWebhookWithTokenResult, RESTGetAPIWebhookResult, RESTGetAPIWebhookWithTokenMessageResult, RESTGetAPIWebhookWithTokenResult, RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookResult, RESTPatchAPIWebhookWithTokenJSONBody, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageResult, RESTPatchAPIWebhookWithTokenResult, RESTPostAPIWebhookWithTokenGitHubQuery, RESTPostAPIWebhookWithTokenGitHubResult, RESTPostAPIWebhookWithTokenGitHubWaitResult, RESTPostAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery, RESTPostAPIWebhookWithTokenResult, RESTPostAPIWebhookWithTokenSlackQuery, RESTPostAPIWebhookWithTokenSlackResult, RESTPostAPIWebhookWithTokenSlackWaitResult, RESTPostAPIWebhookWithTokenWaitResult } from '../../types';
1
+ import type { RESTDeleteAPIWebhookResult, RESTDeleteAPIWebhookWithTokenMessageResult, RESTDeleteAPIWebhookWithTokenResult, RESTGetAPIWebhookResult, RESTGetAPIWebhookWithTokenMessageResult, RESTGetAPIWebhookWithTokenResult, RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookResult, RESTPatchAPIWebhookWithTokenJSONBody, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageQuery, RESTPatchAPIWebhookWithTokenMessageResult, RESTPatchAPIWebhookWithTokenResult, RESTPostAPIWebhookWithTokenGitHubQuery, RESTPostAPIWebhookWithTokenGitHubResult, RESTPostAPIWebhookWithTokenGitHubWaitResult, RESTPostAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery, RESTPostAPIWebhookWithTokenResult, RESTPostAPIWebhookWithTokenSlackQuery, RESTPostAPIWebhookWithTokenSlackResult, RESTPostAPIWebhookWithTokenSlackWaitResult, RESTPostAPIWebhookWithTokenWaitResult } from '../../types';
2
2
  import type { RestArguments, RestArgumentsNoBody } from '../api';
3
3
  export interface WebhookRoutes {
4
4
  webhooks(id: string): {
@@ -7,7 +7,7 @@ export interface WebhookRoutes {
7
7
  delete(args?: RestArgumentsNoBody): Promise<RESTDeleteAPIWebhookResult>;
8
8
  (token: string): {
9
9
  get(args?: RestArgumentsNoBody): Promise<RESTGetAPIWebhookWithTokenResult>;
10
- patch(args: RestArguments<RESTPatchAPIWebhookWithTokenJSONBody>): Promise<RESTPatchAPIWebhookWithTokenResult>;
10
+ patch(args: RestArguments<RESTPatchAPIWebhookWithTokenJSONBody, RESTPatchAPIWebhookWithTokenMessageQuery>): Promise<RESTPatchAPIWebhookWithTokenResult>;
11
11
  delete(args?: RestArgumentsNoBody): Promise<RESTDeleteAPIWebhookWithTokenResult>;
12
12
  post(args: RestArguments<RESTPostAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery>): Promise<RESTPostAPIWebhookWithTokenResult | RESTPostAPIWebhookWithTokenWaitResult>;
13
13
  slack: {
@@ -1,12 +1,12 @@
1
1
  import type { RestOrArray } from '../common/types/util';
2
2
  import { type APIActionRowComponent, type APIActionRowComponentTypes, type APIMessageActionRowComponent } from '../types';
3
3
  import { BaseComponentBuilder } from './Base';
4
- import type { BuilderComponents, FixedComponents } from './types';
4
+ import type { ActionBuilderComponents, FixedComponents } from './types';
5
5
  /**
6
6
  * Represents an Action Row component in a message.
7
7
  * @template T - The type of components in the Action Row.
8
8
  */
9
- export declare class ActionRow<T extends BuilderComponents> extends BaseComponentBuilder<APIActionRowComponent<APIActionRowComponentTypes>> {
9
+ export declare class ActionRow<T extends ActionBuilderComponents = ActionBuilderComponents> extends BaseComponentBuilder<APIActionRowComponent<APIActionRowComponentTypes>> {
10
10
  /**
11
11
  * Creates a new instance of the ActionRow class.
12
12
  * @param data - Optional data to initialize the Action Row.
@@ -32,7 +32,7 @@ export declare class ActionRow<T extends BuilderComponents> extends BaseComponen
32
32
  * @example
33
33
  * actionRow.setComponents([buttonComponent1, buttonComponent2]);
34
34
  */
35
- setComponents(component: FixedComponents<T>[]): this;
35
+ setComponents(...component: RestOrArray<FixedComponents<T>>): this;
36
36
  /**
37
37
  * Converts the Action Row to its JSON representation.
38
38
  * @returns The JSON representation of the Action Row.
@@ -40,8 +40,8 @@ class ActionRow extends Base_1.BaseComponentBuilder {
40
40
  * @example
41
41
  * actionRow.setComponents([buttonComponent1, buttonComponent2]);
42
42
  */
43
- setComponents(component) {
44
- this.components = [...component];
43
+ setComponents(...component) {
44
+ this.components = component.flat();
45
45
  return this;
46
46
  }
47
47
  /**
@@ -1,15 +1,11 @@
1
1
  import { type EmojiResolvable } from '../common';
2
2
  import { type APIButtonComponent, type ButtonStyle } from '../types';
3
+ import { BaseComponentBuilder } from './Base';
3
4
  /**
4
5
  * Represents a button component.
5
6
  * @template Type - The type of the button component.
6
7
  */
7
- export declare class Button {
8
- data: Partial<APIButtonComponent>;
9
- /**
10
- * Creates a new Button instance.
11
- * @param data - The initial data for the button.
12
- */
8
+ export declare class Button extends BaseComponentBuilder<APIButtonComponent> {
13
9
  constructor(data?: Partial<APIButtonComponent>);
14
10
  /**
15
11
  * Sets the custom ID for the button.
@@ -43,9 +39,4 @@ export declare class Button {
43
39
  setDisabled(disabled?: boolean): this;
44
40
  setStyle(style: ButtonStyle): this;
45
41
  setSKUId(skuId: string): this;
46
- /**
47
- * Converts the Button instance to its JSON representation.
48
- * @returns The JSON representation of the Button instance.
49
- */
50
- toJSON(): Partial<APIButtonComponent>;
51
42
  }
@@ -3,19 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Button = void 0;
4
4
  const common_1 = require("../common");
5
5
  const types_1 = require("../types");
6
+ const Base_1 = require("./Base");
6
7
  /**
7
8
  * Represents a button component.
8
9
  * @template Type - The type of the button component.
9
10
  */
10
- class Button {
11
- data;
12
- /**
13
- * Creates a new Button instance.
14
- * @param data - The initial data for the button.
15
- */
11
+ class Button extends Base_1.BaseComponentBuilder {
16
12
  constructor(data = {}) {
17
- this.data = data;
18
- this.data.type = types_1.ComponentType.Button;
13
+ super({ type: types_1.ComponentType.Button, ...data });
19
14
  }
20
15
  /**
21
16
  * Sets the custom ID for the button.
@@ -74,12 +69,5 @@ class Button {
74
69
  this.data.sku_id = skuId;
75
70
  return this;
76
71
  }
77
- /**
78
- * Converts the Button instance to its JSON representation.
79
- * @returns The JSON representation of the Button instance.
80
- */
81
- toJSON() {
82
- return { ...this.data };
83
- }
84
72
  }
85
73
  exports.Button = Button;
@@ -0,0 +1,68 @@
1
+ import { type ActionRow } from '.';
2
+ import { type ColorResolvable, type RestOrArray } from '../common';
3
+ import { type APIContainerComponent } from '../types';
4
+ import { BaseComponentBuilder } from './Base';
5
+ import type { File } from './File';
6
+ import type { MediaGallery } from './MediaGallery';
7
+ import type { Section } from './Section';
8
+ import type { Separator } from './Separator';
9
+ import type { TextDisplay } from './TextDisplay';
10
+ /**
11
+ * Represents the possible component types that can be added to a Container.
12
+ */
13
+ export type ContainerBuilderComponents = ActionRow | TextDisplay | Section | MediaGallery | Separator | File;
14
+ /**
15
+ * Represents a container component builder.
16
+ * Containers group other components together.
17
+ * @example
18
+ * ```ts
19
+ * const container = new Container()
20
+ * .addComponents(
21
+ * new TextDisplay('This is text inside a container!'),
22
+ * new ActionRow().addComponents(new Button().setLabel('Click me!'))
23
+ * )
24
+ * .setColor('Blue');
25
+ * ```
26
+ */
27
+ export declare class Container extends BaseComponentBuilder<APIContainerComponent> {
28
+ /**
29
+ * The components held within this container.
30
+ */
31
+ components: ContainerBuilderComponents[];
32
+ /**
33
+ * Constructs a new Container.
34
+ * @param data Optional initial data for the container.
35
+ */
36
+ constructor({ components, ...data }?: Partial<APIContainerComponent>);
37
+ /**
38
+ * Adds components to the container.
39
+ * @param components The components to add. Can be a single component, an array of components, or multiple components as arguments.
40
+ * @returns The updated Container instance.
41
+ */
42
+ addComponents(...components: RestOrArray<ContainerBuilderComponents>): this;
43
+ /**
44
+ * Sets the components for the container, replacing any existing components.
45
+ * @param components The components to set. Can be a single component, an array of components, or multiple components as arguments.
46
+ * @returns The updated Container instance.
47
+ */
48
+ setComponents(...components: RestOrArray<ContainerBuilderComponents>): this;
49
+ /**
50
+ * Sets whether the container's content should be visually marked as a spoiler.
51
+ * @param spoiler Whether the content is a spoiler (defaults to true).
52
+ * @returns The updated Container instance.
53
+ */
54
+ setSpoiler(spoiler?: boolean): this;
55
+ /**
56
+ * Sets the accent color for the container.
57
+ * @param color The color resolvable (e.g., hex code, color name, integer).
58
+ * @returns The updated Container instance.
59
+ */
60
+ setColor(color: ColorResolvable): this;
61
+ /**
62
+ * Sets the ID for the container.
63
+ * @param id The ID to set.
64
+ * @returns The updated Container instance.
65
+ */
66
+ setId(id: number): this;
67
+ toJSON(): APIContainerComponent;
68
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Container = void 0;
4
+ const _1 = require(".");
5
+ const common_1 = require("../common");
6
+ const types_1 = require("../types");
7
+ const Base_1 = require("./Base");
8
+ /**
9
+ * Represents a container component builder.
10
+ * Containers group other components together.
11
+ * @example
12
+ * ```ts
13
+ * const container = new Container()
14
+ * .addComponents(
15
+ * new TextDisplay('This is text inside a container!'),
16
+ * new ActionRow().addComponents(new Button().setLabel('Click me!'))
17
+ * )
18
+ * .setColor('Blue');
19
+ * ```
20
+ */
21
+ class Container extends Base_1.BaseComponentBuilder {
22
+ /**
23
+ * The components held within this container.
24
+ */
25
+ components;
26
+ /**
27
+ * Constructs a new Container.
28
+ * @param data Optional initial data for the container.
29
+ */
30
+ constructor({ components, ...data } = {}) {
31
+ super({ ...data, type: types_1.ComponentType.Container });
32
+ this.components = (components?.map(_1.fromComponent) ?? []);
33
+ }
34
+ /**
35
+ * Adds components to the container.
36
+ * @param components The components to add. Can be a single component, an array of components, or multiple components as arguments.
37
+ * @returns The updated Container instance.
38
+ */
39
+ addComponents(...components) {
40
+ this.components = this.components.concat(components.flat());
41
+ return this;
42
+ }
43
+ /**
44
+ * Sets the components for the container, replacing any existing components.
45
+ * @param components The components to set. Can be a single component, an array of components, or multiple components as arguments.
46
+ * @returns The updated Container instance.
47
+ */
48
+ setComponents(...components) {
49
+ this.components = components.flat();
50
+ return this;
51
+ }
52
+ /**
53
+ * Sets whether the container's content should be visually marked as a spoiler.
54
+ * @param spoiler Whether the content is a spoiler (defaults to true).
55
+ * @returns The updated Container instance.
56
+ */
57
+ setSpoiler(spoiler = true) {
58
+ this.data.spoiler = spoiler;
59
+ return this;
60
+ }
61
+ /**
62
+ * Sets the accent color for the container.
63
+ * @param color The color resolvable (e.g., hex code, color name, integer).
64
+ * @returns The updated Container instance.
65
+ */
66
+ setColor(color) {
67
+ this.data.accent_color = (0, common_1.resolveColor)(color);
68
+ return this;
69
+ }
70
+ /**
71
+ * Sets the ID for the container.
72
+ * @param id The ID to set.
73
+ * @returns The updated Container instance.
74
+ */
75
+ setId(id) {
76
+ this.data.id = id;
77
+ return this;
78
+ }
79
+ toJSON() {
80
+ return {
81
+ ...this.data,
82
+ components: this.components.map(c => c.toJSON()),
83
+ };
84
+ }
85
+ }
86
+ exports.Container = Container;
@@ -0,0 +1,37 @@
1
+ import { type APIFileComponent } from '../types';
2
+ import { BaseComponentBuilder } from './Base';
3
+ /**
4
+ * Represents a file component builder.
5
+ * Used to display files within containers.
6
+ * @example
7
+ * ```ts
8
+ * const file = new File()
9
+ * .setMedia('https://example.com/image.png')
10
+ * .setSpoiler();
11
+ * ```
12
+ */
13
+ export declare class File extends BaseComponentBuilder<APIFileComponent> {
14
+ /**
15
+ * Constructs a new File component.
16
+ * @param data Optional initial data for the file component.
17
+ */
18
+ constructor(data?: Partial<APIFileComponent>);
19
+ /**
20
+ * Sets the ID for the file component.
21
+ * @param id The ID to set.
22
+ * @returns The updated File instance.
23
+ */
24
+ setId(id: number): this;
25
+ /**
26
+ * Sets the media URL for the file.
27
+ * @param url The URL of the file to display.
28
+ * @returns The updated File instance.
29
+ */
30
+ setMedia(url: string): this;
31
+ /**
32
+ * Sets whether the file should be visually marked as a spoiler.
33
+ * @param spoiler Whether the file is a spoiler (defaults to true).
34
+ * @returns The updated File instance.
35
+ */
36
+ setSpoiler(spoiler?: boolean): this;
37
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.File = void 0;
4
+ const types_1 = require("../types");
5
+ const Base_1 = require("./Base");
6
+ /**
7
+ * Represents a file component builder.
8
+ * Used to display files within containers.
9
+ * @example
10
+ * ```ts
11
+ * const file = new File()
12
+ * .setMedia('https://example.com/image.png')
13
+ * .setSpoiler();
14
+ * ```
15
+ */
16
+ class File extends Base_1.BaseComponentBuilder {
17
+ /**
18
+ * Constructs a new File component.
19
+ * @param data Optional initial data for the file component.
20
+ */
21
+ constructor(data = {}) {
22
+ super({ type: types_1.ComponentType.File, ...data });
23
+ }
24
+ /**
25
+ * Sets the ID for the file component.
26
+ * @param id The ID to set.
27
+ * @returns The updated File instance.
28
+ */
29
+ setId(id) {
30
+ this.data.id = id;
31
+ return this;
32
+ }
33
+ /**
34
+ * Sets the media URL for the file.
35
+ * @param url The URL of the file to display.
36
+ * @returns The updated File instance.
37
+ */
38
+ setMedia(url) {
39
+ this.data.file = { url };
40
+ return this;
41
+ }
42
+ /**
43
+ * Sets whether the file should be visually marked as a spoiler.
44
+ * @param spoiler Whether the file is a spoiler (defaults to true).
45
+ * @returns The updated File instance.
46
+ */
47
+ setSpoiler(spoiler = true) {
48
+ this.data.spoiler = spoiler;
49
+ return this;
50
+ }
51
+ }
52
+ exports.File = File;
@@ -0,0 +1,80 @@
1
+ import type { RestOrArray } from '../common';
2
+ import { type APIMediaGalleryComponent, type APIMediaGalleryItems } from '../types';
3
+ import { BaseComponentBuilder } from './Base';
4
+ /**
5
+ * Represents a media gallery component builder.
6
+ * Used to display a collection of media items.
7
+ * @example
8
+ * ```ts
9
+ * const gallery = new MediaGallery()
10
+ * .addItems(
11
+ * new MediaGalleryItem().setMedia('https://example.com/image1.png').setDescription('Image 1'),
12
+ * new MediaGalleryItem().setMedia('https://example.com/image2.jpg').setSpoiler()
13
+ * );
14
+ * ```
15
+ */
16
+ export declare class MediaGallery extends BaseComponentBuilder<APIMediaGalleryComponent> {
17
+ items: MediaGalleryItem[];
18
+ /**
19
+ * Constructs a new MediaGallery.
20
+ * @param data Optional initial data for the media gallery.
21
+ */
22
+ constructor({ items, ...data }?: Partial<APIMediaGalleryComponent>);
23
+ /**
24
+ * Sets the ID for the media gallery component.
25
+ * @param id The ID to set.
26
+ * @returns The updated MediaGallery instance.
27
+ */
28
+ setId(id: number): this;
29
+ /**
30
+ * Adds items to the media gallery.
31
+ * @param items The items to add. Can be a single item, an array of items, or multiple items as arguments.
32
+ * @returns The updated MediaGallery instance.
33
+ */
34
+ addItems(...items: RestOrArray<MediaGalleryItem>): this;
35
+ /**
36
+ * Sets the items for the media gallery, replacing any existing items.
37
+ * @param items The items to set. Can be a single item, an array of items, or multiple items as arguments.
38
+ * @returns The updated MediaGallery instance.
39
+ */
40
+ setItems(...items: RestOrArray<MediaGalleryItem>): this;
41
+ toJSON(): APIMediaGalleryComponent;
42
+ }
43
+ /**
44
+ * Represents an item within a MediaGallery.
45
+ */
46
+ export declare class MediaGalleryItem {
47
+ data: Partial<APIMediaGalleryItems>;
48
+ /**
49
+ * Constructs a new MediaGalleryItem.
50
+ * @param data Optional initial data for the media gallery item.
51
+ */
52
+ constructor(data?: Partial<APIMediaGalleryItems>);
53
+ /**
54
+ * Sets the media URL for this gallery item.
55
+ * @param url The URL of the media.
56
+ * @returns The updated MediaGalleryItem instance.
57
+ */
58
+ setMedia(url: string): this;
59
+ /**
60
+ * Sets the description for this gallery item.
61
+ * @param desc The description text.
62
+ * @returns The updated MediaGalleryItem instance.
63
+ */
64
+ setDescription(desc: string): this;
65
+ /**
66
+ * Sets whether this gallery item should be visually marked as a spoiler.
67
+ * @param spoiler Whether the item is a spoiler (defaults to true).
68
+ * @returns The updated MediaGalleryItem instance.
69
+ */
70
+ setSpoiler(spoiler?: boolean): this;
71
+ /**
72
+ * Converts this MediaGalleryItem instance to its JSON representation.
73
+ * @returns The JSON representation of the item data.
74
+ */
75
+ toJSON(): {
76
+ media?: import("../types").APIUnfurledMediaItem | undefined;
77
+ description?: string | undefined;
78
+ spoiler?: boolean | undefined;
79
+ };
80
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MediaGalleryItem = exports.MediaGallery = void 0;
4
+ const types_1 = require("../types");
5
+ const Base_1 = require("./Base");
6
+ /**
7
+ * Represents a media gallery component builder.
8
+ * Used to display a collection of media items.
9
+ * @example
10
+ * ```ts
11
+ * const gallery = new MediaGallery()
12
+ * .addItems(
13
+ * new MediaGalleryItem().setMedia('https://example.com/image1.png').setDescription('Image 1'),
14
+ * new MediaGalleryItem().setMedia('https://example.com/image2.jpg').setSpoiler()
15
+ * );
16
+ * ```
17
+ */
18
+ class MediaGallery extends Base_1.BaseComponentBuilder {
19
+ items;
20
+ /**
21
+ * Constructs a new MediaGallery.
22
+ * @param data Optional initial data for the media gallery.
23
+ */
24
+ constructor({ items, ...data } = {}) {
25
+ super({ type: types_1.ComponentType.MediaGallery, ...data });
26
+ this.items = (items?.map(i => new MediaGalleryItem(i)) ?? []);
27
+ }
28
+ /**
29
+ * Sets the ID for the media gallery component.
30
+ * @param id The ID to set.
31
+ * @returns The updated MediaGallery instance.
32
+ */
33
+ setId(id) {
34
+ this.data.id = id;
35
+ return this;
36
+ }
37
+ /**
38
+ * Adds items to the media gallery.
39
+ * @param items The items to add. Can be a single item, an array of items, or multiple items as arguments.
40
+ * @returns The updated MediaGallery instance.
41
+ */
42
+ addItems(...items) {
43
+ this.items = this.items.concat(items.flat());
44
+ return this;
45
+ }
46
+ /**
47
+ * Sets the items for the media gallery, replacing any existing items.
48
+ * @param items The items to set. Can be a single item, an array of items, or multiple items as arguments.
49
+ * @returns The updated MediaGallery instance.
50
+ */
51
+ setItems(...items) {
52
+ this.items = items.flat();
53
+ return this;
54
+ }
55
+ toJSON() {
56
+ return {
57
+ ...this.data,
58
+ items: this.items.map(i => i.toJSON()),
59
+ };
60
+ }
61
+ }
62
+ exports.MediaGallery = MediaGallery;
63
+ /**
64
+ * Represents an item within a MediaGallery.
65
+ */
66
+ class MediaGalleryItem {
67
+ data;
68
+ /**
69
+ * Constructs a new MediaGalleryItem.
70
+ * @param data Optional initial data for the media gallery item.
71
+ */
72
+ constructor(data = {}) {
73
+ this.data = data;
74
+ }
75
+ /**
76
+ * Sets the media URL for this gallery item.
77
+ * @param url The URL of the media.
78
+ * @returns The updated MediaGalleryItem instance.
79
+ */
80
+ setMedia(url) {
81
+ this.data.media = { url };
82
+ return this;
83
+ }
84
+ /**
85
+ * Sets the description for this gallery item.
86
+ * @param desc The description text.
87
+ * @returns The updated MediaGalleryItem instance.
88
+ */
89
+ setDescription(desc) {
90
+ this.data.description = desc;
91
+ return this;
92
+ }
93
+ /**
94
+ * Sets whether this gallery item should be visually marked as a spoiler.
95
+ * @param spoiler Whether the item is a spoiler (defaults to true).
96
+ * @returns The updated MediaGalleryItem instance.
97
+ */
98
+ setSpoiler(spoiler = true) {
99
+ this.data.spoiler = spoiler;
100
+ return this;
101
+ }
102
+ /**
103
+ * Converts this MediaGalleryItem instance to its JSON representation.
104
+ * @returns The JSON representation of the item data.
105
+ */
106
+ toJSON() {
107
+ return { ...this.data };
108
+ }
109
+ }
110
+ exports.MediaGalleryItem = MediaGalleryItem;
@@ -0,0 +1,29 @@
1
+ import { type Button } from '.';
2
+ import type { RestOrArray } from '../common';
3
+ import { type APISectionComponent } from '../types';
4
+ import { BaseComponentBuilder } from './Base';
5
+ import type { TextDisplay } from './TextDisplay';
6
+ import type { Thumbnail } from './Thumbnail';
7
+ export declare class Section<Ac extends Button | Thumbnail = Button | Thumbnail> extends BaseComponentBuilder<APISectionComponent> {
8
+ components: TextDisplay[];
9
+ accessory: Ac;
10
+ constructor({ components, accessory, ...data }?: Partial<APISectionComponent>);
11
+ /**
12
+ * Adds components to this section.
13
+ * @param components The components to add
14
+ * @example section.addComponents(new TextDisplay().content('Hello'));
15
+ */
16
+ addComponents(...components: RestOrArray<TextDisplay>): this;
17
+ /**
18
+ * Sets the components for this section.
19
+ * @param components The components to set
20
+ * @example section.setComponents(new TextDisplay().content('Hello'));
21
+ */
22
+ setComponents(...components: RestOrArray<TextDisplay>): this;
23
+ setAccessory(accessory: Ac): this;
24
+ /**
25
+ * Converts this section to JSON.
26
+ * @returns The JSON representation of this section
27
+ */
28
+ toJSON(): APISectionComponent;
29
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Section = void 0;
4
+ const _1 = require(".");
5
+ const types_1 = require("../types");
6
+ const Base_1 = require("./Base");
7
+ class Section extends Base_1.BaseComponentBuilder {
8
+ components;
9
+ accessory;
10
+ constructor({ components, accessory, ...data } = {}) {
11
+ super({ type: types_1.ComponentType.Section, ...data });
12
+ this.components = (components?.map(component => (0, _1.fromComponent)(component)) ?? []);
13
+ if (accessory)
14
+ this.accessory = (0, _1.fromComponent)(accessory);
15
+ }
16
+ /**
17
+ * Adds components to this section.
18
+ * @param components The components to add
19
+ * @example section.addComponents(new TextDisplay().content('Hello'));
20
+ */
21
+ addComponents(...components) {
22
+ this.components = this.components.concat(components.flat());
23
+ return this;
24
+ }
25
+ /**
26
+ * Sets the components for this section.
27
+ * @param components The components to set
28
+ * @example section.setComponents(new TextDisplay().content('Hello'));
29
+ */
30
+ setComponents(...components) {
31
+ this.components = components.flat();
32
+ return this;
33
+ }
34
+ setAccessory(accessory) {
35
+ this.accessory = accessory;
36
+ return this;
37
+ }
38
+ /**
39
+ * Converts this section to JSON.
40
+ * @returns The JSON representation of this section
41
+ */
42
+ toJSON() {
43
+ return {
44
+ ...this.data,
45
+ components: this.components.map(component => component.toJSON()),
46
+ accessory: this.accessory.toJSON(),
47
+ };
48
+ }
49
+ }
50
+ exports.Section = Section;
@@ -0,0 +1,39 @@
1
+ import { type APISeparatorComponent, type Spacing } from '../types';
2
+ import { BaseComponentBuilder } from './Base';
3
+ /**
4
+ * Represents a separator component builder.
5
+ * Used to add visual spacing or dividers between components.
6
+ * @example
7
+ * ```ts
8
+ * // A simple separator for spacing
9
+ * const spacingSeparator = new Separator().setSpacing(Spacing.Small);
10
+ *
11
+ * // A separator acting as a visual divider
12
+ * const dividerSeparator = new Separator().setDivider(true);
13
+ * ```
14
+ */
15
+ export declare class Separator extends BaseComponentBuilder<APISeparatorComponent> {
16
+ /**
17
+ * Constructs a new Separator component.
18
+ * @param data Optional initial data for the separator component.
19
+ */
20
+ constructor(data?: Partial<APISeparatorComponent>);
21
+ /**
22
+ * Sets the ID for the separator component.
23
+ * @param id The ID to set.
24
+ * @returns The updated Separator instance.
25
+ */
26
+ setId(id: number): this;
27
+ /**
28
+ * Sets whether this separator should act as a visual divider.
29
+ * @param divider Whether to render as a divider (defaults to false).
30
+ * @returns The updated Separator instance.
31
+ */
32
+ setDivider(divider?: boolean): this;
33
+ /**
34
+ * Sets the amount of spacing this separator provides.
35
+ * @param spacing The desired spacing level ('None', 'Small', 'Medium', 'Large').
36
+ * @returns The updated Separator instance.
37
+ */
38
+ setSpacing(spacing: Spacing): this;
39
+ }