@wolfstar/plugin-gateway 0.6.0 → 0.7.0-next-20260928141845

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/esm/index.js CHANGED
@@ -2,8 +2,8 @@ import { Client, Listener, container } from "@wolfstar/http-framework";
2
2
  import { CloseCodes, DefaultWebSocketManagerOptions, WebSocketManager, WebSocketShardEvents, WebSocketShardStatus } from "@discordjs/ws";
3
3
  import { Client as Client$1 } from "@discordjs/core";
4
4
  import { applyGatewayDispatch, autoModerationRuleKey, banKey, createCache, emojiKey, integrationKey, inviteKey, isIterableCache, memberKey, mergeValues, messageKey, presenceKey, roleKey, scheduledEventKey, soundboardSoundKey, stageInstanceKey, stickerKey, threadMemberKey, voiceStateKey } from "@wolfstar/plugin-cache";
5
- import { ActivityType, AuditLogEvent, ChannelType, FormattingPatterns, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, GuildFeature, GuildMemberFlags, GuildPremiumTier, GuildScheduledEventStatus, GuildSystemChannelFlags, GuildWidgetStyle, InviteType, MessageFlags, MessageReferenceType, MessageType, OverwriteType, PermissionFlagsBits, PresenceUpdateStatus, RoleFlags, RouteBases, Routes, StickerFormatType, UserFlags, WebhookType } from "discord-api-types/v10";
6
- import { Activity as Activity$1, ActivityFlagsBitField as ActivityFlagsBitField$1, AnnouncementChannel as AnnouncementChannel$1, AnnouncementThreadChannel as AnnouncementThreadChannel$1, Attachment as Attachment$1, AttachmentFlagsBitField as AttachmentFlagsBitField$1, AutoModerationRule as AutoModerationRule$1, BitField, BitField as BitField$1, CategoryChannel as CategoryChannel$1, Channel as Channel$1, ChannelFlagsBitField as ChannelFlagsBitField$1, DMChannel as DMChannel$1, Embed as Embed$1, Emoji as Emoji$1, ForumChannel as ForumChannel$1, GroupDMChannel as GroupDMChannel$1, Invite, MediaChannel as MediaChannel$1, Message as Message$1, MessageFlagsBitField as MessageFlagsBitField$1, PermissionsBitField, Poll as Poll$1, PollAnswer as PollAnswer$1, Presence as Presence$1, PrivateThreadChannel as PrivateThreadChannel$1, PublicThreadChannel as PublicThreadChannel$1, Reaction, SoundboardSound as SoundboardSound$1, StageChannel as StageChannel$1, StageInstance as StageInstance$1, Sticker as Sticker$1, StickerPack as StickerPack$1, Structure as Structure$1, TextChannel as TextChannel$1, User as User$1, VoiceChannel as VoiceChannel$1, VoiceState as VoiceState$1, Webhook as Webhook$1 } from "@discordjs/structures";
5
+ import { ActivityType, AuditLogEvent, ButtonStyle, ChannelType, ComponentType, FormattingPatterns, GatewayDispatchEvents, GatewayIntentBits, GatewayOpcodes, GuildFeature, GuildMemberFlags, GuildPremiumTier, GuildScheduledEventStatus, GuildSystemChannelFlags, GuildWidgetStyle, InviteType, MessageFlags, MessageReferenceType, MessageType, OverwriteType, PermissionFlagsBits, PresenceUpdateStatus, RoleFlags, RouteBases, Routes, SeparatorSpacingSize, StickerFormatType, UserFlags, WebhookType } from "discord-api-types/v10";
6
+ import { ActionRowComponent, Activity as Activity$1, ActivityFlagsBitField as ActivityFlagsBitField$1, AnnouncementChannel as AnnouncementChannel$1, AnnouncementThreadChannel as AnnouncementThreadChannel$1, Attachment as Attachment$1, AttachmentFlagsBitField as AttachmentFlagsBitField$1, AutoModerationRule as AutoModerationRule$1, BitField, BitField as BitField$1, CategoryChannel as CategoryChannel$1, Channel as Channel$1, ChannelFlagsBitField as ChannelFlagsBitField$1, ChannelSelectMenuComponent as ChannelSelectMenuComponent$1, Component as Component$1, ContainerComponent as ContainerComponent$1, DMChannel as DMChannel$1, Embed as Embed$1, Emoji as Emoji$1, FileComponent as FileComponent$1, FileUploadComponent as FileUploadComponent$1, ForumChannel as ForumChannel$1, GroupDMChannel as GroupDMChannel$1, InteractiveButtonComponent as InteractiveButtonComponent$1, Invite, LinkButtonComponent as LinkButtonComponent$1, MediaChannel as MediaChannel$1, MediaGalleryComponent as MediaGalleryComponent$1, MediaGalleryItem as MediaGalleryItem$1, MentionableSelectMenuComponent as MentionableSelectMenuComponent$1, Message as Message$1, MessageFlagsBitField as MessageFlagsBitField$1, PermissionsBitField, Poll as Poll$1, PollAnswer as PollAnswer$1, PremiumButtonComponent as PremiumButtonComponent$1, Presence as Presence$1, PrivateThreadChannel as PrivateThreadChannel$1, PublicThreadChannel as PublicThreadChannel$1, Reaction, RoleSelectMenuComponent as RoleSelectMenuComponent$1, SectionComponent as SectionComponent$1, SeparatorComponent as SeparatorComponent$1, SoundboardSound as SoundboardSound$1, StageChannel as StageChannel$1, StageInstance as StageInstance$1, Sticker as Sticker$1, StickerPack as StickerPack$1, StringSelectMenuComponent as StringSelectMenuComponent$1, Structure as Structure$1, TextChannel as TextChannel$1, TextDisplayComponent as TextDisplayComponent$1, TextInputComponent as TextInputComponent$1, ThumbnailComponent as ThumbnailComponent$1, UnfurledMediaItem as UnfurledMediaItem$1, User as User$1, UserSelectMenuComponent as UserSelectMenuComponent$1, VoiceChannel as VoiceChannel$1, VoiceState as VoiceState$1, Webhook as Webhook$1 } from "@discordjs/structures";
7
7
  import { readFile } from "node:fs/promises";
8
8
  import { basename } from "node:path";
9
9
  import { CDN, DiscordAPIError } from "@discordjs/rest";
@@ -51,6 +51,113 @@ var EventGatewayListener = class extends Listener {
51
51
  }
52
52
  };
53
53
 
54
+ //#endregion
55
+ //#region src/errors/Messages.ts
56
+ /**
57
+ * The message of every {@link GatewayErrorCode}: a string, or a function formatting the arguments passed to the
58
+ * error's constructor.
59
+ */
60
+ const GatewayErrorMessages = {
61
+ ClientSessionStoreConflict: "sessionStore replaces gateway.retrieveSessionInfo and gateway.updateSessionInfo, pass one or the other",
62
+ ClientNotConstructed: "No GatewayClient has been constructed yet",
63
+ DispatchHandlerConflict: (event) => `Dispatch event "${event}" is registered in both DispatchHandlers and MultiDispatchHandlers`,
64
+ DispatchTimeout: (type, shardId, partition, timeout) => `Processing ${type} on shard ${shardId} (${partition ?? "barrier"}) took longer than ${timeout}ms`,
65
+ SessionStoreFailed: (operation, shardId) => `Cannot ${operation === "get" ? "read" : "write"} the session of shard ${shardId} in the session store`,
66
+ SessionStoreTimeout: (timeout) => `Timed out after ${timeout}ms`,
67
+ CacheAsynchronous: (entity) => `The ${entity} cache is asynchronous, use get instead of cached`,
68
+ CacheRelationsAsynchronous: (entity) => `The relations of the ${entity} cache are read from an asynchronous cache, use get instead of cached`,
69
+ CacheNotIterable: (entity) => `The ${entity} cache cannot enumerate its entries (it has no keys/values/entries)`,
70
+ CacheKeyUnresolvable: (entity, reason) => `Cannot key a ${entity} ${reason}`,
71
+ IdUnresolvable: "Cannot resolve an ID from a structure without one",
72
+ ChannelGuildUnknown: (channelId) => `Channel ${channelId} has no known guild`,
73
+ ChannelTypeChanged: (channelId, from, to) => `Channel ${channelId} changed type from ${from} to ${to}`,
74
+ ChannelLockPermissionsConflict: "Pass either lockPermissions or permissionOverwrites, not both",
75
+ GuildChannelOrphan: (channelId) => `Channel ${channelId} has no category to sync its permissions with`,
76
+ ThreadParentUnknown: (threadId) => `Thread ${threadId} has no known parent`,
77
+ ThreadOwnerUnknown: (threadId) => `Thread ${threadId} has no known owner`,
78
+ ThreadMemberIdsMissing: (action) => `A thread member without a thread or user ID cannot be ${action}`,
79
+ GuildIntegrationNotFound: (guildId, integrationId) => `The guild ${guildId} has no integration ${integrationId}`,
80
+ GuildMemberUserUnknown: "This member has no user data: its ID is unknown",
81
+ GuildMembersQueryConflict: "Cannot request members by both query and userIds",
82
+ GuildMembersUserIdsLimit: "Cannot request more than 100 members by their IDs",
83
+ MemberFetchNonceLength: "The nonce of a members request cannot exceed 32 bytes",
84
+ GuildMembersNoncePending: (nonce) => `A members request with the nonce "${nonce}" is pending already`,
85
+ GuildMembersTimeout: (guildId, nonce, timeout) => `Requesting the members of guild ${guildId} (${nonce}) took longer than ${timeout}ms`,
86
+ GuildMembersRateLimited: (guildId, nonce, retryAfter) => `Requesting the members of guild ${guildId} (${nonce}) is rate limited, retry after ${retryAfter}ms`,
87
+ PresenceNotFetchable: (guildId, userId) => `Presences cannot be fetched from the API, they are only received from the gateway (user ${userId} of guild ${guildId} is not cached); enable the presences cache to read them later`,
88
+ InviteGuildUnknown: (code) => `Invite ${code} has no known guild`,
89
+ EmojiEmpty: "Cannot resolve an empty string to an emoji",
90
+ EmojiType: "Cannot resolve an emoji without an ID nor a name",
91
+ NotGuildSticker: "Only guild stickers can be edited or deleted",
92
+ NotGuildSoundboardSound: "Default soundboard sounds cannot be changed",
93
+ MessageContentType: "The content of a message must be a string",
94
+ MessageNonceLength: "A message nonce must be at most 25 characters long",
95
+ MessageNonceType: "A message nonce must be an integer",
96
+ MessageForwardChannelMissing: "Forwarding a message by ID needs its channel",
97
+ MessageReferenceMissing: (messageId) => `Message ${messageId} references no message`,
98
+ MessagePollMissing: (messageId) => `Message ${messageId} has no poll`,
99
+ AttachmentDownloadFailed: (url, status) => `Could not download ${url}: ${status}`,
100
+ VoiceStateNotOwn: "Only the bot's own voice state can request to speak",
101
+ VoiceStateGuildUnknown: "This voice state does not belong to a guild",
102
+ WebhookTokenUnavailable: (webhookId) => `Webhook ${webhookId} has no token to post with`
103
+ };
104
+
105
+ //#endregion
106
+ //#region src/errors/GatewayError.ts
107
+ /**
108
+ * An {@link Error} carrying a {@link GatewayErrorCode}, like discord.js's `DiscordjsError`.
109
+ *
110
+ * @remarks
111
+ * Its `name` is `GatewayError [<code>]`, and its message is the code's entry in {@link GatewayErrorMessages}.
112
+ */
113
+ var GatewayError = class extends Error {
114
+ /**
115
+ * The code of the error.
116
+ */
117
+ code;
118
+ constructor(code, ...args) {
119
+ super(formatMessage(code, args));
120
+ this.code = code;
121
+ setName(this, new.target, code);
122
+ }
123
+ };
124
+ /**
125
+ * A {@link TypeError} carrying a {@link GatewayErrorCode}, like discord.js's `DiscordjsTypeError`.
126
+ */
127
+ var GatewayTypeError = class extends TypeError {
128
+ /**
129
+ * The code of the error.
130
+ */
131
+ code;
132
+ constructor(code, ...args) {
133
+ super(formatMessage(code, args));
134
+ this.code = code;
135
+ setName(this, new.target, code);
136
+ }
137
+ };
138
+ /**
139
+ * A {@link RangeError} carrying a {@link GatewayErrorCode}, like discord.js's `DiscordjsRangeError`.
140
+ */
141
+ var GatewayRangeError = class extends RangeError {
142
+ /**
143
+ * The code of the error.
144
+ */
145
+ code;
146
+ constructor(code, ...args) {
147
+ super(formatMessage(code, args));
148
+ this.code = code;
149
+ setName(this, new.target, code);
150
+ }
151
+ };
152
+ function formatMessage(code, args) {
153
+ const message = GatewayErrorMessages[code];
154
+ return typeof message === "function" ? message(...args) : message;
155
+ }
156
+ function setName(error, target, code) {
157
+ error.name = `${target.name} [${code}]`;
158
+ Error.captureStackTrace?.(error, target);
159
+ }
160
+
54
161
  //#endregion
55
162
  //#region src/util/channels.ts
56
163
  /**
@@ -60,7 +167,7 @@ var EventGatewayListener = class extends Listener {
60
167
  */
61
168
  function resolveId(value) {
62
169
  const id = typeof value === "string" ? value : value.id;
63
- if (!id) throw new TypeError("Cannot resolve an ID from a structure without one");
170
+ if (!id) throw new GatewayTypeError("IdUnresolvable");
64
171
  return id;
65
172
  }
66
173
  /**
@@ -210,7 +317,7 @@ function Mixin(target, mixins) {
210
317
  */
211
318
  function getGatewayClient() {
212
319
  const { client } = container;
213
- if (!client || !("gateway" in client)) throw new Error("No GatewayClient has been constructed yet");
320
+ if (!client || !("gateway" in client)) throw new GatewayError("ClientNotConstructed");
214
321
  return client;
215
322
  }
216
323
 
@@ -521,7 +628,7 @@ var BaseChannelMixin = class {
521
628
  */
522
629
  async fetch() {
523
630
  const data = await this.client.api.channels.get(this.id);
524
- if (data.type !== this.type) throw new TypeError(`Channel ${this.id} changed type from ${this.type} to ${data.type}`);
631
+ if (data.type !== this.type) throw new GatewayTypeError("ChannelTypeChanged", this.id, this.type, data.type);
525
632
  return this[kPatch](data);
526
633
  }
527
634
  };
@@ -833,7 +940,7 @@ async function computePermissionsIn(channel, target) {
833
940
  resolved = await client.channels.fetch(data.parent_id);
834
941
  data = resolved.toJSON();
835
942
  }
836
- if (!data.guild_id) throw new Error(`Channel ${resolved.id} has no known guild`);
943
+ if (!data.guild_id) throw new GatewayError("ChannelGuildUnknown", resolved.id);
837
944
  return computeTargetPermissions(data.guild_id, data.permission_overwrites ?? [], target);
838
945
  }
839
946
 
@@ -889,7 +996,7 @@ var ChannelPermissionMixin = class {
889
996
  */
890
997
  async setPosition(position, options = {}) {
891
998
  const { guild_id: guildId } = this[kData];
892
- if (!guildId) throw new Error(`Channel ${this.id} has no known guild`);
999
+ if (!guildId) throw new GatewayError("ChannelGuildUnknown", this.id);
893
1000
  const target = options.relative ? this.position + position : position;
894
1001
  await this.client.guilds.channels(guildId).setPositions([{
895
1002
  channel: this.id,
@@ -922,7 +1029,7 @@ var ChannelPermissionMixin = class {
922
1029
  * @param reason The reason for the audit log.
923
1030
  */
924
1031
  lockPermissions(reason) {
925
- if (!this[kData].parent_id) throw new Error(`Channel ${this.id} has no category to sync its permissions with`);
1032
+ if (!this[kData].parent_id) throw new GatewayError("GuildChannelOrphan", this.id);
926
1033
  return editChannel(this, {
927
1034
  lockPermissions: true,
928
1035
  reason
@@ -945,7 +1052,7 @@ var ChannelPermissionMixin = class {
945
1052
  */
946
1053
  async fetchPermissionsFor(target) {
947
1054
  const { guild_id: guildId, permission_overwrites: overwrites = [] } = this[kData];
948
- if (!guildId) throw new Error(`Channel ${this.id} has no known guild`);
1055
+ if (!guildId) throw new GatewayError("ChannelGuildUnknown", this.id);
949
1056
  return computeTargetPermissions(guildId, overwrites, target);
950
1057
  }
951
1058
  };
@@ -1002,7 +1109,7 @@ var ChannelThreadManager = class {
1002
1109
  * Fetches the active threads of the channel, and caches them.
1003
1110
  */
1004
1111
  async fetchActive() {
1005
- if (!this.guildId) throw new Error(`Channel ${this.channelId} has no known guild`);
1112
+ if (!this.guildId) throw new GatewayError("ChannelGuildUnknown", this.channelId);
1006
1113
  const { threads, members } = await this.client.threads.fetchActive(this.guildId);
1007
1114
  const own = threads.filter((thread) => thread.parentId === this.channelId);
1008
1115
  const ids = new Set(own.map((thread) => thread.id));
@@ -1125,7 +1232,7 @@ var GuildChannelMixin = class {
1125
1232
  */
1126
1233
  async clone(options = {}) {
1127
1234
  const { guildId } = this;
1128
- if (!guildId) throw new Error(`Channel ${this.id} has no known guild`);
1235
+ if (!guildId) throw new GatewayError("ChannelGuildUnknown", this.id);
1129
1236
  const data = this[kData];
1130
1237
  return this.client.guilds.channels(guildId).create({
1131
1238
  name: data.name ?? "",
@@ -1323,7 +1430,7 @@ var MessagePayload = class MessagePayload {
1323
1430
  const { content } = this.options;
1324
1431
  if (content === null) return this.isEdit ? "" : void 0;
1325
1432
  if (content === void 0) return void 0;
1326
- if (typeof content !== "string") throw new TypeError("The content of a message must be a string");
1433
+ if (typeof content !== "string") throw new GatewayTypeError("MessageContentType");
1327
1434
  return content;
1328
1435
  }
1329
1436
  /**
@@ -1380,8 +1487,8 @@ var MessagePayload = class MessagePayload {
1380
1487
  }
1381
1488
  resolveNonce(nonce) {
1382
1489
  if (nonce === void 0) return void 0;
1383
- if (typeof nonce === "string" && nonce.length > 25) throw new RangeError("A message nonce must be at most 25 characters long");
1384
- if (typeof nonce === "number" && !Number.isInteger(nonce)) throw new RangeError("A message nonce must be an integer");
1490
+ if (typeof nonce === "string" && nonce.length > 25) throw new GatewayRangeError("MessageNonceLength");
1491
+ if (typeof nonce === "number" && !Number.isInteger(nonce)) throw new GatewayRangeError("MessageNonceType");
1385
1492
  return nonce;
1386
1493
  }
1387
1494
  resolveList(values) {
@@ -1404,7 +1511,7 @@ var MessagePayload = class MessagePayload {
1404
1511
  if (forward) {
1405
1512
  const { message, channel, guild } = forward;
1406
1513
  const channelId = typeof message === "string" ? MessagePayload.id(channel) : message.channelId;
1407
- if (!channelId) throw new TypeError("Forwarding a message by ID needs its channel");
1514
+ if (!channelId) throw new GatewayTypeError("MessageForwardChannelMissing");
1408
1515
  return {
1409
1516
  type: MessageReferenceType.Forward,
1410
1517
  message_id: typeof message === "string" ? message : message.id,
@@ -1537,7 +1644,7 @@ async function resolveBuffer(attachment) {
1537
1644
  if (typeof attachment === "string") {
1538
1645
  if (/^https?:\/\//.test(attachment)) {
1539
1646
  const response = await fetch(attachment);
1540
- if (!response.ok) throw new Error(`Could not download ${attachment}: ${response.status}`);
1647
+ if (!response.ok) throw new GatewayError("AttachmentDownloadFailed", attachment, response.status);
1541
1648
  return {
1542
1649
  data: new Uint8Array(await response.arrayBuffer()),
1543
1650
  contentType: response.headers.get("content-type") ?? void 0
@@ -1815,7 +1922,7 @@ var ThreadChannelMixin = class {
1815
1922
  */
1816
1923
  fetchStarterMessage() {
1817
1924
  const { parent_id: parentId } = this[kData];
1818
- if (!parentId) throw new Error(`Thread ${this.id} has no known parent`);
1925
+ if (!parentId) throw new GatewayError("ThreadParentUnknown", this.id);
1819
1926
  return this.client.messages.fetch(parentId, this.id);
1820
1927
  }
1821
1928
  /**
@@ -1823,7 +1930,7 @@ var ThreadChannelMixin = class {
1823
1930
  */
1824
1931
  fetchOwner() {
1825
1932
  const { owner_id: ownerId } = this[kData];
1826
- if (!ownerId) throw new Error(`Thread ${this.id} has no known owner`);
1933
+ if (!ownerId) throw new GatewayError("ThreadOwnerUnknown", this.id);
1827
1934
  return this.client.threadMembers.fetch(this.id, ownerId);
1828
1935
  }
1829
1936
  };
@@ -2477,7 +2584,7 @@ var StageChannel = class extends StageChannel$1 {
2477
2584
  */
2478
2585
  createStageInstance(options) {
2479
2586
  const { guildId } = this;
2480
- if (!guildId) return Promise.reject(/* @__PURE__ */ new Error(`Channel ${this.id} has no known guild`));
2587
+ if (!guildId) return Promise.reject(new GatewayError("ChannelGuildUnknown", this.id));
2481
2588
  return this.client.guilds.stageInstances(guildId).create(this.id, options);
2482
2589
  }
2483
2590
  };
@@ -2771,11 +2878,11 @@ var CachedManager = class {
2771
2878
  cached(...args) {
2772
2879
  const { cache } = this;
2773
2880
  if (cache === void 0) return void 0;
2774
- if (cache.synchronous !== true) throw new TypeError(`The ${this.entity} cache is asynchronous, use get instead of cached`);
2881
+ if (cache.synchronous !== true) throw new GatewayTypeError("CacheAsynchronous", this.entity);
2775
2882
  const value = this._get(...args);
2776
2883
  if (isPromiseLike(value)) {
2777
2884
  value.catch(() => void 0);
2778
- throw new TypeError(`The relations of the ${this.entity} cache are read from an asynchronous cache, use get instead of cached`);
2885
+ throw new GatewayTypeError("CacheRelationsAsynchronous", this.entity);
2779
2886
  }
2780
2887
  return value;
2781
2888
  }
@@ -2934,7 +3041,7 @@ var CachedManager = class {
2934
3041
  iterableCache() {
2935
3042
  const { cache } = this;
2936
3043
  if (cache === void 0) return void 0;
2937
- if (!isIterableCache(cache)) throw new TypeError(`The ${this.entity} cache cannot enumerate its entries (it has no keys/values/entries)`);
3044
+ if (!isIterableCache(cache)) throw new GatewayTypeError("CacheNotIterable", this.entity);
2938
3045
  return cache;
2939
3046
  }
2940
3047
  /**
@@ -3118,7 +3225,7 @@ var ChannelManager = class extends CachedManager {
3118
3225
  * @param options The fields to edit, and the reason for the audit log.
3119
3226
  */
3120
3227
  async edit(channelId, options) {
3121
- if (options.lockPermissions && options.permissionOverwrites) throw new TypeError("Pass either lockPermissions or permissionOverwrites, not both");
3228
+ if (options.lockPermissions && options.permissionOverwrites) throw new GatewayTypeError("ChannelLockPermissionsConflict");
3122
3229
  const body = toChannelBody(options);
3123
3230
  if (options.lockPermissions) {
3124
3231
  const parentId = options.parent === void 0 ? overwriteHolder(await this.fetch(channelId)).parent_id ?? null : options.parent && resolveId(options.parent);
@@ -4112,13 +4219,13 @@ var ReactionEmoji = class extends Emoji {
4112
4219
  const { animated, name, id } = custom.groups;
4113
4220
  return `${animated ? "a:" : ""}${name}:${id}`;
4114
4221
  }
4115
- if (!decoded) throw new TypeError("Cannot resolve an empty string to an emoji");
4222
+ if (!decoded) throw new GatewayTypeError("EmojiEmpty");
4116
4223
  return encodeURIComponent(decoded);
4117
4224
  }
4118
4225
  const { id, name, animated } = emoji;
4119
4226
  if (id) return `${animated ? "a:" : ""}${name ?? "_"}:${id}`;
4120
4227
  if (name) return encodeURIComponent(name);
4121
- throw new TypeError("Cannot resolve an emoji without an ID nor a name");
4228
+ throw new GatewayTypeError("EmojiType");
4122
4229
  }
4123
4230
  /**
4124
4231
  * Resolves anything {@link EmojiIdentifierResolvable} to the ID and name pair of welcome screens and onboarding.
@@ -4753,7 +4860,7 @@ var GuildInvite = class extends BaseInvite {
4753
4860
  */
4754
4861
  async delete(reason) {
4755
4862
  const { guildId } = this;
4756
- if (!guildId) throw new Error(`Invite ${this.code} has no known guild`);
4863
+ if (!guildId) throw new GatewayError("InviteGuildUnknown", this.code);
4757
4864
  await this.client.guilds.invites(guildId).delete(this.code, reason);
4758
4865
  return this;
4759
4866
  }
@@ -4889,7 +4996,7 @@ var Sticker = class extends Sticker$1 {
4889
4996
  }
4890
4997
  requireGuildId() {
4891
4998
  const { guildId } = this;
4892
- if (!guildId) throw new Error("Only guild stickers can be edited or deleted");
4999
+ if (!guildId) throw new GatewayError("NotGuildSticker");
4893
5000
  return guildId;
4894
5001
  }
4895
5002
  };
@@ -4972,7 +5079,7 @@ var WebhookMixin = class {
4972
5079
  */
4973
5080
  requireToken() {
4974
5081
  const { token } = this;
4975
- if (!token) throw new Error(`Webhook ${this.id} has no token to post with`);
5082
+ if (!token) throw new GatewayError("WebhookTokenUnavailable", this.id);
4976
5083
  return token;
4977
5084
  }
4978
5085
  };
@@ -5949,7 +6056,7 @@ var GuildIntegrationManager = class extends CachedManager {
5949
6056
  }
5950
6057
  async fetchRaw(integrationId) {
5951
6058
  const integration = (await this.list()).find(({ id }) => id === integrationId);
5952
- if (!integration) throw new RangeError(`The guild ${this.guildId} has no integration ${integrationId}`);
6059
+ if (!integration) throw new GatewayRangeError("GuildIntegrationNotFound", this.guildId, integrationId);
5953
6060
  return integration;
5954
6061
  }
5955
6062
  async list() {
@@ -6165,7 +6272,7 @@ var SoundboardSound = class extends SoundboardSound$1 {
6165
6272
  }
6166
6273
  withGuild(action) {
6167
6274
  const { guildId } = this;
6168
- if (!guildId) return Promise.reject(/* @__PURE__ */ new Error("Default soundboard sounds cannot be changed"));
6275
+ if (!guildId) return Promise.reject(new GatewayError("NotGuildSoundboardSound"));
6169
6276
  return action(guildId);
6170
6277
  }
6171
6278
  };
@@ -7675,7 +7782,7 @@ var GuildMember = class extends Structure {
7675
7782
  }
7676
7783
  requireId() {
7677
7784
  const { id } = this;
7678
- if (id === null) throw new Error("This member has no user data: its ID is unknown");
7785
+ if (id === null) throw new GatewayError("GuildMemberUserUnknown");
7679
7786
  return id;
7680
7787
  }
7681
7788
  };
@@ -8084,7 +8191,7 @@ var VoiceState = class extends VoiceState$1 {
8084
8191
  */
8085
8192
  async edit(options) {
8086
8193
  const target = this.resolveTarget();
8087
- if (target !== "@me" && options.requestToSpeak !== void 0) throw new Error("Only the bot's own voice state can request to speak");
8194
+ if (target !== "@me" && options.requestToSpeak !== void 0) throw new GatewayError("VoiceStateNotOwn");
8088
8195
  const requestToSpeakTimestamp = options.requestToSpeak ? (/* @__PURE__ */ new Date()).toISOString() : options.requestToSpeak === false ? null : void 0;
8089
8196
  const body = {
8090
8197
  channel_id: this.channelId ?? void 0,
@@ -8112,7 +8219,7 @@ var VoiceState = class extends VoiceState$1 {
8112
8219
  }
8113
8220
  requireGuildId() {
8114
8221
  const { guildId } = this;
8115
- if (!guildId) throw new Error("This voice state does not belong to a guild");
8222
+ if (!guildId) throw new GatewayError("VoiceStateGuildUnknown");
8116
8223
  return guildId;
8117
8224
  }
8118
8225
  resolveTarget() {
@@ -8132,7 +8239,7 @@ Mixin(VoiceState, [StructureMixin]);
8132
8239
  * event order is preserved. The error only reports that the partition is stuck, usually on a slow or unreachable
8133
8240
  * cache.
8134
8241
  */
8135
- var DispatchTimeoutError = class extends Error {
8242
+ var DispatchTimeoutError = class extends GatewayError {
8136
8243
  /**
8137
8244
  * The type of the slow dispatch, e.g. `MESSAGE_CREATE`.
8138
8245
  */
@@ -8150,8 +8257,7 @@ var DispatchTimeoutError = class extends Error {
8150
8257
  */
8151
8258
  timeout;
8152
8259
  constructor(type, shardId, partition, timeout) {
8153
- super(`Processing ${type} on shard ${shardId} (${partition ?? "barrier"}) took longer than ${timeout}ms`);
8154
- this.name = "DispatchTimeoutError";
8260
+ super("DispatchTimeout", type, shardId, partition, timeout);
8155
8261
  this.type = type;
8156
8262
  this.shardId = shardId;
8157
8263
  this.partition = partition;
@@ -8164,7 +8270,7 @@ var DispatchTimeoutError = class extends Error {
8164
8270
  * @remarks
8165
8271
  * The request is dropped: chunks arriving later still update the cache and emit `guildMembersChunk`.
8166
8272
  */
8167
- var GuildMembersTimeoutError = class extends Error {
8273
+ var GuildMembersTimeoutError = class extends GatewayError {
8168
8274
  /**
8169
8275
  * The ID of the guild whose members were requested.
8170
8276
  */
@@ -8178,8 +8284,7 @@ var GuildMembersTimeoutError = class extends Error {
8178
8284
  */
8179
8285
  timeout;
8180
8286
  constructor(guildId, nonce, timeout) {
8181
- super(`Requesting the members of guild ${guildId} (${nonce}) took longer than ${timeout}ms`);
8182
- this.name = "GuildMembersTimeoutError";
8287
+ super("GuildMembersTimeout", guildId, nonce, timeout);
8183
8288
  this.guildId = guildId;
8184
8289
  this.nonce = nonce;
8185
8290
  this.timeout = timeout;
@@ -8188,7 +8293,7 @@ var GuildMembersTimeoutError = class extends Error {
8188
8293
  /**
8189
8294
  * Thrown by `GuildMemberManager#request` when Discord answers with `RATE_LIMITED` instead of the members' chunks.
8190
8295
  */
8191
- var GuildMembersRateLimitError = class extends Error {
8296
+ var GuildMembersRateLimitError = class extends GatewayError {
8192
8297
  /**
8193
8298
  * The ID of the guild whose members were requested.
8194
8299
  */
@@ -8202,8 +8307,7 @@ var GuildMembersRateLimitError = class extends Error {
8202
8307
  */
8203
8308
  retryAfter;
8204
8309
  constructor(guildId, nonce, retryAfter) {
8205
- super(`Requesting the members of guild ${guildId} (${nonce}) is rate limited, retry after ${retryAfter}ms`);
8206
- this.name = "GuildMembersRateLimitError";
8310
+ super("GuildMembersRateLimited", guildId, nonce, retryAfter);
8207
8311
  this.guildId = guildId;
8208
8312
  this.nonce = nonce;
8209
8313
  this.retryAfter = retryAfter;
@@ -8216,7 +8320,7 @@ var GuildMembersRateLimitError = class extends Error {
8216
8320
  * Neither failure stops the shard: a failed (or timed out) read identifies instead of resuming, and a failed write
8217
8321
  * only means the session may not be resumed after a restart. The store's error is the `cause`.
8218
8322
  */
8219
- var GatewaySessionStoreError = class extends Error {
8323
+ var GatewaySessionStoreError = class extends GatewayError {
8220
8324
  /**
8221
8325
  * Whether the store failed to read (`"get"`) or write (`"set"`) the session.
8222
8326
  */
@@ -8226,8 +8330,8 @@ var GatewaySessionStoreError = class extends Error {
8226
8330
  */
8227
8331
  shardId;
8228
8332
  constructor(operation, shardId, cause) {
8229
- super(`Cannot ${operation === "get" ? "read" : "write"} the session of shard ${shardId} in the session store`, { cause });
8230
- this.name = "GatewaySessionStoreError";
8333
+ super("SessionStoreFailed", operation, shardId);
8334
+ this.cause = cause;
8231
8335
  this.operation = operation;
8232
8336
  this.shardId = shardId;
8233
8337
  }
@@ -8247,7 +8351,7 @@ var GuildMemberManager = class extends CachedManager {
8247
8351
  return new GuildMember(data);
8248
8352
  }
8249
8353
  keyOf(data) {
8250
- if (!data.user) throw new TypeError("Cannot key a member without its user");
8354
+ if (!data.user) throw new GatewayTypeError("CacheKeyUnresolvable", "member", "without its user");
8251
8355
  return this.resolveKey(data.guild_id, data.user.id);
8252
8356
  }
8253
8357
  /**
@@ -8351,9 +8455,9 @@ var GuildMemberManager = class extends CachedManager {
8351
8455
  const { query, limit = 0, presences, time = 12e4 } = options;
8352
8456
  const userIds = options.userIds?.length ? options.userIds : void 0;
8353
8457
  const nonce = options.nonce ?? randomBytes(16).toString("hex");
8354
- if (query !== void 0 && userIds !== void 0) throw new TypeError("Cannot request members by both query and userIds");
8355
- if (userIds && userIds.length > 100) throw new RangeError("Cannot request more than 100 members by their IDs");
8356
- if (Buffer.byteLength(nonce) > 32) throw new RangeError("The nonce of a members request cannot exceed 32 bytes");
8458
+ if (query !== void 0 && userIds !== void 0) throw new GatewayTypeError("GuildMembersQueryConflict");
8459
+ if (userIds && userIds.length > 100) throw new GatewayRangeError("GuildMembersUserIdsLimit");
8460
+ if (Buffer.byteLength(nonce) > 32) throw new GatewayRangeError("MemberFetchNonceLength");
8357
8461
  const d = userIds ? {
8358
8462
  guild_id: guildId,
8359
8463
  user_ids: [...userIds],
@@ -8368,7 +8472,7 @@ var GuildMemberManager = class extends CachedManager {
8368
8472
  };
8369
8473
  const shardCount = BigInt(await this.client.gateway.getShardCount());
8370
8474
  const shardId = Number((BigInt(guildId) >> 22n) % shardCount);
8371
- if (this.#requests.has(nonce)) throw new Error(`A members request with the nonce "${nonce}" is pending already`);
8475
+ if (this.#requests.has(nonce)) throw new GatewayError("GuildMembersNoncePending", nonce);
8372
8476
  let request;
8373
8477
  const promise = new Promise((resolve, reject) => {
8374
8478
  request = {
@@ -8855,6 +8959,784 @@ function definedEntries(value) {
8855
8959
  return Object.entries(value).filter(([, entry]) => entry !== void 0);
8856
8960
  }
8857
8961
 
8962
+ //#endregion
8963
+ //#region src/structures/components/Component.ts
8964
+ /**
8965
+ * The members every component of this package shares, mixed into each of them.
8966
+ */
8967
+ var ComponentMixin = class {
8968
+ /**
8969
+ * Whether this component has the same data as another one, nested components included.
8970
+ *
8971
+ * @param other The component, or raw component data, to compare with.
8972
+ */
8973
+ equals(other) {
8974
+ return isDeepEqual(this.toJSON(), other instanceof Component ? other.toJSON() : other);
8975
+ }
8976
+ };
8977
+ /**
8978
+ * A component of a message or a modal: `@discordjs/structures`' `Component`, like discord.js' `Component`.
8979
+ *
8980
+ * @remarks
8981
+ * Each component type has its own class, like `ActionRow` or `ButtonComponent`s, which `createComponent` picks for a raw
8982
+ * component. This class is only instantiated for the types it has no class for. Their raw data is kept as received,
8983
+ * nested components included, so `toJSON` serializes them back to the API.
8984
+ *
8985
+ * @typeParam Data The raw data of the component.
8986
+ */
8987
+ var Component = class Component extends Component$1 {
8988
+ /**
8989
+ * Whether a value is a component of this package. Most components extend `@discordjs/structures`' own rather than
8990
+ * this class, so `instanceof Component` matches any `@discordjs/structures` component carrying
8991
+ * {@link StructureMixin}. Subclasses keep the default `instanceof` behavior.
8992
+ *
8993
+ * @param value The value to check.
8994
+ */
8995
+ static [Symbol.hasInstance](value) {
8996
+ if (this !== Component) return Function.prototype[Symbol.hasInstance].call(this, value);
8997
+ return value instanceof Component$1 && kRelations in value;
8998
+ }
8999
+ /**
9000
+ * @param data The raw component.
9001
+ * @param relations The related structures, resolved from the cache.
9002
+ */
9003
+ constructor(data, relations = {}) {
9004
+ super(data);
9005
+ initStructure(this, data, relations);
9006
+ }
9007
+ };
9008
+ Mixin(Component, [StructureMixin, ComponentMixin]);
9009
+
9010
+ //#endregion
9011
+ //#region src/structures/components/ActionRow.ts
9012
+ /**
9013
+ * An action row, holding buttons, a select menu, or a text input: `@discordjs/structures`' `ActionRowComponent`, with
9014
+ * its components like discord.js' `ActionRow`.
9015
+ *
9016
+ * @typeParam Child The components of the row.
9017
+ */
9018
+ var ActionRow = class extends ActionRowComponent {
9019
+ /**
9020
+ * @param data The raw action row.
9021
+ * @param relations The related structures, resolved from the cache.
9022
+ */
9023
+ constructor(data, relations = {}) {
9024
+ super(data);
9025
+ initStructure(this, data, relations);
9026
+ }
9027
+ /**
9028
+ * The components in this action row.
9029
+ */
9030
+ get components() {
9031
+ return this[kData].components.map((component) => createComponent(component));
9032
+ }
9033
+ };
9034
+ Mixin(ActionRow, [StructureMixin, ComponentMixin]);
9035
+
9036
+ //#endregion
9037
+ //#region src/structures/components/ChannelSelectMenuComponent.ts
9038
+ /**
9039
+ * A select menu of channels: `@discordjs/structures`' `ChannelSelectMenuComponent`, like discord.js'.
9040
+ */
9041
+ var ChannelSelectMenuComponent = class extends ChannelSelectMenuComponent$1 {
9042
+ /**
9043
+ * @param data The raw select menu.
9044
+ * @param relations The related structures, resolved from the cache.
9045
+ */
9046
+ constructor(data, relations = {}) {
9047
+ super(data);
9048
+ initStructure(this, data, relations);
9049
+ }
9050
+ /**
9051
+ * Whether the select menu is disabled.
9052
+ */
9053
+ get disabled() {
9054
+ return this[kData].disabled ?? false;
9055
+ }
9056
+ /**
9057
+ * The values selected by default.
9058
+ */
9059
+ get defaultValues() {
9060
+ return this[kData].default_values ?? [];
9061
+ }
9062
+ };
9063
+ Mixin(ChannelSelectMenuComponent, [StructureMixin, ComponentMixin]);
9064
+
9065
+ //#endregion
9066
+ //#region src/structures/components/CheckboxComponent.ts
9067
+ /**
9068
+ * A modal component for a binary choice.
9069
+ */
9070
+ var CheckboxComponent = class extends Component {
9071
+ /**
9072
+ * The custom ID of the checkbox.
9073
+ */
9074
+ get customId() {
9075
+ return this[kData].custom_id;
9076
+ }
9077
+ /**
9078
+ * Whether the checkbox is checked by default.
9079
+ */
9080
+ get default() {
9081
+ return this[kData].default ?? false;
9082
+ }
9083
+ };
9084
+
9085
+ //#endregion
9086
+ //#region src/structures/components/CheckboxGroupComponent.ts
9087
+ /**
9088
+ * A modal component to pick any of its options.
9089
+ */
9090
+ var CheckboxGroupComponent = class extends Component {
9091
+ /**
9092
+ * The custom ID of the checkbox group.
9093
+ */
9094
+ get customId() {
9095
+ return this[kData].custom_id;
9096
+ }
9097
+ /**
9098
+ * The options of the checkbox group.
9099
+ */
9100
+ get options() {
9101
+ return this[kData].options;
9102
+ }
9103
+ /**
9104
+ * The minimum number of options to pick, `1` by default.
9105
+ */
9106
+ get minValues() {
9107
+ return this[kData].min_values ?? 1;
9108
+ }
9109
+ /**
9110
+ * The maximum number of options to pick, the number of options by default.
9111
+ */
9112
+ get maxValues() {
9113
+ return this[kData].max_values ?? this.options.length;
9114
+ }
9115
+ /**
9116
+ * Whether picking options is required to submit the modal, `true` by default.
9117
+ */
9118
+ get required() {
9119
+ return this[kData].required ?? true;
9120
+ }
9121
+ };
9122
+
9123
+ //#endregion
9124
+ //#region src/structures/components/ContainerComponent.ts
9125
+ /**
9126
+ * A container visually grouping components, like an embed: `@discordjs/structures`' `ContainerComponent`, with its
9127
+ * components like discord.js'.
9128
+ */
9129
+ var ContainerComponent = class extends ContainerComponent$1 {
9130
+ /**
9131
+ * @param data The raw container.
9132
+ * @param relations The related structures, resolved from the cache.
9133
+ */
9134
+ constructor(data, relations = {}) {
9135
+ super(data);
9136
+ initStructure(this, data, relations);
9137
+ }
9138
+ /**
9139
+ * The components in this container.
9140
+ */
9141
+ get components() {
9142
+ return this[kData].components.map((component) => createComponent(component));
9143
+ }
9144
+ /**
9145
+ * The accent color of the container, `null` when it has none.
9146
+ */
9147
+ get accentColor() {
9148
+ return this[kData].accent_color ?? null;
9149
+ }
9150
+ /**
9151
+ * The accent color as a `#rrggbb` string, `null` when the container has none.
9152
+ */
9153
+ get hexAccentColor() {
9154
+ const { accentColor } = this;
9155
+ return accentColor === null ? null : `#${accentColor.toString(16).padStart(6, "0")}`;
9156
+ }
9157
+ /**
9158
+ * Whether the container is marked as a spoiler.
9159
+ */
9160
+ get spoiler() {
9161
+ return this[kData].spoiler ?? false;
9162
+ }
9163
+ };
9164
+ Mixin(ContainerComponent, [StructureMixin, ComponentMixin]);
9165
+
9166
+ //#endregion
9167
+ //#region src/structures/components/UnfurledMediaItem.ts
9168
+ /**
9169
+ * A media item of a thumbnail, file, or media gallery component: `@discordjs/structures`' `UnfurledMediaItem`, like
9170
+ * discord.js'.
9171
+ */
9172
+ var UnfurledMediaItem = class extends UnfurledMediaItem$1 {
9173
+ /**
9174
+ * @param data The raw media item.
9175
+ * @param relations The related structures, resolved from the cache.
9176
+ */
9177
+ constructor(data, relations = {}) {
9178
+ super(data);
9179
+ initStructure(this, data, relations);
9180
+ }
9181
+ };
9182
+ Mixin(UnfurledMediaItem, [StructureMixin]);
9183
+
9184
+ //#endregion
9185
+ //#region src/structures/components/FileComponent.ts
9186
+ /**
9187
+ * An attached file: `@discordjs/structures`' `FileComponent`, with its media like discord.js'.
9188
+ */
9189
+ var FileComponent = class extends FileComponent$1 {
9190
+ /**
9191
+ * @param data The raw file component.
9192
+ * @param relations The related structures, resolved from the cache.
9193
+ */
9194
+ constructor(data, relations = {}) {
9195
+ super(data);
9196
+ initStructure(this, data, relations);
9197
+ }
9198
+ /**
9199
+ * The file, an `attachment://` reference to an attachment of the message.
9200
+ */
9201
+ get file() {
9202
+ return new UnfurledMediaItem(this[kData].file);
9203
+ }
9204
+ /**
9205
+ * Whether the file is marked as a spoiler.
9206
+ */
9207
+ get spoiler() {
9208
+ return this[kData].spoiler ?? false;
9209
+ }
9210
+ };
9211
+ Mixin(FileComponent, [StructureMixin, ComponentMixin]);
9212
+
9213
+ //#endregion
9214
+ //#region src/structures/components/FileUploadComponent.ts
9215
+ /**
9216
+ * A file upload field of a modal: `@discordjs/structures`' `FileUploadComponent`, like discord.js'.
9217
+ */
9218
+ var FileUploadComponent = class extends FileUploadComponent$1 {
9219
+ /**
9220
+ * @param data The raw file upload.
9221
+ * @param relations The related structures, resolved from the cache.
9222
+ */
9223
+ constructor(data, relations = {}) {
9224
+ super(data);
9225
+ initStructure(this, data, relations);
9226
+ }
9227
+ /**
9228
+ * The types of files that can be uploaded, any when empty.
9229
+ */
9230
+ get fileTypes() {
9231
+ return this[kData].file_types ?? [];
9232
+ }
9233
+ };
9234
+ Mixin(FileUploadComponent, [StructureMixin, ComponentMixin]);
9235
+
9236
+ //#endregion
9237
+ //#region src/structures/components/InteractiveButtonComponent.ts
9238
+ /**
9239
+ * A button sending an interaction when clicked, of the `Primary`, `Secondary`, `Success`, or `Danger` style:
9240
+ * `@discordjs/structures`' `InteractiveButtonComponent`, with discord.js' `ButtonComponent` helpers.
9241
+ */
9242
+ var InteractiveButtonComponent = class extends InteractiveButtonComponent$1 {
9243
+ /**
9244
+ * @param data The raw button.
9245
+ * @param relations The related structures, resolved from the cache.
9246
+ */
9247
+ constructor(data, relations = {}) {
9248
+ super(data);
9249
+ initStructure(this, data, relations);
9250
+ }
9251
+ /**
9252
+ * Whether the button is disabled.
9253
+ */
9254
+ get disabled() {
9255
+ return this[kData].disabled ?? false;
9256
+ }
9257
+ /**
9258
+ * The emoji on the button.
9259
+ */
9260
+ get emoji() {
9261
+ return this[kData].emoji ?? null;
9262
+ }
9263
+ };
9264
+ Mixin(InteractiveButtonComponent, [StructureMixin, ComponentMixin]);
9265
+
9266
+ //#endregion
9267
+ //#region src/structures/components/LabelComponent.ts
9268
+ /**
9269
+ * A modal component associating a label and a description with another component, like discord.js' `LabelComponent`.
9270
+ */
9271
+ var LabelComponent = class extends Component {
9272
+ /**
9273
+ * The label.
9274
+ */
9275
+ get label() {
9276
+ return this[kData].label;
9277
+ }
9278
+ /**
9279
+ * The description of the label.
9280
+ */
9281
+ get description() {
9282
+ return this[kData].description ?? null;
9283
+ }
9284
+ /**
9285
+ * The component the label is for.
9286
+ */
9287
+ get component() {
9288
+ return createComponent(this[kData].component);
9289
+ }
9290
+ };
9291
+
9292
+ //#endregion
9293
+ //#region src/structures/components/LinkButtonComponent.ts
9294
+ /**
9295
+ * A button of the `Link` style, opening a URL: `@discordjs/structures`' `LinkButtonComponent`, with discord.js'
9296
+ * `ButtonComponent` helpers.
9297
+ */
9298
+ var LinkButtonComponent = class extends LinkButtonComponent$1 {
9299
+ /**
9300
+ * @param data The raw button.
9301
+ * @param relations The related structures, resolved from the cache.
9302
+ */
9303
+ constructor(data, relations = {}) {
9304
+ super(data);
9305
+ initStructure(this, data, relations);
9306
+ }
9307
+ /**
9308
+ * Whether the button is disabled.
9309
+ */
9310
+ get disabled() {
9311
+ return this[kData].disabled ?? false;
9312
+ }
9313
+ /**
9314
+ * The emoji on the button.
9315
+ */
9316
+ get emoji() {
9317
+ return this[kData].emoji ?? null;
9318
+ }
9319
+ };
9320
+ Mixin(LinkButtonComponent, [StructureMixin, ComponentMixin]);
9321
+
9322
+ //#endregion
9323
+ //#region src/structures/components/MediaGalleryItem.ts
9324
+ /**
9325
+ * An item of a media gallery component: `@discordjs/structures`' `MediaGalleryItem`, with its media like discord.js'.
9326
+ */
9327
+ var MediaGalleryItem = class extends MediaGalleryItem$1 {
9328
+ /**
9329
+ * @param data The raw media gallery item.
9330
+ * @param relations The related structures, resolved from the cache.
9331
+ */
9332
+ constructor(data, relations = {}) {
9333
+ super(data);
9334
+ initStructure(this, data, relations);
9335
+ }
9336
+ /**
9337
+ * The media of the item.
9338
+ */
9339
+ get media() {
9340
+ return new UnfurledMediaItem(this[kData].media);
9341
+ }
9342
+ /**
9343
+ * The description of the item.
9344
+ */
9345
+ get description() {
9346
+ return this[kData].description ?? void 0;
9347
+ }
9348
+ /**
9349
+ * Whether the item is marked as a spoiler.
9350
+ */
9351
+ get spoiler() {
9352
+ return this[kData].spoiler ?? false;
9353
+ }
9354
+ };
9355
+ Mixin(MediaGalleryItem, [StructureMixin]);
9356
+
9357
+ //#endregion
9358
+ //#region src/structures/components/MediaGalleryComponent.ts
9359
+ /**
9360
+ * A gallery of images and videos: `@discordjs/structures`' `MediaGalleryComponent`, with its items like discord.js'.
9361
+ */
9362
+ var MediaGalleryComponent = class extends MediaGalleryComponent$1 {
9363
+ /**
9364
+ * @param data The raw media gallery.
9365
+ * @param relations The related structures, resolved from the cache.
9366
+ */
9367
+ constructor(data, relations = {}) {
9368
+ super(data);
9369
+ initStructure(this, data, relations);
9370
+ }
9371
+ /**
9372
+ * The items of the gallery.
9373
+ */
9374
+ get items() {
9375
+ return this[kData].items.map((item) => new MediaGalleryItem(item));
9376
+ }
9377
+ };
9378
+ Mixin(MediaGalleryComponent, [StructureMixin, ComponentMixin]);
9379
+
9380
+ //#endregion
9381
+ //#region src/structures/components/MentionableSelectMenuComponent.ts
9382
+ /**
9383
+ * A select menu of users and roles: `@discordjs/structures`' `MentionableSelectMenuComponent`, like discord.js'.
9384
+ */
9385
+ var MentionableSelectMenuComponent = class extends MentionableSelectMenuComponent$1 {
9386
+ /**
9387
+ * @param data The raw select menu.
9388
+ * @param relations The related structures, resolved from the cache.
9389
+ */
9390
+ constructor(data, relations = {}) {
9391
+ super(data);
9392
+ initStructure(this, data, relations);
9393
+ }
9394
+ /**
9395
+ * Whether the select menu is disabled.
9396
+ */
9397
+ get disabled() {
9398
+ return this[kData].disabled ?? false;
9399
+ }
9400
+ /**
9401
+ * The values selected by default.
9402
+ */
9403
+ get defaultValues() {
9404
+ return this[kData].default_values ?? [];
9405
+ }
9406
+ };
9407
+ Mixin(MentionableSelectMenuComponent, [StructureMixin, ComponentMixin]);
9408
+
9409
+ //#endregion
9410
+ //#region src/structures/components/PremiumButtonComponent.ts
9411
+ /**
9412
+ * A button of the `Premium` style, purchasing a SKU: `@discordjs/structures`' `PremiumButtonComponent`.
9413
+ */
9414
+ var PremiumButtonComponent = class extends PremiumButtonComponent$1 {
9415
+ /**
9416
+ * @param data The raw button.
9417
+ * @param relations The related structures, resolved from the cache.
9418
+ */
9419
+ constructor(data, relations = {}) {
9420
+ super(data);
9421
+ initStructure(this, data, relations);
9422
+ }
9423
+ /**
9424
+ * Whether the button is disabled.
9425
+ */
9426
+ get disabled() {
9427
+ return this[kData].disabled ?? false;
9428
+ }
9429
+ };
9430
+ Mixin(PremiumButtonComponent, [StructureMixin, ComponentMixin]);
9431
+
9432
+ //#endregion
9433
+ //#region src/structures/components/RadioGroupComponent.ts
9434
+ /**
9435
+ * A modal component to pick one of its options.
9436
+ */
9437
+ var RadioGroupComponent = class extends Component {
9438
+ /**
9439
+ * The custom ID of the radio group.
9440
+ */
9441
+ get customId() {
9442
+ return this[kData].custom_id;
9443
+ }
9444
+ /**
9445
+ * The options of the radio group.
9446
+ */
9447
+ get options() {
9448
+ return this[kData].options;
9449
+ }
9450
+ /**
9451
+ * Whether picking an option is required to submit the modal, `true` by default.
9452
+ */
9453
+ get required() {
9454
+ return this[kData].required ?? true;
9455
+ }
9456
+ };
9457
+
9458
+ //#endregion
9459
+ //#region src/structures/components/RoleSelectMenuComponent.ts
9460
+ /**
9461
+ * A select menu of roles: `@discordjs/structures`' `RoleSelectMenuComponent`, like discord.js'.
9462
+ */
9463
+ var RoleSelectMenuComponent = class extends RoleSelectMenuComponent$1 {
9464
+ /**
9465
+ * @param data The raw select menu.
9466
+ * @param relations The related structures, resolved from the cache.
9467
+ */
9468
+ constructor(data, relations = {}) {
9469
+ super(data);
9470
+ initStructure(this, data, relations);
9471
+ }
9472
+ /**
9473
+ * Whether the select menu is disabled.
9474
+ */
9475
+ get disabled() {
9476
+ return this[kData].disabled ?? false;
9477
+ }
9478
+ /**
9479
+ * The values selected by default.
9480
+ */
9481
+ get defaultValues() {
9482
+ return this[kData].default_values ?? [];
9483
+ }
9484
+ };
9485
+ Mixin(RoleSelectMenuComponent, [StructureMixin, ComponentMixin]);
9486
+
9487
+ //#endregion
9488
+ //#region src/structures/components/SectionComponent.ts
9489
+ /**
9490
+ * Text displayed alongside an accessory: `@discordjs/structures`' `SectionComponent`, with its components and accessory
9491
+ * like discord.js'.
9492
+ */
9493
+ var SectionComponent = class extends SectionComponent$1 {
9494
+ /**
9495
+ * @param data The raw section.
9496
+ * @param relations The related structures, resolved from the cache.
9497
+ */
9498
+ constructor(data, relations = {}) {
9499
+ super(data);
9500
+ initStructure(this, data, relations);
9501
+ }
9502
+ /**
9503
+ * The text components in this section.
9504
+ */
9505
+ get components() {
9506
+ return this[kData].components.map((component) => createComponent(component));
9507
+ }
9508
+ /**
9509
+ * The button or thumbnail shown next to the section.
9510
+ */
9511
+ get accessory() {
9512
+ return createComponent(this[kData].accessory);
9513
+ }
9514
+ };
9515
+ Mixin(SectionComponent, [StructureMixin, ComponentMixin]);
9516
+
9517
+ //#endregion
9518
+ //#region src/structures/components/SeparatorComponent.ts
9519
+ /**
9520
+ * Vertical padding between components: `@discordjs/structures`' `SeparatorComponent`, with Discord's defaults like
9521
+ * discord.js'.
9522
+ */
9523
+ var SeparatorComponent = class extends SeparatorComponent$1 {
9524
+ /**
9525
+ * @param data The raw separator.
9526
+ * @param relations The related structures, resolved from the cache.
9527
+ */
9528
+ constructor(data, relations = {}) {
9529
+ super(data);
9530
+ initStructure(this, data, relations);
9531
+ }
9532
+ /**
9533
+ * The size of the padding, `Small` by default.
9534
+ */
9535
+ get spacing() {
9536
+ return this[kData].spacing ?? SeparatorSpacingSize.Small;
9537
+ }
9538
+ /**
9539
+ * Whether a divider line is shown, `true` by default.
9540
+ */
9541
+ get divider() {
9542
+ return this[kData].divider ?? true;
9543
+ }
9544
+ };
9545
+ Mixin(SeparatorComponent, [StructureMixin, ComponentMixin]);
9546
+
9547
+ //#endregion
9548
+ //#region src/structures/components/StringSelectMenuComponent.ts
9549
+ /**
9550
+ * A select menu of predefined text options: `@discordjs/structures`' `StringSelectMenuComponent`, like discord.js'.
9551
+ */
9552
+ var StringSelectMenuComponent = class extends StringSelectMenuComponent$1 {
9553
+ /**
9554
+ * @param data The raw select menu.
9555
+ * @param relations The related structures, resolved from the cache.
9556
+ */
9557
+ constructor(data, relations = {}) {
9558
+ super(data);
9559
+ initStructure(this, data, relations);
9560
+ }
9561
+ /**
9562
+ * Whether the select menu is disabled.
9563
+ */
9564
+ get disabled() {
9565
+ return this[kData].disabled ?? false;
9566
+ }
9567
+ /**
9568
+ * The options of the select menu.
9569
+ */
9570
+ get options() {
9571
+ return this[kData].options;
9572
+ }
9573
+ };
9574
+ Mixin(StringSelectMenuComponent, [StructureMixin, ComponentMixin]);
9575
+
9576
+ //#endregion
9577
+ //#region src/structures/components/TextDisplayComponent.ts
9578
+ /**
9579
+ * Markdown text: `@discordjs/structures`' `TextDisplayComponent`, like discord.js'.
9580
+ */
9581
+ var TextDisplayComponent = class extends TextDisplayComponent$1 {
9582
+ /**
9583
+ * @param data The raw text display.
9584
+ * @param relations The related structures, resolved from the cache.
9585
+ */
9586
+ constructor(data, relations = {}) {
9587
+ super(data);
9588
+ initStructure(this, data, relations);
9589
+ }
9590
+ };
9591
+ Mixin(TextDisplayComponent, [StructureMixin, ComponentMixin]);
9592
+
9593
+ //#endregion
9594
+ //#region src/structures/components/TextInputComponent.ts
9595
+ /**
9596
+ * A text field of a modal: `@discordjs/structures`' `TextInputComponent`, like discord.js'.
9597
+ */
9598
+ var TextInputComponent = class extends TextInputComponent$1 {
9599
+ /**
9600
+ * @param data The raw text input.
9601
+ * @param relations The related structures, resolved from the cache.
9602
+ */
9603
+ constructor(data, relations = {}) {
9604
+ super(data);
9605
+ initStructure(this, data, relations);
9606
+ }
9607
+ };
9608
+ Mixin(TextInputComponent, [StructureMixin, ComponentMixin]);
9609
+
9610
+ //#endregion
9611
+ //#region src/structures/components/ThumbnailComponent.ts
9612
+ /**
9613
+ * A small image, used as the accessory of a section: `@discordjs/structures`' `ThumbnailComponent`, with its media like
9614
+ * discord.js'.
9615
+ */
9616
+ var ThumbnailComponent = class extends ThumbnailComponent$1 {
9617
+ /**
9618
+ * @param data The raw thumbnail.
9619
+ * @param relations The related structures, resolved from the cache.
9620
+ */
9621
+ constructor(data, relations = {}) {
9622
+ super(data);
9623
+ initStructure(this, data, relations);
9624
+ }
9625
+ /**
9626
+ * The media of the thumbnail.
9627
+ */
9628
+ get media() {
9629
+ return new UnfurledMediaItem(this[kData].media);
9630
+ }
9631
+ /**
9632
+ * The description of the thumbnail.
9633
+ */
9634
+ get description() {
9635
+ return this[kData].description ?? void 0;
9636
+ }
9637
+ /**
9638
+ * Whether the thumbnail is marked as a spoiler.
9639
+ */
9640
+ get spoiler() {
9641
+ return this[kData].spoiler ?? false;
9642
+ }
9643
+ };
9644
+ Mixin(ThumbnailComponent, [StructureMixin, ComponentMixin]);
9645
+
9646
+ //#endregion
9647
+ //#region src/structures/components/UserSelectMenuComponent.ts
9648
+ /**
9649
+ * A select menu of users: `@discordjs/structures`' `UserSelectMenuComponent`, like discord.js'.
9650
+ */
9651
+ var UserSelectMenuComponent = class extends UserSelectMenuComponent$1 {
9652
+ /**
9653
+ * @param data The raw select menu.
9654
+ * @param relations The related structures, resolved from the cache.
9655
+ */
9656
+ constructor(data, relations = {}) {
9657
+ super(data);
9658
+ initStructure(this, data, relations);
9659
+ }
9660
+ /**
9661
+ * Whether the select menu is disabled.
9662
+ */
9663
+ get disabled() {
9664
+ return this[kData].disabled ?? false;
9665
+ }
9666
+ /**
9667
+ * The values selected by default.
9668
+ */
9669
+ get defaultValues() {
9670
+ return this[kData].default_values ?? [];
9671
+ }
9672
+ };
9673
+ Mixin(UserSelectMenuComponent, [StructureMixin, ComponentMixin]);
9674
+
9675
+ //#endregion
9676
+ //#region src/util/components.ts
9677
+ function createComponent(data) {
9678
+ if (data instanceof Component) return data;
9679
+ return buildComponent(data);
9680
+ }
9681
+ function buildComponent(data) {
9682
+ switch (data.type) {
9683
+ case ComponentType.ActionRow: return new ActionRow(data);
9684
+ case ComponentType.Button: switch (data.style) {
9685
+ case ButtonStyle.Link: return new LinkButtonComponent(data);
9686
+ case ButtonStyle.Premium: return new PremiumButtonComponent(data);
9687
+ default: return new InteractiveButtonComponent(data);
9688
+ }
9689
+ case ComponentType.StringSelect: return new StringSelectMenuComponent(data);
9690
+ case ComponentType.TextInput: return new TextInputComponent(data);
9691
+ case ComponentType.UserSelect: return new UserSelectMenuComponent(data);
9692
+ case ComponentType.RoleSelect: return new RoleSelectMenuComponent(data);
9693
+ case ComponentType.MentionableSelect: return new MentionableSelectMenuComponent(data);
9694
+ case ComponentType.ChannelSelect: return new ChannelSelectMenuComponent(data);
9695
+ case ComponentType.Section: return new SectionComponent(data);
9696
+ case ComponentType.TextDisplay: return new TextDisplayComponent(data);
9697
+ case ComponentType.Thumbnail: return new ThumbnailComponent(data);
9698
+ case ComponentType.MediaGallery: return new MediaGalleryComponent(data);
9699
+ case ComponentType.File: return new FileComponent(data);
9700
+ case ComponentType.Separator: return new SeparatorComponent(data);
9701
+ case ComponentType.Container: return new ContainerComponent(data);
9702
+ case ComponentType.Label: return new LabelComponent(data);
9703
+ case ComponentType.FileUpload: return new FileUploadComponent(data);
9704
+ case ComponentType.RadioGroup: return new RadioGroupComponent(data);
9705
+ case ComponentType.CheckboxGroup: return new CheckboxGroupComponent(data);
9706
+ case ComponentType.Checkbox: return new CheckboxComponent(data);
9707
+ default: return new Component(data);
9708
+ }
9709
+ }
9710
+ /**
9711
+ * Gets the components of a component tree that can have a custom ID: the children of action rows and labels, the
9712
+ * components and accessory of sections, recursively through containers.
9713
+ *
9714
+ * @param component The component, or raw component data.
9715
+ */
9716
+ function extractInteractiveComponents(component) {
9717
+ const node = component;
9718
+ switch (node.type) {
9719
+ case ComponentType.ActionRow: return node.components;
9720
+ case ComponentType.Section: return [...node.components, node.accessory];
9721
+ case ComponentType.Container: return node.components.flatMap(extractInteractiveComponents);
9722
+ case ComponentType.Label: return [node.component];
9723
+ default: return [component];
9724
+ }
9725
+ }
9726
+ /**
9727
+ * Finds a component by its custom ID in a component tree, like discord.js' `findComponentByCustomId`.
9728
+ *
9729
+ * @param components The components, or raw component data, to search in, like a message's top-level components.
9730
+ * @param customId The custom ID.
9731
+ * @returns The component, as given, `null` when none has the custom ID.
9732
+ */
9733
+ function findComponentByCustomId(components, customId) {
9734
+ return components.flatMap(extractInteractiveComponents).find((component) => {
9735
+ const node = component;
9736
+ return (component instanceof Component ? node.customId : node.custom_id) === customId;
9737
+ }) ?? null;
9738
+ }
9739
+
8858
9740
  //#endregion
8859
9741
  //#region src/structures/messages/Attachment.ts
8860
9742
  /**
@@ -9250,7 +10132,7 @@ var Poll = class extends Poll$1 {
9250
10132
  */
9251
10133
  async fetch() {
9252
10134
  const { poll } = (await this.client.messages.fetch(this.channelId, this.messageId, { force: true })).toJSON();
9253
- if (!poll) throw new Error(`Message ${this.messageId} has no poll`);
10135
+ if (!poll) throw new GatewayError("MessagePollMissing", this.messageId);
9254
10136
  return this[kPatch](poll);
9255
10137
  }
9256
10138
  get question() {
@@ -9403,10 +10285,11 @@ var Message = class Message extends Message$1 {
9403
10285
  return (this[kData].embeds ?? []).map((embed) => new Embed(embed));
9404
10286
  }
9405
10287
  /**
9406
- * The raw components of the message. Build components with `@discordjs/builders`.
10288
+ * The top-level components of the message, like discord.js'. Their `toJSON` returns the raw components; build new
10289
+ * ones with `@discordjs/builders`.
9407
10290
  */
9408
10291
  get components() {
9409
- return this[kData].components ?? [];
10292
+ return (this[kData].components ?? []).map((component) => createComponent(component));
9410
10293
  }
9411
10294
  /**
9412
10295
  * The raw sticker items of the message; fetch a full sticker with `client.fetchSticker(id)`.
@@ -9564,7 +10447,7 @@ var Message = class Message extends Message$1 {
9564
10447
  */
9565
10448
  async fetchReference() {
9566
10449
  const reference = this.reference;
9567
- if (!reference?.message_id) throw new Error(`Message ${this.id} references no message`);
10450
+ if (!reference?.message_id) throw new GatewayError("MessageReferenceMissing", this.id);
9568
10451
  return this.client.messages.fetch(reference.channel_id ?? this.channelId, reference.message_id);
9569
10452
  }
9570
10453
  /**
@@ -10839,7 +11722,7 @@ var VoiceStateManager = class extends CachedManager {
10839
11722
  return new VoiceState(data);
10840
11723
  }
10841
11724
  keyOf(data) {
10842
- if (!data.guild_id) throw new TypeError("Cannot key a voice state outside of a guild");
11725
+ if (!data.guild_id) throw new GatewayTypeError("CacheKeyUnresolvable", "voice state", "outside of a guild");
10843
11726
  return this.resolveKey(data.guild_id, data.user_id);
10844
11727
  }
10845
11728
  resolveKey(guildId, userId) {
@@ -10928,7 +11811,7 @@ var PresenceManager = class extends CachedManager {
10928
11811
  return Promise.all(entries.filter(([key]) => key.startsWith(prefix)).map(([, raw]) => this.hydrate(raw)));
10929
11812
  }
10930
11813
  fetchRaw(guildId, userId) {
10931
- return Promise.reject(/* @__PURE__ */ new Error(`Presences cannot be fetched from the API, they are only received from the gateway (user ${userId} of guild ${guildId} is not cached); enable the presences cache to read them later`));
11814
+ return Promise.reject(new GatewayError("PresenceNotFetchable", guildId, userId));
10932
11815
  }
10933
11816
  };
10934
11817
 
@@ -11077,7 +11960,7 @@ var ThreadMember = class extends Structure {
11077
11960
  */
11078
11961
  async fetch() {
11079
11962
  const { threadId, id } = this;
11080
- if (!threadId || !id) throw new Error("A thread member without a thread or user ID cannot be fetched");
11963
+ if (!threadId || !id) throw new GatewayError("ThreadMemberIdsMissing", "fetched");
11081
11964
  const member = await this.client.threadMembers.fetch(threadId, id, { force: true });
11082
11965
  return this[kPatch](member.toJSON());
11083
11966
  }
@@ -11117,7 +12000,7 @@ var ThreadMember = class extends Structure {
11117
12000
  */
11118
12001
  async remove() {
11119
12002
  const { id, threadId } = this;
11120
- if (!id || !threadId) throw new Error("Cannot remove a thread member without its IDs");
12003
+ if (!id || !threadId) throw new GatewayError("ThreadMemberIdsMissing", "removed");
11121
12004
  await this.client.threadMembers.remove(threadId, id);
11122
12005
  return this;
11123
12006
  }
@@ -11136,7 +12019,7 @@ var ThreadMemberManager = class extends CachedManager {
11136
12019
  return new ThreadMember(data);
11137
12020
  }
11138
12021
  keyOf(data) {
11139
- if (!data.id || !data.user_id) throw new TypeError("Cannot key a thread member without its IDs");
12022
+ if (!data.id || !data.user_id) throw new GatewayTypeError("CacheKeyUnresolvable", "thread member", "without its IDs");
11140
12023
  return this.resolveKey(data.id, data.user_id);
11141
12024
  }
11142
12025
  resolveKey(threadId, userId) {
@@ -12479,7 +13362,7 @@ var ActionsManager = class {
12479
13362
  constructor(client) {
12480
13363
  for (const [event, handler] of Object.entries(DispatchHandlers)) if (handler) this.#actions.set(event, new DispatchAction(client, handler));
12481
13364
  for (const [event, handler] of Object.entries(MultiDispatchHandlers)) if (handler) {
12482
- if (this.#actions.has(event)) throw new Error(`Dispatch event "${event}" is registered in both DispatchHandlers and MultiDispatchHandlers`);
13365
+ if (this.#actions.has(event)) throw new GatewayError("DispatchHandlerConflict", event);
12483
13366
  this.#actions.set(event, new MultiDispatchAction(client, handler));
12484
13367
  }
12485
13368
  }
@@ -12642,7 +13525,7 @@ var GatewaySessionMirror = class {
12642
13525
  if (this.#timeout === null) return await read;
12643
13526
  const timeout = this.#timeout;
12644
13527
  return await Promise.race([read, new Promise((_, reject) => {
12645
- timer = setTimeout(() => reject(/* @__PURE__ */ new Error(`Timed out after ${timeout}ms`)), timeout);
13528
+ timer = setTimeout(() => reject(new GatewayError("SessionStoreTimeout", timeout)), timeout);
12646
13529
  })]);
12647
13530
  } catch (error) {
12648
13531
  this.#onError(new GatewaySessionStoreError("get", shardId, error));
@@ -13107,7 +13990,7 @@ var GatewayClient = class extends Client {
13107
13990
  }
13108
13991
  sessionCallbacks(options) {
13109
13992
  const { sessionStore, gateway } = options;
13110
- if (sessionStore && (gateway?.retrieveSessionInfo || gateway?.updateSessionInfo)) throw new TypeError("sessionStore replaces gateway.retrieveSessionInfo and gateway.updateSessionInfo, pass one or the other");
13993
+ if (sessionStore && (gateway?.retrieveSessionInfo || gateway?.updateSessionInfo)) throw new GatewayTypeError("ClientSessionStoreConflict");
13111
13994
  let retrieve = gateway?.retrieveSessionInfo ?? DefaultWebSocketManagerOptions.retrieveSessionInfo;
13112
13995
  let update = gateway?.updateSessionInfo ?? DefaultWebSocketManagerOptions.updateSessionInfo;
13113
13996
  if (sessionStore) {
@@ -13142,6 +14025,24 @@ function resolveCache(options) {
13142
14025
  return Object.keys(resolved).length === 0 ? void 0 : resolved;
13143
14026
  }
13144
14027
 
14028
+ //#endregion
14029
+ //#region src/errors/ErrorCodes.ts
14030
+ /**
14031
+ * Every {@link GatewayErrorCode}, keyed by itself, like discord.js's `DiscordjsErrorCodes`.
14032
+ *
14033
+ * @example
14034
+ * ```typescript
14035
+ * try {
14036
+ * await webhook.send("Awoo");
14037
+ * } catch (error) {
14038
+ * if (error instanceof GatewayError && error.code === GatewayErrorCodes.WebhookTokenUnavailable) {
14039
+ * // ...
14040
+ * }
14041
+ * }
14042
+ * ```
14043
+ */
14044
+ const GatewayErrorCodes = Object.freeze(Object.fromEntries(Object.keys(GatewayErrorMessages).map((code) => [code, code])));
14045
+
13145
14046
  //#endregion
13146
14047
  //#region src/util/decorators.ts
13147
14048
  /**
@@ -13180,5 +14081,5 @@ function RegisterAsGatewayListener(event, options = {}) {
13180
14081
  }
13181
14082
 
13182
14083
  //#endregion
13183
- export { Action, ActionsManager, Activity, ActivityFlagsBitField, AnnouncementChannel, AnnouncementThreadChannel, AnonymousGuild, AppliedTagsMixin, Attachment, AttachmentFlagsBitField, AutoModerationActionExecution, AutoModerationRule, AutoModerationRuleManager, BaseChannel, BaseChannelMixin, BaseInvite, CachedManager as BaseManager, CachedManager, BitField, CategoryChannel, Channel, ChannelFlagsBitField, ChannelManager, ChannelMessageManager, ChannelOwnerMixin, ChannelParentMixin, ChannelPermissionMixin, ChannelSlowmodeMixin, ChannelThreadManager, ChannelThreadsMixin, ChannelTopicMixin, ChannelWebhooksMixin, ClientUser, DMChannel, DMChannelMixin, DispatchAction, DispatchHandlers, DispatchQueue, DispatchTimeoutError, Embed, Emoji, EventGatewayListener, ForumChannel, GatewayClient, GatewayEvents, GatewaySessionStoreError, GroupDMChannel, GroupDMInvite, GroupDMMixin, Guild, GuildAuditLogsEntry, GuildBan, GuildBanManager, GuildChannelFields, GuildChannelManager, GuildChannelMixin, GuildEmoji, GuildEmojiManager, GuildEmojiRoleManager, GuildIntegrationManager, GuildInvite, GuildInviteManager, GuildManager, GuildMember, GuildMemberFlagsBitField, GuildMemberManager, GuildMemberRoleManager, GuildMembersRateLimitError, GuildMembersTimeoutError, GuildOnboarding, GuildOnboardingPrompt, GuildOnboardingPromptOption, GuildPreview, GuildScheduledEvent, GuildScheduledEventManager, GuildSoundboardSoundManager, GuildStickerManager, GuildTemplate, GuildTemplateManager, Integration, IntentsBitField, InviteGuild, MediaChannel, Message, MessageFlagsBitField, MessageManager, MessageMentions, MessagePayload, MessageReaction, Mixin, MultiDispatchAction, MultiDispatchHandlers, NumberFlagsBitField, Partials, PermissionOverwriteManager, PermissionOverwrites, PermissionsBitField, Poll, PollAnswer, Presence, PresenceManager, PrivateThreadChannel, PublicThreadChannel, ReactionEmoji, ReactionManager, ReactionUserManager, RegisterAsGatewayListener, RichPresenceAssets, Role, RoleFlagsBitField, RoleManager, SoundboardSound, StageChannel, StageInstance, StageInstanceManager, Sticker, StickerPack, Structure, StructureMixin, SystemChannelFlagsBitField, TextChannel, TextChannelMixin, ThreadChannelMemberManager, ThreadChannelMixin, ThreadManager, ThreadMember, ThreadMemberManager, ThreadOnlyChannelMixin, Typing, User, UserFlagsBitField, UserManager, VoiceChannel, VoiceChannelMixin, VoiceState, VoiceStateManager, Webhook, WebhookManager, WebhookMixin, WelcomeScreen, Widget, WidgetMember, bindClient, compareRolePositions, computeChannelPermissions, computeGuildPermissions, computePermissionsIn, computeTargetPermissions, createChannel, createInvite, dispatchPartition, getGatewayClient, initStructure, isDeepEqual, isThreadChannelType, kClient, kClone, kData, kPatch, kPatchRelations, kRelations, resolveId, resolveOverwriteOptions, snowflakeTimestamp, toAPIOverwrite, toChannelBody };
14084
+ export { Action, ActionRow, ActionsManager, Activity, ActivityFlagsBitField, AnnouncementChannel, AnnouncementThreadChannel, AnonymousGuild, AppliedTagsMixin, Attachment, AttachmentFlagsBitField, AutoModerationActionExecution, AutoModerationRule, AutoModerationRuleManager, BaseChannel, BaseChannelMixin, BaseInvite, CachedManager as BaseManager, CachedManager, BitField, CategoryChannel, Channel, ChannelFlagsBitField, ChannelManager, ChannelMessageManager, ChannelOwnerMixin, ChannelParentMixin, ChannelPermissionMixin, ChannelSelectMenuComponent, ChannelSlowmodeMixin, ChannelThreadManager, ChannelThreadsMixin, ChannelTopicMixin, ChannelWebhooksMixin, CheckboxComponent, CheckboxGroupComponent, ClientUser, Component, ComponentMixin, ContainerComponent, DMChannel, DMChannelMixin, DispatchAction, DispatchHandlers, DispatchQueue, DispatchTimeoutError, Embed, Emoji, EventGatewayListener, FileComponent, FileUploadComponent, ForumChannel, GatewayClient, GatewayError, GatewayErrorCodes, GatewayErrorMessages, GatewayEvents, GatewayRangeError, GatewaySessionStoreError, GatewayTypeError, GroupDMChannel, GroupDMInvite, GroupDMMixin, Guild, GuildAuditLogsEntry, GuildBan, GuildBanManager, GuildChannelFields, GuildChannelManager, GuildChannelMixin, GuildEmoji, GuildEmojiManager, GuildEmojiRoleManager, GuildIntegrationManager, GuildInvite, GuildInviteManager, GuildManager, GuildMember, GuildMemberFlagsBitField, GuildMemberManager, GuildMemberRoleManager, GuildMembersRateLimitError, GuildMembersTimeoutError, GuildOnboarding, GuildOnboardingPrompt, GuildOnboardingPromptOption, GuildPreview, GuildScheduledEvent, GuildScheduledEventManager, GuildSoundboardSoundManager, GuildStickerManager, GuildTemplate, GuildTemplateManager, Integration, IntentsBitField, InteractiveButtonComponent, InviteGuild, LabelComponent, LinkButtonComponent, MediaChannel, MediaGalleryComponent, MediaGalleryItem, MentionableSelectMenuComponent, Message, MessageFlagsBitField, MessageManager, MessageMentions, MessagePayload, MessageReaction, Mixin, MultiDispatchAction, MultiDispatchHandlers, NumberFlagsBitField, Partials, PermissionOverwriteManager, PermissionOverwrites, PermissionsBitField, Poll, PollAnswer, PremiumButtonComponent, Presence, PresenceManager, PrivateThreadChannel, PublicThreadChannel, RadioGroupComponent, ReactionEmoji, ReactionManager, ReactionUserManager, RegisterAsGatewayListener, RichPresenceAssets, Role, RoleFlagsBitField, RoleManager, RoleSelectMenuComponent, SectionComponent, SeparatorComponent, SoundboardSound, StageChannel, StageInstance, StageInstanceManager, Sticker, StickerPack, StringSelectMenuComponent, Structure, StructureMixin, SystemChannelFlagsBitField, TextChannel, TextChannelMixin, TextDisplayComponent, TextInputComponent, ThreadChannelMemberManager, ThreadChannelMixin, ThreadManager, ThreadMember, ThreadMemberManager, ThreadOnlyChannelMixin, ThumbnailComponent, Typing, UnfurledMediaItem, User, UserFlagsBitField, UserManager, UserSelectMenuComponent, VoiceChannel, VoiceChannelMixin, VoiceState, VoiceStateManager, Webhook, WebhookManager, WebhookMixin, WelcomeScreen, Widget, WidgetMember, bindClient, compareRolePositions, computeChannelPermissions, computeGuildPermissions, computePermissionsIn, computeTargetPermissions, createChannel, createComponent, createInvite, dispatchPartition, findComponentByCustomId, getGatewayClient, initStructure, isDeepEqual, isThreadChannelType, kClient, kClone, kData, kPatch, kPatchRelations, kRelations, resolveId, resolveOverwriteOptions, snowflakeTimestamp, toAPIOverwrite, toChannelBody };
13184
14085
  //# sourceMappingURL=index.js.map