seyfert 3.0.1-dev-14631093284.0 → 3.0.1-dev-14657186698.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/Routes/webhooks.d.ts +2 -2
- package/lib/api/api.d.ts +3 -2
- package/lib/api/api.js +3 -3
- package/lib/builders/ActionRow.d.ts +3 -3
- package/lib/builders/ActionRow.js +2 -2
- package/lib/builders/Button.d.ts +2 -11
- package/lib/builders/Button.js +3 -15
- package/lib/builders/Container.d.ts +68 -0
- package/lib/builders/Container.js +86 -0
- package/lib/builders/File.d.ts +37 -0
- package/lib/builders/File.js +52 -0
- package/lib/builders/MediaGallery.d.ts +80 -0
- package/lib/builders/MediaGallery.js +110 -0
- package/lib/builders/Section.d.ts +29 -0
- package/lib/builders/Section.js +50 -0
- package/lib/builders/Separator.d.ts +39 -0
- package/lib/builders/Separator.js +54 -0
- package/lib/builders/TextDisplay.d.ts +29 -0
- package/lib/builders/TextDisplay.js +41 -0
- package/lib/builders/Thumbnail.d.ts +43 -0
- package/lib/builders/Thumbnail.js +61 -0
- package/lib/builders/index.d.ts +10 -4
- package/lib/builders/index.js +29 -1
- package/lib/builders/types.d.ts +11 -1
- package/lib/common/types/write.d.ts +3 -3
- package/lib/components/ActionRow.d.ts +1 -1
- package/lib/components/BaseComponent.d.ts +27 -2
- package/lib/components/Container.d.ts +10 -0
- package/lib/components/Container.js +22 -0
- package/lib/components/File.d.ts +7 -0
- package/lib/components/File.js +16 -0
- package/lib/components/MediaGallery.d.ts +6 -0
- package/lib/components/MediaGallery.js +13 -0
- package/lib/components/Section.d.ts +12 -0
- package/lib/components/Section.js +21 -0
- package/lib/components/Separator.d.ts +7 -0
- package/lib/components/Separator.js +16 -0
- package/lib/components/TextDisplay.d.ts +5 -0
- package/lib/components/TextDisplay.js +10 -0
- package/lib/components/Thumbnail.d.ts +8 -0
- package/lib/components/Thumbnail.js +19 -0
- package/lib/components/index.d.ts +13 -3
- package/lib/components/index.js +27 -0
- package/lib/events/hooks/interactions.d.ts +1 -1
- package/lib/structures/Interaction.d.ts +1 -1
- package/lib/structures/Interaction.js +3 -1
- package/lib/structures/Message.d.ts +2 -3
- package/lib/structures/Message.js +1 -2
- package/lib/structures/Webhook.d.ts +2 -2
- package/lib/structures/channels.js +2 -2
- package/lib/types/payloads/_interactions/messageComponents.d.ts +1 -2
- package/lib/types/payloads/_interactions/modalSubmit.d.ts +1 -2
- package/lib/types/payloads/_interactions/responses.d.ts +1 -2
- package/lib/types/payloads/channel.d.ts +11 -332
- package/lib/types/payloads/channel.js +9 -111
- package/lib/types/payloads/components.d.ts +489 -0
- package/lib/types/payloads/components.js +148 -0
- package/lib/types/payloads/index.d.ts +1 -0
- package/lib/types/payloads/index.js +1 -0
- package/lib/types/rest/channel.d.ts +3 -3
- package/lib/types/rest/webhook.d.ts +12 -4
- package/package.json +1 -1
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Separator = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const Base_1 = require("./Base");
|
|
6
|
+
/**
|
|
7
|
+
* Represents a separator component builder.
|
|
8
|
+
* Used to add visual spacing or dividers between components.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* // A simple separator for spacing
|
|
12
|
+
* const spacingSeparator = new Separator().setSpacing(Spacing.Small);
|
|
13
|
+
*
|
|
14
|
+
* // A separator acting as a visual divider
|
|
15
|
+
* const dividerSeparator = new Separator().setDivider(true);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
class Separator extends Base_1.BaseComponentBuilder {
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a new Separator component.
|
|
21
|
+
* @param data Optional initial data for the separator component.
|
|
22
|
+
*/
|
|
23
|
+
constructor(data = {}) {
|
|
24
|
+
super({ type: types_1.ComponentType.Separator, ...data });
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Sets the ID for the separator component.
|
|
28
|
+
* @param id The ID to set.
|
|
29
|
+
* @returns The updated Separator instance.
|
|
30
|
+
*/
|
|
31
|
+
setId(id) {
|
|
32
|
+
this.data.id = id;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sets whether this separator should act as a visual divider.
|
|
37
|
+
* @param divider Whether to render as a divider (defaults to false).
|
|
38
|
+
* @returns The updated Separator instance.
|
|
39
|
+
*/
|
|
40
|
+
setDivider(divider = false) {
|
|
41
|
+
this.data.divider = divider;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sets the amount of spacing this separator provides.
|
|
46
|
+
* @param spacing The desired spacing level ('None', 'Small', 'Medium', 'Large').
|
|
47
|
+
* @returns The updated Separator instance.
|
|
48
|
+
*/
|
|
49
|
+
setSpacing(spacing) {
|
|
50
|
+
this.data.spacing = spacing;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.Separator = Separator;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type APITextDispalyComponent } from '../types';
|
|
2
|
+
import { BaseComponentBuilder } from './Base';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a text display component builder.
|
|
5
|
+
* Used to display simple text content.
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const text = new TextDisplay().content('Hello, world!');
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare class TextDisplay extends BaseComponentBuilder<APITextDispalyComponent> {
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new TextDisplay component.
|
|
14
|
+
* @param data Optional initial data for the text display component.
|
|
15
|
+
*/
|
|
16
|
+
constructor(data?: Partial<APITextDispalyComponent>);
|
|
17
|
+
/**
|
|
18
|
+
* Sets the ID for the text display component.
|
|
19
|
+
* @param id The ID to set.
|
|
20
|
+
* @returns The updated TextDisplay instance.
|
|
21
|
+
*/
|
|
22
|
+
setId(id: number): this;
|
|
23
|
+
/**
|
|
24
|
+
* Sets the text content to display.
|
|
25
|
+
* @param content The text content.
|
|
26
|
+
* @returns The updated TextDisplay instance.
|
|
27
|
+
*/
|
|
28
|
+
setContent(content: string): this;
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextDisplay = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const Base_1 = require("./Base");
|
|
6
|
+
/**
|
|
7
|
+
* Represents a text display component builder.
|
|
8
|
+
* Used to display simple text content.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const text = new TextDisplay().content('Hello, world!');
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
class TextDisplay extends Base_1.BaseComponentBuilder {
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a new TextDisplay component.
|
|
17
|
+
* @param data Optional initial data for the text display component.
|
|
18
|
+
*/
|
|
19
|
+
constructor(data = {}) {
|
|
20
|
+
super({ type: types_1.ComponentType.TextDisplay, ...data });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sets the ID for the text display component.
|
|
24
|
+
* @param id The ID to set.
|
|
25
|
+
* @returns The updated TextDisplay instance.
|
|
26
|
+
*/
|
|
27
|
+
setId(id) {
|
|
28
|
+
this.data.id = id;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Sets the text content to display.
|
|
33
|
+
* @param content The text content.
|
|
34
|
+
* @returns The updated TextDisplay instance.
|
|
35
|
+
*/
|
|
36
|
+
setContent(content) {
|
|
37
|
+
this.data.content = content;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.TextDisplay = TextDisplay;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type APIThumbnailComponent } from '../types';
|
|
2
|
+
import { BaseComponentBuilder } from './Base';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a thumbnail component builder.
|
|
5
|
+
* Used to display a small image preview, often alongside other content.
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const thumbnail = new Thumbnail()
|
|
9
|
+
* .setMedia('https://example.com/thumbnail.jpg')
|
|
10
|
+
* .setDescription('A cool thumbnail');
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare class Thumbnail extends BaseComponentBuilder<APIThumbnailComponent> {
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a new Thumbnail component.
|
|
16
|
+
* @param data Optional initial data for the thumbnail component.
|
|
17
|
+
*/
|
|
18
|
+
constructor(data?: Partial<APIThumbnailComponent>);
|
|
19
|
+
/**
|
|
20
|
+
* Sets whether the thumbnail should be visually marked as a spoiler.
|
|
21
|
+
* @param spoiler Whether the thumbnail is a spoiler (defaults to true).
|
|
22
|
+
* @returns The updated Thumbnail instance.
|
|
23
|
+
*/
|
|
24
|
+
setSpoiler(spoiler?: boolean): this;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the description for the thumbnail.
|
|
27
|
+
* @param description The description text. Can be undefined to remove the description.
|
|
28
|
+
* @returns The updated Thumbnail instance.
|
|
29
|
+
*/
|
|
30
|
+
setDescription(description: string | undefined): this;
|
|
31
|
+
/**
|
|
32
|
+
* Sets the ID for the thumbnail component.
|
|
33
|
+
* @param id The ID to set.
|
|
34
|
+
* @returns The updated Thumbnail instance.
|
|
35
|
+
*/
|
|
36
|
+
setId(id: number): this;
|
|
37
|
+
/**
|
|
38
|
+
* Sets the media URL for the thumbnail.
|
|
39
|
+
* @param url The URL of the image to display as a thumbnail.
|
|
40
|
+
* @returns The updated Thumbnail instance.
|
|
41
|
+
*/
|
|
42
|
+
setMedia(url: string): this;
|
|
43
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Thumbnail = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
const Base_1 = require("./Base");
|
|
6
|
+
/**
|
|
7
|
+
* Represents a thumbnail component builder.
|
|
8
|
+
* Used to display a small image preview, often alongside other content.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const thumbnail = new Thumbnail()
|
|
12
|
+
* .setMedia('https://example.com/thumbnail.jpg')
|
|
13
|
+
* .setDescription('A cool thumbnail');
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
class Thumbnail extends Base_1.BaseComponentBuilder {
|
|
17
|
+
/**
|
|
18
|
+
* Constructs a new Thumbnail component.
|
|
19
|
+
* @param data Optional initial data for the thumbnail component.
|
|
20
|
+
*/
|
|
21
|
+
constructor(data = {}) {
|
|
22
|
+
super({ type: types_1.ComponentType.Thumbnail, ...data });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Sets whether the thumbnail should be visually marked as a spoiler.
|
|
26
|
+
* @param spoiler Whether the thumbnail is a spoiler (defaults to true).
|
|
27
|
+
* @returns The updated Thumbnail instance.
|
|
28
|
+
*/
|
|
29
|
+
setSpoiler(spoiler = true) {
|
|
30
|
+
this.data.spoiler = spoiler;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sets the description for the thumbnail.
|
|
35
|
+
* @param description The description text. Can be undefined to remove the description.
|
|
36
|
+
* @returns The updated Thumbnail instance.
|
|
37
|
+
*/
|
|
38
|
+
setDescription(description) {
|
|
39
|
+
this.data.description = description;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Sets the ID for the thumbnail component.
|
|
44
|
+
* @param id The ID to set.
|
|
45
|
+
* @returns The updated Thumbnail instance.
|
|
46
|
+
*/
|
|
47
|
+
setId(id) {
|
|
48
|
+
this.data.id = id;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Sets the media URL for the thumbnail.
|
|
53
|
+
* @param url The URL of the image to display as a thumbnail.
|
|
54
|
+
* @returns The updated Thumbnail instance.
|
|
55
|
+
*/
|
|
56
|
+
setMedia(url) {
|
|
57
|
+
this.data.media = { url };
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.Thumbnail = Thumbnail;
|
package/lib/builders/index.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { ActionRow } from './ActionRow';
|
|
1
|
+
import { type APIComponents } from '../types';
|
|
3
2
|
import type { BuilderComponents } from './types';
|
|
4
3
|
export * from './ActionRow';
|
|
5
4
|
export * from './Attachment';
|
|
6
5
|
export * from './Base';
|
|
7
6
|
export * from './Button';
|
|
7
|
+
export * from './Container';
|
|
8
8
|
export * from './Embed';
|
|
9
|
+
export * from './File';
|
|
10
|
+
export * from './MediaGallery';
|
|
9
11
|
export * from './Modal';
|
|
10
|
-
export * from './SelectMenu';
|
|
11
12
|
export * from './Poll';
|
|
13
|
+
export * from './Section';
|
|
14
|
+
export * from './SelectMenu';
|
|
15
|
+
export * from './Separator';
|
|
16
|
+
export * from './TextDisplay';
|
|
17
|
+
export * from './Thumbnail';
|
|
12
18
|
export * from './types';
|
|
13
|
-
export declare function fromComponent(data: BuilderComponents |
|
|
19
|
+
export declare function fromComponent(data: BuilderComponents | APIComponents): BuilderComponents;
|
package/lib/builders/index.js
CHANGED
|
@@ -18,16 +18,30 @@ exports.fromComponent = fromComponent;
|
|
|
18
18
|
const types_1 = require("../types");
|
|
19
19
|
const ActionRow_1 = require("./ActionRow");
|
|
20
20
|
const Button_1 = require("./Button");
|
|
21
|
+
const Container_1 = require("./Container");
|
|
22
|
+
const File_1 = require("./File");
|
|
23
|
+
const MediaGallery_1 = require("./MediaGallery");
|
|
21
24
|
const Modal_1 = require("./Modal");
|
|
25
|
+
const Section_1 = require("./Section");
|
|
22
26
|
const SelectMenu_1 = require("./SelectMenu");
|
|
27
|
+
const Separator_1 = require("./Separator");
|
|
28
|
+
const TextDisplay_1 = require("./TextDisplay");
|
|
29
|
+
const Thumbnail_1 = require("./Thumbnail");
|
|
23
30
|
__exportStar(require("./ActionRow"), exports);
|
|
24
31
|
__exportStar(require("./Attachment"), exports);
|
|
25
32
|
__exportStar(require("./Base"), exports);
|
|
26
33
|
__exportStar(require("./Button"), exports);
|
|
34
|
+
__exportStar(require("./Container"), exports);
|
|
27
35
|
__exportStar(require("./Embed"), exports);
|
|
36
|
+
__exportStar(require("./File"), exports);
|
|
37
|
+
__exportStar(require("./MediaGallery"), exports);
|
|
28
38
|
__exportStar(require("./Modal"), exports);
|
|
29
|
-
__exportStar(require("./SelectMenu"), exports);
|
|
30
39
|
__exportStar(require("./Poll"), exports);
|
|
40
|
+
__exportStar(require("./Section"), exports);
|
|
41
|
+
__exportStar(require("./SelectMenu"), exports);
|
|
42
|
+
__exportStar(require("./Separator"), exports);
|
|
43
|
+
__exportStar(require("./TextDisplay"), exports);
|
|
44
|
+
__exportStar(require("./Thumbnail"), exports);
|
|
31
45
|
__exportStar(require("./types"), exports);
|
|
32
46
|
function fromComponent(data) {
|
|
33
47
|
if ('toJSON' in data) {
|
|
@@ -50,5 +64,19 @@ function fromComponent(data) {
|
|
|
50
64
|
return new SelectMenu_1.ChannelSelectMenu(data);
|
|
51
65
|
case types_1.ComponentType.ActionRow:
|
|
52
66
|
return new ActionRow_1.ActionRow(data);
|
|
67
|
+
case types_1.ComponentType.Section:
|
|
68
|
+
return new Section_1.Section(data);
|
|
69
|
+
case types_1.ComponentType.TextDisplay:
|
|
70
|
+
return new TextDisplay_1.TextDisplay(data);
|
|
71
|
+
case types_1.ComponentType.Thumbnail:
|
|
72
|
+
return new Thumbnail_1.Thumbnail(data);
|
|
73
|
+
case types_1.ComponentType.Container:
|
|
74
|
+
return new Container_1.Container(data);
|
|
75
|
+
case types_1.ComponentType.MediaGallery:
|
|
76
|
+
return new MediaGallery_1.MediaGallery(data);
|
|
77
|
+
case types_1.ComponentType.Separator:
|
|
78
|
+
return new Separator_1.Separator(data);
|
|
79
|
+
case types_1.ComponentType.File:
|
|
80
|
+
return new File_1.File(data);
|
|
53
81
|
}
|
|
54
82
|
}
|
package/lib/builders/types.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { ComponentInteraction, ModalSubmitInteraction, StringSelectMenuInteraction } from '../structures/Interaction';
|
|
2
|
+
import type { ActionRow } from './ActionRow';
|
|
2
3
|
import type { Button } from './Button';
|
|
4
|
+
import type { Container } from './Container';
|
|
5
|
+
import type { File } from './File';
|
|
6
|
+
import type { MediaGallery } from './MediaGallery';
|
|
3
7
|
import type { TextInput } from './Modal';
|
|
8
|
+
import type { Section } from './Section';
|
|
4
9
|
import type { BuilderSelectMenus } from './SelectMenu';
|
|
10
|
+
import type { Separator } from './Separator';
|
|
11
|
+
import type { TextDisplay } from './TextDisplay';
|
|
12
|
+
import type { Thumbnail } from './Thumbnail';
|
|
5
13
|
export type ComponentCallback<T extends ComponentInteraction | StringSelectMenuInteraction = ComponentInteraction | StringSelectMenuInteraction> = (interaction: T, stop: ComponentStopCallback, refresh: ComponentRefreshCallback) => any;
|
|
6
14
|
export type ComponentOnErrorCallback<T extends ComponentInteraction | StringSelectMenuInteraction = ComponentInteraction | StringSelectMenuInteraction> = (interaction: T, error: unknown, stop: ComponentStopCallback, refresh: ComponentRefreshCallback) => any;
|
|
7
15
|
export type ComponentFilterCallback<T = ComponentInteraction> = (interaction: T) => any;
|
|
@@ -12,7 +20,9 @@ export type ButtonLink = Omit<Button, 'setCustomId'>;
|
|
|
12
20
|
export type ButtonID = Omit<Button, 'setURL'>;
|
|
13
21
|
export type MessageBuilderComponents = FixedComponents<Button> | BuilderSelectMenus;
|
|
14
22
|
export type ModalBuilderComponents = TextInput;
|
|
15
|
-
export type
|
|
23
|
+
export type ActionBuilderComponents = MessageBuilderComponents | TextInput;
|
|
24
|
+
export type BuilderComponents = ActionRow | ActionBuilderComponents | Section<Button | Thumbnail> | Thumbnail | TextDisplay | Container | Separator | MediaGallery | File | TextInput;
|
|
25
|
+
export type TopLevelBuilders = Exclude<BuilderComponents, Thumbnail | TextInput>;
|
|
16
26
|
export type FixedComponents<T = Button> = T extends Button ? ButtonLink | ButtonID : T;
|
|
17
27
|
export interface ListenerOptions {
|
|
18
28
|
timeout?: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RawFile } from '../../api';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { Attachment, AttachmentBuilder, Embed, Modal, PollBuilder, TopLevelBuilders } from '../../builders';
|
|
3
|
+
import type { APIEmbed, APIInteractionResponseCallbackData, APIInteractionResponseChannelMessageWithSource, APIModalInteractionResponse, RESTAPIPollCreate, RESTPatchAPIChannelMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPostAPIChannelMessageJSONBody, RESTPostAPIWebhookWithTokenJSONBody } from '../../types';
|
|
4
4
|
import type { OmitInsert } from './util';
|
|
5
5
|
export interface ResolverProps {
|
|
6
6
|
embeds?: Embed[] | APIEmbed[] | undefined;
|
|
7
|
-
components?:
|
|
7
|
+
components?: TopLevelBuilders[];
|
|
8
8
|
files?: AttachmentBuilder[] | Attachment[] | RawFile[] | undefined;
|
|
9
9
|
}
|
|
10
10
|
export interface SendResolverProps extends ResolverProps {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { APIMessageActionRowComponent, ComponentType } from '../types';
|
|
2
2
|
import { BaseComponent } from './BaseComponent';
|
|
3
3
|
import type { ActionRowMessageComponents } from './index';
|
|
4
|
-
export declare class MessageActionRowComponent<T extends ActionRowMessageComponents> extends BaseComponent<ComponentType.ActionRow> {
|
|
4
|
+
export declare class MessageActionRowComponent<T extends ActionRowMessageComponents = ActionRowMessageComponents> extends BaseComponent<ComponentType.ActionRow> {
|
|
5
5
|
private ComponentsFactory;
|
|
6
6
|
constructor(data: {
|
|
7
7
|
type: ComponentType.ActionRow;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ActionRow, type Button, type ChannelSelectMenu, type Container, type File, type MediaGallery, type MentionableSelectMenu, type RoleSelectMenu, type Section, type Separator, type StringSelectMenu, type TextDisplay, type TextInput, type Thumbnail, type UserSelectMenu } from '../builders';
|
|
2
|
+
import { type APIActionRowComponent, type APIActionRowComponentTypes, type APIButtonComponent, type APIChannelSelectComponent, type APIContainerComponent, type APIFileComponent, type APIMediaGalleryComponent, type APIMentionableSelectComponent, type APIRoleSelectComponent, type APISectionComponent, type APISeparatorComponent, type APIStringSelectComponent, type APITextDispalyComponent, type APITextInputComponent, type APIThumbnailComponent, type APIUserSelectComponent, ComponentType } from '../types';
|
|
2
3
|
export declare class BaseComponent<T extends ComponentType> {
|
|
3
4
|
data: APIComponentsMap[T];
|
|
4
5
|
constructor(data: APIComponentsMap[T]);
|
|
5
6
|
get type(): ComponentType;
|
|
6
7
|
toJSON(): APIComponentsMap[T];
|
|
7
|
-
toBuilder():
|
|
8
|
+
toBuilder(): BuilderComponentsMap[T];
|
|
8
9
|
}
|
|
9
10
|
export interface APIComponentsMap {
|
|
10
11
|
[ComponentType.ActionRow]: APIActionRowComponent<APIActionRowComponentTypes>;
|
|
@@ -15,4 +16,28 @@ export interface APIComponentsMap {
|
|
|
15
16
|
[ComponentType.StringSelect]: APIStringSelectComponent;
|
|
16
17
|
[ComponentType.UserSelect]: APIUserSelectComponent;
|
|
17
18
|
[ComponentType.TextInput]: APITextInputComponent;
|
|
19
|
+
[ComponentType.File]: APIFileComponent;
|
|
20
|
+
[ComponentType.Thumbnail]: APIThumbnailComponent;
|
|
21
|
+
[ComponentType.Section]: APISectionComponent;
|
|
22
|
+
[ComponentType.Container]: APIContainerComponent;
|
|
23
|
+
[ComponentType.MediaGallery]: APIMediaGalleryComponent;
|
|
24
|
+
[ComponentType.Separator]: APISeparatorComponent;
|
|
25
|
+
[ComponentType.TextDisplay]: APITextDispalyComponent;
|
|
26
|
+
}
|
|
27
|
+
export interface BuilderComponentsMap {
|
|
28
|
+
[ComponentType.ActionRow]: ActionRow;
|
|
29
|
+
[ComponentType.Button]: Button;
|
|
30
|
+
[ComponentType.ChannelSelect]: ChannelSelectMenu;
|
|
31
|
+
[ComponentType.MentionableSelect]: MentionableSelectMenu;
|
|
32
|
+
[ComponentType.RoleSelect]: RoleSelectMenu;
|
|
33
|
+
[ComponentType.StringSelect]: StringSelectMenu;
|
|
34
|
+
[ComponentType.UserSelect]: UserSelectMenu;
|
|
35
|
+
[ComponentType.TextInput]: TextInput;
|
|
36
|
+
[ComponentType.File]: File;
|
|
37
|
+
[ComponentType.Thumbnail]: Thumbnail;
|
|
38
|
+
[ComponentType.Section]: Section;
|
|
39
|
+
[ComponentType.Container]: Container;
|
|
40
|
+
[ComponentType.MediaGallery]: MediaGallery;
|
|
41
|
+
[ComponentType.Separator]: Separator;
|
|
42
|
+
[ComponentType.TextDisplay]: TextDisplay;
|
|
18
43
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ContainerComponents } from '.';
|
|
2
|
+
import type { APIContainerComponent, ComponentType } from '../types';
|
|
3
|
+
import { BaseComponent } from './BaseComponent';
|
|
4
|
+
export declare class ContainerComponent extends BaseComponent<ComponentType.Container> {
|
|
5
|
+
_components: ContainerComponents[];
|
|
6
|
+
constructor(data: APIContainerComponent);
|
|
7
|
+
get components(): import("../types").APIContainerComponents[];
|
|
8
|
+
get accentColor(): number | undefined;
|
|
9
|
+
get spoiler(): boolean | undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContainerComponent = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
6
|
+
class ContainerComponent extends BaseComponent_1.BaseComponent {
|
|
7
|
+
_components;
|
|
8
|
+
constructor(data) {
|
|
9
|
+
super(data);
|
|
10
|
+
this._components = this.data.components.map(_1.componentFactory);
|
|
11
|
+
}
|
|
12
|
+
get components() {
|
|
13
|
+
return this.data.components;
|
|
14
|
+
}
|
|
15
|
+
get accentColor() {
|
|
16
|
+
return this.data.accent_color;
|
|
17
|
+
}
|
|
18
|
+
get spoiler() {
|
|
19
|
+
return this.data.spoiler;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ContainerComponent = ContainerComponent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentType } from '../types';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
|
+
export declare class FileComponent extends BaseComponent<ComponentType.File> {
|
|
4
|
+
get spoiler(): boolean | undefined;
|
|
5
|
+
get file(): import("../types").APIUnfurledMediaItem;
|
|
6
|
+
get id(): number | undefined;
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileComponent = void 0;
|
|
4
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
5
|
+
class FileComponent extends BaseComponent_1.BaseComponent {
|
|
6
|
+
get spoiler() {
|
|
7
|
+
return this.data.spoiler;
|
|
8
|
+
}
|
|
9
|
+
get file() {
|
|
10
|
+
return this.data.file;
|
|
11
|
+
}
|
|
12
|
+
get id() {
|
|
13
|
+
return this.data.id;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.FileComponent = FileComponent;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentType } from '../types';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
|
+
export declare class MediaGalleryComponent extends BaseComponent<ComponentType.MediaGallery> {
|
|
4
|
+
get items(): import("../types").APIMediaGalleryItems[];
|
|
5
|
+
get id(): number | undefined;
|
|
6
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MediaGalleryComponent = void 0;
|
|
4
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
5
|
+
class MediaGalleryComponent extends BaseComponent_1.BaseComponent {
|
|
6
|
+
get items() {
|
|
7
|
+
return this.data.items;
|
|
8
|
+
}
|
|
9
|
+
get id() {
|
|
10
|
+
return this.data.id;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.MediaGalleryComponent = MediaGalleryComponent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { APISectionComponent, ComponentType } from '../types';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
|
+
import type { ButtonComponent } from './ButtonComponent';
|
|
4
|
+
import type { TextDisplayComponent } from './TextDisplay';
|
|
5
|
+
import type { ThumbnailComponent } from './Thumbnail';
|
|
6
|
+
export declare class SectionComponent extends BaseComponent<ComponentType.Section> {
|
|
7
|
+
protected _components: TextDisplayComponent[];
|
|
8
|
+
protected _accessory: ThumbnailComponent | ButtonComponent;
|
|
9
|
+
constructor(data: APISectionComponent);
|
|
10
|
+
get components(): TextDisplayComponent[];
|
|
11
|
+
get accessory(): ButtonComponent | ThumbnailComponent;
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SectionComponent = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
6
|
+
class SectionComponent extends BaseComponent_1.BaseComponent {
|
|
7
|
+
_components;
|
|
8
|
+
_accessory;
|
|
9
|
+
constructor(data) {
|
|
10
|
+
super(data);
|
|
11
|
+
this._components = data.components?.map(_1.componentFactory);
|
|
12
|
+
this._accessory = (0, _1.componentFactory)(data.accessory);
|
|
13
|
+
}
|
|
14
|
+
get components() {
|
|
15
|
+
return this._components;
|
|
16
|
+
}
|
|
17
|
+
get accessory() {
|
|
18
|
+
return this._accessory;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.SectionComponent = SectionComponent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentType } from '../types';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
|
+
export declare class SeparatorComponent extends BaseComponent<ComponentType.Separator> {
|
|
4
|
+
get id(): number | undefined;
|
|
5
|
+
get spacing(): import("../types").Spacing | undefined;
|
|
6
|
+
get divider(): boolean | undefined;
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SeparatorComponent = void 0;
|
|
4
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
5
|
+
class SeparatorComponent extends BaseComponent_1.BaseComponent {
|
|
6
|
+
get id() {
|
|
7
|
+
return this.data.id;
|
|
8
|
+
}
|
|
9
|
+
get spacing() {
|
|
10
|
+
return this.data.spacing;
|
|
11
|
+
}
|
|
12
|
+
get divider() {
|
|
13
|
+
return this.data.divider;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.SeparatorComponent = SeparatorComponent;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextDisplayComponent = void 0;
|
|
4
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
5
|
+
class TextDisplayComponent extends BaseComponent_1.BaseComponent {
|
|
6
|
+
get content() {
|
|
7
|
+
return this.data.content;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.TextDisplayComponent = TextDisplayComponent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentType } from '../types';
|
|
2
|
+
import { BaseComponent } from './BaseComponent';
|
|
3
|
+
export declare class ThumbnailComponent extends BaseComponent<ComponentType.Thumbnail> {
|
|
4
|
+
get id(): number | undefined;
|
|
5
|
+
get media(): import("../types").APIUnfurledMediaItem;
|
|
6
|
+
get description(): string | undefined;
|
|
7
|
+
get spoiler(): boolean | undefined;
|
|
8
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThumbnailComponent = void 0;
|
|
4
|
+
const BaseComponent_1 = require("./BaseComponent");
|
|
5
|
+
class ThumbnailComponent extends BaseComponent_1.BaseComponent {
|
|
6
|
+
get id() {
|
|
7
|
+
return this.data.id;
|
|
8
|
+
}
|
|
9
|
+
get media() {
|
|
10
|
+
return this.data.media;
|
|
11
|
+
}
|
|
12
|
+
get description() {
|
|
13
|
+
return this.data.description;
|
|
14
|
+
}
|
|
15
|
+
get spoiler() {
|
|
16
|
+
return this.data.spoiler;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.ThumbnailComponent = ThumbnailComponent;
|