discord.js 15.0.0-dev.1761307297-c9a9b6ce9 → 15.0.0-dev.1761350521-756eac6bb
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.1761350521-756eac6bb",
|
|
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/util": "^2.0.0-dev.
|
|
68
|
-
"@discordjs/
|
|
69
|
-
"@discordjs/
|
|
64
|
+
"@discordjs/builders": "^2.0.0-dev.1761350521-756eac6bb",
|
|
65
|
+
"@discordjs/collection": "^3.0.0-dev.1761350521-756eac6bb",
|
|
66
|
+
"@discordjs/rest": "^3.0.0-dev.1761350521-756eac6bb",
|
|
67
|
+
"@discordjs/util": "^2.0.0-dev.1761350521-756eac6bb",
|
|
68
|
+
"@discordjs/ws": "^3.0.0-dev.1761350521-756eac6bb",
|
|
69
|
+
"@discordjs/formatters": "^1.0.0-dev.1761350521-756eac6bb"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@favware/cliff-jumper": "^4.1.0",
|
|
@@ -22,11 +22,11 @@ class CachedManager extends DataManager {
|
|
|
22
22
|
* @name CachedManager#_cache
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(this, '_cache', {
|
|
25
|
-
value: this.client.options.makeCache(
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
this.constructor,
|
|
29
|
-
),
|
|
25
|
+
value: this.client.options.makeCache({
|
|
26
|
+
holds: this.holds,
|
|
27
|
+
manager: this.constructor,
|
|
28
|
+
managerType: this.constructor[MakeCacheOverrideSymbol] ?? this.constructor,
|
|
29
|
+
}),
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
if (iterable) {
|
|
@@ -136,11 +136,11 @@ class ApplicationCommand extends Base {
|
|
|
136
136
|
/**
|
|
137
137
|
* The options of this command
|
|
138
138
|
*
|
|
139
|
-
* @type {ApplicationCommandOption[]}
|
|
139
|
+
* @type {?ApplicationCommandOption[]}
|
|
140
140
|
*/
|
|
141
141
|
this.options = data.options.map(option => this.constructor.transformOption(option, true));
|
|
142
142
|
} else {
|
|
143
|
-
this.options ??=
|
|
143
|
+
this.options ??= null;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
if ('default_member_permissions' in data) {
|
|
@@ -436,9 +436,7 @@ class ApplicationCommand extends Base {
|
|
|
436
436
|
('version' in command && command.version !== this.version) ||
|
|
437
437
|
(command.type && command.type !== this.type) ||
|
|
438
438
|
('nsfw' in command && command.nsfw !== this.nsfw) ||
|
|
439
|
-
|
|
440
|
-
// TODO: remove ?? 0 on each when nullable
|
|
441
|
-
(command.options?.length ?? 0) !== (this.options?.length ?? 0) ||
|
|
439
|
+
command.options?.length !== this.options?.length ||
|
|
442
440
|
defaultMemberPermissions !== (this.defaultMemberPermissions?.bitfield ?? null) ||
|
|
443
441
|
!isEqual(command.nameLocalizations ?? command.name_localizations ?? {}, this.nameLocalizations ?? {}) ||
|
|
444
442
|
!isEqual(
|
|
@@ -452,6 +450,7 @@ class ApplicationCommand extends Base {
|
|
|
452
450
|
return false;
|
|
453
451
|
}
|
|
454
452
|
|
|
453
|
+
// Don't need to check both because we already checked the lengths above
|
|
455
454
|
if (command.options) {
|
|
456
455
|
return this.constructor.optionsEqual(this.options, command.options, enforceOptionOrder);
|
|
457
456
|
}
|
package/src/util/Options.js
CHANGED
|
@@ -5,12 +5,16 @@ const { DefaultWebSocketManagerOptions } = require('@discordjs/ws');
|
|
|
5
5
|
const { version } = require('../../package.json');
|
|
6
6
|
const { toSnakeCase } = require('./Transformers.js');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} CacheFactoryParams
|
|
10
|
+
* @property {Function} holds The class that the cache will hold.
|
|
11
|
+
* @property {Function} manager The fully extended manager class the cache is being requested from.
|
|
12
|
+
* @property {Function} managerType The base manager class the cache is being requested from.
|
|
13
|
+
*/
|
|
14
|
+
|
|
9
15
|
/**
|
|
10
16
|
* @typedef {Function} CacheFactory
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {Function} holds The class that the cache will hold.
|
|
13
|
-
* @param {Function} manager The fully extended manager class the cache is being requested from.
|
|
17
|
+
* @param {CacheFactoryParams} params The parameters
|
|
14
18
|
* @returns {Collection} A Collection used to store the cache of the manager.
|
|
15
19
|
*/
|
|
16
20
|
|
|
@@ -121,7 +125,7 @@ class Options extends null {
|
|
|
121
125
|
const { Collection } = require('@discordjs/collection');
|
|
122
126
|
const { LimitedCollection } = require('./LimitedCollection.js');
|
|
123
127
|
|
|
124
|
-
return (managerType,
|
|
128
|
+
return ({ managerType, manager }) => {
|
|
125
129
|
const setting = settings[manager.name] ?? settings[managerType.name];
|
|
126
130
|
/* eslint-disable-next-line eqeqeq */
|
|
127
131
|
if (setting == null) {
|
package/typings/index.d.mts
CHANGED
|
@@ -419,7 +419,7 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
419
419
|
public name: string;
|
|
420
420
|
public nameLocalizations: LocalizationMap | null;
|
|
421
421
|
public nameLocalized: string | null;
|
|
422
|
-
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[];
|
|
422
|
+
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[] | null;
|
|
423
423
|
public permissions: ApplicationCommandPermissionsManager<
|
|
424
424
|
PermissionsFetchType,
|
|
425
425
|
PermissionsFetchType,
|
|
@@ -5368,13 +5368,21 @@ export type OverriddenCaches =
|
|
|
5368
5368
|
| 'GuildMessageManager'
|
|
5369
5369
|
| 'GuildTextThreadManager';
|
|
5370
5370
|
|
|
5371
|
+
export interface CacheFactoryParams<Manager extends keyof Caches> {
|
|
5372
|
+
holds: Caches[Manager][1];
|
|
5373
|
+
manager: CacheConstructors[keyof Caches];
|
|
5374
|
+
managerType: CacheConstructors[Exclude<keyof Caches, OverriddenCaches>];
|
|
5375
|
+
}
|
|
5376
|
+
|
|
5371
5377
|
// This doesn't actually work the way it looks 😢.
|
|
5372
5378
|
// Narrowing the type of `manager.name` doesn't propagate type information to `holds` and the return type.
|
|
5373
|
-
export type CacheFactory = (
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
) => (typeof manager)['prototype'] extends DataManager<infer Key, infer Value, any>
|
|
5379
|
+
export type CacheFactory = ({
|
|
5380
|
+
holds,
|
|
5381
|
+
manager,
|
|
5382
|
+
managerType,
|
|
5383
|
+
}: CacheFactoryParams<keyof Caches>) => (typeof manager)['prototype'] extends DataManager<infer Key, infer Value, any>
|
|
5384
|
+
? Collection<Key, Value>
|
|
5385
|
+
: never;
|
|
5378
5386
|
|
|
5379
5387
|
export type CacheWithLimitsOptions = {
|
|
5380
5388
|
[K in keyof Caches]?: Caches[K][0]['prototype'] extends DataManager<infer Key, infer Value, any>
|
package/typings/index.d.ts
CHANGED
|
@@ -419,7 +419,7 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
419
419
|
public name: string;
|
|
420
420
|
public nameLocalizations: LocalizationMap | null;
|
|
421
421
|
public nameLocalized: string | null;
|
|
422
|
-
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[];
|
|
422
|
+
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[] | null;
|
|
423
423
|
public permissions: ApplicationCommandPermissionsManager<
|
|
424
424
|
PermissionsFetchType,
|
|
425
425
|
PermissionsFetchType,
|
|
@@ -5368,13 +5368,21 @@ export type OverriddenCaches =
|
|
|
5368
5368
|
| 'GuildMessageManager'
|
|
5369
5369
|
| 'GuildTextThreadManager';
|
|
5370
5370
|
|
|
5371
|
+
export interface CacheFactoryParams<Manager extends keyof Caches> {
|
|
5372
|
+
holds: Caches[Manager][1];
|
|
5373
|
+
manager: CacheConstructors[keyof Caches];
|
|
5374
|
+
managerType: CacheConstructors[Exclude<keyof Caches, OverriddenCaches>];
|
|
5375
|
+
}
|
|
5376
|
+
|
|
5371
5377
|
// This doesn't actually work the way it looks 😢.
|
|
5372
5378
|
// Narrowing the type of `manager.name` doesn't propagate type information to `holds` and the return type.
|
|
5373
|
-
export type CacheFactory = (
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
) => (typeof manager)['prototype'] extends DataManager<infer Key, infer Value, any>
|
|
5379
|
+
export type CacheFactory = ({
|
|
5380
|
+
holds,
|
|
5381
|
+
manager,
|
|
5382
|
+
managerType,
|
|
5383
|
+
}: CacheFactoryParams<keyof Caches>) => (typeof manager)['prototype'] extends DataManager<infer Key, infer Value, any>
|
|
5384
|
+
? Collection<Key, Value>
|
|
5385
|
+
: never;
|
|
5378
5386
|
|
|
5379
5387
|
export type CacheWithLimitsOptions = {
|
|
5380
5388
|
[K in keyof Caches]?: Caches[K][0]['prototype'] extends DataManager<infer Key, infer Value, any>
|