discord.js 15.0.0-dev.1752452150-7e3d4e536 → 15.0.0-dev.1752538515-5a611be8d

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.1752452150-7e3d4e536",
4
+ "version": "15.0.0-dev.1752538515-5a611be8d",
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.11.0",
64
- "@discordjs/collection": "^2.1.1",
65
64
  "@discordjs/builders": "^1.11.1",
66
- "@discordjs/util": "^1.1.1",
65
+ "@discordjs/collection": "^2.1.1",
67
66
  "@discordjs/formatters": "^0.6.1",
68
- "@discordjs/ws": "^2.0.2",
69
- "@discordjs/rest": "^2.5.0"
67
+ "@discordjs/rest": "^2.5.0",
68
+ "@discordjs/util": "^1.1.1",
69
+ "@discordjs/ws": "^2.0.2"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@favware/cliff-jumper": "^4.1.0",
@@ -3,6 +3,7 @@
3
3
  const { userMention } = require('@discordjs/formatters');
4
4
  const { calculateUserDefaultAvatarIndex } = require('@discordjs/rest');
5
5
  const { DiscordSnowflake } = require('@sapphire/snowflake');
6
+ const { _transformCollectibles } = require('../util/Transformers.js');
6
7
  const { UserFlagsBitField } = require('../util/UserFlagsBitField.js');
7
8
  const { Base } = require('./Base.js');
8
9
 
@@ -151,6 +152,30 @@ class User extends Base {
151
152
  } else {
152
153
  this.avatarDecorationData = null;
153
154
  }
155
+
156
+ /**
157
+ * @typedef {Object} NameplateData
158
+ * @property {Snowflake} skuId The id of the nameplate's SKU
159
+ * @property {string} asset The nameplate's asset path
160
+ * @property {string} label The nameplate's label
161
+ * @property {NameplatePalette} palette Background color of the nameplate
162
+ */
163
+
164
+ /**
165
+ * @typedef {Object} Collectibles
166
+ * @property {?NameplateData} nameplate The user's nameplate data
167
+ */
168
+
169
+ if (data.collectibles) {
170
+ /**
171
+ * The user's collectibles
172
+ *
173
+ * @type {?Collectibles}
174
+ */
175
+ this.collectibles = _transformCollectibles(data.collectibles);
176
+ } else {
177
+ this.collectibles = null;
178
+ }
154
179
  }
155
180
 
156
181
  /**
@@ -338,7 +363,11 @@ class User extends Base {
338
363
  this.banner === user.banner &&
339
364
  this.accentColor === user.accentColor &&
340
365
  this.avatarDecorationData?.asset === user.avatarDecorationData?.asset &&
341
- this.avatarDecorationData?.skuId === user.avatarDecorationData?.skuId
366
+ this.avatarDecorationData?.skuId === user.avatarDecorationData?.skuId &&
367
+ this.collectibles?.nameplate?.skuId === user.collectibles?.nameplate?.skuId &&
368
+ this.collectibles?.nameplate?.asset === user.collectibles?.nameplate?.asset &&
369
+ this.collectibles?.nameplate?.label === user.collectibles?.nameplate?.label &&
370
+ this.collectibles?.nameplate?.palette === user.collectibles?.nameplate?.palette
342
371
  );
343
372
  }
344
373
 
@@ -363,6 +392,12 @@ class User extends Base {
363
392
  ('avatar_decoration_data' in user
364
393
  ? this.avatarDecorationData?.asset === user.avatar_decoration_data?.asset &&
365
394
  this.avatarDecorationData?.skuId === user.avatar_decoration_data?.sku_id
395
+ : true) &&
396
+ ('collectibles' in user
397
+ ? this.collectibles?.nameplate?.skuId === user.collectibles?.nameplate?.sku_id &&
398
+ this.collectibles?.nameplate?.asset === user.collectibles?.nameplate?.asset &&
399
+ this.collectibles?.nameplate?.label === user.collectibles?.nameplate?.label &&
400
+ this.collectibles?.nameplate?.palette === user.collectibles?.nameplate?.palette
366
401
  : true)
367
402
  );
368
403
  }
@@ -549,6 +549,11 @@
549
549
  * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/MessageFlags}
550
550
  */
551
551
 
552
+ /**
553
+ * @external NameplatePalette
554
+ * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/NameplatePalette}
555
+ */
556
+
552
557
  /**
553
558
  * @external OAuth2Scopes
554
559
  * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/OAuth2Scopes}
@@ -92,8 +92,29 @@ function _transformAPIIncidentsData(data) {
92
92
  };
93
93
  }
94
94
 
95
+ /**
96
+ * Transforms a collectibles object to a camel-cased variant.
97
+ *
98
+ * @param {APICollectibles} collectibles The collectibles to transform
99
+ * @returns {Collectibles}
100
+ * @ignore
101
+ */
102
+ function _transformCollectibles(collectibles) {
103
+ if (!collectibles.nameplate) return { nameplate: null };
104
+
105
+ return {
106
+ nameplate: {
107
+ skuId: collectibles.nameplate.sku_id,
108
+ asset: collectibles.nameplate.asset,
109
+ label: collectibles.nameplate.label,
110
+ palette: collectibles.nameplate.palette,
111
+ },
112
+ };
113
+ }
114
+
95
115
  exports.toSnakeCase = toSnakeCase;
96
116
  exports._transformAPIAutoModerationAction = _transformAPIAutoModerationAction;
97
117
  exports._transformAPIMessageInteractionMetadata = _transformAPIMessageInteractionMetadata;
98
118
  exports._transformGuildScheduledEventRecurrenceRule = _transformGuildScheduledEventRecurrenceRule;
99
119
  exports._transformAPIIncidentsData = _transformAPIIncidentsData;
120
+ exports._transformCollectibles = _transformCollectibles;
@@ -170,6 +170,7 @@ import {
170
170
  MessageFlags,
171
171
  MessageReferenceType,
172
172
  MessageType,
173
+ NameplatePalette,
173
174
  OAuth2Scopes,
174
175
  OverwriteType,
175
176
  PermissionFlagsBits,
@@ -3509,6 +3510,17 @@ export interface AvatarDecorationData {
3509
3510
  skuId: Snowflake;
3510
3511
  }
3511
3512
 
3513
+ export interface NameplateData {
3514
+ asset: string;
3515
+ label: string;
3516
+ palette: NameplatePalette;
3517
+ skuId: Snowflake;
3518
+ }
3519
+
3520
+ export interface Collectibles {
3521
+ nameplate: NameplateData | null;
3522
+ }
3523
+
3512
3524
  export interface UnfurledMediaItemData {
3513
3525
  url: string;
3514
3526
  }
@@ -3531,6 +3543,7 @@ export class User extends Base {
3531
3543
  public bot: boolean;
3532
3544
  public get createdAt(): Date;
3533
3545
  public get createdTimestamp(): number;
3546
+ public collectibles: Collectibles | null;
3534
3547
  public discriminator: string;
3535
3548
  public get displayName(): string;
3536
3549
  public get defaultAvatarURL(): string;
@@ -170,6 +170,7 @@ import {
170
170
  MessageFlags,
171
171
  MessageReferenceType,
172
172
  MessageType,
173
+ NameplatePalette,
173
174
  OAuth2Scopes,
174
175
  OverwriteType,
175
176
  PermissionFlagsBits,
@@ -3509,6 +3510,17 @@ export interface AvatarDecorationData {
3509
3510
  skuId: Snowflake;
3510
3511
  }
3511
3512
 
3513
+ export interface NameplateData {
3514
+ asset: string;
3515
+ label: string;
3516
+ palette: NameplatePalette;
3517
+ skuId: Snowflake;
3518
+ }
3519
+
3520
+ export interface Collectibles {
3521
+ nameplate: NameplateData | null;
3522
+ }
3523
+
3512
3524
  export interface UnfurledMediaItemData {
3513
3525
  url: string;
3514
3526
  }
@@ -3531,6 +3543,7 @@ export class User extends Base {
3531
3543
  public bot: boolean;
3532
3544
  public get createdAt(): Date;
3533
3545
  public get createdTimestamp(): number;
3546
+ public collectibles: Collectibles | null;
3534
3547
  public discriminator: string;
3535
3548
  public get displayName(): string;
3536
3549
  public get defaultAvatarURL(): string;