@discord-selfbot/core 14.0.1 → 14.0.2

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/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // package.json
3
3
  var package_default = {
4
4
  name: "@discord-selfbot/core",
5
- version: "14.0.1",
5
+ version: "14.0.2",
6
6
  description: "An unofficial discord.js fork for creating selfbots, migrated to TypeScript and ESM",
7
7
  keywords: [
8
8
  "api",
@@ -5200,14 +5200,17 @@ import { setInterval as setInterval2 } from "timers";
5200
5200
  import { Collection as Collection10 } from "@discordjs/collection";
5201
5201
  import makeFetchCookie from "fetch-cookie";
5202
5202
  import { CookieJar } from "tough-cookie";
5203
- import { fetch as fetchOriginal } from "undici";
5203
+ import {
5204
+ Client as UndiciClient,
5205
+ ProxyAgent,
5206
+ buildConnector,
5207
+ fetch as fetchOriginal
5208
+ } from "undici";
5204
5209
 
5205
5210
  // src/rest/APIRequest.ts
5206
5211
  import { Buffer as Buffer3 } from "buffer";
5207
5212
  import { setTimeout as setTimeout4 } from "timers";
5208
- import { FormData, buildConnector, Client as Client2, ProxyAgent } from "undici";
5209
- var { ciphers } = Constants_default;
5210
- var agent = null;
5213
+ import { FormData } from "undici";
5211
5214
 
5212
5215
  class APIRequest {
5213
5216
  rest;
@@ -5226,7 +5229,6 @@ class APIRequest {
5226
5229
  this.options = options;
5227
5230
  this.retries = 0;
5228
5231
  this.fullUserAgent = this.client.options.http.headers["User-Agent"];
5229
- this.client.options.ws.properties.browser_user_agent = this.fullUserAgent;
5230
5232
  let queryString = "";
5231
5233
  if (options.query) {
5232
5234
  const queryOptions = options.query;
@@ -5236,7 +5238,7 @@ class APIRequest {
5236
5238
  this.path = `${path}${queryString && `?${queryString}`}`;
5237
5239
  }
5238
5240
  make(captchaKey, captchaRqToken) {
5239
- this.ensureAgent();
5241
+ const dispatcher = this.rest.getDispatcher();
5240
5242
  const API = this.options.versioned === false ? this.client.options.http.api : `${this.client.options.http.api}/v${this.client.options.http.version}`;
5241
5243
  const url = API + this.path;
5242
5244
  const headers = this.buildHeaders(captchaKey, captchaRqToken);
@@ -5246,25 +5248,13 @@ class APIRequest {
5246
5248
  return this.rest.fetch(url, {
5247
5249
  body,
5248
5250
  credentials: "include",
5249
- dispatcher: agent,
5251
+ dispatcher,
5250
5252
  headers,
5251
5253
  method: this.method.toUpperCase(),
5252
5254
  redirect: "follow",
5253
5255
  signal: controller.signal
5254
5256
  }).finally(() => clearTimeout(timeout));
5255
5257
  }
5256
- ensureAgent() {
5257
- if (agent) {
5258
- return;
5259
- }
5260
- const proxyAgent = Util_default.checkUndiciProxyAgent(this.client.options.http.agent);
5261
- agent = proxyAgent ? new ProxyAgent({
5262
- ...proxyAgent,
5263
- ciphers: ciphers.join(":")
5264
- }) : new Client2("https://discord.com", {
5265
- connect: buildConnector({ ciphers: ciphers.join(":") })
5266
- });
5267
- }
5268
5258
  buildHeaders(captchaKey, captchaRqToken) {
5269
5259
  let headers = {
5270
5260
  accept: "*/*",
@@ -5569,8 +5559,6 @@ function calculateReset(reset, resetAfter, serverDate) {
5569
5559
  }
5570
5560
  return new Date(Number(reset) * 1000).getTime() - getAPIOffset(serverDate);
5571
5561
  }
5572
- var invalidCount = 0;
5573
- var invalidCountResetTime = null;
5574
5562
 
5575
5563
  class RequestHandler {
5576
5564
  manager;
@@ -5750,16 +5738,16 @@ class RequestHandler {
5750
5738
  }
5751
5739
  trackInvalidRequest(res) {
5752
5740
  if (res.status === 401 || res.status === 403 || res.status === 429) {
5753
- if (!invalidCountResetTime || invalidCountResetTime < Date.now()) {
5754
- invalidCountResetTime = Date.now() + 1000 * 60 * 10;
5755
- invalidCount = 0;
5741
+ if (!this.manager.invalidCountResetTime || this.manager.invalidCountResetTime < Date.now()) {
5742
+ this.manager.invalidCountResetTime = Date.now() + 1000 * 60 * 10;
5743
+ this.manager.invalidCount = 0;
5756
5744
  }
5757
- invalidCount++;
5758
- const emitInvalid = this.manager.client.listenerCount(INVALID_REQUEST_WARNING) && this.manager.client.options.invalidRequestWarningInterval > 0 && invalidCount % this.manager.client.options.invalidRequestWarningInterval === 0;
5745
+ this.manager.invalidCount++;
5746
+ const emitInvalid = this.manager.client.listenerCount(INVALID_REQUEST_WARNING) && this.manager.client.options.invalidRequestWarningInterval > 0 && this.manager.invalidCount % this.manager.client.options.invalidRequestWarningInterval === 0;
5759
5747
  if (emitInvalid) {
5760
5748
  this.manager.client.emit(INVALID_REQUEST_WARNING, {
5761
- count: invalidCount,
5762
- remainingTime: invalidCountResetTime - Date.now()
5749
+ count: this.manager.invalidCount,
5750
+ remainingTime: (this.manager.invalidCountResetTime ?? Date.now()) - Date.now()
5763
5751
  });
5764
5752
  }
5765
5753
  }
@@ -5857,7 +5845,7 @@ var RequestHandler_default = RequestHandler;
5857
5845
 
5858
5846
  // src/rest/RESTManager.ts
5859
5847
  var { Error: Error7 } = errors_default;
5860
- var { Endpoints: Endpoints3 } = Constants_default;
5848
+ var { Endpoints: Endpoints3, ciphers } = Constants_default;
5861
5849
 
5862
5850
  class RESTManager {
5863
5851
  client;
@@ -5870,6 +5858,9 @@ class RESTManager {
5870
5858
  cookieJar;
5871
5859
  fetch;
5872
5860
  sweepInterval;
5861
+ agent;
5862
+ invalidCount;
5863
+ invalidCountResetTime;
5873
5864
  constructor(client) {
5874
5865
  this.client = client;
5875
5866
  this.handlers = new Collection10;
@@ -5880,12 +5871,28 @@ class RESTManager {
5880
5871
  this.globalDelay = null;
5881
5872
  this.cookieJar = new CookieJar;
5882
5873
  this.fetch = makeFetchCookie(fetchOriginal, this.cookieJar);
5874
+ this.agent = null;
5875
+ this.invalidCount = 0;
5876
+ this.invalidCountResetTime = null;
5883
5877
  if (client.options.restSweepInterval > 0) {
5884
5878
  this.sweepInterval = setInterval2(() => {
5885
5879
  this.handlers.sweep((handler) => handler._inactive);
5886
5880
  }, client.options.restSweepInterval * 1000).unref();
5887
5881
  }
5888
5882
  }
5883
+ getDispatcher() {
5884
+ if (this.agent) {
5885
+ return this.agent;
5886
+ }
5887
+ const proxyAgent = Util_default.checkUndiciProxyAgent(this.client.options.http.agent);
5888
+ this.agent = proxyAgent ? new ProxyAgent({
5889
+ ...proxyAgent,
5890
+ ciphers: ciphers.join(":")
5891
+ }) : new UndiciClient("https://discord.com", {
5892
+ connect: buildConnector({ ciphers: ciphers.join(":") })
5893
+ });
5894
+ return this.agent;
5895
+ }
5889
5896
  get api() {
5890
5897
  return APIRouter_default(this);
5891
5898
  }
@@ -6181,6 +6188,7 @@ class BaseClient extends EventEmitter {
6181
6188
  process6.emitWarning("Intents is not available.", "DeprecationWarning");
6182
6189
  }
6183
6190
  this.options = Util_default.mergeDefault(Options_default.createDefault(), options);
6191
+ this.options.ws.properties.browser_user_agent = this.options.http.headers["User-Agent"];
6184
6192
  this.rest = new RESTManager_default(this);
6185
6193
  }
6186
6194
  get api() {
@@ -6212,11 +6220,22 @@ var BaseClient_default = BaseClient;
6212
6220
  // src/client/WebhookClient.ts
6213
6221
  var require4 = createRequire3(import.meta.url);
6214
6222
  var { Error: Error8 } = errors_default;
6223
+ var _webhookPatched = false;
6215
6224
 
6216
6225
  class WebhookClient extends BaseClient_default {
6217
6226
  constructor(data, options) {
6218
6227
  super(options);
6219
6228
  Object.defineProperty(this, "client", { value: this });
6229
+ if (!_webhookPatched) {
6230
+ try {
6231
+ const WebhookMod = require4("../structures/Webhook");
6232
+ const Webhook = WebhookMod.default ?? WebhookMod;
6233
+ if (typeof Webhook.applyToClass === "function") {
6234
+ Webhook.applyToClass(WebhookClient);
6235
+ _webhookPatched = true;
6236
+ }
6237
+ } catch {}
6238
+ }
6220
6239
  let id = null;
6221
6240
  let token = null;
6222
6241
  if ("url" in data) {
@@ -6245,12 +6264,6 @@ class WebhookClient extends BaseClient_default {
6245
6264
  deleteMessage() {}
6246
6265
  }
6247
6266
  var WebhookClient_default = WebhookClient;
6248
- setTimeout(() => {
6249
- try {
6250
- const Webhook = require4("../structures/Webhook");
6251
- Webhook.applyToClass(WebhookClient);
6252
- } catch {}
6253
- }, 0);
6254
6267
 
6255
6268
  // src/structures/VoiceState.ts
6256
6269
  var { Error: Error9, TypeError: TypeError10 } = errors_default;
@@ -6633,6 +6646,31 @@ var MessageCollector_default = MessageCollector;
6633
6646
  import { setTimeout as setTimeout6 } from "timers";
6634
6647
  import { s } from "@sapphire/shapeshift";
6635
6648
 
6649
+ // src/util/OutboundMessagePipeline.ts
6650
+ async function uploadMessageAttachments(client, channelId, files) {
6651
+ if (!files.length) {
6652
+ return [];
6653
+ }
6654
+ const uploads = await Util_default.getUploadURL(client, channelId, files);
6655
+ const attachments = await Promise.all(uploads.map(async (upload) => {
6656
+ const file = files[Number(upload.id)];
6657
+ if (!file) {
6658
+ throw new TypeError("Invalid upload attachment index");
6659
+ }
6660
+ await Util_default.uploadFile(file.file, upload.upload_url);
6661
+ return {
6662
+ description: file.description,
6663
+ duration_secs: file.duration_secs,
6664
+ filename: file.name,
6665
+ id: upload.id,
6666
+ uploaded_filename: upload.upload_filename,
6667
+ waveform: file.waveform
6668
+ };
6669
+ }));
6670
+ attachments.sort((left, right) => Math.trunc(Number(left.id)) - Math.trunc(Number(right.id)));
6671
+ return attachments;
6672
+ }
6673
+
6636
6674
  // src/structures/GuildMember.ts
6637
6675
  import { createRequire as createRequire4 } from "module";
6638
6676
  import process8 from "process";
@@ -9117,25 +9155,7 @@ class MessageManager extends CachedManager_default {
9117
9155
  throw new TypeError14("INVALID_TYPE", "message", "MessageResolvable");
9118
9156
  }
9119
9157
  const { data, files } = await (options instanceof MessagePayload_default ? options : MessagePayload_default.create(message instanceof Message2 ? message : this, options)).resolveData().resolveFiles();
9120
- const fileList = files ?? [];
9121
- const attachments = await Util_default.getUploadURL(this.client, this.channel.id, fileList);
9122
- const requestPromises = attachments.map(async (attachment) => {
9123
- const file = fileList[Number(attachment.id)];
9124
- if (!file) {
9125
- throw new TypeError14("INVALID_TYPE", "attachment", "FileOptions");
9126
- }
9127
- await Util_default.uploadFile(file.file, attachment.upload_url);
9128
- return {
9129
- description: file.description,
9130
- duration_secs: file.duration_secs,
9131
- filename: file.name,
9132
- id: attachment.id,
9133
- uploaded_filename: attachment.upload_filename,
9134
- waveform: file.waveform
9135
- };
9136
- });
9137
- const attachmentsData = await Promise.all(requestPromises);
9138
- attachmentsData.sort((left, right) => Math.trunc(Number(left.id)) - Math.trunc(Number(right.id)));
9158
+ const attachmentsData = await uploadMessageAttachments(this.client, this.channel.id, files ?? []);
9139
9159
  if (data) {
9140
9160
  Object.assign(data, { attachments: attachmentsData });
9141
9161
  }
@@ -9644,25 +9664,7 @@ class TextBasedChannel {
9644
9664
  }
9645
9665
  const messagePayload = options instanceof MessagePayload_default ? options.resolveData() : MessagePayload_default.create(this, options).resolveData();
9646
9666
  const { data, files } = await messagePayload.resolveFiles();
9647
- const fileList = files ?? [];
9648
- const attachments = await Util_default.getUploadURL(this.client, this.id, fileList);
9649
- const requestPromises = attachments.map(async (attachment) => {
9650
- const file = fileList[Number(attachment.id)];
9651
- if (!file) {
9652
- throw new Error17("INVALID_TYPE", "attachment", "FileOptions");
9653
- }
9654
- await Util_default.uploadFile(file.file, attachment.upload_url);
9655
- return {
9656
- description: file.description,
9657
- duration_secs: file.duration_secs,
9658
- filename: file.name,
9659
- id: attachment.id,
9660
- uploaded_filename: attachment.upload_filename,
9661
- waveform: file.waveform
9662
- };
9663
- });
9664
- const attachmentsData = await Promise.all(requestPromises);
9665
- attachmentsData.sort((left, right) => Math.trunc(Number(left.id)) - Math.trunc(Number(right.id)));
9667
+ const attachmentsData = await uploadMessageAttachments(this.client, this.id, files ?? []);
9666
9668
  if (data) {
9667
9669
  Object.assign(data, { attachments: attachmentsData });
9668
9670
  }
@@ -11048,7 +11050,6 @@ import process15 from "process";
11048
11050
  import { Collection as Collection27 } from "@discordjs/collection";
11049
11051
 
11050
11052
  // src/structures/Channel.ts
11051
- import { createRequire as createRequire6 } from "module";
11052
11053
  import process12 from "process";
11053
11054
 
11054
11055
  // src/util/ChannelFlags.ts
@@ -11060,114 +11061,116 @@ ChannelFlags.FLAGS = {
11060
11061
  };
11061
11062
  var ChannelFlags_default = ChannelFlags;
11062
11063
 
11063
- // src/structures/Channel.ts
11064
+ // src/structures/ChannelConstruction.ts
11065
+ import { createRequire as createRequire6 } from "module";
11064
11066
  var require7 = createRequire6(import.meta.url);
11065
- var { ChannelTypes: ChannelTypes3, ThreadChannelTypes: ThreadChannelTypes2, VoiceBasedChannelTypes } = Constants_default;
11066
- var CategoryChannel;
11067
- var DMChannel;
11068
- var NewsChannel;
11069
- var StageChannel;
11070
- var StoreChannel;
11071
- var TextChannel;
11072
- var ThreadChannel;
11073
- var VoiceChannel;
11074
- var DirectoryChannel;
11075
- var ForumChannel;
11076
- var MediaChannel;
11077
- var deletedChannels = new WeakSet;
11078
- var deprecationEmittedForDeleted6 = false;
11079
- function loadChannelClasses() {
11080
- CategoryChannel ??= require7("./CategoryChannel").default;
11081
- DMChannel ??= require7("./DMChannel").default;
11082
- NewsChannel ??= require7("./NewsChannel").default;
11083
- StageChannel ??= require7("./StageChannel").default;
11084
- StoreChannel ??= require7("./StoreChannel").default;
11085
- TextChannel ??= require7("./TextChannel").default;
11086
- ThreadChannel ??= require7("./ThreadChannel").default;
11087
- VoiceChannel ??= require7("./VoiceChannel").default;
11088
- DirectoryChannel ??= require7("./DirectoryChannel").default;
11089
- ForumChannel ??= require7("./ForumChannel").default;
11090
- MediaChannel ??= require7("./MediaChannel").default;
11091
- }
11092
- function cacheGuildChannel(cache, channel) {
11093
- cache.set(channel.id, channel);
11094
- }
11067
+ var { ChannelTypes: ChannelTypes3 } = Constants_default;
11068
+ var channelFactory = null;
11095
11069
  function requireGuild(guild) {
11096
11070
  if (!guild) {
11097
11071
  throw new TypeError("A guild is required to create a guild channel");
11098
11072
  }
11099
11073
  return guild;
11100
11074
  }
11101
- function createDirectMessageChannel(client, data) {
11102
- let channel;
11103
- if ("recipients" in data && data.recipients && data.type !== ChannelTypes3.GROUP_DM || data.type === ChannelTypes3.DM) {
11104
- channel = new DMChannel(client, data);
11105
- } else if (data.type === ChannelTypes3.GROUP_DM) {
11106
- const GroupDMChannel = require7("./GroupDMChannel").default;
11107
- channel = new GroupDMChannel(client, data);
11108
- }
11109
- return channel;
11110
- }
11111
- function createGuildChannel(client, data, guild, allowUnknownGuild) {
11112
- let channel;
11113
- switch (data.type) {
11114
- case ChannelTypes3.GUILD_TEXT: {
11115
- channel = new TextChannel(requireGuild(guild), data, client);
11116
- break;
11117
- }
11118
- case ChannelTypes3.GUILD_VOICE: {
11119
- channel = new VoiceChannel(requireGuild(guild), data, client);
11120
- break;
11121
- }
11122
- case ChannelTypes3.GUILD_CATEGORY: {
11123
- channel = new CategoryChannel(requireGuild(guild), data, client);
11124
- break;
11125
- }
11126
- case ChannelTypes3.GUILD_NEWS: {
11127
- channel = new NewsChannel(requireGuild(guild), data, client);
11128
- break;
11129
- }
11130
- case ChannelTypes3.GUILD_STORE: {
11131
- channel = new StoreChannel(requireGuild(guild), data, client);
11132
- break;
11075
+ function buildChannelFactory() {
11076
+ const CategoryChannel = require7("./CategoryChannel").default;
11077
+ const DMChannel = require7("./DMChannel").default;
11078
+ const GroupDMChannel = require7("./GroupDMChannel").default;
11079
+ const NewsChannel = require7("./NewsChannel").default;
11080
+ const StageChannel = require7("./StageChannel").default;
11081
+ const StoreChannel = require7("./StoreChannel").default;
11082
+ const TextChannel = require7("./TextChannel").default;
11083
+ const ThreadChannel = require7("./ThreadChannel").default;
11084
+ const VoiceChannel = require7("./VoiceChannel").default;
11085
+ const DirectoryChannel = require7("./DirectoryChannel").default;
11086
+ const ForumChannel = require7("./ForumChannel").default;
11087
+ const MediaChannel = require7("./MediaChannel").default;
11088
+ const constructDirect = (client, data) => {
11089
+ if ("recipients" in data && data.recipients && data.type !== ChannelTypes3.GROUP_DM || data.type === ChannelTypes3.DM) {
11090
+ return new DMChannel(client, data);
11091
+ }
11092
+ if (data.type === ChannelTypes3.GROUP_DM) {
11093
+ return new GroupDMChannel(client, data);
11133
11094
  }
11134
- case ChannelTypes3.GUILD_STAGE_VOICE: {
11135
- channel = new StageChannel(requireGuild(guild), data, client);
11136
- break;
11137
- }
11138
- case ChannelTypes3.GUILD_NEWS_THREAD:
11139
- case ChannelTypes3.GUILD_PUBLIC_THREAD:
11140
- case ChannelTypes3.GUILD_PRIVATE_THREAD: {
11141
- const thread = new ThreadChannel(requireGuild(guild), data, client);
11142
- if (!allowUnknownGuild && thread.parent && isThreadParentChannel(thread.parent)) {
11143
- thread.parent.threads.cache.set(thread.id, thread);
11095
+ return;
11096
+ };
11097
+ const constructGuild = (client, data, guild) => {
11098
+ switch (data.type) {
11099
+ case ChannelTypes3.GUILD_TEXT: {
11100
+ return new TextChannel(requireGuild(guild), data, client);
11101
+ }
11102
+ case ChannelTypes3.GUILD_VOICE: {
11103
+ return new VoiceChannel(requireGuild(guild), data, client);
11104
+ }
11105
+ case ChannelTypes3.GUILD_CATEGORY: {
11106
+ return new CategoryChannel(requireGuild(guild), data, client);
11107
+ }
11108
+ case ChannelTypes3.GUILD_NEWS: {
11109
+ return new NewsChannel(requireGuild(guild), data, client);
11110
+ }
11111
+ case ChannelTypes3.GUILD_STORE: {
11112
+ return new StoreChannel(requireGuild(guild), data, client);
11113
+ }
11114
+ case ChannelTypes3.GUILD_STAGE_VOICE: {
11115
+ return new StageChannel(requireGuild(guild), data, client);
11116
+ }
11117
+ case ChannelTypes3.GUILD_NEWS_THREAD:
11118
+ case ChannelTypes3.GUILD_PUBLIC_THREAD:
11119
+ case ChannelTypes3.GUILD_PRIVATE_THREAD: {
11120
+ return new ThreadChannel(requireGuild(guild), data, client);
11121
+ }
11122
+ case ChannelTypes3.GUILD_DIRECTORY: {
11123
+ return new DirectoryChannel(client, data);
11124
+ }
11125
+ case ChannelTypes3.GUILD_FORUM: {
11126
+ return new ForumChannel(requireGuild(guild), data, client);
11127
+ }
11128
+ case ChannelTypes3.GUILD_MEDIA: {
11129
+ return new MediaChannel(requireGuild(guild), data, client);
11130
+ }
11131
+ default: {
11132
+ return;
11144
11133
  }
11145
- channel = thread;
11146
- break;
11147
- }
11148
- case ChannelTypes3.GUILD_DIRECTORY: {
11149
- channel = new DirectoryChannel(client, data);
11150
- break;
11151
- }
11152
- case ChannelTypes3.GUILD_FORUM: {
11153
- channel = new ForumChannel(requireGuild(guild), data, client);
11154
- break;
11155
- }
11156
- case ChannelTypes3.GUILD_MEDIA: {
11157
- channel = new MediaChannel(requireGuild(guild), data, client);
11158
- break;
11159
11134
  }
11160
- default: {
11161
- break;
11135
+ };
11136
+ return (client, data, guild) => {
11137
+ const guildId = "guild_id" in data ? data.guild_id : undefined;
11138
+ if (!guildId && !guild) {
11139
+ return constructDirect(client, data);
11162
11140
  }
11141
+ return constructGuild(client, data, guild);
11142
+ };
11143
+ }
11144
+ function constructChannel(client, data, guild, { allowUnknownGuild = false } = {}) {
11145
+ channelFactory ??= buildChannelFactory();
11146
+ const relations = {};
11147
+ const guildId = "guild_id" in data ? data.guild_id : undefined;
11148
+ if (!guildId && !guild) {
11149
+ return { channel: channelFactory(client, data), relations };
11150
+ }
11151
+ const resolvedGuild = guild ?? (guildId ? client.guilds.cache.get(guildId) : undefined);
11152
+ if (!resolvedGuild && !allowUnknownGuild) {
11153
+ return { channel: undefined, relations };
11163
11154
  }
11164
- return channel;
11155
+ const channel = channelFactory(client, data, resolvedGuild);
11156
+ if (channel && resolvedGuild) {
11157
+ relations.guild = resolvedGuild;
11158
+ }
11159
+ if (channel && typeof channel.isThread === "function" && channel.isThread() && "parent" in channel && channel.parent && isThreadParentChannel(channel.parent)) {
11160
+ relations.threadParent = channel.parent;
11161
+ }
11162
+ return { channel, relations };
11165
11163
  }
11166
11164
 
11165
+ // src/structures/Channel.ts
11166
+ var { ChannelTypes: ChannelTypes4, ThreadChannelTypes: ThreadChannelTypes2, VoiceBasedChannelTypes } = Constants_default;
11167
+ var deletedChannels = new WeakSet;
11168
+ var deprecationEmittedForDeleted6 = false;
11169
+
11167
11170
  class Channel extends Base_default {
11168
11171
  constructor(client, data, immediatePatch = true) {
11169
11172
  super(client);
11170
- const type = data?.type === undefined ? undefined : ChannelTypes3[data.type];
11173
+ const type = data?.type === undefined ? undefined : ChannelTypes4[data.type];
11171
11174
  this.type = type ?? "UNKNOWN";
11172
11175
  if (data && immediatePatch) {
11173
11176
  this._patch(data);
@@ -11236,20 +11239,22 @@ class Channel extends Base_default {
11236
11239
  isDirectory() {
11237
11240
  return this.type === "GUILD_DIRECTORY";
11238
11241
  }
11242
+ static construct(client, data, guild, { allowUnknownGuild = false } = {}) {
11243
+ return constructChannel(client, data, guild, { allowUnknownGuild });
11244
+ }
11239
11245
  static create(client, data, guild, { allowUnknownGuild = false } = {}) {
11240
- loadChannelClasses();
11241
- let channel;
11242
- const guildId = "guild_id" in data ? data.guild_id : undefined;
11243
- if (!guildId && !guild) {
11244
- channel = createDirectMessageChannel(client, data);
11245
- } else {
11246
- const resolvedGuild = guild ?? (guildId ? client.guilds.cache.get(guildId) : undefined);
11247
- if (resolvedGuild || allowUnknownGuild) {
11248
- channel = createGuildChannel(client, data, resolvedGuild, allowUnknownGuild);
11249
- if (channel && !allowUnknownGuild && resolvedGuild) {
11250
- cacheGuildChannel(resolvedGuild.channels.cache, channel);
11251
- }
11252
- }
11246
+ const { channel, relations } = constructChannel(client, data, guild, {
11247
+ allowUnknownGuild
11248
+ });
11249
+ if (!channel) {
11250
+ return channel;
11251
+ }
11252
+ if (!allowUnknownGuild && relations.guild) {
11253
+ relations.guild.channels.cache.set(channel.id, channel);
11254
+ }
11255
+ if (!allowUnknownGuild && relations.threadParent) {
11256
+ const parent = relations.threadParent;
11257
+ parent.threads?.cache?.set(channel.id, channel);
11253
11258
  }
11254
11259
  return channel;
11255
11260
  }
@@ -11906,7 +11911,7 @@ var { Channel: Channel3 } = Channel_default;
11906
11911
  var { RangeError: RangeError7 } = errors_default;
11907
11912
  var { resolveAutoArchiveMaxLimit } = Util_default;
11908
11913
 
11909
- class ThreadChannel2 extends Channel3 {
11914
+ class ThreadChannel extends Channel3 {
11910
11915
  constructor(guild, data, client) {
11911
11916
  super(guild?.client ?? client, data, false);
11912
11917
  this.guild = guild;
@@ -12040,7 +12045,7 @@ class ThreadChannel2 extends Channel3 {
12040
12045
  reason
12041
12046
  });
12042
12047
  const { updated } = this.client.actions.ChannelUpdate.handle(newData);
12043
- return updated instanceof ThreadChannel2 ? updated : this;
12048
+ return updated instanceof ThreadChannel ? updated : this;
12044
12049
  }
12045
12050
  setArchived(archived = true, reason) {
12046
12051
  return this.edit({ archived }, reason);
@@ -12132,18 +12137,18 @@ class ThreadChannel2 extends Channel3 {
12132
12137
  createMessageCollector() {}
12133
12138
  awaitMessages() {}
12134
12139
  }
12135
- TextBasedChannel_default.applyToClass(ThreadChannel2, true, [
12140
+ TextBasedChannel_default.applyToClass(ThreadChannel, true, [
12136
12141
  "fetchWebhooks",
12137
12142
  "setRateLimitPerUser",
12138
12143
  "setNSFW"
12139
12144
  ]);
12140
- var ThreadChannel_default = ThreadChannel2;
12145
+ var ThreadChannel_default = ThreadChannel;
12141
12146
 
12142
12147
  // src/managers/GuildChannelManager.ts
12143
12148
  var { Error: Error22, TypeError: TypeError20 } = errors_default;
12144
12149
  var {
12145
12150
  ThreadChannelTypes: ThreadChannelTypes3,
12146
- ChannelTypes: ChannelTypes4,
12151
+ ChannelTypes: ChannelTypes5,
12147
12152
  VideoQualityModes,
12148
12153
  SortOrderTypes,
12149
12154
  ForumLayoutTypes
@@ -12220,14 +12225,14 @@ class GuildChannelManager extends CachedManager_default {
12220
12225
  if (typeof type === "number") {
12221
12226
  intType = type;
12222
12227
  } else if (type) {
12223
- intType = resolveEnumValue(ChannelTypes4, type) ?? ChannelTypes4.GUILD_TEXT;
12228
+ intType = resolveEnumValue(ChannelTypes5, type) ?? ChannelTypes5.GUILD_TEXT;
12224
12229
  } else {
12225
- intType = ChannelTypes4.GUILD_TEXT;
12230
+ intType = ChannelTypes5.GUILD_TEXT;
12226
12231
  }
12227
12232
  const videoMode = resolveEnumValue(VideoQualityModes, videoQualityMode);
12228
12233
  const sortMode = resolveEnumValue(SortOrderTypes, defaultSortOrder);
12229
12234
  const layoutMode = resolveEnumValue(ForumLayoutTypes, defaultForumLayout);
12230
- if (intType === ChannelTypes4.GUILD_STORE && !storeChannelDeprecationEmitted) {
12235
+ if (intType === ChannelTypes5.GUILD_STORE && !storeChannelDeprecationEmitted) {
12231
12236
  storeChannelDeprecationEmitted = true;
12232
12237
  process15.emitWarning("Creating store channels is deprecated by Discord and will stop working in March 2022. Check the docs for more info.", "DeprecationWarning");
12233
12238
  }
@@ -16472,7 +16477,7 @@ import { Collection as Collection37 } from "@discordjs/collection";
16472
16477
  var { Channel: Channel5 } = Channel_default;
16473
16478
  var { Opcodes: Opcodes2, Status: Status2 } = Constants_default;
16474
16479
 
16475
- class DMChannel2 extends Channel5 {
16480
+ class DMChannel extends Channel5 {
16476
16481
  constructor(client, data) {
16477
16482
  super(client, data);
16478
16483
  this.type = "DM";
@@ -16581,13 +16586,13 @@ class DMChannel2 extends Channel5 {
16581
16586
  createMessageCollector() {}
16582
16587
  awaitMessages() {}
16583
16588
  }
16584
- TextBasedChannel_default.applyToClass(DMChannel2, true, [
16589
+ TextBasedChannel_default.applyToClass(DMChannel, true, [
16585
16590
  "fetchWebhooks",
16586
16591
  "createWebhook",
16587
16592
  "setRateLimitPerUser",
16588
16593
  "setNSFW"
16589
16594
  ]);
16590
- var DMChannel_default = DMChannel2;
16595
+ var DMChannel_default = DMChannel;
16591
16596
 
16592
16597
  // src/client/actions/ChannelDelete.ts
16593
16598
  var { deletedChannels: deletedChannels2 } = Channel_default;
@@ -16619,7 +16624,7 @@ var ChannelDelete_default = ChannelDeleteAction;
16619
16624
 
16620
16625
  // src/client/actions/ChannelUpdate.ts
16621
16626
  var { Channel: Channel6 } = Channel_default;
16622
- var { ChannelTypes: ChannelTypes5 } = Constants_default;
16627
+ var { ChannelTypes: ChannelTypes6 } = Constants_default;
16623
16628
 
16624
16629
  class ChannelUpdateAction extends Action_default {
16625
16630
  handle(data) {
@@ -16627,7 +16632,7 @@ class ChannelUpdateAction extends Action_default {
16627
16632
  let channel = client.channels.cache.get(data.id);
16628
16633
  if (channel) {
16629
16634
  const old = channel._update(data);
16630
- if (resolveEnumValue(ChannelTypes5, channel.type) !== data.type) {
16635
+ if (resolveEnumValue(ChannelTypes6, channel.type) !== data.type) {
16631
16636
  const guild = isGuildBasedChannel(channel) ? channel.guild : undefined;
16632
16637
  const newChannel = Channel6.create(this.client, data, guild);
16633
16638
  if (!newChannel) {
@@ -21215,7 +21220,6 @@ var ClientVoiceManager_default = ClientVoiceManager;
21215
21220
 
21216
21221
  // src/client/websocket/WebSocketManager.ts
21217
21222
  import EventEmitter12 from "events";
21218
- import { setImmediate as setImmediate2 } from "timers";
21219
21223
  import { Collection as Collection46 } from "@discordjs/collection";
21220
21224
  import { RPCErrorCodes } from "discord-api-types/v10";
21221
21225
 
@@ -21796,6 +21800,9 @@ Emitting close and reconnecting again.`);
21796
21800
  }
21797
21801
  var WebSocketShard_default = WebSocketShard;
21798
21802
 
21803
+ // src/client/websocket/GatewayDispatch.ts
21804
+ import { setImmediate as setImmediate2 } from "timers";
21805
+
21799
21806
  // src/client/websocket/handlers/USER_REQUIRED_ACTION_UPDATE.ts
21800
21807
  async function acceptAgreements(client) {
21801
21808
  try {
@@ -23236,7 +23243,7 @@ var MessageButton_default = MessageButton;
23236
23243
 
23237
23244
  // src/structures/MessageSelectMenu.ts
23238
23245
  import { ChannelType, ComponentType as ComponentType2 } from "discord-api-types/v10";
23239
- var { ChannelTypes: ChannelTypes6 } = Constants_default;
23246
+ var { ChannelTypes: ChannelTypes7 } = Constants_default;
23240
23247
  var SELECT_MENU_TYPES = {
23241
23248
  CHANNEL_SELECT: ComponentType2.ChannelSelect,
23242
23249
  MENTIONABLE_SELECT: ComponentType2.MentionableSelect,
@@ -23251,14 +23258,14 @@ function resolveChannelType(value) {
23251
23258
  if (typeof value === "number") {
23252
23259
  return isChannelType(value) ? value : undefined;
23253
23260
  }
23254
- const resolved = resolveEnumValue(ChannelTypes6, value);
23261
+ const resolved = resolveEnumValue(ChannelTypes7, value);
23255
23262
  return typeof resolved === "number" && isChannelType(resolved) ? resolved : undefined;
23256
23263
  }
23257
23264
  function isPublicChannelType(value) {
23258
23265
  return typeof value === "number" && value in ChannelType;
23259
23266
  }
23260
23267
  function resolvePublicChannelType(value) {
23261
- const resolved = resolveEnumValue(ChannelTypes6, value);
23268
+ const resolved = resolveEnumValue(ChannelTypes7, value);
23262
23269
  return isPublicChannelType(resolved) ? resolved : undefined;
23263
23270
  }
23264
23271
  function serializeSelectOption(option) {
@@ -24278,10 +24285,9 @@ var handlers = Object.fromEntries([
24278
24285
  ]);
24279
24286
  var handlers_default = handlers;
24280
24287
 
24281
- // src/client/websocket/WebSocketManager.ts
24282
- var { Error: Error39 } = errors_default;
24283
- var { Events: Events90, ShardEvents: ShardEvents2, Status: Status10, WSCodes: WSCodes2, WSEvents: WSEvents2 } = Constants_default;
24284
- var BeforeReadyWhitelist = [
24288
+ // src/client/websocket/GatewayDispatch.ts
24289
+ var { Events: Events90, Status: Status10, WSEvents: WSEvents2 } = Constants_default;
24290
+ var BEFORE_READY_WHITELIST = new Set([
24285
24291
  WSEvents2.READY,
24286
24292
  WSEvents2.RESUMED,
24287
24293
  WSEvents2.GUILD_CREATE,
@@ -24289,7 +24295,135 @@ var BeforeReadyWhitelist = [
24289
24295
  WSEvents2.GUILD_MEMBERS_CHUNK,
24290
24296
  WSEvents2.GUILD_MEMBER_ADD,
24291
24297
  WSEvents2.GUILD_MEMBER_REMOVE
24298
+ ]);
24299
+ var ACTION_EVENT_TYPES = [
24300
+ "APPLICATION_COMMAND_PERMISSIONS_UPDATE",
24301
+ "AUTO_MODERATION_ACTION_EXECUTION",
24302
+ "AUTO_MODERATION_RULE_CREATE",
24303
+ "AUTO_MODERATION_RULE_DELETE",
24304
+ "AUTO_MODERATION_RULE_UPDATE",
24305
+ "CHANNEL_CREATE",
24306
+ "CHANNEL_DELETE",
24307
+ "CHANNEL_UPDATE",
24308
+ "GUILD_AUDIT_LOG_ENTRY_CREATE",
24309
+ "GUILD_BAN_ADD",
24310
+ "GUILD_BAN_REMOVE",
24311
+ "GUILD_CHANNELS_POSITION_UPDATE",
24312
+ "GUILD_DELETE",
24313
+ "GUILD_EMOJI_CREATE",
24314
+ "GUILD_EMOJI_DELETE",
24315
+ "GUILD_EMOJI_UPDATE",
24316
+ "GUILD_EMOJIS_UPDATE",
24317
+ "GUILD_INTEGRATIONS_UPDATE",
24318
+ "GUILD_MEMBER_REMOVE",
24319
+ "GUILD_MEMBER_UPDATE",
24320
+ "GUILD_ROLE_CREATE",
24321
+ "GUILD_ROLE_DELETE",
24322
+ "GUILD_ROLE_UPDATE",
24323
+ "GUILD_ROLES_POSITION_UPDATE",
24324
+ "GUILD_SCHEDULED_EVENT_CREATE",
24325
+ "GUILD_SCHEDULED_EVENT_DELETE",
24326
+ "GUILD_SCHEDULED_EVENT_UPDATE",
24327
+ "GUILD_SCHEDULED_EVENT_USER_ADD",
24328
+ "GUILD_SCHEDULED_EVENT_USER_REMOVE",
24329
+ "GUILD_STICKER_CREATE",
24330
+ "GUILD_STICKER_DELETE",
24331
+ "GUILD_STICKER_UPDATE",
24332
+ "GUILD_STICKERS_UPDATE",
24333
+ "GUILD_UPDATE",
24334
+ "INVITE_CREATE",
24335
+ "INVITE_DELETE",
24336
+ "MESSAGE_CREATE",
24337
+ "MESSAGE_DELETE",
24338
+ "MESSAGE_DELETE_BULK",
24339
+ "MESSAGE_POLL_VOTE_ADD",
24340
+ "MESSAGE_POLL_VOTE_REMOVE",
24341
+ "MESSAGE_REACTION_ADD",
24342
+ "MESSAGE_REACTION_REMOVE",
24343
+ "MESSAGE_REACTION_REMOVE_ALL",
24344
+ "MESSAGE_REACTION_REMOVE_EMOJI",
24345
+ "MESSAGE_UPDATE",
24346
+ "PRESENCE_UPDATE",
24347
+ "STAGE_INSTANCE_CREATE",
24348
+ "STAGE_INSTANCE_DELETE",
24349
+ "STAGE_INSTANCE_UPDATE",
24350
+ "THREAD_CREATE",
24351
+ "THREAD_DELETE",
24352
+ "THREAD_LIST_SYNC",
24353
+ "THREAD_MEMBER_UPDATE",
24354
+ "THREAD_MEMBERS_UPDATE",
24355
+ "TYPING_START",
24356
+ "USER_UPDATE",
24357
+ "VOICE_STATE_UPDATE",
24358
+ "WEBHOOKS_UPDATE"
24292
24359
  ];
24360
+ function toActionPropertyName(eventType) {
24361
+ return eventType.split("_").map((part) => part.charAt(0) + part.slice(1).toLowerCase()).join("");
24362
+ }
24363
+ function isActionLike(value) {
24364
+ return typeof value === "object" && value !== null && "handle" in value && typeof value.handle === "function";
24365
+ }
24366
+
24367
+ class GatewayDispatch {
24368
+ client;
24369
+ packetQueue = [];
24370
+ registry = new Map;
24371
+ constructor(client) {
24372
+ this.client = client;
24373
+ }
24374
+ registerDefaults(actions) {
24375
+ const handlers = handlers_default;
24376
+ for (const [eventType, handler] of Object.entries(handlers)) {
24377
+ if (typeof handler === "function") {
24378
+ this.registry.set(eventType, handler);
24379
+ }
24380
+ }
24381
+ for (const eventType of ACTION_EVENT_TYPES) {
24382
+ if (this.registry.has(eventType)) {
24383
+ continue;
24384
+ }
24385
+ const actionName = toActionPropertyName(eventType);
24386
+ const action = Reflect.get(actions, actionName);
24387
+ if (!isActionLike(action)) {
24388
+ continue;
24389
+ }
24390
+ this.registry.set(eventType, (_client, packet, shard) => action.handle(packet.d, shard));
24391
+ }
24392
+ }
24393
+ handle(packet, shard) {
24394
+ const manager = this.client.ws;
24395
+ if (packet && manager.status !== Status10.READY && !BEFORE_READY_WHITELIST.has(packet.t ?? "")) {
24396
+ this.packetQueue.push({ packet, shard });
24397
+ return false;
24398
+ }
24399
+ if (this.packetQueue.length) {
24400
+ const item = this.packetQueue.shift();
24401
+ if (item) {
24402
+ setImmediate2(() => {
24403
+ this.handle(item.packet, item.shard);
24404
+ }).unref();
24405
+ }
24406
+ }
24407
+ if (!packet) {
24408
+ return true;
24409
+ }
24410
+ const eventType = packet.t;
24411
+ if (eventType) {
24412
+ const handler = this.registry.get(eventType);
24413
+ if (handler) {
24414
+ handler(this.client, packet, shard);
24415
+ return true;
24416
+ }
24417
+ }
24418
+ this.client.emit(Events90.UNHANDLED_PACKET, packet, shard);
24419
+ return true;
24420
+ }
24421
+ }
24422
+ var GatewayDispatch_default = GatewayDispatch;
24423
+
24424
+ // src/client/websocket/WebSocketManager.ts
24425
+ var { Error: Error39 } = errors_default;
24426
+ var { Events: Events91, ShardEvents: ShardEvents2, Status: Status11, WSCodes: WSCodes2 } = Constants_default;
24293
24427
  function isRecord26(value) {
24294
24428
  return typeof value === "object" && value !== null;
24295
24429
  }
@@ -24311,8 +24445,8 @@ class WebSocketManager extends EventEmitter12 {
24311
24445
  value: new Set,
24312
24446
  writable: true
24313
24447
  });
24314
- Object.defineProperty(this, "packetQueue", { value: [] });
24315
- this.status = Status10.IDLE;
24448
+ this.dispatch = new GatewayDispatch_default(client);
24449
+ this.status = Status11.IDLE;
24316
24450
  this.destroyed = false;
24317
24451
  this.reconnecting = false;
24318
24452
  }
@@ -24321,7 +24455,7 @@ class WebSocketManager extends EventEmitter12 {
24321
24455
  return sum / this.shards.size;
24322
24456
  }
24323
24457
  debug(message, shard) {
24324
- this.client.emit(Events90.DEBUG, `[WS => ${shard ? `Shard ${shard.id}` : "Manager"}] ${message}`);
24458
+ this.client.emit(Events91.DEBUG, `[WS => ${shard ? `Shard ${shard.id}` : "Manager"}] ${message}`);
24325
24459
  }
24326
24460
  async connect() {
24327
24461
  let gatewayURL = "wss://gateway.discord.gg";
@@ -24361,7 +24495,7 @@ class WebSocketManager extends EventEmitter12 {
24361
24495
  this.shardQueue.delete(shard);
24362
24496
  if (!shard.eventsAttached) {
24363
24497
  shard.on(ShardEvents2.ALL_READY, (unavailableGuilds) => {
24364
- this.client.emit(Events90.SHARD_READY, shard.id, unavailableGuilds);
24498
+ this.client.emit(Events91.SHARD_READY, shard.id, unavailableGuilds);
24365
24499
  if (!this.shardQueue.size) {
24366
24500
  this.reconnecting = false;
24367
24501
  }
@@ -24369,7 +24503,7 @@ class WebSocketManager extends EventEmitter12 {
24369
24503
  });
24370
24504
  shard.on(ShardEvents2.CLOSE, (event) => {
24371
24505
  if (event.code === 1000 ? this.destroyed : event.code !== undefined && UNRECOVERABLE_CLOSE_CODES.includes(event.code)) {
24372
- this.client.emit(Events90.SHARD_DISCONNECT, event, shard.id);
24506
+ this.client.emit(Events91.SHARD_DISCONNECT, event, shard.id);
24373
24507
  if (event.code !== undefined) {
24374
24508
  this.debug(WSCodes2[event.code], shard);
24375
24509
  }
@@ -24378,7 +24512,7 @@ class WebSocketManager extends EventEmitter12 {
24378
24512
  if (event.code !== undefined && UNRESUMABLE_CLOSE_CODES.includes(event.code)) {
24379
24513
  shard.sessionId = null;
24380
24514
  }
24381
- this.client.emit(Events90.SHARD_RECONNECTING, shard.id);
24515
+ this.client.emit(Events91.SHARD_RECONNECTING, shard.id);
24382
24516
  this.shardQueue.add(shard);
24383
24517
  if (shard.sessionId) {
24384
24518
  this.debug(`Session id is present, attempting an immediate reconnect...`, shard);
@@ -24386,11 +24520,11 @@ class WebSocketManager extends EventEmitter12 {
24386
24520
  this.reconnect();
24387
24521
  });
24388
24522
  shard.on(ShardEvents2.INVALID_SESSION, () => {
24389
- this.client.emit(Events90.SHARD_RECONNECTING, shard.id);
24523
+ this.client.emit(Events91.SHARD_RECONNECTING, shard.id);
24390
24524
  });
24391
24525
  shard.on(ShardEvents2.DESTROYED, () => {
24392
24526
  this.debug("Shard was destroyed but no WebSocket connection was present! Reconnecting...", shard);
24393
- this.client.emit(Events90.SHARD_RECONNECTING, shard.id);
24527
+ this.client.emit(Events91.SHARD_RECONNECTING, shard.id);
24394
24528
  this.shardQueue.add(shard);
24395
24529
  this.reconnect();
24396
24530
  });
@@ -24418,7 +24552,7 @@ class WebSocketManager extends EventEmitter12 {
24418
24552
  return true;
24419
24553
  }
24420
24554
  async reconnect() {
24421
- if (this.reconnecting || this.status !== Status10.READY) {
24555
+ if (this.reconnecting || this.status !== Status11.READY) {
24422
24556
  return false;
24423
24557
  }
24424
24558
  this.reconnecting = true;
@@ -24433,8 +24567,8 @@ class WebSocketManager extends EventEmitter12 {
24433
24567
  this.reconnecting = false;
24434
24568
  return this.reconnect();
24435
24569
  }
24436
- if (this.client.listenerCount(Events90.INVALIDATED)) {
24437
- this.client.emit(Events90.INVALIDATED);
24570
+ if (this.client.listenerCount(Events91.INVALIDATED)) {
24571
+ this.client.emit(Events91.INVALIDATED);
24438
24572
  this.destroy();
24439
24573
  } else {
24440
24574
  this.client.destroy();
@@ -24462,44 +24596,21 @@ ${new Error39("MANAGER_DESTROYED").stack}`);
24462
24596
  }
24463
24597
  }
24464
24598
  handlePacket(packet, shard) {
24465
- if (packet && this.status !== Status10.READY && !BeforeReadyWhitelist.includes(packet.t ?? "")) {
24466
- this.packetQueue.push({ packet, shard });
24467
- return false;
24468
- }
24469
- if (this.packetQueue.length) {
24470
- const item = this.packetQueue.shift();
24471
- if (item) {
24472
- setImmediate2(() => {
24473
- this.handlePacket(item.packet, item.shard);
24474
- }).unref();
24475
- }
24476
- }
24477
- if (packet?.t && handlers_default[packet.t]) {
24478
- handlers_default[packet.t](this.client, packet, shard);
24479
- } else if (packet) {
24480
- const actionName = String(packet.t || "").split("_").map((part) => part.charAt(0) + part.slice(1).toLowerCase()).join("");
24481
- const action = Reflect.get(this.client.actions, actionName);
24482
- if (action && typeof action === "object" && "handle" in action && typeof action.handle === "function") {
24483
- Reflect.apply(action.handle, action, [packet.d, shard]);
24484
- return true;
24485
- }
24486
- this.client.emit(Events90.UNHANDLED_PACKET, packet, shard);
24487
- }
24488
- return true;
24599
+ return this.dispatch.handle(packet, shard);
24489
24600
  }
24490
24601
  checkShardsReady() {
24491
- if (this.status === Status10.READY) {
24602
+ if (this.status === Status11.READY) {
24492
24603
  return;
24493
24604
  }
24494
- if (this.shards.size !== this.totalShards || this.shards.some((s) => s.status !== Status10.READY)) {
24605
+ if (this.shards.size !== this.totalShards || this.shards.some((s) => s.status !== Status11.READY)) {
24495
24606
  return;
24496
24607
  }
24497
24608
  this.triggerClientReady();
24498
24609
  }
24499
24610
  triggerClientReady() {
24500
- this.status = Status10.READY;
24611
+ this.status = Status11.READY;
24501
24612
  this.client.readyAt = new Date;
24502
- this.client.emit(Events90.CLIENT_READY, this.client);
24613
+ this.client.emit(Events91.CLIENT_READY, this.client);
24503
24614
  this.handlePacket();
24504
24615
  }
24505
24616
  }
@@ -24610,7 +24721,7 @@ var BillingManager_default = BillingManager;
24610
24721
  // src/managers/ChannelManager.ts
24611
24722
  import process21 from "process";
24612
24723
  var { Channel: Channel8 } = Channel_default;
24613
- var { Events: Events91, RelationshipTypes: RelationshipTypes2 } = Constants_default;
24724
+ var { Events: Events92, RelationshipTypes: RelationshipTypes2 } = Constants_default;
24614
24725
  var cacheWarningEmitted4 = false;
24615
24726
 
24616
24727
  class ChannelManager extends CachedManager_default {
@@ -24649,7 +24760,7 @@ class ChannelManager extends CachedManager_default {
24649
24760
  }
24650
24761
  const channel = data instanceof Channel8 ? data : Channel8.create(this.client, data, guild, { allowUnknownGuild });
24651
24762
  if (!channel) {
24652
- this.client.emit(Events91.DEBUG, `Failed to find guild, or unknown type for channel ${data.id} ${data.type}`);
24763
+ this.client.emit(Events92.DEBUG, `Failed to find guild, or unknown type for channel ${data.id} ${data.type}`);
24653
24764
  return null;
24654
24765
  }
24655
24766
  if (cache && !allowUnknownGuild) {
@@ -24936,8 +25047,8 @@ var { Guild: Guild2 } = Guild_default;
24936
25047
  var { GuildMember: GuildMember6 } = GuildMember_default;
24937
25048
  var { Role: Role7 } = Role_default;
24938
25049
  var {
24939
- ChannelTypes: ChannelTypes7,
24940
- Events: Events92,
25050
+ ChannelTypes: ChannelTypes8,
25051
+ Events: Events93,
24941
25052
  OverwriteTypes: OverwriteTypes4,
24942
25053
  VerificationLevels: VerificationLevels3,
24943
25054
  DefaultMessageNotificationLevels: DefaultMessageNotificationLevels2,
@@ -24996,7 +25107,7 @@ class GuildManager extends CachedManager_default {
24996
25107
  const resolvedDefaultMessageNotifications = typeof defaultMessageNotifications === "string" ? DefaultMessageNotificationLevels2[defaultMessageNotifications] : defaultMessageNotifications;
24997
25108
  const resolvedExplicitContentFilter = typeof explicitContentFilter === "string" ? ExplicitContentFilterLevels2[explicitContentFilter] : explicitContentFilter;
24998
25109
  for (const channel of channels) {
24999
- channel.type &&= resolveEnumValue(ChannelTypes7, channel.type);
25110
+ channel.type &&= resolveEnumValue(ChannelTypes8, channel.type);
25000
25111
  channel.parent_id = channel.parentId;
25001
25112
  delete channel.parentId;
25002
25113
  channel.user_limit = channel.userLimit;
@@ -25052,15 +25163,15 @@ class GuildManager extends CachedManager_default {
25052
25163
  if (timeoutState.timer) {
25053
25164
  clearTimeout(timeoutState.timer);
25054
25165
  }
25055
- this.client.removeListener(Events92.GUILD_CREATE, handleGuild);
25166
+ this.client.removeListener(Events93.GUILD_CREATE, handleGuild);
25056
25167
  this.client.decrementMaxListeners();
25057
25168
  resolve(guild);
25058
25169
  }
25059
25170
  };
25060
25171
  this.client.incrementMaxListeners();
25061
- this.client.on(Events92.GUILD_CREATE, handleGuild);
25172
+ this.client.on(Events93.GUILD_CREATE, handleGuild);
25062
25173
  timeoutState.timer = setTimeout14(() => {
25063
- this.client.removeListener(Events92.GUILD_CREATE, handleGuild);
25174
+ this.client.removeListener(Events93.GUILD_CREATE, handleGuild);
25064
25175
  this.client.decrementMaxListeners();
25065
25176
  resolve(this.client.guilds._add(data));
25066
25177
  }, 1e4).unref();
@@ -25620,7 +25731,7 @@ import { parentPort } from "worker_threads";
25620
25731
  import process23 from "process";
25621
25732
  import { promisify } from "util";
25622
25733
  var { Error: Error41 } = errors_default;
25623
- var { Events: Events93 } = Constants_default;
25734
+ var { Events: Events94 } = Constants_default;
25624
25735
  function readProperty(value, key) {
25625
25736
  if (typeof value !== "object" || value === null) {
25626
25737
  return;
@@ -25805,12 +25916,12 @@ class ShardClientUtil {
25805
25916
  const reason = error instanceof Error41 ? error : new Error41(String(error));
25806
25917
  const wrapped = new Error41(`Error when sending ${type} response to master process: ${reason.message}`);
25807
25918
  wrapped.stack = reason.stack;
25808
- this.client.emit(Events93.ERROR, wrapped);
25919
+ this.client.emit(Events94.ERROR, wrapped);
25809
25920
  }
25810
25921
  }
25811
25922
  static singleton(client, mode) {
25812
25923
  if (this._singleton) {
25813
- client.emit(Events93.WARN, "Multiple clients created in child process/worker; only the first will handle sharding helpers.");
25924
+ client.emit(Events94.WARN, "Multiple clients created in child process/worker; only the first will handle sharding helpers.");
25814
25925
  } else {
25815
25926
  this._singleton = new this(client, mode);
25816
25927
  }
@@ -26313,7 +26424,7 @@ var RemoteAuth_default = DiscordAuthWebsocket;
26313
26424
  // src/client/Client.ts
26314
26425
  var { Error: Error42, TypeError: TypeError36 } = errors_default;
26315
26426
  var { Sticker: Sticker7 } = Sticker_default;
26316
- var { Events: Events94, Status: Status11 } = Constants_default;
26427
+ var { Events: Events95, Status: Status12 } = Constants_default;
26317
26428
  var deprecationEmitted2 = false;
26318
26429
  function validateBasicOptions(options) {
26319
26430
  if (typeof options.makeCache !== "function") {
@@ -26398,6 +26509,7 @@ class Client extends BaseClient_default {
26398
26509
  this._finalizers = new FinalizationRegistry(this._finalize.bind(this));
26399
26510
  this.ws = new WebSocketManager_default(this);
26400
26511
  this.actions = new ActionsManager_default(this);
26512
+ this.ws.dispatch.registerDefaults(this.actions);
26401
26513
  this.voice = new ClientVoiceManager_default(this);
26402
26514
  this.voiceStates = new VoiceStateManager_default({ client: this });
26403
26515
  const shardingMode = process24.env.SHARDING_MANAGER_MODE;
@@ -26456,16 +26568,16 @@ class Client extends BaseClient_default {
26456
26568
  }
26457
26569
  const normalizedToken = token.replace(/^(?:Bot|Bearer)\s*/iu, "");
26458
26570
  this.token = normalizedToken;
26459
- this.emit(Events94.DEBUG, `
26571
+ this.emit(Events95.DEBUG, `
26460
26572
  Logging on with a user token is unfortunately against the Discord
26461
26573
  \`Terms of Service\` <https://support.discord.com/hc/en-us/articles/115002192352>
26462
26574
  and doing so might potentially get your account banned.
26463
26575
  Use this at your own risk.`);
26464
- this.emit(Events94.DEBUG, `Provided token: ${normalizedToken.split(".").map((value, index) => index > 1 ? value.replaceAll(/./gu, "*") : value).join(".")}`);
26576
+ this.emit(Events95.DEBUG, `Provided token: ${normalizedToken.split(".").map((value, index) => index > 1 ? value.replaceAll(/./gu, "*") : value).join(".")}`);
26465
26577
  if (this.options.presence) {
26466
26578
  this.options.ws.presence = this.presence._parse(this.options.presence);
26467
26579
  }
26468
- this.emit(Events94.DEBUG, "Preparing to connect to the gateway...");
26580
+ this.emit(Events95.DEBUG, "Preparing to connect to the gateway...");
26469
26581
  try {
26470
26582
  await this.ws.connect();
26471
26583
  return normalizedToken;
@@ -26515,7 +26627,7 @@ class Client extends BaseClient_default {
26515
26627
  return null;
26516
26628
  }
26517
26629
  isReady() {
26518
- return !this.ws.destroyed && this.ws.status === Status11.READY;
26630
+ return !this.ws.destroyed && this.ws.status === Status12.READY;
26519
26631
  }
26520
26632
  destroy() {
26521
26633
  super.destroy();
@@ -26607,10 +26719,10 @@ class Client extends BaseClient_default {
26607
26719
  cleanup();
26608
26720
  this._cleanups.delete(cleanup);
26609
26721
  if (message) {
26610
- this.emit(Events94.DEBUG, message);
26722
+ this.emit(Events95.DEBUG, message);
26611
26723
  }
26612
26724
  } catch {
26613
- this.emit(Events94.DEBUG, `Garbage collection failed on ${name ?? "an unknown item"}.`);
26725
+ this.emit(Events95.DEBUG, `Garbage collection failed on ${name ?? "an unknown item"}.`);
26614
26726
  }
26615
26727
  }
26616
26728
  sweepMessages(lifetime = this.options.messageCacheLifetime) {
@@ -26618,7 +26730,7 @@ class Client extends BaseClient_default {
26618
26730
  throw new TypeError36("INVALID_TYPE", "lifetime", "number");
26619
26731
  }
26620
26732
  if (lifetime <= 0) {
26621
- this.emit(Events94.DEBUG, "Didn't sweep messages - lifetime is unlimited");
26733
+ this.emit(Events95.DEBUG, "Didn't sweep messages - lifetime is unlimited");
26622
26734
  return -1;
26623
26735
  }
26624
26736
  const filter = Sweepers_default.outdatedMessageSweepFilter(lifetime)();
@@ -26626,7 +26738,7 @@ class Client extends BaseClient_default {
26626
26738
  return -1;
26627
26739
  }
26628
26740
  const messages = this.sweepers.sweepMessages(filter);
26629
- this.emit(Events94.DEBUG, `Swept ${messages} messages older than ${lifetime} seconds`);
26741
+ this.emit(Events95.DEBUG, `Swept ${messages} messages older than ${lifetime} seconds`);
26630
26742
  return messages;
26631
26743
  }
26632
26744
  async fetchGuildPreview(guild) {
@@ -26729,14 +26841,14 @@ class Client extends BaseClient_default {
26729
26841
  session_id: this.sessionId
26730
26842
  }
26731
26843
  });
26732
- this.emit(Events94.DEBUG, `[Invite > Guild ${guildId}] Joined`);
26844
+ this.emit(Events95.DEBUG, `[Invite > Guild ${guildId}] Joined`);
26733
26845
  if (!guildId) {
26734
26846
  const channelId = inviteInfo.channelId || data.channel?.id;
26735
26847
  return channelId ? this.channels.cache.has(channelId) : false;
26736
26848
  }
26737
26849
  const guild = this.guilds.cache.get(guildId);
26738
26850
  if (inviteInfo.flags.has("GUEST")) {
26739
- this.emit(Events94.DEBUG, `[Invite > Guild ${guildId}] Guest invite`);
26851
+ this.emit(Events95.DEBUG, `[Invite > Guild ${guildId}] Guest invite`);
26740
26852
  return guild;
26741
26853
  }
26742
26854
  if (resolvedOptions.bypassOnboarding) {
@@ -26776,15 +26888,15 @@ class Client extends BaseClient_default {
26776
26888
  onboarding_responses_seen
26777
26889
  }
26778
26890
  });
26779
- this.emit(Events94.DEBUG, `[Invite > Guild ${guildId}] Bypassed onboarding`);
26891
+ this.emit(Events95.DEBUG, `[Invite > Guild ${guildId}] Bypassed onboarding`);
26780
26892
  }
26781
26893
  async bypassVerification(guildId, verificationLevel) {
26782
26894
  if (verificationLevel === "VERY_HIGH" && !this.user?.phone) {
26783
- this.emit(Events94.DEBUG, `[Invite > Guild ${guildId}] Cannot bypass verify (Phone required)`);
26895
+ this.emit(Events95.DEBUG, `[Invite > Guild ${guildId}] Cannot bypass verify (Phone required)`);
26784
26896
  return;
26785
26897
  }
26786
26898
  if (verificationLevel !== "NONE" && !this.user?.email) {
26787
- this.emit(Events94.DEBUG, `[Invite > Guild ${guildId}] Cannot bypass verify (Email required)`);
26899
+ this.emit(Events95.DEBUG, `[Invite > Guild ${guildId}] Cannot bypass verify (Email required)`);
26788
26900
  return;
26789
26901
  }
26790
26902
  let getForm;
@@ -26800,7 +26912,7 @@ class Client extends BaseClient_default {
26800
26912
  await this.api.guilds(guildId).requests["@me"].put({
26801
26913
  data: { form_fields: [form], version: getForm.version }
26802
26914
  });
26803
- this.emit(Events94.DEBUG, `[Invite > Guild ${guildId}] Bypassed verify`);
26915
+ this.emit(Events95.DEBUG, `[Invite > Guild ${guildId}] Bypassed verify`);
26804
26916
  }
26805
26917
  }
26806
26918
  redeemNitro(nitro, channel, paymentSourceId) {
@@ -27577,7 +27689,7 @@ class OAuth2RoleConnection {
27577
27689
  }
27578
27690
  }
27579
27691
  // src/util/Events.ts
27580
- var Events95 = {
27692
+ var Events96 = {
27581
27693
  API_REQUEST: "apiRequest",
27582
27694
  API_RESPONSE: "apiResponse",
27583
27695
  APPLICATION_COMMAND_CREATE: "applicationCommandCreate",
@@ -27765,7 +27877,7 @@ var Events95 = {
27765
27877
  Warn: "warn",
27766
27878
  WebhooksUpdate: "webhooksUpdate"
27767
27879
  };
27768
- var Events_default = Events95;
27880
+ var Events_default = Events96;
27769
27881
  // src/util/Formatters.ts
27770
27882
  import {
27771
27883
  blockQuote,
@@ -27827,7 +27939,7 @@ var Partials;
27827
27939
  })(Partials ||= {});
27828
27940
  var Partials_default = Partials;
27829
27941
  // src/util/Status.ts
27830
- var Status12;
27942
+ var Status13;
27831
27943
  ((Status) => {
27832
27944
  Status[Status["Ready"] = 0] = "Ready";
27833
27945
  Status[Status["Connecting"] = 1] = "Connecting";
@@ -27838,8 +27950,8 @@ var Status12;
27838
27950
  Status[Status["WaitingForGuilds"] = 6] = "WaitingForGuilds";
27839
27951
  Status[Status["Identifying"] = 7] = "Identifying";
27840
27952
  Status[Status["Resuming"] = 8] = "Resuming";
27841
- })(Status12 ||= {});
27842
- var Status_default = Status12;
27953
+ })(Status13 ||= {});
27954
+ var Status_default = Status13;
27843
27955
  // src/managers/ThreadManager.ts
27844
27956
  import { Collection as Collection56 } from "@discordjs/collection";
27845
27957
  class ThreadManager extends CachedManager_default {
@@ -27926,7 +28038,7 @@ var ThreadManager_default = ThreadManager;
27926
28038
 
27927
28039
  // src/managers/GuildForumThreadManager.ts
27928
28040
  var { TypeError: TypeError38 } = errors_default;
27929
- var { resolveAutoArchiveMaxLimit: resolveAutoArchiveMaxLimit3, getUploadURL, uploadFile } = Util_default;
28041
+ var { resolveAutoArchiveMaxLimit: resolveAutoArchiveMaxLimit3 } = Util_default;
27930
28042
 
27931
28043
  class GuildForumThreadManager extends ThreadManager_default {
27932
28044
  async create({
@@ -27942,26 +28054,7 @@ class GuildForumThreadManager extends ThreadManager_default {
27942
28054
  }
27943
28055
  const messagePayload = message instanceof MessagePayload_default ? message.resolveData() : MessagePayload_default.create(this, message).resolveData();
27944
28056
  const { data: body, files } = await messagePayload.resolveFiles();
27945
- const fileList = files ?? [];
27946
- const attachments = await getUploadURL(this.client, this.channel.id, fileList);
27947
- const requestPromises = attachments.map(async (attachment) => {
27948
- const index = Number(attachment.id);
27949
- const file = fileList[index];
27950
- if (!file) {
27951
- throw new TypeError38("GUILD_FORUM_ATTACHMENT_MISSING");
27952
- }
27953
- await uploadFile(file.file, attachment.upload_url);
27954
- return {
27955
- description: file.description,
27956
- duration_secs: file.duration_secs,
27957
- filename: file.name,
27958
- id: attachment.id,
27959
- uploaded_filename: attachment.upload_filename,
27960
- waveform: file.waveform
27961
- };
27962
- });
27963
- const attachmentsData = await Promise.all(requestPromises);
27964
- attachmentsData.sort((left, right) => Math.trunc(Number(left.id)) - Math.trunc(Number(right.id)));
28057
+ const attachmentsData = await uploadMessageAttachments(this.client, this.channel.id, files ?? []);
27965
28058
  let archiveDuration = autoArchiveDuration;
27966
28059
  if (autoArchiveDuration === "MAX") {
27967
28060
  resolveAutoArchiveMaxLimit3(this.channel.guild);
@@ -27985,7 +28078,7 @@ class GuildForumThreadManager extends ThreadManager_default {
27985
28078
  var GuildForumThreadManager_default = GuildForumThreadManager;
27986
28079
  // src/managers/GuildTextThreadManager.ts
27987
28080
  var { TypeError: TypeError39 } = errors_default;
27988
- var { ChannelTypes: ChannelTypes8 } = Constants_default;
28081
+ var { ChannelTypes: ChannelTypes9 } = Constants_default;
27989
28082
  var { resolveAutoArchiveMaxLimit: resolveAutoArchiveMaxLimit4 } = Util_default;
27990
28083
 
27991
28084
  class GuildTextThreadManager extends ThreadManager_default {
@@ -28002,7 +28095,7 @@ class GuildTextThreadManager extends ThreadManager_default {
28002
28095
  if (type && typeof type !== "string" && typeof type !== "number") {
28003
28096
  throw new TypeError39("INVALID_TYPE", "type", "ThreadChannelType or Number");
28004
28097
  }
28005
- let resolvedType = this.channel.type === "GUILD_NEWS" ? ChannelTypes8.GUILD_NEWS_THREAD : ChannelTypes8.GUILD_PUBLIC_THREAD;
28098
+ let resolvedType = this.channel.type === "GUILD_NEWS" ? ChannelTypes9.GUILD_NEWS_THREAD : ChannelTypes9.GUILD_PUBLIC_THREAD;
28006
28099
  if (startMessage) {
28007
28100
  const { messages } = this.channel;
28008
28101
  const startMessageId = messages?.resolveId(startMessage);
@@ -28012,7 +28105,7 @@ class GuildTextThreadManager extends ThreadManager_default {
28012
28105
  path = path.messages(startMessageId);
28013
28106
  } else if (this.channel.type !== "GUILD_NEWS") {
28014
28107
  if (typeof type === "string") {
28015
- resolvedType = resolveEnumValue(ChannelTypes8, type);
28108
+ resolvedType = resolveEnumValue(ChannelTypes9, type);
28016
28109
  } else if (typeof type === "number") {
28017
28110
  resolvedType = type;
28018
28111
  }
@@ -28021,7 +28114,7 @@ class GuildTextThreadManager extends ThreadManager_default {
28021
28114
  const data = await path.threads.post({
28022
28115
  data: {
28023
28116
  auto_archive_duration: resolvedAutoArchiveDuration,
28024
- invitable: resolvedType === ChannelTypes8.GUILD_PRIVATE_THREAD ? invitable : undefined,
28117
+ invitable: resolvedType === ChannelTypes9.GUILD_PRIVATE_THREAD ? invitable : undefined,
28025
28118
  name,
28026
28119
  rate_limit_per_user: rateLimitPerUser,
28027
28120
  type: resolvedType
@@ -28101,7 +28194,7 @@ class BaseGuildTextChannel extends GuildChannel_default {
28101
28194
  TextBasedChannel_default.applyToClass(BaseGuildTextChannel, true);
28102
28195
  var BaseGuildTextChannel_default = BaseGuildTextChannel;
28103
28196
  // src/structures/CategoryChannel.ts
28104
- class CategoryChannel2 extends GuildChannel_default {
28197
+ class CategoryChannel extends GuildChannel_default {
28105
28198
  get children() {
28106
28199
  return this.guild.channels.cache.filter((channel) => channel.parentId === this.id);
28107
28200
  }
@@ -28112,7 +28205,7 @@ class CategoryChannel2 extends GuildChannel_default {
28112
28205
  });
28113
28206
  }
28114
28207
  }
28115
- var CategoryChannel_default = CategoryChannel2;
28208
+ var CategoryChannel_default = CategoryChannel;
28116
28209
  // src/structures/ContainerComponent.ts
28117
28210
  import { ComponentType as ComponentType6 } from "discord-api-types/v10";
28118
28211
  function isContainerChild(component) {
@@ -28147,7 +28240,7 @@ var ContainerComponent_default = ContainerComponent;
28147
28240
  // src/structures/DirectoryChannel.ts
28148
28241
  var { Channel: Channel9 } = Channel_default;
28149
28242
 
28150
- class DirectoryChannel2 extends Channel9 {
28243
+ class DirectoryChannel extends Channel9 {
28151
28244
  _patch(data) {
28152
28245
  super._patch(data);
28153
28246
  if (typeof data.name === "string") {
@@ -28155,7 +28248,7 @@ class DirectoryChannel2 extends Channel9 {
28155
28248
  }
28156
28249
  }
28157
28250
  }
28158
- var DirectoryChannel_default = DirectoryChannel2;
28251
+ var DirectoryChannel_default = DirectoryChannel;
28159
28252
  // src/structures/UnfurledMediaItem.ts
28160
28253
  function isRecord27(value) {
28161
28254
  return typeof value === "object" && value !== null;
@@ -28266,7 +28359,7 @@ var ThreadOnlyChannel_default = ThreadOnlyChannel;
28266
28359
  // src/structures/ForumChannel.ts
28267
28360
  var { ForumLayoutTypes: ForumLayoutTypes2 } = Constants_default;
28268
28361
 
28269
- class ForumChannel2 extends ThreadOnlyChannel_default {
28362
+ class ForumChannel extends ThreadOnlyChannel_default {
28270
28363
  _patch(data) {
28271
28364
  super._patch(data);
28272
28365
  this.defaultForumLayout = resolveEnumMember(ForumLayoutTypes2, data.default_forum_layout ?? 0) ?? ForumLayoutTypes2.NOT_SET;
@@ -28275,11 +28368,11 @@ class ForumChannel2 extends ThreadOnlyChannel_default {
28275
28368
  return this.edit({ defaultForumLayout }, reason);
28276
28369
  }
28277
28370
  }
28278
- var ForumChannel_default = ForumChannel2;
28371
+ var ForumChannel_default = ForumChannel;
28279
28372
  // src/structures/MediaChannel.ts
28280
- class MediaChannel2 extends ThreadOnlyChannel_default {
28373
+ class MediaChannel extends ThreadOnlyChannel_default {
28281
28374
  }
28282
- var MediaChannel_default = MediaChannel2;
28375
+ var MediaChannel_default = MediaChannel;
28283
28376
  // src/structures/MediaGalleryItem.ts
28284
28377
  class MediaGalleryItem {
28285
28378
  constructor(data = {}) {
@@ -28322,7 +28415,7 @@ var MediaGalleryComponent_default = MediaGalleryComponent;
28322
28415
  // src/structures/NewsChannel.ts
28323
28416
  var { Error: Error45 } = errors_default;
28324
28417
 
28325
- class NewsChannel2 extends BaseGuildTextChannel_default {
28418
+ class NewsChannel extends BaseGuildTextChannel_default {
28326
28419
  async addFollower(channel, reason) {
28327
28420
  const channelId = this.guild.channels.resolveId(channel);
28328
28421
  if (!channelId) {
@@ -28332,7 +28425,7 @@ class NewsChannel2 extends BaseGuildTextChannel_default {
28332
28425
  return this;
28333
28426
  }
28334
28427
  }
28335
- var NewsChannel_default = NewsChannel2;
28428
+ var NewsChannel_default = NewsChannel;
28336
28429
  // src/structures/TextDisplayComponent.ts
28337
28430
  import { ComponentType as ComponentType9 } from "discord-api-types/v10";
28338
28431
 
@@ -28433,7 +28526,7 @@ class SeparatorComponent extends BaseMessageComponent_default {
28433
28526
  }
28434
28527
  var SeparatorComponent_default = SeparatorComponent;
28435
28528
  // src/structures/StageChannel.ts
28436
- class StageChannel2 extends BaseGuildVoiceChannel_default {
28529
+ class StageChannel extends BaseGuildVoiceChannel_default {
28437
28530
  _patch(data) {
28438
28531
  super._patch(data);
28439
28532
  if ("topic" in data) {
@@ -28450,9 +28543,9 @@ class StageChannel2 extends BaseGuildVoiceChannel_default {
28450
28543
  return this.edit({ topic }, reason);
28451
28544
  }
28452
28545
  }
28453
- var StageChannel_default = StageChannel2;
28546
+ var StageChannel_default = StageChannel;
28454
28547
  // src/structures/StoreChannel.ts
28455
- class StoreChannel2 extends GuildChannel_default {
28548
+ class StoreChannel extends GuildChannel_default {
28456
28549
  constructor(guild, data, client) {
28457
28550
  super(guild, data, client);
28458
28551
  this.nsfw = Boolean(data.nsfw);
@@ -28470,9 +28563,9 @@ class StoreChannel2 extends GuildChannel_default {
28470
28563
  return this.guild.invites.fetch({ cache, channelId: this.id });
28471
28564
  }
28472
28565
  }
28473
- var StoreChannel_default = StoreChannel2;
28566
+ var StoreChannel_default = StoreChannel;
28474
28567
  // src/structures/TextChannel.ts
28475
- class TextChannel2 extends BaseGuildTextChannel_default {
28568
+ class TextChannel extends BaseGuildTextChannel_default {
28476
28569
  _patch(data) {
28477
28570
  super._patch(data);
28478
28571
  if ("rate_limit_per_user" in data) {
@@ -28483,12 +28576,12 @@ class TextChannel2 extends BaseGuildTextChannel_default {
28483
28576
  return this.edit({ rateLimitPerUser }, reason);
28484
28577
  }
28485
28578
  }
28486
- var TextChannel_default = TextChannel2;
28579
+ var TextChannel_default = TextChannel;
28487
28580
  // src/structures/VoiceChannel.ts
28488
28581
  import process27 from "process";
28489
28582
  var deprecationEmittedForEditable = false;
28490
28583
 
28491
- class VoiceChannel2 extends BaseGuildVoiceChannel_default {
28584
+ class VoiceChannel extends BaseGuildVoiceChannel_default {
28492
28585
  get editable() {
28493
28586
  if (!deprecationEmittedForEditable) {
28494
28587
  process27.emitWarning("The VoiceChannel#editable getter is deprecated. Use VoiceChannel#manageable instead.", "DeprecationWarning");
@@ -28519,7 +28612,7 @@ class VoiceChannel2 extends BaseGuildVoiceChannel_default {
28519
28612
  return Boolean(me && me.communicationDisabledUntilTimestamp !== null && me.communicationDisabledUntilTimestamp < Date.now() && permissions.has(Permissions_default.FLAGS.SPEAK, false));
28520
28613
  }
28521
28614
  }
28522
- var VoiceChannel_default = VoiceChannel2;
28615
+ var VoiceChannel_default = VoiceChannel;
28523
28616
  // src/structures/WebEmbed.ts
28524
28617
  var { RangeError: RangeError12 } = errors_default;
28525
28618
  var baseURL2 = "https://webembed-sb.onrender.com/embed?";