discord.js 15.0.0-dev.1732795515-2b0944a92 → 15.0.0-dev.1732881918-8efb72e76

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.1732795515-2b0944a92",
4
+ "version": "15.0.0-dev.1732881918-8efb72e76",
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,9 +61,9 @@
61
61
  "tslib": "^2.8.1",
62
62
  "undici": "6.21.0",
63
63
  "@discordjs/formatters": "^0.5.0",
64
- "@discordjs/rest": "^2.4.0",
65
64
  "@discordjs/util": "^1.1.1",
66
- "@discordjs/ws": "^2.0.0"
65
+ "@discordjs/ws": "^2.0.0",
66
+ "@discordjs/rest": "^2.4.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@favware/cliff-jumper": "^4.1.0",
@@ -80,9 +80,9 @@
80
80
  "tslint": "6.1.3",
81
81
  "turbo": "^2.3.0",
82
82
  "typescript": "~5.5.4",
83
- "@discordjs/docgen": "^0.12.1",
83
+ "@discordjs/api-extractor": "^7.38.1",
84
84
  "@discordjs/scripts": "^0.1.0",
85
- "@discordjs/api-extractor": "^7.38.1"
85
+ "@discordjs/docgen": "^0.12.1"
86
86
  },
87
87
  "engines": {
88
88
  "node": ">=20"
@@ -13,7 +13,7 @@ class ThreadListSyncAction extends Action {
13
13
 
14
14
  if (data.channel_ids) {
15
15
  for (const id of data.channel_ids) {
16
- const channel = client.channels.resolve(id);
16
+ const channel = client.channels.cache.get(id);
17
17
  if (channel) this.removeStale(channel);
18
18
  }
19
19
  } else {
@@ -82,7 +82,7 @@ class ApplicationCommandManager extends CachedManager {
82
82
  * Options used to fetch Application Commands from Discord
83
83
  * @typedef {BaseFetchOptions} FetchApplicationCommandOptions
84
84
  * @property {Snowflake} [guildId] The guild's id to fetch commands for, for when the guild is not cached
85
- * @property {LocaleString} [locale] The locale to use when fetching this command
85
+ * @property {Locale} [locale] The locale to use when fetching this command
86
86
  * @property {boolean} [withLocalizations] Whether to fetch all localization data
87
87
  */
88
88
 
@@ -36,8 +36,8 @@ class BaseGuildEmojiManager extends CachedManager {
36
36
  * @returns {?GuildEmoji}
37
37
  */
38
38
  resolve(emoji) {
39
- if (emoji instanceof ReactionEmoji) return super.resolve(emoji.id);
40
- if (emoji instanceof ApplicationEmoji) return super.resolve(emoji.id);
39
+ if (emoji instanceof ReactionEmoji) return super.cache.get(emoji.id) ?? null;
40
+ if (emoji instanceof ApplicationEmoji) return super.cache.get(emoji.id) ?? null;
41
41
  return super.resolve(emoji);
42
42
  }
43
43
 
@@ -158,7 +158,7 @@ class GuildBanManager extends CachedManager {
158
158
  reason: options.reason,
159
159
  });
160
160
  if (user instanceof GuildMember) return user;
161
- const _user = this.client.users.resolve(id);
161
+ const _user = this.client.users.cache.get(id);
162
162
  if (_user) {
163
163
  return this.guild.members.resolve(_user) ?? _user;
164
164
  }
@@ -84,7 +84,7 @@ class GuildChannelManager extends CachedManager {
84
84
  * @returns {?(GuildChannel|ThreadChannel)}
85
85
  */
86
86
  resolve(channel) {
87
- if (channel instanceof ThreadChannel) return super.resolve(channel.id);
87
+ if (channel instanceof ThreadChannel) return super.cache.get(channel.id) ?? null;
88
88
  return super.resolve(channel);
89
89
  }
90
90
 
@@ -287,7 +287,7 @@ class GuildChannelManager extends CachedManager {
287
287
  const resolvedChannel = this.resolve(channel);
288
288
  if (!resolvedChannel) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'channel', 'GuildChannelResolvable');
289
289
 
290
- const parent = options.parent && this.client.channels.resolveId(options.parent);
290
+ const parentId = options.parent && this.client.channels.resolveId(options.parent);
291
291
 
292
292
  if (options.position !== undefined) {
293
293
  await this.setPosition(resolvedChannel, options.position, { position: options.position, reason: options.reason });
@@ -298,8 +298,8 @@ class GuildChannelManager extends CachedManager {
298
298
  );
299
299
 
300
300
  if (options.lockPermissions) {
301
- if (parent) {
302
- const newParent = this.resolve(parent);
301
+ if (parentId) {
302
+ const newParent = this.cache.get(parentId);
303
303
  if (newParent?.type === ChannelType.GuildCategory) {
304
304
  permission_overwrites = newParent.permissionOverwrites.cache.map(overwrite =>
305
305
  PermissionOverwrites.resolve(overwrite, this.guild),
@@ -322,7 +322,7 @@ class GuildChannelManager extends CachedManager {
322
322
  user_limit: options.userLimit,
323
323
  rtc_region: options.rtcRegion,
324
324
  video_quality_mode: options.videoQualityMode,
325
- parent_id: parent,
325
+ parent_id: parentId,
326
326
  lock_permissions: options.lockPermissions,
327
327
  rate_limit_per_user: options.rateLimitPerUser,
328
328
  default_auto_archive_duration: options.defaultAutoArchiveDuration,
@@ -55,7 +55,7 @@ class GuildMemberManager extends CachedManager {
55
55
  const memberResolvable = super.resolve(member);
56
56
  if (memberResolvable) return memberResolvable;
57
57
  const userResolvable = this.client.users.resolveId(member);
58
- if (userResolvable) return super.resolve(userResolvable);
58
+ if (userResolvable) return super.cache.get(userResolvable) ?? null;
59
59
  return null;
60
60
  }
61
61
 
@@ -144,7 +144,7 @@ class GuildMemberManager extends CachedManager {
144
144
  */
145
145
  get me() {
146
146
  return (
147
- this.resolve(this.client.user.id) ??
147
+ this.cache.get(this.client.user.id) ??
148
148
  (this.client.options.partials.includes(Partials.GuildMember)
149
149
  ? this._add({ user: { id: this.client.user.id } }, true)
150
150
  : null)
@@ -38,8 +38,8 @@ class PresenceManager extends CachedManager {
38
38
  resolve(presence) {
39
39
  const presenceResolvable = super.resolve(presence);
40
40
  if (presenceResolvable) return presenceResolvable;
41
- const UserResolvable = this.client.users.resolveId(presence);
42
- return super.resolve(UserResolvable);
41
+ const userId = this.client.users.resolveId(presence);
42
+ return super.cache.get(userId) ?? null;
43
43
  }
44
44
 
45
45
  /**
@@ -50,8 +50,8 @@ class PresenceManager extends CachedManager {
50
50
  resolveId(presence) {
51
51
  const presenceResolvable = super.resolveId(presence);
52
52
  if (presenceResolvable) return presenceResolvable;
53
- const userResolvable = this.client.users.resolveId(presence);
54
- return this.cache.has(userResolvable) ? userResolvable : null;
53
+ const userId = this.client.users.resolveId(presence);
54
+ return this.cache.has(userId) ? userId : null;
55
55
  }
56
56
  }
57
57
 
@@ -53,7 +53,7 @@ class ThreadMemberManager extends CachedManager {
53
53
  * @readonly
54
54
  */
55
55
  get me() {
56
- return this.resolve(this.client.user.id);
56
+ return this.cache.get(this.client.user.id) ?? null;
57
57
  }
58
58
 
59
59
  /**
@@ -71,8 +71,8 @@ class ThreadMemberManager extends CachedManager {
71
71
  resolve(member) {
72
72
  const memberResolvable = super.resolve(member);
73
73
  if (memberResolvable) return memberResolvable;
74
- const userResolvable = this.client.users.resolveId(member);
75
- if (userResolvable) return super.resolve(userResolvable);
74
+ const userId = this.client.users.resolveId(member);
75
+ if (userId) return super.cache.get(userId) ?? null;
76
76
  return null;
77
77
  }
78
78
 
@@ -228,7 +228,7 @@ class GuildMember extends Base {
228
228
  * @readonly
229
229
  */
230
230
  get presence() {
231
- return this.guild.presences.resolve(this.id);
231
+ return this.guild.presences.cache.get(this.id) ?? null;
232
232
  }
233
233
 
234
234
  /**
@@ -79,7 +79,7 @@ class GuildOnboardingPromptOption extends Base {
79
79
  */
80
80
  get emoji() {
81
81
  if (!this._emoji.id && !this._emoji.name) return null;
82
- return this.client.emojis.resolve(this._emoji.id) ?? new Emoji(this.client, this._emoji);
82
+ return this.client.emojis.cache.get(this._emoji.id) ?? new Emoji(this.client, this._emoji);
83
83
  }
84
84
  }
85
85
 
@@ -39,7 +39,7 @@ class Invite extends Base {
39
39
  */
40
40
  this.guild ??= null;
41
41
  if (data.guild) {
42
- this.guild = this.client.guilds.resolve(data.guild.id) ?? new InviteGuild(this.client, data.guild);
42
+ this.guild = this.client.guilds.cache.get(data.guild.id) ?? new InviteGuild(this.client, data.guild);
43
43
  }
44
44
 
45
45
  if ('code' in data) {
@@ -570,7 +570,7 @@ class Message extends Base {
570
570
  * @readonly
571
571
  */
572
572
  get thread() {
573
- return this.channel?.threads?.resolve(this.id) ?? null;
573
+ return this.channel?.threads?.cache.get(this.id) ?? null;
574
574
  }
575
575
 
576
576
  /**
@@ -180,7 +180,7 @@ class PermissionOverwrites extends Base {
180
180
  };
181
181
  }
182
182
 
183
- const userOrRole = guild.roles.resolve(overwrite.id) ?? guild.client.users.resolve(overwrite.id);
183
+ const userOrRole = guild.roles.cache.get(overwrite.id) ?? guild.client.users.cache.get(overwrite.id);
184
184
  if (!userOrRole) throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'parameter', 'User nor a Role');
185
185
  const type = userOrRole instanceof Role ? OverwriteType.Role : OverwriteType.Member;
186
186
 
@@ -61,7 +61,7 @@ class PollAnswer extends Base {
61
61
  */
62
62
  get emoji() {
63
63
  if (!this._emoji || (!this._emoji.id && !this._emoji.name)) return null;
64
- return this.client.emojis.resolve(this._emoji.id) ?? new Emoji(this.client, this._emoji);
64
+ return this.client.emojis.cache.get(this._emoji.id) ?? new Emoji(this.client, this._emoji);
65
65
  }
66
66
 
67
67
  /**
@@ -69,7 +69,7 @@ class ThreadMember extends Base {
69
69
  * @readonly
70
70
  */
71
71
  get guildMember() {
72
- return this.member ?? this.thread.guild.members.resolve(this.id);
72
+ return this.member ?? this.thread.guild.members.cache.get(this.id) ?? null;
73
73
  }
74
74
 
75
75
  /**
@@ -87,7 +87,7 @@ class ThreadMember extends Base {
87
87
  * @readonly
88
88
  */
89
89
  get user() {
90
- return this.client.users.resolve(this.id);
90
+ return this.client.users.cache.get(this.id) ?? null;
91
91
  }
92
92
 
93
93
  /**
@@ -108,7 +108,7 @@ class Webhook {
108
108
  * The source guild of the webhook
109
109
  * @type {?(Guild|APIGuild)}
110
110
  */
111
- this.sourceGuild = this.client.guilds?.resolve(data.source_guild.id) ?? data.source_guild;
111
+ this.sourceGuild = this.client.guilds?.cache.get(data.source_guild.id) ?? data.source_guild;
112
112
  } else {
113
113
  this.sourceGuild ??= null;
114
114
  }
@@ -118,7 +118,7 @@ class Webhook {
118
118
  * The source channel of the webhook
119
119
  * @type {?(AnnouncementChannel|APIChannel)}
120
120
  */
121
- this.sourceChannel = this.client.channels?.resolve(data.source_channel?.id) ?? data.source_channel;
121
+ this.sourceChannel = this.client.channels?.cache.get(data.source_channel?.id) ?? data.source_channel;
122
122
  } else {
123
123
  this.sourceChannel ??= null;
124
124
  }
@@ -53,7 +53,7 @@ class WelcomeChannel extends Base {
53
53
  * @type {GuildEmoji|Emoji}
54
54
  */
55
55
  get emoji() {
56
- return this.client.emojis.resolve(this._emoji.id) ?? new Emoji(this.client, this._emoji);
56
+ return this.client.emojis.cache.get(this._emoji.id) ?? new Emoji(this.client, this._emoji);
57
57
  }
58
58
  }
59
59
 
@@ -466,12 +466,7 @@
466
466
 
467
467
  /**
468
468
  * @external Locale
469
- * @see {@link https://discord-api-types.dev/api/discord-api-types-rest/common/enum/Locale}
470
- */
471
-
472
- /**
473
- * @external LocaleString
474
- * @see {@link https://discord-api-types.dev/api/discord-api-types-rest/common#LocaleString}
469
+ * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/Locale}
475
470
  */
476
471
 
477
472
  /**
@@ -506,7 +501,7 @@
506
501
 
507
502
  /**
508
503
  * @external PermissionFlagsBits
509
- * @see {@link https://discord-api-types.dev/api/discord-api-types-payloads/common#PermissionFlagsBits}
504
+ * @see {@link https://discord-api-types.dev/api/discord-api-types-v10#PermissionFlagsBits}
510
505
  */
511
506
 
512
507
  /**
@@ -531,7 +526,7 @@
531
526
 
532
527
  /**
533
528
  * @external RESTJSONErrorCodes
534
- * @see {@link https://discord-api-types.dev/api/discord-api-types-rest/common/enum/RESTJSONErrorCodes}
529
+ * @see {@link https://discord-api-types.dev/api/discord-api-types-v10/enum/RESTJSONErrorCodes}
535
530
  */
536
531
 
537
532
  /**
@@ -101,7 +101,6 @@ import {
101
101
  APIEmbedImage,
102
102
  VideoQualityMode,
103
103
  LocalizationMap,
104
- LocaleString,
105
104
  MessageActivityType,
106
105
  APIAttachment,
107
106
  APIChannel,
@@ -5566,7 +5565,7 @@ export type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji | Applicati
5566
5565
 
5567
5566
  export interface FetchApplicationCommandOptions extends BaseFetchOptions {
5568
5567
  guildId?: Snowflake;
5569
- locale?: LocaleString;
5568
+ locale?: Locale;
5570
5569
  withLocalizations?: boolean;
5571
5570
  }
5572
5571
 
@@ -101,7 +101,6 @@ import {
101
101
  APIEmbedImage,
102
102
  VideoQualityMode,
103
103
  LocalizationMap,
104
- LocaleString,
105
104
  MessageActivityType,
106
105
  APIAttachment,
107
106
  APIChannel,
@@ -5566,7 +5565,7 @@ export type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji | Applicati
5566
5565
 
5567
5566
  export interface FetchApplicationCommandOptions extends BaseFetchOptions {
5568
5567
  guildId?: Snowflake;
5569
- locale?: LocaleString;
5568
+ locale?: Locale;
5570
5569
  withLocalizations?: boolean;
5571
5570
  }
5572
5571