discord.js 15.0.0-dev.1750593907-cbb20566c → 15.0.0-dev.1750724058-615faf5f6

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/README.md CHANGED
@@ -56,6 +56,8 @@ pnpm add discord.js
56
56
  bun add discord.js
57
57
  ```
58
58
 
59
+ These examples use [ES modules](https://nodejs.org/api/esm.html#enabling).
60
+
59
61
  Register a slash command against the Discord API:
60
62
 
61
63
  ```js
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.1750593907-cbb20566c",
4
+ "version": "15.0.0-dev.1750724058-615faf5f6",
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.10.0",
62
62
  "tslib": "^2.8.1",
63
63
  "undici": "7.8.0",
64
+ "@discordjs/builders": "^1.11.1",
64
65
  "@discordjs/collection": "^2.1.1",
65
66
  "@discordjs/formatters": "^0.6.1",
66
- "@discordjs/builders": "^1.11.1",
67
- "@discordjs/util": "^1.1.1",
68
67
  "@discordjs/rest": "^2.5.0",
69
- "@discordjs/ws": "^2.0.2"
68
+ "@discordjs/ws": "^2.0.2",
69
+ "@discordjs/util": "^1.1.1"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@favware/cliff-jumper": "^4.1.0",
@@ -83,8 +83,8 @@
83
83
  "tsd": "^0.31.2",
84
84
  "turbo": "^2.5.2",
85
85
  "typescript": "~5.8.3",
86
- "@discordjs/api-extractor": "^7.52.7",
87
86
  "@discordjs/docgen": "^0.12.1",
87
+ "@discordjs/api-extractor": "^7.52.7",
88
88
  "@discordjs/scripts": "^0.1.0"
89
89
  },
90
90
  "engines": {
@@ -178,6 +178,17 @@ class ClientApplication extends Application {
178
178
  this.approximateUserInstallCount ??= null;
179
179
  }
180
180
 
181
+ if ('approximate_user_authorization_count' in data) {
182
+ /**
183
+ * An approximate amount of users that have OAuth2 authorizations for this application.
184
+ *
185
+ * @type {?number}
186
+ */
187
+ this.approximateUserAuthorizationCount = data.approximate_user_authorization_count;
188
+ } else {
189
+ this.approximateUserAuthorizationCount ??= null;
190
+ }
191
+
181
192
  if ('guild_id' in data) {
182
193
  /**
183
194
  * The id of the guild associated with this application.
@@ -133,6 +133,20 @@ class GuildMember extends Base {
133
133
  } else {
134
134
  this.flags ??= new GuildMemberFlagsBitField().freeze();
135
135
  }
136
+
137
+ if (data.avatar_decoration_data) {
138
+ /**
139
+ * The member avatar decoration's data
140
+ *
141
+ * @type {?AvatarDecorationData}
142
+ */
143
+ this.avatarDecorationData = {
144
+ asset: data.avatar_decoration_data.asset,
145
+ skuId: data.avatar_decoration_data.sku_id,
146
+ };
147
+ } else {
148
+ this.avatarDecorationData = null;
149
+ }
136
150
  }
137
151
 
138
152
  _clone() {
@@ -181,6 +195,15 @@ class GuildMember extends Base {
181
195
  return this.avatar && this.client.rest.cdn.guildMemberAvatar(this.guild.id, this.id, this.avatar, options);
182
196
  }
183
197
 
198
+ /**
199
+ * A link to the member's avatar decoration.
200
+ *
201
+ * @returns {?string}
202
+ */
203
+ avatarDecorationURL() {
204
+ return this.avatarDecorationData ? this.client.rest.cdn.avatarDecoration(this.avatarDecorationData.asset) : null;
205
+ }
206
+
184
207
  /**
185
208
  * A link to the member's banner.
186
209
  *
@@ -213,6 +236,16 @@ class GuildMember extends Base {
213
236
  return this.bannerURL(options) ?? this.user.bannerURL(options);
214
237
  }
215
238
 
239
+ /**
240
+ * A link to the member's guild avatar decoration if they have one.
241
+ * Otherwise, a link to their {@link User#avatarDecorationURL} will be returned.
242
+ *
243
+ * @returns {?string}
244
+ */
245
+ displayAvatarDecorationURL() {
246
+ return this.avatarDecorationURL() ?? this.user.avatarDecorationURL();
247
+ }
248
+
216
249
  /**
217
250
  * The time this member joined the guild
218
251
  *
@@ -560,7 +593,9 @@ class GuildMember extends Base {
560
593
  this.flags.bitfield === member.flags.bitfield &&
561
594
  (this._roles === member._roles ||
562
595
  (this._roles.length === member._roles.length &&
563
- this._roles.every((role, index) => role === member._roles[index])))
596
+ this._roles.every((role, index) => role === member._roles[index]))) &&
597
+ this.avatarDecorationData?.asset === member.avatarDecorationData?.asset &&
598
+ this.avatarDecorationData?.skuId === member.avatarDecorationData?.skuId
564
599
  );
565
600
  }
566
601
 
@@ -587,6 +622,7 @@ class GuildMember extends Base {
587
622
  json.bannerURL = this.bannerURL();
588
623
  json.displayAvatarURL = this.displayAvatarURL();
589
624
  json.displayBannerURL = this.displayBannerURL();
625
+ json.avatarDecorationURL = this.avatarDecorationURL();
590
626
  return json;
591
627
  }
592
628
  }
@@ -947,6 +947,7 @@ export class ClientApplication extends Application {
947
947
  public flags: Readonly<ApplicationFlagsBitField>;
948
948
  public approximateGuildCount: number | null;
949
949
  public approximateUserInstallCount: number | null;
950
+ public approximateUserAuthorizationCount: number | null;
950
951
  public tags: string[];
951
952
  public installParams: ClientApplicationInstallParams | null;
952
953
  public integrationTypesConfig: IntegrationTypesConfiguration | null;
@@ -1596,6 +1597,7 @@ export class GuildMember extends Base {
1596
1597
  private constructor(client: Client<true>, data: unknown, guild: Guild);
1597
1598
  private readonly _roles: Snowflake[];
1598
1599
  public avatar: string | null;
1600
+ public avatarDecorationData: AvatarDecorationData | null;
1599
1601
  public banner: string | null;
1600
1602
  public get bannable(): boolean;
1601
1603
  public get dmChannel(): DMChannel | null;
@@ -1623,6 +1625,7 @@ export class GuildMember extends Base {
1623
1625
  public user: User;
1624
1626
  public get voice(): VoiceState;
1625
1627
  public avatarURL(options?: ImageURLOptions): string | null;
1628
+ public avatarDecorationURL(): string | null;
1626
1629
  public bannerURL(options?: ImageURLOptions): string | null;
1627
1630
  public ban(options?: BanOptions): Promise<void>;
1628
1631
  public disableCommunicationUntil(timeout: DateResolvable | null, reason?: string): Promise<GuildMember>;
@@ -1632,6 +1635,7 @@ export class GuildMember extends Base {
1632
1635
  public deleteDM(): Promise<DMChannel>;
1633
1636
  public displayAvatarURL(options?: ImageURLOptions): string;
1634
1637
  public displayBannerURL(options?: ImageURLOptions): string | null;
1638
+ public displayAvatarDecorationURL(): string | null;
1635
1639
  public edit(options: GuildMemberEditOptions): Promise<GuildMember>;
1636
1640
  public isCommunicationDisabled(): this is GuildMember & {
1637
1641
  readonly communicationDisabledUntil: Date;
@@ -3534,7 +3538,7 @@ export class User extends Base {
3534
3538
  public get tag(): string;
3535
3539
  public username: string;
3536
3540
  public avatarURL(options?: ImageURLOptions): string | null;
3537
- public avatarDecorationURL(options?: BaseImageURLOptions): string | null;
3541
+ public avatarDecorationURL(): string | null;
3538
3542
  public bannerURL(options?: ImageURLOptions): string | null | undefined;
3539
3543
  public createDM(force?: boolean): Promise<DMChannel>;
3540
3544
  public deleteDM(): Promise<DMChannel>;
@@ -947,6 +947,7 @@ export class ClientApplication extends Application {
947
947
  public flags: Readonly<ApplicationFlagsBitField>;
948
948
  public approximateGuildCount: number | null;
949
949
  public approximateUserInstallCount: number | null;
950
+ public approximateUserAuthorizationCount: number | null;
950
951
  public tags: string[];
951
952
  public installParams: ClientApplicationInstallParams | null;
952
953
  public integrationTypesConfig: IntegrationTypesConfiguration | null;
@@ -1596,6 +1597,7 @@ export class GuildMember extends Base {
1596
1597
  private constructor(client: Client<true>, data: unknown, guild: Guild);
1597
1598
  private readonly _roles: Snowflake[];
1598
1599
  public avatar: string | null;
1600
+ public avatarDecorationData: AvatarDecorationData | null;
1599
1601
  public banner: string | null;
1600
1602
  public get bannable(): boolean;
1601
1603
  public get dmChannel(): DMChannel | null;
@@ -1623,6 +1625,7 @@ export class GuildMember extends Base {
1623
1625
  public user: User;
1624
1626
  public get voice(): VoiceState;
1625
1627
  public avatarURL(options?: ImageURLOptions): string | null;
1628
+ public avatarDecorationURL(): string | null;
1626
1629
  public bannerURL(options?: ImageURLOptions): string | null;
1627
1630
  public ban(options?: BanOptions): Promise<void>;
1628
1631
  public disableCommunicationUntil(timeout: DateResolvable | null, reason?: string): Promise<GuildMember>;
@@ -1632,6 +1635,7 @@ export class GuildMember extends Base {
1632
1635
  public deleteDM(): Promise<DMChannel>;
1633
1636
  public displayAvatarURL(options?: ImageURLOptions): string;
1634
1637
  public displayBannerURL(options?: ImageURLOptions): string | null;
1638
+ public displayAvatarDecorationURL(): string | null;
1635
1639
  public edit(options: GuildMemberEditOptions): Promise<GuildMember>;
1636
1640
  public isCommunicationDisabled(): this is GuildMember & {
1637
1641
  readonly communicationDisabledUntil: Date;
@@ -3534,7 +3538,7 @@ export class User extends Base {
3534
3538
  public get tag(): string;
3535
3539
  public username: string;
3536
3540
  public avatarURL(options?: ImageURLOptions): string | null;
3537
- public avatarDecorationURL(options?: BaseImageURLOptions): string | null;
3541
+ public avatarDecorationURL(): string | null;
3538
3542
  public bannerURL(options?: ImageURLOptions): string | null | undefined;
3539
3543
  public createDM(force?: boolean): Promise<DMChannel>;
3540
3544
  public deleteDM(): Promise<DMChannel>;