discord.js 15.0.0-dev.1753316115-f2fec9177 → 15.0.0-dev.1753613926-c0c1ac287

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.1753316115-f2fec9177",
4
+ "version": "15.0.0-dev.1753613926-c0c1ac287",
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/builders": "^1.11.1",
65
- "@discordjs/collection": "^2.1.1",
66
- "@discordjs/rest": "^2.5.0",
67
- "@discordjs/formatters": "^0.6.1",
68
- "@discordjs/util": "^1.1.1",
69
- "@discordjs/ws": "^2.0.2"
64
+ "@discordjs/collection": "^3.0.0-dev.1753613924-c0c1ac287",
65
+ "@discordjs/formatters": "^1.0.0-dev.1753613928-c0c1ac287",
66
+ "@discordjs/builders": "^2.0.0-dev.1753613923-c0c1ac287",
67
+ "@discordjs/util": "^2.0.0-dev.1753613932-c0c1ac287",
68
+ "@discordjs/rest": "^3.0.0-dev.1753613930-c0c1ac287",
69
+ "@discordjs/ws": "^3.0.0-dev.1753613934-c0c1ac287"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@favware/cliff-jumper": "^4.1.0",
@@ -82,9 +82,9 @@
82
82
  "tsd": "^0.32.0",
83
83
  "turbo": "^2.5.4",
84
84
  "typescript": "~5.8.3",
85
+ "@discordjs/api-extractor": "^7.52.7",
85
86
  "@discordjs/docgen": "^0.12.1",
86
- "@discordjs/scripts": "^0.1.0",
87
- "@discordjs/api-extractor": "^7.52.7"
87
+ "@discordjs/scripts": "^0.1.0"
88
88
  },
89
89
  "engines": {
90
90
  "node": ">=22.12.0"
@@ -163,7 +163,7 @@ class Client extends BaseClient {
163
163
  const wsOptions = {
164
164
  ...this.options.ws,
165
165
  intents: this.options.intents.bitfield,
166
- rest: this.rest,
166
+ fetchGatewayInformation: () => this.rest.get(Routes.gatewayBot()),
167
167
  // Explicitly nulled to always be set using `setToken` in `login`
168
168
  token: null,
169
169
  };
@@ -14,12 +14,8 @@ const { GuildInvite } = require('../structures/GuildInvite.js');
14
14
  const { GuildMember } = require('../structures/GuildMember.js');
15
15
  const { OAuth2Guild } = require('../structures/OAuth2Guild.js');
16
16
  const { Role } = require('../structures/Role.js');
17
- const { resolveImage } = require('../util/DataResolver.js');
18
17
  const { Events } = require('../util/Events.js');
19
- const { PermissionsBitField } = require('../util/PermissionsBitField.js');
20
- const { SystemChannelFlagsBitField } = require('../util/SystemChannelFlagsBitField.js');
21
18
  const { _transformAPIIncidentsData } = require('../util/Transformers.js');
22
- const { resolveColor } = require('../util/Util.js');
23
19
  const { CachedManager } = require('./CachedManager.js');
24
20
 
25
21
  let cacheWarningEmitted = false;
@@ -60,50 +56,6 @@ class GuildManager extends CachedManager {
60
56
  * @typedef {Guild|GuildChannel|GuildMember|GuildEmoji|Role|Snowflake|Invite} GuildResolvable
61
57
  */
62
58
 
63
- /**
64
- * Partial data for a Role.
65
- *
66
- * @typedef {Object} PartialRoleData
67
- * @property {Snowflake|number} [id] The role's id, used to set channel overrides.
68
- * This is a placeholder and will be replaced by the API after consumption
69
- * @property {string} [name] The name of the role
70
- * @property {ColorResolvable} [color] The color of the role, either a hex string or a base 10 number
71
- * @property {boolean} [hoist] Whether the role should be hoisted
72
- * @property {number} [position] The position of the role
73
- * @property {PermissionResolvable} [permissions] The permissions of the role
74
- * @property {boolean} [mentionable] Whether the role should be mentionable
75
- */
76
-
77
- /**
78
- * Partial overwrite data.
79
- *
80
- * @typedef {Object} PartialOverwriteData
81
- * @property {Snowflake|number} id The id of the {@link Role} or {@link User} this overwrite belongs to
82
- * @property {OverwriteType} [type] The type of this overwrite
83
- * @property {PermissionResolvable} [allow] The permissions to allow
84
- * @property {PermissionResolvable} [deny] The permissions to deny
85
- */
86
-
87
- /**
88
- * Partial data for a Channel.
89
- *
90
- * @typedef {Object} PartialChannelData
91
- * @property {Snowflake|number} [id] The channel's id, used to set its parent.
92
- * This is a placeholder and will be replaced by the API after consumption
93
- * @property {Snowflake|number} [parentId] The parent id for this channel
94
- * @property {ChannelType.GuildText|ChannelType.GuildVoice|ChannelType.GuildCategory} [type] The type of the channel
95
- * @property {string} name The name of the channel
96
- * @property {?string} [topic] The topic of the text channel
97
- * @property {boolean} [nsfw] Whether the channel is NSFW
98
- * @property {number} [bitrate] The bitrate of the voice channel
99
- * @property {number} [userLimit] The user limit of the channel
100
- * @property {?string} [rtcRegion] The RTC region of the channel
101
- * @property {VideoQualityMode} [videoQualityMode] The camera video quality mode of the channel
102
- * @property {PartialOverwriteData[]} [permissionOverwrites]
103
- * Overwrites of the channel
104
- * @property {number} [rateLimitPerUser] The rate limit per user (slowmode) of the channel in seconds
105
- */
106
-
107
59
  /**
108
60
  * Resolves a {@link GuildResolvable} to a {@link Guild} object.
109
61
  *
@@ -150,112 +102,6 @@ class GuildManager extends CachedManager {
150
102
  return super.resolveId(guild);
151
103
  }
152
104
 
153
- /**
154
- * Options used to create a guild.
155
- *
156
- * @typedef {Object} GuildCreateOptions
157
- * @property {string} name The name of the guild
158
- * @property {?(BufferResolvable|Base64Resolvable)} [icon=null] The icon for the guild
159
- * @property {GuildVerificationLevel} [verificationLevel] The verification level for the guild
160
- * @property {GuildDefaultMessageNotifications} [defaultMessageNotifications] The default message notifications
161
- * for the guild
162
- * @property {GuildExplicitContentFilter} [explicitContentFilter] The explicit content filter level for the guild
163
- * @property {PartialRoleData[]} [roles=[]] The roles for this guild,
164
- * @property {PartialChannelData[]} [channels=[]] The channels for this guild
165
- * @property {Snowflake|number} [afkChannelId] The AFK channel's id
166
- * @property {number} [afkTimeout] The AFK timeout in seconds
167
- * the first element of this array is used to change properties of the guild's everyone role.
168
- * @property {Snowflake|number} [systemChannelId] The system channel's id
169
- * @property {SystemChannelFlagsResolvable} [systemChannelFlags] The flags of the system channel
170
- */
171
-
172
- /**
173
- * Creates a guild.
174
- * <warn>This is only available to bots in fewer than 10 guilds.</warn>
175
- *
176
- * @param {GuildCreateOptions} options Options for creating the guild
177
- * @returns {Promise<Guild>} The guild that was created
178
- */
179
- async create({
180
- name,
181
- icon = null,
182
- verificationLevel,
183
- defaultMessageNotifications,
184
- explicitContentFilter,
185
- roles = [],
186
- channels = [],
187
- afkChannelId,
188
- afkTimeout,
189
- systemChannelId,
190
- systemChannelFlags,
191
- }) {
192
- const data = await this.client.rest.post(Routes.guilds(), {
193
- body: {
194
- name,
195
- icon: icon && (await resolveImage(icon)),
196
- verification_level: verificationLevel,
197
- default_message_notifications: defaultMessageNotifications,
198
- explicit_content_filter: explicitContentFilter,
199
- roles: roles.map(({ color, permissions, ...options }) => ({
200
- ...options,
201
- color: color && resolveColor(color),
202
- permissions: permissions === undefined ? undefined : PermissionsBitField.resolve(permissions).toString(),
203
- })),
204
- channels: channels.map(
205
- ({
206
- parentId,
207
- userLimit,
208
- rtcRegion,
209
- videoQualityMode,
210
- permissionOverwrites,
211
- rateLimitPerUser,
212
- ...options
213
- }) => ({
214
- ...options,
215
- parent_id: parentId,
216
- user_limit: userLimit,
217
- rtc_region: rtcRegion,
218
- video_quality_mode: videoQualityMode,
219
- permission_overwrites: permissionOverwrites?.map(({ allow, deny, ...permissionOverwriteOptions }) => ({
220
- ...permissionOverwriteOptions,
221
- allow: allow === undefined ? undefined : PermissionsBitField.resolve(allow).toString(),
222
- deny: deny === undefined ? undefined : PermissionsBitField.resolve(deny).toString(),
223
- })),
224
- rate_limit_per_user: rateLimitPerUser,
225
- }),
226
- ),
227
- afk_channel_id: afkChannelId,
228
- afk_timeout: afkTimeout,
229
- system_channel_id: systemChannelId,
230
- system_channel_flags:
231
- systemChannelFlags === undefined ? undefined : SystemChannelFlagsBitField.resolve(systemChannelFlags),
232
- },
233
- });
234
-
235
- return (
236
- this.client.guilds.cache.get(data.id) ??
237
- new Promise(resolve => {
238
- const handleGuild = guild => {
239
- if (guild.id === data.id) {
240
- // eslint-disable-next-line no-use-before-define
241
- clearTimeout(timeout);
242
- this.client.decrementMaxListeners();
243
- resolve(guild);
244
- }
245
- };
246
-
247
- this.client.incrementMaxListeners();
248
- this.client.once(Events.GuildCreate, handleGuild);
249
-
250
- const timeout = setTimeout(() => {
251
- this.client.removeListener(Events.GuildCreate, handleGuild);
252
- this.client.decrementMaxListeners();
253
- resolve(this.client.guilds._add(data));
254
- }, 10_000).unref();
255
- })
256
- );
257
- }
258
-
259
105
  /**
260
106
  * Options used to fetch a single guild.
261
107
  *
@@ -4347,7 +4347,6 @@ export interface FetchSoundboardSoundsOptions {
4347
4347
 
4348
4348
  export class GuildManager extends CachedManager<Snowflake, Guild, GuildResolvable> {
4349
4349
  private constructor(client: Client<true>, iterable?: Iterable<APIGuild | APIUnavailableGuild>);
4350
- public create(options: GuildCreateOptions): Promise<Guild>;
4351
4350
  public fetch(options: FetchGuildOptions | Snowflake): Promise<Guild>;
4352
4351
  public fetch(options?: FetchGuildsOptions): Promise<Collection<Snowflake, OAuth2Guild>>;
4353
4352
  public fetchSoundboardSounds(
@@ -6111,20 +6110,6 @@ export interface GuildChannelOverwriteOptions {
6111
6110
  type?: OverwriteType;
6112
6111
  }
6113
6112
 
6114
- export interface GuildCreateOptions {
6115
- afkChannelId?: Snowflake | number;
6116
- afkTimeout?: number;
6117
- channels?: readonly PartialChannelData[];
6118
- defaultMessageNotifications?: GuildDefaultMessageNotifications;
6119
- explicitContentFilter?: GuildExplicitContentFilter;
6120
- icon?: Base64Resolvable | BufferResolvable | null;
6121
- name: string;
6122
- roles?: readonly PartialRoleData[];
6123
- systemChannelFlags?: SystemChannelFlagsResolvable;
6124
- systemChannelId?: Snowflake | number;
6125
- verificationLevel?: GuildVerificationLevel;
6126
- }
6127
-
6128
6113
  export interface GuildWidgetSettings {
6129
6114
  channel: AnnouncementChannel | ForumChannel | MediaChannel | TextChannel | VoiceBasedChannel | null;
6130
6115
  enabled: boolean;
@@ -6788,21 +6773,6 @@ export interface PresenceData {
6788
6773
 
6789
6774
  export type PresenceResolvable = Presence | Snowflake | UserResolvable;
6790
6775
 
6791
- export interface PartialChannelData {
6792
- bitrate?: number;
6793
- id?: Snowflake | number;
6794
- name: string;
6795
- nsfw?: boolean;
6796
- parentId?: Snowflake | number;
6797
- permissionOverwrites?: readonly PartialOverwriteData[];
6798
- rateLimitPerUser?: number;
6799
- rtcRegion?: string | null;
6800
- topic?: string | null;
6801
- type?: ChannelType.GuildCategory | ChannelType.GuildText | ChannelType.GuildVoice;
6802
- userLimit?: number;
6803
- videoQualityMode?: VideoQualityMode;
6804
- }
6805
-
6806
6776
  export interface PartialEmoji {
6807
6777
  animated: boolean;
6808
6778
  id: Snowflake | undefined;
@@ -6863,17 +6833,6 @@ export interface PartialThreadMember extends Partialize<ThreadMember, 'flags' |
6863
6833
 
6864
6834
  export interface PartialSoundboardSound extends Partialize<SoundboardSound, 'available' | 'name' | 'volume'> {}
6865
6835
 
6866
- export interface PartialOverwriteData {
6867
- allow?: PermissionResolvable;
6868
- deny?: PermissionResolvable;
6869
- id: Snowflake | number;
6870
- type?: OverwriteType;
6871
- }
6872
-
6873
- export interface PartialRoleData extends RoleData {
6874
- id?: Snowflake | number;
6875
- }
6876
-
6877
6836
  export enum Partials {
6878
6837
  User,
6879
6838
  Channel,
@@ -4347,7 +4347,6 @@ export interface FetchSoundboardSoundsOptions {
4347
4347
 
4348
4348
  export class GuildManager extends CachedManager<Snowflake, Guild, GuildResolvable> {
4349
4349
  private constructor(client: Client<true>, iterable?: Iterable<APIGuild | APIUnavailableGuild>);
4350
- public create(options: GuildCreateOptions): Promise<Guild>;
4351
4350
  public fetch(options: FetchGuildOptions | Snowflake): Promise<Guild>;
4352
4351
  public fetch(options?: FetchGuildsOptions): Promise<Collection<Snowflake, OAuth2Guild>>;
4353
4352
  public fetchSoundboardSounds(
@@ -6111,20 +6110,6 @@ export interface GuildChannelOverwriteOptions {
6111
6110
  type?: OverwriteType;
6112
6111
  }
6113
6112
 
6114
- export interface GuildCreateOptions {
6115
- afkChannelId?: Snowflake | number;
6116
- afkTimeout?: number;
6117
- channels?: readonly PartialChannelData[];
6118
- defaultMessageNotifications?: GuildDefaultMessageNotifications;
6119
- explicitContentFilter?: GuildExplicitContentFilter;
6120
- icon?: Base64Resolvable | BufferResolvable | null;
6121
- name: string;
6122
- roles?: readonly PartialRoleData[];
6123
- systemChannelFlags?: SystemChannelFlagsResolvable;
6124
- systemChannelId?: Snowflake | number;
6125
- verificationLevel?: GuildVerificationLevel;
6126
- }
6127
-
6128
6113
  export interface GuildWidgetSettings {
6129
6114
  channel: AnnouncementChannel | ForumChannel | MediaChannel | TextChannel | VoiceBasedChannel | null;
6130
6115
  enabled: boolean;
@@ -6788,21 +6773,6 @@ export interface PresenceData {
6788
6773
 
6789
6774
  export type PresenceResolvable = Presence | Snowflake | UserResolvable;
6790
6775
 
6791
- export interface PartialChannelData {
6792
- bitrate?: number;
6793
- id?: Snowflake | number;
6794
- name: string;
6795
- nsfw?: boolean;
6796
- parentId?: Snowflake | number;
6797
- permissionOverwrites?: readonly PartialOverwriteData[];
6798
- rateLimitPerUser?: number;
6799
- rtcRegion?: string | null;
6800
- topic?: string | null;
6801
- type?: ChannelType.GuildCategory | ChannelType.GuildText | ChannelType.GuildVoice;
6802
- userLimit?: number;
6803
- videoQualityMode?: VideoQualityMode;
6804
- }
6805
-
6806
6776
  export interface PartialEmoji {
6807
6777
  animated: boolean;
6808
6778
  id: Snowflake | undefined;
@@ -6863,17 +6833,6 @@ export interface PartialThreadMember extends Partialize<ThreadMember, 'flags' |
6863
6833
 
6864
6834
  export interface PartialSoundboardSound extends Partialize<SoundboardSound, 'available' | 'name' | 'volume'> {}
6865
6835
 
6866
- export interface PartialOverwriteData {
6867
- allow?: PermissionResolvable;
6868
- deny?: PermissionResolvable;
6869
- id: Snowflake | number;
6870
- type?: OverwriteType;
6871
- }
6872
-
6873
- export interface PartialRoleData extends RoleData {
6874
- id?: Snowflake | number;
6875
- }
6876
-
6877
6836
  export enum Partials {
6878
6837
  User,
6879
6838
  Channel,