discord.js 15.0.0-dev.1745841930-696d8339a → 15.0.0-dev.1745947844-82435c308
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/package.json +4 -4
- package/src/index.js +9 -0
- package/src/structures/Component.js +9 -0
- package/src/structures/ContainerComponent.js +60 -0
- package/src/structures/FileComponent.js +40 -0
- package/src/structures/MediaGalleryComponent.js +31 -0
- package/src/structures/MediaGalleryItem.js +51 -0
- package/src/structures/Message.js +4 -4
- package/src/structures/MessageComponentInteraction.js +3 -4
- package/src/structures/MessagePayload.js +2 -1
- package/src/structures/SectionComponent.js +42 -0
- package/src/structures/SeparatorComponent.js +30 -0
- package/src/structures/TextDisplayComponent.js +20 -0
- package/src/structures/ThumbnailComponent.js +49 -0
- package/src/structures/UnfurledMediaItem.js +25 -0
- package/src/structures/interfaces/TextBasedChannel.js +8 -3
- package/src/util/APITypes.js +42 -2
- package/src/util/Components.js +130 -18
- package/typings/index.d.mts +176 -9
- package/typings/index.d.ts +176 -9
- package/typings/index.test-d.ts +66 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "discord.js",
|
|
4
|
-
"version": "15.0.0-dev.
|
|
4
|
+
"version": "15.0.0-dev.1745947844-82435c308",
|
|
5
5
|
"description": "A powerful library for interacting with the Discord API",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"types": "./typings/index.d.ts",
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"magic-bytes.js": "^1.10.0",
|
|
61
61
|
"tslib": "^2.8.1",
|
|
62
62
|
"undici": "7.8.0",
|
|
63
|
-
"@discordjs/collection": "^2.1.1",
|
|
64
63
|
"@discordjs/builders": "^1.11.1",
|
|
65
|
-
"@discordjs/
|
|
64
|
+
"@discordjs/collection": "^2.1.1",
|
|
66
65
|
"@discordjs/formatters": "^0.6.1",
|
|
67
66
|
"@discordjs/util": "^1.1.1",
|
|
68
|
-
"@discordjs/ws": "^2.0.2"
|
|
67
|
+
"@discordjs/ws": "^2.0.2",
|
|
68
|
+
"@discordjs/rest": "^2.5.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@favware/cliff-jumper": "^4.1.0",
|
package/src/index.js
CHANGED
|
@@ -131,12 +131,14 @@ exports.CommandInteraction = require('./structures/CommandInteraction.js').Comma
|
|
|
131
131
|
exports.CommandInteractionOptionResolver =
|
|
132
132
|
require('./structures/CommandInteractionOptionResolver.js').CommandInteractionOptionResolver;
|
|
133
133
|
exports.Component = require('./structures/Component.js').Component;
|
|
134
|
+
exports.ContainerComponent = require('./structures/ContainerComponent.js').ContainerComponent;
|
|
134
135
|
exports.ContextMenuCommandInteraction =
|
|
135
136
|
require('./structures/ContextMenuCommandInteraction.js').ContextMenuCommandInteraction;
|
|
136
137
|
exports.DMChannel = require('./structures/DMChannel.js').DMChannel;
|
|
137
138
|
exports.Embed = require('./structures/Embed.js').Embed;
|
|
138
139
|
exports.Emoji = require('./structures/Emoji.js').Emoji;
|
|
139
140
|
exports.Entitlement = require('./structures/Entitlement.js').Entitlement;
|
|
141
|
+
exports.FileComponent = require('./structures/FileComponent.js').FileComponent;
|
|
140
142
|
exports.ForumChannel = require('./structures/ForumChannel.js').ForumChannel;
|
|
141
143
|
exports.Guild = require('./structures/Guild.js').Guild;
|
|
142
144
|
exports.GuildAuditLogs = require('./structures/GuildAuditLogs.js').GuildAuditLogs;
|
|
@@ -165,6 +167,8 @@ exports.InteractionWebhook = require('./structures/InteractionWebhook.js').Inter
|
|
|
165
167
|
exports.Invite = require('./structures/Invite.js').Invite;
|
|
166
168
|
exports.InviteGuild = require('./structures/InviteGuild.js').InviteGuild;
|
|
167
169
|
exports.MediaChannel = require('./structures/MediaChannel.js').MediaChannel;
|
|
170
|
+
exports.MediaGalleryComponent = require('./structures/MediaGalleryComponent.js').MediaGalleryComponent;
|
|
171
|
+
exports.MediaGalleryItem = require('./structures/MediaGalleryItem.js').MediaGalleryItem;
|
|
168
172
|
exports.MentionableSelectMenuComponent =
|
|
169
173
|
require('./structures/MentionableSelectMenuComponent.js').MentionableSelectMenuComponent;
|
|
170
174
|
exports.MentionableSelectMenuInteraction =
|
|
@@ -196,6 +200,8 @@ exports.RichPresenceAssets = require('./structures/Presence.js').RichPresenceAss
|
|
|
196
200
|
exports.Role = require('./structures/Role.js').Role;
|
|
197
201
|
exports.RoleSelectMenuComponent = require('./structures/RoleSelectMenuComponent.js').RoleSelectMenuComponent;
|
|
198
202
|
exports.RoleSelectMenuInteraction = require('./structures/RoleSelectMenuInteraction.js').RoleSelectMenuInteraction;
|
|
203
|
+
exports.SectionComponent = require('./structures/SectionComponent.js').SectionComponent;
|
|
204
|
+
exports.SeparatorComponent = require('./structures/SeparatorComponent.js').SeparatorComponent;
|
|
199
205
|
exports.SKU = require('./structures/SKU.js').SKU;
|
|
200
206
|
exports.SoundboardSound = require('./structures/SoundboardSound.js').SoundboardSound;
|
|
201
207
|
exports.StageChannel = require('./structures/StageChannel.js').StageChannel;
|
|
@@ -209,11 +215,14 @@ exports.Subscription = require('./structures/Subscription.js').Subscription;
|
|
|
209
215
|
exports.Team = require('./structures/Team.js').Team;
|
|
210
216
|
exports.TeamMember = require('./structures/TeamMember.js').TeamMember;
|
|
211
217
|
exports.TextChannel = require('./structures/TextChannel.js').TextChannel;
|
|
218
|
+
exports.TextDisplayComponent = require('./structures/TextDisplayComponent.js').TextDisplayComponent;
|
|
212
219
|
exports.TextInputComponent = require('./structures/TextInputComponent.js').TextInputComponent;
|
|
213
220
|
exports.ThreadChannel = require('./structures/ThreadChannel.js').ThreadChannel;
|
|
214
221
|
exports.ThreadMember = require('./structures/ThreadMember.js').ThreadMember;
|
|
215
222
|
exports.ThreadOnlyChannel = require('./structures/ThreadOnlyChannel.js').ThreadOnlyChannel;
|
|
223
|
+
exports.ThumbnailComponent = require('./structures/ThumbnailComponent.js').ThumbnailComponent;
|
|
216
224
|
exports.Typing = require('./structures/Typing.js').Typing;
|
|
225
|
+
exports.UnfurledMediaItem = require('./structures/UnfurledMediaItem.js').UnfurledMediaItem;
|
|
217
226
|
exports.User = require('./structures/User.js').User;
|
|
218
227
|
exports.UserContextMenuCommandInteraction =
|
|
219
228
|
require('./structures/UserContextMenuCommandInteraction.js').UserContextMenuCommandInteraction;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Component } = require('./Component.js');
|
|
4
|
+
const { createComponent } = require('../util/Components.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a container component
|
|
8
|
+
* @extends {Component}
|
|
9
|
+
*/
|
|
10
|
+
class ContainerComponent extends Component {
|
|
11
|
+
constructor({ components, ...data }) {
|
|
12
|
+
super(data);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The components in this container
|
|
16
|
+
* @type {Component[]}
|
|
17
|
+
* @readonly
|
|
18
|
+
*/
|
|
19
|
+
this.components = components.map(component => createComponent(component));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The accent color of this container
|
|
24
|
+
* @type {?number}
|
|
25
|
+
* @readonly
|
|
26
|
+
*/
|
|
27
|
+
get accentColor() {
|
|
28
|
+
return this.data.accent_color ?? null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The hex accent color of this container
|
|
33
|
+
* @type {?string}
|
|
34
|
+
* @readonly
|
|
35
|
+
*/
|
|
36
|
+
get hexAccentColor() {
|
|
37
|
+
return typeof this.data.accent_color === 'number'
|
|
38
|
+
? `#${this.data.accent_color.toString(16).padStart(6, '0')}`
|
|
39
|
+
: (this.data.accent_color ?? null);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Whether this container is spoilered
|
|
44
|
+
* @type {boolean}
|
|
45
|
+
* @readonly
|
|
46
|
+
*/
|
|
47
|
+
get spoiler() {
|
|
48
|
+
return this.data.spoiler ?? false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Returns the API-compatible JSON for this component
|
|
53
|
+
* @returns {APIContainerComponent}
|
|
54
|
+
*/
|
|
55
|
+
toJSON() {
|
|
56
|
+
return { ...this.data, components: this.components.map(component => component.toJSON()) };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
exports.ContainerComponent = ContainerComponent;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Component } = require('./Component.js');
|
|
4
|
+
const { UnfurledMediaItem } = require('./UnfurledMediaItem.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a file component
|
|
8
|
+
* @extends {Component}
|
|
9
|
+
*/
|
|
10
|
+
class FileComponent extends Component {
|
|
11
|
+
constructor({ file, ...data }) {
|
|
12
|
+
super(data);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The media associated with this file
|
|
16
|
+
* @type {UnfurledMediaItem}
|
|
17
|
+
* @readonly
|
|
18
|
+
*/
|
|
19
|
+
this.file = new UnfurledMediaItem(file);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Whether this thumbnail is spoilered
|
|
24
|
+
* @type {boolean}
|
|
25
|
+
* @readonly
|
|
26
|
+
*/
|
|
27
|
+
get spoiler() {
|
|
28
|
+
return this.data.spoiler ?? false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Returns the API-compatible JSON for this component
|
|
33
|
+
* @returns {APIFileComponent}
|
|
34
|
+
*/
|
|
35
|
+
toJSON() {
|
|
36
|
+
return { ...this.data, file: this.file.toJSON() };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.FileComponent = FileComponent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Component } = require('./Component.js');
|
|
4
|
+
const { MediaGalleryItem } = require('./MediaGalleryItem.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a media gallery component
|
|
8
|
+
* @extends {Component}
|
|
9
|
+
*/
|
|
10
|
+
class MediaGalleryComponent extends Component {
|
|
11
|
+
constructor({ items, ...data }) {
|
|
12
|
+
super(data);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The items in this media gallery
|
|
16
|
+
* @type {MediaGalleryItem[]}
|
|
17
|
+
* @readonly
|
|
18
|
+
*/
|
|
19
|
+
this.items = items.map(item => new MediaGalleryItem(item));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Returns the API-compatible JSON for this component
|
|
24
|
+
* @returns {APIMediaGalleryComponent}
|
|
25
|
+
*/
|
|
26
|
+
toJSON() {
|
|
27
|
+
return { ...this.data, items: this.items.map(item => item.toJSON()) };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.MediaGalleryComponent = MediaGalleryComponent;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { UnfurledMediaItem } = require('./UnfurledMediaItem.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents an item in a media gallery
|
|
7
|
+
*/
|
|
8
|
+
class MediaGalleryItem {
|
|
9
|
+
constructor({ media, ...data }) {
|
|
10
|
+
/**
|
|
11
|
+
* The API data associated with this component
|
|
12
|
+
* @type {APIMediaGalleryItem}
|
|
13
|
+
*/
|
|
14
|
+
this.data = data;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The media associated with this media gallery item
|
|
18
|
+
* @type {UnfurledMediaItem}
|
|
19
|
+
* @readonly
|
|
20
|
+
*/
|
|
21
|
+
this.media = new UnfurledMediaItem(media);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The description of this media gallery item
|
|
26
|
+
* @type {?string}
|
|
27
|
+
* @readonly
|
|
28
|
+
*/
|
|
29
|
+
get description() {
|
|
30
|
+
return this.data.description ?? null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Whether this media gallery item is spoilered
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
* @readonly
|
|
37
|
+
*/
|
|
38
|
+
get spoiler() {
|
|
39
|
+
return this.data.spoiler ?? false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Returns the API-compatible JSON for this component
|
|
44
|
+
* @returns {APIMediaGalleryItem}
|
|
45
|
+
*/
|
|
46
|
+
toJSON() {
|
|
47
|
+
return { ...this.data, media: this.media.toJSON() };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
exports.MediaGalleryItem = MediaGalleryItem;
|
|
@@ -23,7 +23,7 @@ const { ReactionCollector } = require('./ReactionCollector.js');
|
|
|
23
23
|
const { Sticker } = require('./Sticker.js');
|
|
24
24
|
const { DiscordjsError, ErrorCodes } = require('../errors/index.js');
|
|
25
25
|
const { ReactionManager } = require('../managers/ReactionManager.js');
|
|
26
|
-
const { createComponent } = require('../util/Components.js');
|
|
26
|
+
const { createComponent, findComponentByCustomId } = require('../util/Components.js');
|
|
27
27
|
const { NonSystemMessageTypes, MaxBulkDeletableMessageAge, UndeletableMessageTypes } = require('../util/Constants.js');
|
|
28
28
|
const { MessageFlagsBitField } = require('../util/MessageFlagsBitField.js');
|
|
29
29
|
const { PermissionsBitField } = require('../util/PermissionsBitField.js');
|
|
@@ -151,10 +151,10 @@ class Message extends Base {
|
|
|
151
151
|
|
|
152
152
|
if ('components' in data) {
|
|
153
153
|
/**
|
|
154
|
-
* An array of
|
|
154
|
+
* An array of components in the message.
|
|
155
155
|
* <info>This property requires the {@link GatewayIntentBits.MessageContent} privileged intent
|
|
156
156
|
* in a guild for messages that do not mention the client.</info>
|
|
157
|
-
* @type {
|
|
157
|
+
* @type {Component[]}
|
|
158
158
|
*/
|
|
159
159
|
this.components = data.components.map(component => createComponent(component));
|
|
160
160
|
} else {
|
|
@@ -1032,7 +1032,7 @@ class Message extends Base {
|
|
|
1032
1032
|
* @returns {?MessageActionRowComponent}
|
|
1033
1033
|
*/
|
|
1034
1034
|
resolveComponent(customId) {
|
|
1035
|
-
return this.components
|
|
1035
|
+
return findComponentByCustomId(this.components, customId);
|
|
1036
1036
|
}
|
|
1037
1037
|
|
|
1038
1038
|
/**
|
|
@@ -4,6 +4,7 @@ const { lazy } = require('@discordjs/util');
|
|
|
4
4
|
const { BaseInteraction } = require('./BaseInteraction.js');
|
|
5
5
|
const { InteractionWebhook } = require('./InteractionWebhook.js');
|
|
6
6
|
const { InteractionResponses } = require('./interfaces/InteractionResponses.js');
|
|
7
|
+
const { findComponentByCustomId } = require('../util/Components.js');
|
|
7
8
|
|
|
8
9
|
const getMessage = lazy(() => require('./Message.js').Message);
|
|
9
10
|
|
|
@@ -79,13 +80,11 @@ class MessageComponentInteraction extends BaseInteraction {
|
|
|
79
80
|
|
|
80
81
|
/**
|
|
81
82
|
* The component which was interacted with
|
|
82
|
-
* @type {MessageActionRowComponent|
|
|
83
|
+
* @type {MessageActionRowComponent|APIComponentInMessageActionRow}
|
|
83
84
|
* @readonly
|
|
84
85
|
*/
|
|
85
86
|
get component() {
|
|
86
|
-
return this.message.components
|
|
87
|
-
.flatMap(row => row.components)
|
|
88
|
-
.find(component => (component.customId ?? component.custom_id) === this.customId);
|
|
87
|
+
return findComponentByCustomId(this.message.components, this.customId);
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
// These are here only for documentation purposes - they are implemented by InteractionResponses
|
|
@@ -217,7 +217,8 @@ class MessagePayload {
|
|
|
217
217
|
components,
|
|
218
218
|
username,
|
|
219
219
|
avatar_url: avatarURL,
|
|
220
|
-
allowed_mentions:
|
|
220
|
+
allowed_mentions:
|
|
221
|
+
this.isMessage() && this.target.author.id !== this.target.client.user.id ? undefined : allowedMentions,
|
|
221
222
|
flags,
|
|
222
223
|
message_reference,
|
|
223
224
|
attachments: this.options.attachments,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Component } = require('./Component.js');
|
|
4
|
+
const { createComponent } = require('../util/Components.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a section component
|
|
8
|
+
* @extends {Component}
|
|
9
|
+
*/
|
|
10
|
+
class SectionComponent extends Component {
|
|
11
|
+
constructor({ accessory, components, ...data }) {
|
|
12
|
+
super(data);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The components in this section
|
|
16
|
+
* @type {Component[]}
|
|
17
|
+
* @readonly
|
|
18
|
+
*/
|
|
19
|
+
this.components = components.map(component => createComponent(component));
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The accessory component of this section
|
|
23
|
+
* @type {Component}
|
|
24
|
+
* @readonly
|
|
25
|
+
*/
|
|
26
|
+
this.accessory = createComponent(accessory);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns the API-compatible JSON for this component
|
|
31
|
+
* @returns {APISectionComponent}
|
|
32
|
+
*/
|
|
33
|
+
toJSON() {
|
|
34
|
+
return {
|
|
35
|
+
...this.data,
|
|
36
|
+
accessory: this.accessory.toJSON(),
|
|
37
|
+
components: this.components.map(component => component.toJSON()),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.SectionComponent = SectionComponent;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { SeparatorSpacingSize } = require('discord-api-types/v10');
|
|
4
|
+
const { Component } = require('./Component.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a separator component
|
|
8
|
+
* @extends {Component}
|
|
9
|
+
*/
|
|
10
|
+
class SeparatorComponent extends Component {
|
|
11
|
+
/**
|
|
12
|
+
* The spacing of this separator
|
|
13
|
+
* @type {SeparatorSpacingSize}
|
|
14
|
+
* @readonly
|
|
15
|
+
*/
|
|
16
|
+
get spacing() {
|
|
17
|
+
return this.data.spacing ?? SeparatorSpacingSize.Small;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Whether this separator is a divider
|
|
22
|
+
* @type {boolean}
|
|
23
|
+
* @readonly
|
|
24
|
+
*/
|
|
25
|
+
get divider() {
|
|
26
|
+
return this.data.divider ?? true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.SeparatorComponent = SeparatorComponent;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Component } = require('./Component.js');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a text display component
|
|
7
|
+
* @extends {Component}
|
|
8
|
+
*/
|
|
9
|
+
class TextDisplayComponent extends Component {
|
|
10
|
+
/**
|
|
11
|
+
* The content of this text display
|
|
12
|
+
* @type {string}
|
|
13
|
+
* @readonly
|
|
14
|
+
*/
|
|
15
|
+
get content() {
|
|
16
|
+
return this.data.content;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.TextDisplayComponent = TextDisplayComponent;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { Component } = require('./Component.js');
|
|
4
|
+
const { UnfurledMediaItem } = require('./UnfurledMediaItem.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a thumbnail component
|
|
8
|
+
* @extends {Component}
|
|
9
|
+
*/
|
|
10
|
+
class ThumbnailComponent extends Component {
|
|
11
|
+
constructor({ media, ...data }) {
|
|
12
|
+
super(data);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The media associated with this thumbnail
|
|
16
|
+
* @type {UnfurledMediaItem}
|
|
17
|
+
* @readonly
|
|
18
|
+
*/
|
|
19
|
+
this.media = new UnfurledMediaItem(media);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The description of this thumbnail
|
|
24
|
+
* @type {?string}
|
|
25
|
+
* @readonly
|
|
26
|
+
*/
|
|
27
|
+
get description() {
|
|
28
|
+
return this.data.description ?? null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether this thumbnail is spoilered
|
|
33
|
+
* @type {boolean}
|
|
34
|
+
* @readonly
|
|
35
|
+
*/
|
|
36
|
+
get spoiler() {
|
|
37
|
+
return this.data.spoiler ?? false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Returns the API-compatible JSON for this component
|
|
42
|
+
* @returns {APIThumbnailComponent}
|
|
43
|
+
*/
|
|
44
|
+
toJSON() {
|
|
45
|
+
return { ...this.data, media: this.media.toJSON() };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
exports.ThumbnailComponent = ThumbnailComponent;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a media item in a component
|
|
5
|
+
*/
|
|
6
|
+
class UnfurledMediaItem {
|
|
7
|
+
constructor(data) {
|
|
8
|
+
/**
|
|
9
|
+
* The API data associated with this media item
|
|
10
|
+
* @type {APIUnfurledMediaItem}
|
|
11
|
+
*/
|
|
12
|
+
this.data = data;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The URL of this media gallery item
|
|
17
|
+
* @type {string}
|
|
18
|
+
* @readonly
|
|
19
|
+
*/
|
|
20
|
+
get url() {
|
|
21
|
+
return this.data.url;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
exports.UnfurledMediaItem = UnfurledMediaItem;
|
|
@@ -77,8 +77,11 @@ class TextBasedChannel {
|
|
|
77
77
|
* (see {@link https://discord.com/developers/docs/resources/message#allowed-mentions-object here} for more details)
|
|
78
78
|
* @property {Array<(AttachmentBuilder|Attachment|AttachmentPayload|BufferResolvable)>} [files]
|
|
79
79
|
* The files to send with the message.
|
|
80
|
-
* @property {Array<(ActionRowBuilder|
|
|
81
|
-
* Action rows containing interactive components for the message (buttons, select menus)
|
|
80
|
+
* @property {Array<(ActionRowBuilder|MessageTopLevelComponent|APIMessageTopLevelComponent)>} [components]
|
|
81
|
+
* Action rows containing interactive components for the message (buttons, select menus) and other
|
|
82
|
+
* top-level components.
|
|
83
|
+
* <info>When using components v2, the flag {@link MessageFlags.IsComponentsV2} needs to be set
|
|
84
|
+
* and `content`, `embeds`, `stickers`, and `poll` cannot be used.</info>
|
|
82
85
|
*/
|
|
83
86
|
|
|
84
87
|
/**
|
|
@@ -98,7 +101,9 @@ class TextBasedChannel {
|
|
|
98
101
|
* that message will be returned and no new message will be created
|
|
99
102
|
* @property {StickerResolvable[]} [stickers=[]] The stickers to send in the message
|
|
100
103
|
* @property {MessageFlags} [flags] Which flags to set for the message.
|
|
101
|
-
* <info>Only
|
|
104
|
+
* <info>Only {@link MessageFlags.SuppressEmbeds}, {@link MessageFlags.SuppressNotifications} and
|
|
105
|
+
* {@link MessageFlags.IsComponentsV2} can be set.</info>
|
|
106
|
+
* <info>{@link MessageFlags.IsComponentsV2} is required if passing components that aren't action rows</info>
|
|
102
107
|
*/
|
|
103
108
|
|
|
104
109
|
/**
|
package/src/util/APITypes.js
CHANGED
|
@@ -60,6 +60,11 @@
|
|
|
60
60
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIChannelSelectComponent}
|
|
61
61
|
*/
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* @external APIContainerComponent
|
|
65
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIContainerComponent}
|
|
66
|
+
*/
|
|
67
|
+
|
|
63
68
|
/**
|
|
64
69
|
* @external APIEmbed
|
|
65
70
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmbed}
|
|
@@ -80,6 +85,11 @@
|
|
|
80
85
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIEmoji}
|
|
81
86
|
*/
|
|
82
87
|
|
|
88
|
+
/**
|
|
89
|
+
* @external APIFileComponent
|
|
90
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIFileComponent}
|
|
91
|
+
*/
|
|
92
|
+
|
|
83
93
|
/**
|
|
84
94
|
* @external APIGuild
|
|
85
95
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIGuild}
|
|
@@ -135,6 +145,16 @@
|
|
|
135
145
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIInteractionGuildMember}
|
|
136
146
|
*/
|
|
137
147
|
|
|
148
|
+
/**
|
|
149
|
+
* @external APIMediaGalleryComponent
|
|
150
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIMediaGalleryComponent}
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @external APIMediaGalleryItem
|
|
155
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIMediaGalleryItem}
|
|
156
|
+
*/
|
|
157
|
+
|
|
138
158
|
/**
|
|
139
159
|
* @external APIMentionableSelectComponent
|
|
140
160
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIMentionableSelectComponent}
|
|
@@ -146,8 +166,8 @@
|
|
|
146
166
|
*/
|
|
147
167
|
|
|
148
168
|
/**
|
|
149
|
-
* @external
|
|
150
|
-
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#
|
|
169
|
+
* @external APIComponentInMessageActionRow
|
|
170
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIComponentInMessageActionRow}
|
|
151
171
|
*/
|
|
152
172
|
|
|
153
173
|
/**
|
|
@@ -165,6 +185,11 @@
|
|
|
165
185
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIMessageInteractionMetadata}
|
|
166
186
|
*/
|
|
167
187
|
|
|
188
|
+
/**
|
|
189
|
+
* @external APIMessageTopLevelComponent
|
|
190
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10#APIMessageTopLevelComponent}
|
|
191
|
+
*/
|
|
192
|
+
|
|
168
193
|
/**
|
|
169
194
|
* @external APIModalInteractionResponse
|
|
170
195
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIModalInteractionResponse}
|
|
@@ -210,6 +235,11 @@
|
|
|
210
235
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APISelectMenuOption}
|
|
211
236
|
*/
|
|
212
237
|
|
|
238
|
+
/**
|
|
239
|
+
* @external APISectionComponent
|
|
240
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APISectionComponent}
|
|
241
|
+
*/
|
|
242
|
+
|
|
213
243
|
/**
|
|
214
244
|
* @external APISticker
|
|
215
245
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APISticker}
|
|
@@ -225,6 +255,16 @@
|
|
|
225
255
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APITextInputComponent}
|
|
226
256
|
*/
|
|
227
257
|
|
|
258
|
+
/**
|
|
259
|
+
* @external APIThumbnailComponent
|
|
260
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIThumbnailComponent}
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @external APIUnfurledMediaItem
|
|
265
|
+
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIUnfurledMediaItem}
|
|
266
|
+
*/
|
|
267
|
+
|
|
228
268
|
/**
|
|
229
269
|
* @external APIUser
|
|
230
270
|
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIUser}
|