discord.js 15.0.0-dev.1763164928-7349a6ee3 → 15.0.0-dev.1763510521-315f42278
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": "15.0.0-dev.
|
|
4
|
+
"version": "15.0.0-dev.1763510521-315f42278",
|
|
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",
|
|
@@ -61,12 +61,12 @@
|
|
|
61
61
|
"magic-bytes.js": "^1.12.1",
|
|
62
62
|
"tslib": "^2.8.1",
|
|
63
63
|
"undici": "7.16.0",
|
|
64
|
-
"@discordjs/builders": "2.0.0-dev.
|
|
65
|
-
"@discordjs/collection": "3.0.0-dev.
|
|
66
|
-
"@discordjs/
|
|
67
|
-
"@discordjs/
|
|
68
|
-
"@discordjs/
|
|
69
|
-
"@discordjs/
|
|
64
|
+
"@discordjs/builders": "2.0.0-dev.1763510521-315f42278",
|
|
65
|
+
"@discordjs/collection": "3.0.0-dev.1763510521-315f42278",
|
|
66
|
+
"@discordjs/formatters": "1.0.0-dev.1763510521-315f42278",
|
|
67
|
+
"@discordjs/rest": "3.0.0-dev.1763510521-315f42278",
|
|
68
|
+
"@discordjs/util": "2.0.0-dev.1763510521-315f42278",
|
|
69
|
+
"@discordjs/ws": "3.0.0-dev.1763510521-315f42278"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@favware/cliff-jumper": "^4.1.0",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"tsd": "^0.33.0",
|
|
83
83
|
"turbo": "^2.5.8",
|
|
84
84
|
"typescript": "~5.9.3",
|
|
85
|
+
"@discordjs/scripts": "0.1.0",
|
|
85
86
|
"@discordjs/api-extractor": "7.52.7",
|
|
86
|
-
"@discordjs/docgen": "0.12.1"
|
|
87
|
-
"@discordjs/scripts": "0.1.0"
|
|
87
|
+
"@discordjs/docgen": "0.12.1"
|
|
88
88
|
},
|
|
89
89
|
"engines": {
|
|
90
90
|
"node": ">=22.12.0"
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { Buffer } = require('node:buffer');
|
|
4
|
-
const { isJSONEncodable } = require('@discordjs/util');
|
|
4
|
+
const { isJSONEncodable, lazy } = require('@discordjs/util');
|
|
5
5
|
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
|
6
6
|
const { DiscordjsError, DiscordjsRangeError, ErrorCodes } = require('../errors/index.js');
|
|
7
7
|
const { resolveFile } = require('../util/DataResolver.js');
|
|
8
8
|
const { MessageFlagsBitField } = require('../util/MessageFlagsBitField.js');
|
|
9
9
|
const { findName, verifyString, resolvePartialEmoji } = require('../util/Util.js');
|
|
10
10
|
|
|
11
|
+
// Fixes circular dependencies.
|
|
12
|
+
const getWebhook = lazy(() => require('./Webhook.js').Webhook);
|
|
13
|
+
const getUser = lazy(() => require('./User.js').User);
|
|
14
|
+
const getGuildMember = lazy(() => require('./GuildMember.js').GuildMember);
|
|
15
|
+
const getMessage = lazy(() => require('./Message.js').Message);
|
|
16
|
+
const getMessageManager = lazy(() => require('../managers/MessageManager.js').MessageManager);
|
|
17
|
+
|
|
11
18
|
/**
|
|
12
19
|
* Represents a message to be sent to the API.
|
|
13
20
|
*/
|
|
@@ -53,8 +60,7 @@ class MessagePayload {
|
|
|
53
60
|
* @readonly
|
|
54
61
|
*/
|
|
55
62
|
get isWebhook() {
|
|
56
|
-
|
|
57
|
-
return this.target instanceof Webhook;
|
|
63
|
+
return this.target instanceof getWebhook();
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
/**
|
|
@@ -64,9 +70,7 @@ class MessagePayload {
|
|
|
64
70
|
* @readonly
|
|
65
71
|
*/
|
|
66
72
|
get isUser() {
|
|
67
|
-
|
|
68
|
-
const { GuildMember } = require('./GuildMember.js');
|
|
69
|
-
return this.target instanceof User || this.target instanceof GuildMember;
|
|
73
|
+
return this.target instanceof getUser() || this.target instanceof getGuildMember();
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
/**
|
|
@@ -76,8 +80,7 @@ class MessagePayload {
|
|
|
76
80
|
* @readonly
|
|
77
81
|
*/
|
|
78
82
|
get isMessage() {
|
|
79
|
-
|
|
80
|
-
return this.target instanceof Message;
|
|
83
|
+
return this.target instanceof getMessage();
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
/**
|
|
@@ -87,8 +90,7 @@ class MessagePayload {
|
|
|
87
90
|
* @readonly
|
|
88
91
|
*/
|
|
89
92
|
get isMessageManager() {
|
|
90
|
-
|
|
91
|
-
return this.target instanceof MessageManager;
|
|
93
|
+
return this.target instanceof getMessageManager();
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
/**
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { Collection } = require('@discordjs/collection');
|
|
4
|
+
const { lazy } = require('@discordjs/util');
|
|
4
5
|
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
|
5
6
|
const { InteractionType, Routes } = require('discord-api-types/v10');
|
|
6
7
|
const { DiscordjsTypeError, DiscordjsError, ErrorCodes } = require('../../errors/index.js');
|
|
7
8
|
const { MaxBulkDeletableMessageAge } = require('../../util/Constants.js');
|
|
8
9
|
const { InteractionCollector } = require('../InteractionCollector.js');
|
|
9
|
-
// eslint-disable-next-line import-x/order
|
|
10
10
|
const { MessageCollector } = require('../MessageCollector.js');
|
|
11
11
|
|
|
12
|
+
// Fixes circular dependencies.
|
|
13
|
+
const getGuildMessageManager = lazy(() => require('../../managers/GuildMessageManager.js').GuildMessageManager);
|
|
14
|
+
|
|
12
15
|
/**
|
|
13
16
|
* Interface for classes that have text-channel-like features.
|
|
14
17
|
*
|
|
@@ -21,8 +24,7 @@ class TextBasedChannel {
|
|
|
21
24
|
*
|
|
22
25
|
* @type {GuildMessageManager}
|
|
23
26
|
*/
|
|
24
|
-
|
|
25
|
-
this.messages = new GuildMessageManager(this);
|
|
27
|
+
this.messages = new (getGuildMessageManager())(this);
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* The channel's last message id, if one was sent
|
|
@@ -427,7 +429,3 @@ class TextBasedChannel {
|
|
|
427
429
|
}
|
|
428
430
|
|
|
429
431
|
exports.TextBasedChannel = TextBasedChannel;
|
|
430
|
-
|
|
431
|
-
// Fixes Circular
|
|
432
|
-
// eslint-disable-next-line import-x/order
|
|
433
|
-
const { GuildMessageManager } = require('../../managers/GuildMessageManager.js');
|
package/src/util/Components.js
CHANGED
|
@@ -1,9 +1,37 @@
|
|
|
1
|
-
/* eslint-disable no-use-before-define */
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
const { lazy } = require('@discordjs/util');
|
|
5
4
|
const { ComponentType } = require('discord-api-types/v10');
|
|
6
5
|
|
|
6
|
+
// Fixes circular dependencies.
|
|
7
|
+
const getActionRow = lazy(() => require('../structures/ActionRow.js').ActionRow);
|
|
8
|
+
const getButtonComponent = lazy(() => require('../structures/ButtonComponent.js').ButtonComponent);
|
|
9
|
+
const getChannelSelectMenuComponent = lazy(
|
|
10
|
+
() => require('../structures/ChannelSelectMenuComponent.js').ChannelSelectMenuComponent,
|
|
11
|
+
);
|
|
12
|
+
const getComponent = lazy(() => require('../structures/Component.js').Component);
|
|
13
|
+
const getContainerComponent = lazy(() => require('../structures/ContainerComponent.js').ContainerComponent);
|
|
14
|
+
const getFileComponent = lazy(() => require('../structures/FileComponent.js').FileComponent);
|
|
15
|
+
const getLabelComponent = lazy(() => require('../structures/LabelComponent.js').LabelComponent);
|
|
16
|
+
const getMediaGalleryComponent = lazy(() => require('../structures/MediaGalleryComponent.js').MediaGalleryComponent);
|
|
17
|
+
const getMentionableSelectMenuComponent = lazy(
|
|
18
|
+
() => require('../structures/MentionableSelectMenuComponent.js').MentionableSelectMenuComponent,
|
|
19
|
+
);
|
|
20
|
+
const getRoleSelectMenuComponent = lazy(
|
|
21
|
+
() => require('../structures/RoleSelectMenuComponent.js').RoleSelectMenuComponent,
|
|
22
|
+
);
|
|
23
|
+
const getSectionComponent = lazy(() => require('../structures/SectionComponent.js').SectionComponent);
|
|
24
|
+
const getSeparatorComponent = lazy(() => require('../structures/SeparatorComponent.js').SeparatorComponent);
|
|
25
|
+
const getStringSelectMenuComponent = lazy(
|
|
26
|
+
() => require('../structures/StringSelectMenuComponent.js').StringSelectMenuComponent,
|
|
27
|
+
);
|
|
28
|
+
const getTextDisplayComponent = lazy(() => require('../structures/TextDisplayComponent.js').TextDisplayComponent);
|
|
29
|
+
const getTextInputComponent = lazy(() => require('../structures/TextInputComponent.js').TextInputComponent);
|
|
30
|
+
const getThumbnailComponent = lazy(() => require('../structures/ThumbnailComponent.js').ThumbnailComponent);
|
|
31
|
+
const getUserSelectMenuComponent = lazy(
|
|
32
|
+
() => require('../structures/UserSelectMenuComponent.js').UserSelectMenuComponent,
|
|
33
|
+
);
|
|
34
|
+
|
|
7
35
|
/**
|
|
8
36
|
* @typedef {Object} BaseComponentData
|
|
9
37
|
* @property {number} [id] the id of this component
|
|
@@ -192,6 +220,25 @@ const { ComponentType } = require('discord-api-types/v10');
|
|
|
192
220
|
* SectionComponent|SeparatorComponent|TextDisplayComponent} MessageTopLevelComponent
|
|
193
221
|
*/
|
|
194
222
|
|
|
223
|
+
const ComponentTypeToClass = {
|
|
224
|
+
[ComponentType.ActionRow]: getActionRow,
|
|
225
|
+
[ComponentType.Button]: getButtonComponent,
|
|
226
|
+
[ComponentType.StringSelect]: getStringSelectMenuComponent,
|
|
227
|
+
[ComponentType.TextInput]: getTextInputComponent,
|
|
228
|
+
[ComponentType.UserSelect]: getUserSelectMenuComponent,
|
|
229
|
+
[ComponentType.RoleSelect]: getRoleSelectMenuComponent,
|
|
230
|
+
[ComponentType.MentionableSelect]: getMentionableSelectMenuComponent,
|
|
231
|
+
[ComponentType.ChannelSelect]: getChannelSelectMenuComponent,
|
|
232
|
+
[ComponentType.Container]: getContainerComponent,
|
|
233
|
+
[ComponentType.TextDisplay]: getTextDisplayComponent,
|
|
234
|
+
[ComponentType.File]: getFileComponent,
|
|
235
|
+
[ComponentType.MediaGallery]: getMediaGalleryComponent,
|
|
236
|
+
[ComponentType.Section]: getSectionComponent,
|
|
237
|
+
[ComponentType.Separator]: getSeparatorComponent,
|
|
238
|
+
[ComponentType.Thumbnail]: getThumbnailComponent,
|
|
239
|
+
[ComponentType.Label]: getLabelComponent,
|
|
240
|
+
};
|
|
241
|
+
|
|
195
242
|
/**
|
|
196
243
|
* Transforms API data into a component
|
|
197
244
|
*
|
|
@@ -200,7 +247,7 @@ const { ComponentType } = require('discord-api-types/v10');
|
|
|
200
247
|
* @ignore
|
|
201
248
|
*/
|
|
202
249
|
function createComponent(data) {
|
|
203
|
-
return data instanceof
|
|
250
|
+
return data instanceof getComponent() ? data : new (ComponentTypeToClass[data.type]?.() ?? getComponent())(data);
|
|
204
251
|
}
|
|
205
252
|
|
|
206
253
|
/**
|
|
@@ -241,40 +288,3 @@ function findComponentByCustomId(components, customId) {
|
|
|
241
288
|
|
|
242
289
|
exports.createComponent = createComponent;
|
|
243
290
|
exports.findComponentByCustomId = findComponentByCustomId;
|
|
244
|
-
|
|
245
|
-
const { ActionRow } = require('../structures/ActionRow.js');
|
|
246
|
-
const { ButtonComponent } = require('../structures/ButtonComponent.js');
|
|
247
|
-
const { ChannelSelectMenuComponent } = require('../structures/ChannelSelectMenuComponent.js');
|
|
248
|
-
const { Component } = require('../structures/Component.js');
|
|
249
|
-
const { ContainerComponent } = require('../structures/ContainerComponent.js');
|
|
250
|
-
const { FileComponent } = require('../structures/FileComponent.js');
|
|
251
|
-
const { LabelComponent } = require('../structures/LabelComponent.js');
|
|
252
|
-
const { MediaGalleryComponent } = require('../structures/MediaGalleryComponent.js');
|
|
253
|
-
const { MentionableSelectMenuComponent } = require('../structures/MentionableSelectMenuComponent.js');
|
|
254
|
-
const { RoleSelectMenuComponent } = require('../structures/RoleSelectMenuComponent.js');
|
|
255
|
-
const { SectionComponent } = require('../structures/SectionComponent.js');
|
|
256
|
-
const { SeparatorComponent } = require('../structures/SeparatorComponent.js');
|
|
257
|
-
const { StringSelectMenuComponent } = require('../structures/StringSelectMenuComponent.js');
|
|
258
|
-
const { TextDisplayComponent } = require('../structures/TextDisplayComponent.js');
|
|
259
|
-
const { TextInputComponent } = require('../structures/TextInputComponent.js');
|
|
260
|
-
const { ThumbnailComponent } = require('../structures/ThumbnailComponent.js');
|
|
261
|
-
const { UserSelectMenuComponent } = require('../structures/UserSelectMenuComponent.js');
|
|
262
|
-
|
|
263
|
-
const ComponentTypeToClass = {
|
|
264
|
-
[ComponentType.ActionRow]: ActionRow,
|
|
265
|
-
[ComponentType.Button]: ButtonComponent,
|
|
266
|
-
[ComponentType.StringSelect]: StringSelectMenuComponent,
|
|
267
|
-
[ComponentType.TextInput]: TextInputComponent,
|
|
268
|
-
[ComponentType.UserSelect]: UserSelectMenuComponent,
|
|
269
|
-
[ComponentType.RoleSelect]: RoleSelectMenuComponent,
|
|
270
|
-
[ComponentType.MentionableSelect]: MentionableSelectMenuComponent,
|
|
271
|
-
[ComponentType.ChannelSelect]: ChannelSelectMenuComponent,
|
|
272
|
-
[ComponentType.Container]: ContainerComponent,
|
|
273
|
-
[ComponentType.TextDisplay]: TextDisplayComponent,
|
|
274
|
-
[ComponentType.File]: FileComponent,
|
|
275
|
-
[ComponentType.MediaGallery]: MediaGalleryComponent,
|
|
276
|
-
[ComponentType.Section]: SectionComponent,
|
|
277
|
-
[ComponentType.Separator]: SeparatorComponent,
|
|
278
|
-
[ComponentType.Thumbnail]: ThumbnailComponent,
|
|
279
|
-
[ComponentType.Label]: LabelComponent,
|
|
280
|
-
};
|
package/src/util/DataResolver.js
CHANGED
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
const { Buffer } = require('node:buffer');
|
|
4
4
|
const fs = require('node:fs/promises');
|
|
5
5
|
const path = require('node:path');
|
|
6
|
+
const { lazy } = require('@discordjs/util');
|
|
6
7
|
const { fetch } = require('undici');
|
|
7
8
|
const { DiscordjsError, DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
|
|
8
9
|
const { BaseInvite } = require('../structures/BaseInvite.js');
|
|
9
10
|
|
|
11
|
+
// Fixes circular dependencies.
|
|
12
|
+
const getGuildTemplate = lazy(() => require('../structures/GuildTemplate.js').GuildTemplate);
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* Data that can be resolved to give an invite code. This can be:
|
|
12
16
|
* - An invite code
|
|
@@ -54,8 +58,7 @@ function resolveInviteCode(data) {
|
|
|
54
58
|
* @private
|
|
55
59
|
*/
|
|
56
60
|
function resolveGuildTemplateCode(data) {
|
|
57
|
-
|
|
58
|
-
return resolveCode(data, GuildTemplate.GuildTemplatesPattern);
|
|
61
|
+
return resolveCode(data, getGuildTemplate().GuildTemplatesPattern);
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
/**
|
package/src/util/Util.js
CHANGED
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
const { parse } = require('node:path');
|
|
4
4
|
const { Collection } = require('@discordjs/collection');
|
|
5
|
+
const { lazy } = require('@discordjs/util');
|
|
5
6
|
const { ChannelType, RouteBases, Routes } = require('discord-api-types/v10');
|
|
6
7
|
const { fetch } = require('undici');
|
|
7
|
-
// eslint-disable-next-line import-x/order
|
|
8
8
|
const { Colors } = require('./Colors.js');
|
|
9
9
|
// eslint-disable-next-line import-x/order
|
|
10
10
|
const { DiscordjsError, DiscordjsRangeError, DiscordjsTypeError, ErrorCodes } = require('../errors/index.js');
|
|
11
11
|
|
|
12
|
+
// Fixes circular dependencies.
|
|
13
|
+
const getAttachment = lazy(() => require('../structures/Attachment.js').Attachment);
|
|
14
|
+
const getGuildChannel = lazy(() => require('../structures/GuildChannel.js').GuildChannel);
|
|
15
|
+
const getSKU = lazy(() => require('../structures/SKU.js').SKU);
|
|
16
|
+
|
|
12
17
|
const isObject = data => typeof data === 'object' && data !== null;
|
|
13
18
|
|
|
14
19
|
/**
|
|
@@ -352,8 +357,7 @@ function resolveColor(color) {
|
|
|
352
357
|
* @returns {Collection}
|
|
353
358
|
*/
|
|
354
359
|
function discordSort(collection) {
|
|
355
|
-
|
|
356
|
-
const isGuildChannel = collection.first() instanceof GuildChannel;
|
|
360
|
+
const isGuildChannel = collection.first() instanceof getGuildChannel();
|
|
357
361
|
return collection.toSorted(
|
|
358
362
|
isGuildChannel
|
|
359
363
|
? (a, b) => a.rawPosition - b.rawPosition || Number(BigInt(a.id) - BigInt(b.id))
|
|
@@ -555,8 +559,7 @@ function transformResolved(
|
|
|
555
559
|
if (attachments) {
|
|
556
560
|
result.attachments = new Collection();
|
|
557
561
|
for (const attachment of Object.values(attachments)) {
|
|
558
|
-
|
|
559
|
-
const patched = new Attachment(attachment);
|
|
562
|
+
const patched = new (getAttachment())(attachment);
|
|
560
563
|
result.attachments.set(attachment.id, patched);
|
|
561
564
|
}
|
|
562
565
|
}
|
|
@@ -572,8 +575,7 @@ function transformResolved(
|
|
|
572
575
|
*/
|
|
573
576
|
function resolveSKUId(resolvable) {
|
|
574
577
|
if (typeof resolvable === 'string') return resolvable;
|
|
575
|
-
|
|
576
|
-
if (resolvable instanceof SKU) return resolvable.id;
|
|
578
|
+
if (resolvable instanceof getSKU()) return resolvable.id;
|
|
577
579
|
return null;
|
|
578
580
|
}
|
|
579
581
|
|
|
@@ -600,8 +602,3 @@ exports.setPosition = setPosition;
|
|
|
600
602
|
exports.basename = basename;
|
|
601
603
|
exports.findName = findName;
|
|
602
604
|
exports.transformResolved = transformResolved;
|
|
603
|
-
|
|
604
|
-
// Fixes Circular
|
|
605
|
-
const { Attachment } = require('../structures/Attachment.js');
|
|
606
|
-
const { GuildChannel } = require('../structures/GuildChannel.js');
|
|
607
|
-
const { SKU } = require('../structures/SKU.js');
|