discord.js 14.23.0 → 14.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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": "14.23.
|
|
4
|
+
"version": "14.23.1",
|
|
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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"homepage": "https://discord.js.org",
|
|
54
54
|
"funding": "https://github.com/discordjs/discord.js?sponsor",
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@discordjs/builders": "^1.12.
|
|
56
|
+
"@discordjs/builders": "^1.12.1",
|
|
57
57
|
"@discordjs/collection": "1.5.3",
|
|
58
58
|
"@discordjs/formatters": "^0.6.1",
|
|
59
59
|
"@discordjs/ws": "^1.2.3",
|
|
@@ -80,7 +80,10 @@ class ModalSubmitInteraction extends BaseInteraction {
|
|
|
80
80
|
* @type {Array<ActionRowModalData | LabelModalData | TextDisplayModalData>}
|
|
81
81
|
*/
|
|
82
82
|
this.components = data.data.components?.map(component =>
|
|
83
|
-
ModalSubmitInteraction.transformComponent(component, data.data.resolved
|
|
83
|
+
ModalSubmitInteraction.transformComponent(component, data.data.resolved, {
|
|
84
|
+
client: this.client,
|
|
85
|
+
guild: this.guild,
|
|
86
|
+
}),
|
|
84
87
|
);
|
|
85
88
|
|
|
86
89
|
/**
|
|
@@ -121,14 +124,17 @@ class ModalSubmitInteraction extends BaseInteraction {
|
|
|
121
124
|
* Transforms component data to discord.js-compatible data
|
|
122
125
|
* @param {*} rawComponent The data to transform
|
|
123
126
|
* @param {APIInteractionDataResolved} [resolved] The resolved data for the interaction
|
|
127
|
+
* @param {*} [extra] Extra data required for the transformation
|
|
124
128
|
* @returns {ModalData[]}
|
|
125
129
|
*/
|
|
126
|
-
static transformComponent(rawComponent, resolved) {
|
|
130
|
+
static transformComponent(rawComponent, resolved, { client, guild } = {}) {
|
|
127
131
|
if ('components' in rawComponent) {
|
|
128
132
|
return {
|
|
129
133
|
type: rawComponent.type,
|
|
130
134
|
id: rawComponent.id,
|
|
131
|
-
components: rawComponent.components.map(component =>
|
|
135
|
+
components: rawComponent.components.map(component =>
|
|
136
|
+
this.transformComponent(component, resolved, { client, guild }),
|
|
137
|
+
),
|
|
132
138
|
};
|
|
133
139
|
}
|
|
134
140
|
|
|
@@ -136,7 +142,7 @@ class ModalSubmitInteraction extends BaseInteraction {
|
|
|
136
142
|
return {
|
|
137
143
|
type: rawComponent.type,
|
|
138
144
|
id: rawComponent.id,
|
|
139
|
-
component: this.transformComponent(rawComponent.component, resolved),
|
|
145
|
+
component: this.transformComponent(rawComponent.component, resolved, { client, guild }),
|
|
140
146
|
};
|
|
141
147
|
}
|
|
142
148
|
|
|
@@ -164,19 +170,25 @@ class ModalSubmitInteraction extends BaseInteraction {
|
|
|
164
170
|
return collection.size ? collection : null;
|
|
165
171
|
};
|
|
166
172
|
|
|
167
|
-
const users = resolveCollection(resolved.users, user =>
|
|
173
|
+
const users = resolveCollection(resolved.users, user => client.users._add(user));
|
|
168
174
|
if (users) data.users = users;
|
|
169
175
|
|
|
170
176
|
const channels = resolveCollection(
|
|
171
177
|
resolved.channels,
|
|
172
|
-
channel =>
|
|
178
|
+
channel => client.channels._add(channel, guild) ?? channel,
|
|
173
179
|
);
|
|
174
180
|
if (channels) data.channels = channels;
|
|
175
181
|
|
|
176
|
-
const members =
|
|
177
|
-
if (members) data.members = members;
|
|
182
|
+
const members = new Collection();
|
|
178
183
|
|
|
179
|
-
const
|
|
184
|
+
for (const [id, member] of Object.entries(resolved.members)) {
|
|
185
|
+
const user = users.get(id);
|
|
186
|
+
members.set(id, guild?.members._add({ user, ...member }) ?? member);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (members.size > 0) data.members = members;
|
|
190
|
+
|
|
191
|
+
const roles = resolveCollection(resolved.roles, role => guild?.roles._add(role) ?? role);
|
|
180
192
|
if (roles) data.roles = roles;
|
|
181
193
|
}
|
|
182
194
|
}
|
package/src/structures/Poll.js
CHANGED
|
@@ -164,7 +164,7 @@ class Poll extends Base {
|
|
|
164
164
|
* @returns {Promise<Message>}
|
|
165
165
|
*/
|
|
166
166
|
async end() {
|
|
167
|
-
if (Date.now() > this.expiresTimestamp) {
|
|
167
|
+
if (this.expiresTimestamp !== null && Date.now() > this.expiresTimestamp) {
|
|
168
168
|
throw new DiscordjsError(ErrorCodes.PollAlreadyExpired);
|
|
169
169
|
}
|
|
170
170
|
|