@fluxerjs/core 2.0.2 → 2.1.0

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/cluster.mjs CHANGED
@@ -68,8 +68,8 @@ import { Routes as Routes34 } from "@fluxerjs/types";
68
68
 
69
69
  // src/client/ChannelManager.ts
70
70
  import { Collection as Collection5 } from "@fluxerjs/collection";
71
- import { Routes as Routes12 } from "@fluxerjs/types";
72
- import { FluxerAPIError as FluxerAPIError2, RateLimitError as RateLimitError2 } from "@fluxerjs/rest";
71
+ import { Routes as Routes13 } from "@fluxerjs/types";
72
+ import { FluxerAPIError as FluxerAPIError3, RateLimitError as RateLimitError3 } from "@fluxerjs/rest";
73
73
 
74
74
  // src/util/messageUtils/files.ts
75
75
  var FILE_FETCH_TIMEOUT_MS = 3e4;
@@ -251,19 +251,19 @@ async function prepareMessagePostPayload(options, defaults) {
251
251
  }
252
252
 
253
253
  // src/structures/channel/base.ts
254
- import { ChannelType, Routes as Routes6 } from "@fluxerjs/types";
254
+ import { ChannelType, Routes as Routes7 } from "@fluxerjs/types";
255
255
 
256
256
  // src/client/MessageManager.ts
257
- import { Routes as Routes4 } from "@fluxerjs/types";
257
+ import { Routes as Routes5 } from "@fluxerjs/types";
258
258
  import { Collection as Collection3 } from "@fluxerjs/collection";
259
- import { FluxerAPIError, RateLimitError } from "@fluxerjs/rest";
259
+ import { FluxerAPIError as FluxerAPIError2, RateLimitError as RateLimitError2 } from "@fluxerjs/rest";
260
260
 
261
261
  // src/structures/message/Message.ts
262
262
  import { Collection as Collection2 } from "@fluxerjs/collection";
263
263
  import { EmbedBuilder as EmbedBuilder2 } from "@fluxerjs/builders";
264
264
  import {
265
265
  MessageType,
266
- Routes as Routes3
266
+ Routes as Routes4
267
267
  } from "@fluxerjs/types";
268
268
 
269
269
  // src/client/sdkOptions.ts
@@ -504,6 +504,70 @@ function toProfilePayload(data) {
504
504
  // src/util/ReactionCollector.ts
505
505
  import { EventEmitter } from "events";
506
506
  import { Collection } from "@fluxerjs/collection";
507
+
508
+ // src/structures/MessageReaction.ts
509
+ import { Routes } from "@fluxerjs/types";
510
+ import { FluxerAPIError, RateLimitError } from "@fluxerjs/rest";
511
+
512
+ // src/structures/Base.ts
513
+ var Base = class {
514
+ };
515
+
516
+ // src/structures/MessageReaction.ts
517
+ var MessageReaction = class extends Base {
518
+ client;
519
+ messageId;
520
+ channelId;
521
+ guildId;
522
+ emoji;
523
+ /** Raw gateway payload for low-level access. */
524
+ _data;
525
+ constructor(client, data) {
526
+ super();
527
+ this.client = client;
528
+ this._data = data;
529
+ this.messageId = data.message_id;
530
+ this.channelId = data.channel_id;
531
+ this.guildId = data.guild_id ?? null;
532
+ this.emoji = {
533
+ name: data.emoji.name,
534
+ ...data.emoji.id !== void 0 ? { id: data.emoji.id } : {},
535
+ ...data.emoji.animated !== void 0 ? { animated: data.emoji.animated } : {}
536
+ };
537
+ }
538
+ /** Emoji as a string: unicode or "name:id" for custom. */
539
+ get emojiIdentifier() {
540
+ return this.emoji.id ? `${this.emoji.name}:${this.emoji.id}` : this.emoji.name;
541
+ }
542
+ /** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
543
+ get guild() {
544
+ return this.guildId ? this.client.guilds.get(this.guildId) ?? null : null;
545
+ }
546
+ /**
547
+ * Fetch the message this reaction belongs to.
548
+ * Use when you need to edit, delete, or otherwise interact with the message.
549
+ * @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
550
+ */
551
+ async fetchMessage() {
552
+ try {
553
+ const data = await this.client.rest.get(
554
+ Routes.channelMessage(this.channelId, this.messageId)
555
+ );
556
+ return new Message(this.client, data);
557
+ } catch (err) {
558
+ if (err instanceof RateLimitError) throw err;
559
+ if (err instanceof FluxerAPIError && err.statusCode === 404) {
560
+ throw new FluxerError(`Message ${this.messageId} not found in channel ${this.channelId}`, {
561
+ code: ErrorCodes.MessageNotFound,
562
+ cause: err
563
+ });
564
+ }
565
+ throw err instanceof FluxerError ? err : new FluxerError(String(err), { cause: err });
566
+ }
567
+ }
568
+ };
569
+
570
+ // src/util/ReactionCollector.ts
507
571
  var ReactionCollector = class extends EventEmitter {
508
572
  client;
509
573
  messageId;
@@ -512,7 +576,8 @@ var ReactionCollector = class extends EventEmitter {
512
576
  collected = new Collection();
513
577
  _timeout = null;
514
578
  _ended = false;
515
- _listener;
579
+ _onAdd;
580
+ _onAddMany;
516
581
  constructor(client, messageId, channelId, options = {}) {
517
582
  super();
518
583
  this.client = client;
@@ -523,27 +588,58 @@ var ReactionCollector = class extends EventEmitter {
523
588
  time: options.time ?? 0,
524
589
  max: options.max ?? 0
525
590
  };
526
- this._listener = (payload) => {
591
+ this._onAdd = (payload) => {
527
592
  if (this._ended || payload.reaction.messageId !== this.messageId || payload.channelId !== this.channelId) {
528
593
  return;
529
594
  }
530
- if (!this.options.filter(payload.reaction, payload.user)) return;
531
- const key = `${payload.userId}:${payload.reaction.emoji.id ?? payload.reaction.emoji.name}`;
532
- this.collected.set(key, { reaction: payload.reaction, user: payload.user });
533
- this.emit("collect", payload.reaction, payload.user);
534
- if (this.options.max > 0 && this.collected.size >= this.options.max) {
535
- this.stop("limit");
595
+ this._collect(payload.reaction, payload.user, payload.userId);
596
+ };
597
+ this._onAddMany = (payload) => {
598
+ if (this._ended || payload.messageId !== this.messageId || payload.channelId !== this.channelId) {
599
+ return;
600
+ }
601
+ for (const entry of payload.reactions) {
602
+ if (this._ended) return;
603
+ const reaction = new MessageReaction(this.client, {
604
+ message_id: payload.messageId,
605
+ channel_id: payload.channelId,
606
+ guild_id: payload.guildId ?? void 0,
607
+ user_id: entry.userId,
608
+ emoji: {
609
+ name: entry.emoji.name,
610
+ ...entry.emoji.id !== void 0 ? { id: entry.emoji.id } : {},
611
+ ...entry.emoji.animated !== void 0 ? { animated: entry.emoji.animated } : {}
612
+ }
613
+ });
614
+ const user = entry.member?.user ?? this.client.users.get(entry.userId) ?? this.client.getOrCreateUser({
615
+ id: entry.userId,
616
+ username: "Unknown",
617
+ discriminator: "0"
618
+ });
619
+ this._collect(reaction, user, entry.userId);
536
620
  }
537
621
  };
538
- this.client.on(Events.MessageReactionAdd, this._listener);
622
+ this.client.on(Events.MessageReactionAdd, this._onAdd);
623
+ this.client.on(Events.MessageReactionAddMany, this._onAddMany);
539
624
  if (this.options.time > 0) {
540
625
  this._timeout = setTimeout(() => this.stop("time"), this.options.time);
541
626
  }
542
627
  }
628
+ _collect(reaction, user, userId) {
629
+ if (this._ended) return;
630
+ if (!this.options.filter(reaction, user)) return;
631
+ const key = `${userId}:${reaction.emoji.id ?? reaction.emoji.name}`;
632
+ this.collected.set(key, { reaction, user });
633
+ this.emit("collect", reaction, user);
634
+ if (this.options.max > 0 && this.collected.size >= this.options.max) {
635
+ this.stop("limit");
636
+ }
637
+ }
543
638
  stop(reason = "user") {
544
639
  if (this._ended) return;
545
640
  this._ended = true;
546
- this.client.off(Events.MessageReactionAdd, this._listener);
641
+ this.client.off(Events.MessageReactionAdd, this._onAdd);
642
+ this.client.off(Events.MessageReactionAddMany, this._onAddMany);
547
643
  if (this._timeout) {
548
644
  clearTimeout(this._timeout);
549
645
  this._timeout = null;
@@ -558,30 +654,26 @@ var ReactionCollector = class extends EventEmitter {
558
654
  }
559
655
  };
560
656
 
561
- // src/structures/Base.ts
562
- var Base = class {
563
- };
564
-
565
657
  // src/structures/message/reactions.ts
566
- import { Routes } from "@fluxerjs/types";
658
+ import { Routes as Routes2 } from "@fluxerjs/types";
567
659
  async function emojiPath(message, emoji) {
568
660
  return message.client.resolveEmoji(emoji, message.guildId);
569
661
  }
570
662
  async function reactToMessage(message, emoji) {
571
663
  const e = await emojiPath(message, emoji);
572
- await message.client.rest.put(Routes.channelMessageReactionMe(message.channelId, message.id, e));
664
+ await message.client.rest.put(Routes2.channelMessageReactionMe(message.channelId, message.id, e));
573
665
  }
574
666
  async function removeMessageReaction(message, emoji, userId) {
575
667
  const e = await emojiPath(message, emoji);
576
- const route = userId ? Routes.channelMessageReactionUser(message.channelId, message.id, e, userId) : Routes.channelMessageReactionMe(message.channelId, message.id, e);
668
+ const route = userId ? Routes2.channelMessageReactionUser(message.channelId, message.id, e, userId) : Routes2.channelMessageReactionMe(message.channelId, message.id, e);
577
669
  await message.client.rest.delete(route);
578
670
  }
579
671
  async function removeAllMessageReactions(message) {
580
- await message.client.rest.delete(Routes.channelMessageReactions(message.channelId, message.id));
672
+ await message.client.rest.delete(Routes2.channelMessageReactions(message.channelId, message.id));
581
673
  }
582
674
  async function removeMessageReactionEmoji(message, emoji) {
583
675
  const e = await emojiPath(message, emoji);
584
- await message.client.rest.delete(Routes.channelMessageReaction(message.channelId, message.id, e));
676
+ await message.client.rest.delete(Routes2.channelMessageReaction(message.channelId, message.id, e));
585
677
  }
586
678
  async function fetchMessageReactionUsers(message, emoji, options) {
587
679
  return (await fetchMessageReactionUsersPage(message, emoji, options)).users;
@@ -592,7 +684,7 @@ async function fetchMessageReactionUsersPage(message, emoji, options) {
592
684
  if (options?.limit != null) params.set("limit", String(options.limit));
593
685
  if (options?.after) params.set("after", options.after);
594
686
  const qs2 = params.toString();
595
- const route = Routes.channelMessageReactionUsers(message.channelId, message.id, e) + (qs2 ? `?${qs2}` : "");
687
+ const route = Routes2.channelMessageReactionUsers(message.channelId, message.id, e) + (qs2 ? `?${qs2}` : "");
596
688
  const data = await message.client.rest.get(route);
597
689
  if (Array.isArray(data)) {
598
690
  return {
@@ -611,7 +703,7 @@ async function fetchMessageReactionUsersPage(message, emoji, options) {
611
703
 
612
704
  // src/structures/message/send.ts
613
705
  import { MessagePayload as MessagePayloadBuilder } from "@fluxerjs/builders";
614
- import { Routes as Routes2 } from "@fluxerjs/types";
706
+ import { Routes as Routes3 } from "@fluxerjs/types";
615
707
  function toReplyTarget(ref) {
616
708
  return {
617
709
  channelId: ref.channel_id,
@@ -645,7 +737,7 @@ function asReplyTarget(value) {
645
737
  }
646
738
  async function sendPrepared(message, payload) {
647
739
  const data = await message.client.rest.post(
648
- Routes2.channelMessages(message.channelId),
740
+ Routes3.channelMessages(message.channelId),
649
741
  payload
650
742
  );
651
743
  message.client._addMessageToCache(message.channelId, data);
@@ -822,7 +914,7 @@ var Message = class _Message extends Base {
822
914
  if (options.attachments !== void 0) {
823
915
  body.attachments = toMessageAttachmentEditWire(options.attachments);
824
916
  }
825
- const data = await this.client.rest.patch(Routes3.channelMessage(this.channelId, this.id), {
917
+ const data = await this.client.rest.patch(Routes4.channelMessage(this.channelId, this.id), {
826
918
  body
827
919
  });
828
920
  const updated = new _Message(this.client, data);
@@ -839,25 +931,25 @@ var Message = class _Message extends Base {
839
931
  }
840
932
  /** Delete this message. */
841
933
  async delete() {
842
- await this.client.rest.delete(Routes3.channelMessage(this.channelId, this.id));
934
+ await this.client.rest.delete(Routes4.channelMessage(this.channelId, this.id));
843
935
  this.client._removeMessageFromCache(this.channelId, this.id);
844
936
  }
845
937
  /** Delete a specific attachment from this message. */
846
938
  async deleteAttachment(attachmentId) {
847
939
  await this.client.rest.delete(
848
- Routes3.channelMessageAttachment(this.channelId, this.id, attachmentId),
940
+ Routes4.channelMessageAttachment(this.channelId, this.id, attachmentId),
849
941
  { auth: true }
850
942
  );
851
943
  this.attachments.delete(attachmentId);
852
944
  }
853
945
  /** Pin this message in the channel. */
854
946
  async pin() {
855
- await this.client.rest.put(Routes3.channelPinMessage(this.channelId, this.id));
947
+ await this.client.rest.put(Routes4.channelPinMessage(this.channelId, this.id));
856
948
  this.pinned = true;
857
949
  }
858
950
  /** Unpin this message from the channel. */
859
951
  async unpin() {
860
- await this.client.rest.delete(Routes3.channelPinMessage(this.channelId, this.id));
952
+ await this.client.rest.delete(Routes4.channelPinMessage(this.channelId, this.id));
861
953
  this.pinned = false;
862
954
  }
863
955
  /** React to this message with an emoji. */
@@ -938,12 +1030,12 @@ var MessageManager = class {
938
1030
  async fetchOne(messageId) {
939
1031
  try {
940
1032
  const data = await this.client.rest.get(
941
- Routes4.channelMessage(this.channelId, messageId)
1033
+ Routes5.channelMessage(this.channelId, messageId)
942
1034
  );
943
1035
  return this.wrap(data);
944
1036
  } catch (err) {
945
- if (err instanceof RateLimitError) throw err;
946
- if (err instanceof FluxerAPIError && err.statusCode === 404) {
1037
+ if (err instanceof RateLimitError2) throw err;
1038
+ if (err instanceof FluxerAPIError2 && err.statusCode === 404) {
947
1039
  throw new FluxerError(`Message ${messageId} not found in channel ${this.channelId}`, {
948
1040
  code: ErrorCodes.MessageNotFound,
949
1041
  cause: err
@@ -964,7 +1056,7 @@ var MessageManager = class {
964
1056
  const value = options[key];
965
1057
  if (value != null && value !== "") qs2.set(key, String(value));
966
1058
  }
967
- const base = Routes4.channelMessages(this.channelId);
1059
+ const base = Routes5.channelMessages(this.channelId);
968
1060
  const data = await this.client.rest.get(qs2.size > 0 ? `${base}?${qs2}` : base);
969
1061
  const collection = new Collection3();
970
1062
  for (const msg of data) collection.set(msg.id, this.wrap(msg));
@@ -973,7 +1065,7 @@ var MessageManager = class {
973
1065
  };
974
1066
 
975
1067
  // src/structures/channel/attachments.ts
976
- import { Routes as Routes5 } from "@fluxerjs/types";
1068
+ import { Routes as Routes6 } from "@fluxerjs/types";
977
1069
  function asBytes(data) {
978
1070
  const src = data instanceof ArrayBuffer ? new Uint8Array(data) : new Uint8Array(data);
979
1071
  const out = new Uint8Array(src.byteLength);
@@ -994,7 +1086,7 @@ async function putBlob(url, body, contentType) {
994
1086
  }
995
1087
  async function uploadAttachmentsForSend(client, channelId, files) {
996
1088
  const plan = await client.rest.post(
997
- Routes5.channelAttachments(channelId),
1089
+ Routes6.channelAttachments(channelId),
998
1090
  {
999
1091
  body: {
1000
1092
  attachments: files.map((f) => ({
@@ -1040,7 +1132,7 @@ async function uploadAttachmentsForSend(client, channelId, files) {
1040
1132
  });
1041
1133
  }
1042
1134
  if (multipart.length) {
1043
- await client.rest.post(Routes5.channelAttachmentsComplete(channelId), {
1135
+ await client.rest.post(Routes6.channelAttachmentsComplete(channelId), {
1044
1136
  body: { uploads: multipart },
1045
1137
  auth: true
1046
1138
  });
@@ -1134,7 +1226,7 @@ var Channel = class extends Base {
1134
1226
  }
1135
1227
  if (ids.length === 0) return [];
1136
1228
  if (ids.length === 1) {
1137
- await this.client.rest.delete(Routes6.channelMessage(this.id, ids[0]), { auth: true });
1229
+ await this.client.rest.delete(Routes7.channelMessage(this.id, ids[0]), { auth: true });
1138
1230
  this.client._removeMessageFromCache(this.id, ids[0]);
1139
1231
  return ids;
1140
1232
  }
@@ -1143,7 +1235,7 @@ var Channel = class extends Base {
1143
1235
  code: ErrorCodes.InvalidBulkDelete
1144
1236
  });
1145
1237
  }
1146
- await this.client.rest.post(Routes6.channelBulkDelete(this.id), {
1238
+ await this.client.rest.post(Routes7.channelBulkDelete(this.id), {
1147
1239
  body: { message_ids: ids },
1148
1240
  auth: true
1149
1241
  });
@@ -1153,23 +1245,23 @@ var Channel = class extends Base {
1153
1245
  /** Delete all messages sent by the bot in this channel (user account feature). */
1154
1246
  async bulkDeleteMyMessages(options) {
1155
1247
  const body = options ? toSudoBody(options) : void 0;
1156
- await this.client.rest.post(Routes6.channelBulkDeleteMine(this.id), {
1248
+ await this.client.rest.post(Routes7.channelBulkDeleteMine(this.id), {
1157
1249
  body: body && Object.keys(body).length ? body : void 0,
1158
1250
  auth: true
1159
1251
  });
1160
1252
  }
1161
1253
  /** Mark all pinned messages as read in this channel. */
1162
1254
  async acknowledgePins() {
1163
- await this.client.rest.post(Routes6.channelPinsAck(this.id), { auth: true });
1255
+ await this.client.rest.post(Routes7.channelPinsAck(this.id), { auth: true });
1164
1256
  }
1165
1257
  /** Clear the read state for this channel. */
1166
1258
  async clearReadState() {
1167
- await this.client.rest.delete(Routes6.channelMessagesAck(this.id), { auth: true });
1259
+ await this.client.rest.delete(Routes7.channelMessagesAck(this.id), { auth: true });
1168
1260
  }
1169
1261
  /** Request upload URLs for attachments before sending a message. */
1170
1262
  async requestAttachmentUploads(attachments) {
1171
1263
  const data = await this.client.rest.post(
1172
- Routes6.channelAttachments(this.id),
1264
+ Routes7.channelAttachments(this.id),
1173
1265
  {
1174
1266
  body: toAttachmentUploadPlanBody(attachments),
1175
1267
  auth: true
@@ -1180,7 +1272,7 @@ var Channel = class extends Base {
1180
1272
  /** Complete the attachment upload flow after uploading to the CDN. */
1181
1273
  async completeAttachmentUploads(uploads) {
1182
1274
  const data = await this.client.rest.post(
1183
- Routes6.channelAttachmentsComplete(this.id),
1275
+ Routes7.channelAttachmentsComplete(this.id),
1184
1276
  {
1185
1277
  body: toAttachmentUploadCompleteBody(uploads),
1186
1278
  auth: true
@@ -1196,11 +1288,11 @@ var Channel = class extends Base {
1196
1288
  }
1197
1289
  /** Trigger the typing indicator in this channel. */
1198
1290
  async sendTyping() {
1199
- await this.client.rest.post(Routes6.channelTyping(this.id), { auth: true });
1291
+ await this.client.rest.post(Routes7.channelTyping(this.id), { auth: true });
1200
1292
  }
1201
1293
  /** Fetch available RTC regions for voice channels. */
1202
1294
  async fetchRtcRegions() {
1203
- const data = await this.client.rest.get(Routes6.channelRtcRegions(this.id), {
1295
+ const data = await this.client.rest.get(Routes7.channelRtcRegions(this.id), {
1204
1296
  auth: true
1205
1297
  });
1206
1298
  return data.map((r) => ({ id: r.id, name: r.name, emoji: r.emoji }));
@@ -1208,7 +1300,7 @@ var Channel = class extends Base {
1208
1300
  /** Fetch slowmode state for this channel. */
1209
1301
  async fetchSlowmode() {
1210
1302
  const data = await this.client.rest.get(
1211
- Routes6.channelSlowmode(this.id),
1303
+ Routes7.channelSlowmode(this.id),
1212
1304
  { auth: true }
1213
1305
  );
1214
1306
  return {
@@ -1224,7 +1316,7 @@ var Channel = class extends Base {
1224
1316
  };
1225
1317
 
1226
1318
  // src/structures/channel/guild.ts
1227
- import { Routes as Routes10 } from "@fluxerjs/types";
1319
+ import { Routes as Routes11 } from "@fluxerjs/types";
1228
1320
  import { PermissionFlags } from "@fluxerjs/util";
1229
1321
 
1230
1322
  // src/structures/Invite.ts
@@ -1233,7 +1325,7 @@ import {
1233
1325
  isGroupDmInvite,
1234
1326
  isGuildInvite,
1235
1327
  isPackInvite,
1236
- Routes as Routes7
1328
+ Routes as Routes8
1237
1329
  } from "@fluxerjs/types";
1238
1330
 
1239
1331
  // src/util/Constants.ts
@@ -1453,19 +1545,19 @@ var Invite = class _Invite extends Base {
1453
1545
  }
1454
1546
  /** Fetch invite metadata by code or URL (does not join). */
1455
1547
  static async fetch(client, codeOrUrl) {
1456
- const data = await client.rest.get(Routes7.invite(parseInviteCode(codeOrUrl)));
1548
+ const data = await client.rest.get(Routes8.invite(parseInviteCode(codeOrUrl)));
1457
1549
  return new _Invite(client, data);
1458
1550
  }
1459
1551
  /** Delete this invite. Requires Manage Guild or Create Instant Invite. */
1460
1552
  async delete() {
1461
- await this.client.rest.delete(Routes7.invite(this.code), { auth: true });
1553
+ await this.client.rest.delete(Routes8.invite(this.code), { auth: true });
1462
1554
  }
1463
1555
  };
1464
1556
 
1465
1557
  // src/structures/Webhook.ts
1466
1558
  import { EmbedBuilder as EmbedBuilder3 } from "@fluxerjs/builders";
1467
1559
  import {
1468
- Routes as Routes8
1560
+ Routes as Routes9
1469
1561
  } from "@fluxerjs/types";
1470
1562
 
1471
1563
  // src/util/cdn.ts
@@ -1558,10 +1650,10 @@ var Webhook = class _Webhook extends Base {
1558
1650
  /** Delete this webhook (token auth when available, otherwise bot auth). */
1559
1651
  async delete() {
1560
1652
  if (this.token) {
1561
- await this.client.rest.delete(Routes8.webhookExecute(this.id, this.token), { auth: false });
1653
+ await this.client.rest.delete(Routes9.webhookExecute(this.id, this.token), { auth: false });
1562
1654
  return;
1563
1655
  }
1564
- await this.client.rest.delete(Routes8.webhook(this.id), { auth: true });
1656
+ await this.client.rest.delete(Routes9.webhook(this.id), { auth: true });
1565
1657
  }
1566
1658
  /**
1567
1659
  * Edit name/avatar. With bot auth (no token), `channelId` may also be set.
@@ -1573,10 +1665,10 @@ var Webhook = class _Webhook extends Base {
1573
1665
  if (!this.token && options.channelId !== void 0) {
1574
1666
  body.channel_id = options.channelId;
1575
1667
  }
1576
- const data = this.token ? await this.client.rest.patch(Routes8.webhookExecute(this.id, this.token), {
1668
+ const data = this.token ? await this.client.rest.patch(Routes9.webhookExecute(this.id, this.token), {
1577
1669
  body,
1578
1670
  auth: false
1579
- }) : await this.client.rest.patch(Routes8.webhook(this.id), { body, auth: true });
1671
+ }) : await this.client.rest.patch(Routes9.webhook(this.id), { body, auth: true });
1580
1672
  this.name = data.name ?? this.name;
1581
1673
  this.avatar = data.avatar ?? null;
1582
1674
  if (!this.token) this.channelId = data.channel_id ?? this.channelId;
@@ -1597,7 +1689,7 @@ var Webhook = class _Webhook extends Base {
1597
1689
  if (overrides.avatarUrl !== void 0) {
1598
1690
  body.avatar_url = overrides.avatarUrl;
1599
1691
  }
1600
- const route = `${Routes8.webhookExecute(this.id, token)}${wait ? "?wait=true" : ""}`;
1692
+ const route = `${Routes9.webhookExecute(this.id, token)}${wait ? "?wait=true" : ""}`;
1601
1693
  const data = await this.client.rest.post(route, {
1602
1694
  body,
1603
1695
  ...files?.length ? { files } : {},
@@ -1638,7 +1730,7 @@ var Webhook = class _Webhook extends Base {
1638
1730
  }
1639
1731
  /** Fetch a webhook by ID (bot auth; no token). */
1640
1732
  static async fetch(client, webhookId) {
1641
- const data = await client.rest.get(Routes8.webhook(webhookId));
1733
+ const data = await client.rest.get(Routes9.webhook(webhookId));
1642
1734
  return new _Webhook(client, data);
1643
1735
  }
1644
1736
  /** Build a webhook from a stored id + token (e.g. webhook URL). */
@@ -1663,12 +1755,12 @@ var Webhook = class _Webhook extends Base {
1663
1755
  return this.token;
1664
1756
  }
1665
1757
  messageRoute(messageId) {
1666
- return Routes8.webhookMessage(this.id, this.requireToken(), messageId);
1758
+ return Routes9.webhookMessage(this.id, this.requireToken(), messageId);
1667
1759
  }
1668
1760
  };
1669
1761
 
1670
1762
  // src/structures/channel/textCapable.ts
1671
- import { Routes as Routes9 } from "@fluxerjs/types";
1763
+ import { Routes as Routes10 } from "@fluxerjs/types";
1672
1764
 
1673
1765
  // src/util/MessageCollector.ts
1674
1766
  import { EventEmitter as EventEmitter2 } from "events";
@@ -1729,7 +1821,7 @@ async function fetchPinnedMessagesPageFor(client, channelId, options) {
1729
1821
  if (options?.before) params.set("before", options.before);
1730
1822
  const qs2 = params.toString();
1731
1823
  const data = await client.rest.get(
1732
- Routes9.channelPins(channelId) + (qs2 ? `?${qs2}` : "")
1824
+ Routes10.channelPins(channelId) + (qs2 ? `?${qs2}` : "")
1733
1825
  );
1734
1826
  const items = data.items ?? [];
1735
1827
  return {
@@ -1745,7 +1837,7 @@ function TextCapable(Base2) {
1745
1837
  const payload = await prepareMessagePostPayload(options, {
1746
1838
  defaultAllowedMentions: this.client.options.defaultAllowedMentions
1747
1839
  });
1748
- const data = await this.client.rest.post(Routes9.channelMessages(this.id), payload);
1840
+ const data = await this.client.rest.post(Routes10.channelMessages(this.id), payload);
1749
1841
  this.client._addMessageToCache(this.id, data);
1750
1842
  return new Message(this.client, data);
1751
1843
  }
@@ -1802,7 +1894,7 @@ var GuildChannel = class extends Channel {
1802
1894
  }
1803
1895
  /** Create a webhook for this channel. Requires Manage Webhooks. */
1804
1896
  async createWebhook(options) {
1805
- const data = await this.client.rest.post(Routes10.channelWebhooks(this.id), {
1897
+ const data = await this.client.rest.post(Routes11.channelWebhooks(this.id), {
1806
1898
  body: options,
1807
1899
  auth: true
1808
1900
  });
@@ -1810,13 +1902,13 @@ var GuildChannel = class extends Channel {
1810
1902
  }
1811
1903
  /** Fetch all webhooks in this channel. Requires Manage Webhooks. */
1812
1904
  async fetchWebhooks() {
1813
- const data = await this.client.rest.get(Routes10.channelWebhooks(this.id));
1905
+ const data = await this.client.rest.get(Routes11.channelWebhooks(this.id));
1814
1906
  return data.map((w) => new Webhook(this.client, w));
1815
1907
  }
1816
1908
  /** Create an invite for this channel. Requires Create Instant Invite. */
1817
1909
  async createInvite(options) {
1818
1910
  const body = options ? toChannelInviteBody(options) : {};
1819
- const data = await this.client.rest.post(Routes10.channelInvites(this.id), {
1911
+ const data = await this.client.rest.post(Routes11.channelInvites(this.id), {
1820
1912
  body: Object.keys(body).length ? body : void 0,
1821
1913
  auth: true
1822
1914
  });
@@ -1824,12 +1916,12 @@ var GuildChannel = class extends Channel {
1824
1916
  }
1825
1917
  /** Fetch all invites for this channel. Requires Manage Channels. */
1826
1918
  async fetchInvites() {
1827
- const data = await this.client.rest.get(Routes10.channelInvites(this.id));
1919
+ const data = await this.client.rest.get(Routes11.channelInvites(this.id));
1828
1920
  return data.map((i) => new Invite(this.client, i));
1829
1921
  }
1830
1922
  /** Edit or create a permission overwrite. Requires Manage Roles. */
1831
1923
  async editPermission(overwriteId, options) {
1832
- await this.client.rest.put(Routes10.channelPermission(this.id, overwriteId), {
1924
+ await this.client.rest.put(Routes11.channelPermission(this.id, overwriteId), {
1833
1925
  body: options,
1834
1926
  auth: true
1835
1927
  });
@@ -1845,7 +1937,7 @@ var GuildChannel = class extends Channel {
1845
1937
  }
1846
1938
  /** Delete a permission overwrite. Requires Manage Roles. */
1847
1939
  async deletePermission(overwriteId) {
1848
- await this.client.rest.delete(Routes10.channelPermission(this.id, overwriteId), { auth: true });
1940
+ await this.client.rest.delete(Routes11.channelPermission(this.id, overwriteId), { auth: true });
1849
1941
  const idx = this.permissionOverwrites.findIndex((o) => o.id === overwriteId);
1850
1942
  if (idx >= 0) this.permissionOverwrites.splice(idx, 1);
1851
1943
  }
@@ -1858,7 +1950,7 @@ var GuildChannel = class extends Channel {
1858
1950
  }
1859
1951
  /** Edit this channel's settings. Requires Manage Channels. */
1860
1952
  async edit(options) {
1861
- const data = await this.client.rest.patch(Routes10.channel(this.id), {
1953
+ const data = await this.client.rest.patch(Routes11.channel(this.id), {
1862
1954
  body: toChannelEditBody(options),
1863
1955
  auth: true
1864
1956
  });
@@ -1878,7 +1970,7 @@ var GuildChannel = class extends Channel {
1878
1970
  const qs2 = params.toString();
1879
1971
  const { silent: _s, deleteMessages: _d, ...sudo } = options ?? {};
1880
1972
  const body = Object.keys(sudo).length ? toSudoBody(sudo) : void 0;
1881
- await this.client.rest.delete(Routes10.channel(this.id) + (qs2 ? `?${qs2}` : ""), {
1973
+ await this.client.rest.delete(Routes11.channel(this.id) + (qs2 ? `?${qs2}` : ""), {
1882
1974
  body,
1883
1975
  auth: true
1884
1976
  });
@@ -1940,7 +2032,7 @@ var LinkChannel = class extends GuildChannel {
1940
2032
  };
1941
2033
 
1942
2034
  // src/structures/channel/dm.ts
1943
- import { ChannelType as ChannelType2, Routes as Routes11 } from "@fluxerjs/types";
2035
+ import { ChannelType as ChannelType2, Routes as Routes12 } from "@fluxerjs/types";
1944
2036
  var DMChannel = class extends TextCapable(Channel) {
1945
2037
  /** ID of the last message sent in this channel. */
1946
2038
  lastMessageId;
@@ -1966,28 +2058,28 @@ var DMChannel = class extends TextCapable(Channel) {
1966
2058
  });
1967
2059
  }
1968
2060
  const data = await this.client.rest.post(
1969
- Routes11.channelMessagesPurge(this.id),
2061
+ Routes12.channelMessagesPurge(this.id),
1970
2062
  { auth: true }
1971
2063
  );
1972
2064
  return data.deleted_count;
1973
2065
  }
1974
2066
  /** Pin this DM channel to the top of the DM list. */
1975
2067
  async pinInList() {
1976
- await this.client.rest.put(Routes11.userMeChannelPin(this.id), { auth: true });
2068
+ await this.client.rest.put(Routes12.userMeChannelPin(this.id), { auth: true });
1977
2069
  }
1978
2070
  /** Unpin this DM channel from the DM list. */
1979
2071
  async unpinFromList() {
1980
- await this.client.rest.delete(Routes11.userMeChannelPin(this.id), { auth: true });
2072
+ await this.client.rest.delete(Routes12.userMeChannelPin(this.id), { auth: true });
1981
2073
  }
1982
2074
  /** Add a user to this group DM. */
1983
2075
  async addRecipient(userId) {
1984
- await this.client.rest.put(Routes11.channelRecipient(this.id, userId), { auth: true });
2076
+ await this.client.rest.put(Routes12.channelRecipient(this.id, userId), { auth: true });
1985
2077
  const user = this.client.users.get(userId) ?? await this.client.users.fetch(userId);
1986
2078
  if (user) this.recipients.push(user);
1987
2079
  }
1988
2080
  /** Remove a user from this group DM. */
1989
2081
  async removeRecipient(userId, options) {
1990
- const url = Routes11.channelRecipient(this.id, userId) + (options?.silent ? "?silent=true" : "");
2082
+ const url = Routes12.channelRecipient(this.id, userId) + (options?.silent ? "?silent=true" : "");
1991
2083
  await this.client.rest.delete(url, { auth: true });
1992
2084
  const idx = this.recipients.findIndex((u) => u.id === userId);
1993
2085
  if (idx >= 0) this.recipients.splice(idx, 1);
@@ -2025,8 +2117,8 @@ Channel.createDM = createDM;
2025
2117
 
2026
2118
  // src/client/ChannelManager.ts
2027
2119
  function rethrowNotFound(err, message, code) {
2028
- if (err instanceof RateLimitError2) throw err;
2029
- if (err instanceof FluxerAPIError2 && err.statusCode === 404) {
2120
+ if (err instanceof RateLimitError3) throw err;
2121
+ if (err instanceof FluxerAPIError3 && err.statusCode === 404) {
2030
2122
  throw new FluxerError(message, { code, cause: err });
2031
2123
  }
2032
2124
  throw err instanceof FluxerError ? err : new FluxerError(String(err), { cause: err });
@@ -2058,7 +2150,7 @@ var ChannelManager = class extends Collection5 {
2058
2150
  const cached = this.get(channelId);
2059
2151
  if (cached) return cached;
2060
2152
  try {
2061
- const data = await this.client.rest.get(Routes12.channel(channelId));
2153
+ const data = await this.client.rest.get(Routes13.channel(channelId));
2062
2154
  const channel = Channel.fromOrCreate(this.client, data);
2063
2155
  if (!channel) {
2064
2156
  throw new FluxerError("Channel data invalid or unsupported type", {
@@ -2091,7 +2183,7 @@ var ChannelManager = class extends Collection5 {
2091
2183
  defaultAllowedMentions: this.client.options.defaultAllowedMentions
2092
2184
  });
2093
2185
  const data = await this.client.rest.post(
2094
- Routes12.channelMessages(channelId),
2186
+ Routes13.channelMessages(channelId),
2095
2187
  postPayload
2096
2188
  );
2097
2189
  this.client._addMessageToCache(channelId, data);
@@ -2101,8 +2193,8 @@ var ChannelManager = class extends Collection5 {
2101
2193
 
2102
2194
  // src/client/GuildManager.ts
2103
2195
  import { Collection as Collection9 } from "@fluxerjs/collection";
2104
- import { Routes as Routes27 } from "@fluxerjs/types";
2105
- import { FluxerAPIError as FluxerAPIError4, RateLimitError as RateLimitError3 } from "@fluxerjs/rest";
2196
+ import { Routes as Routes28 } from "@fluxerjs/types";
2197
+ import { FluxerAPIError as FluxerAPIError5, RateLimitError as RateLimitError4 } from "@fluxerjs/rest";
2106
2198
 
2107
2199
  // src/structures/guild/Guild.ts
2108
2200
  import { Collection as Collection8 } from "@fluxerjs/collection";
@@ -2110,10 +2202,10 @@ import { GuildNSFWLevel } from "@fluxerjs/types";
2110
2202
 
2111
2203
  // src/client/GuildMemberManager.ts
2112
2204
  import { Collection as Collection7 } from "@fluxerjs/collection";
2113
- import { Routes as Routes15 } from "@fluxerjs/types";
2205
+ import { Routes as Routes16 } from "@fluxerjs/types";
2114
2206
 
2115
2207
  // src/structures/GuildMember.ts
2116
- import { Routes as Routes14 } from "@fluxerjs/types";
2208
+ import { Routes as Routes15 } from "@fluxerjs/types";
2117
2209
  import { PermissionsBitField } from "@fluxerjs/util";
2118
2210
 
2119
2211
  // src/util/permissions.ts
@@ -2134,7 +2226,7 @@ function computePermissions(basePermissions, overwrites, memberRoles, memberId,
2134
2226
 
2135
2227
  // src/structures/GuildMemberRoleManager.ts
2136
2228
  import { Collection as Collection6 } from "@fluxerjs/collection";
2137
- import { Routes as Routes13 } from "@fluxerjs/types";
2229
+ import { Routes as Routes14 } from "@fluxerjs/types";
2138
2230
  function roleId(roleOrId) {
2139
2231
  return typeof roleOrId === "string" ? roleOrId : roleOrId.id;
2140
2232
  }
@@ -2163,7 +2255,7 @@ var GuildMemberRoleManager = class {
2163
2255
  const id = roleId(roleOrId);
2164
2256
  if (this.ids.includes(id)) return;
2165
2257
  await this.member.client.rest.put(
2166
- Routes13.guildMemberRole(this.member.guild.id, this.member.id, id)
2258
+ Routes14.guildMemberRole(this.member.guild.id, this.member.id, id)
2167
2259
  );
2168
2260
  this.ids.push(id);
2169
2261
  }
@@ -2172,13 +2264,13 @@ var GuildMemberRoleManager = class {
2172
2264
  const idx = this.ids.indexOf(id);
2173
2265
  if (idx === -1) return;
2174
2266
  await this.member.client.rest.delete(
2175
- Routes13.guildMemberRole(this.member.guild.id, this.member.id, id)
2267
+ Routes14.guildMemberRole(this.member.guild.id, this.member.id, id)
2176
2268
  );
2177
2269
  this.ids.splice(idx, 1);
2178
2270
  }
2179
2271
  async set(roleIds) {
2180
2272
  const data = await this.member.client.rest.patch(
2181
- Routes13.guildMember(this.member.guild.id, this.member.id),
2273
+ Routes14.guildMember(this.member.guild.id, this.member.id),
2182
2274
  { body: { roles: roleIds }, auth: true }
2183
2275
  );
2184
2276
  this.ids = data.roles ? [...data.roles] : [];
@@ -2305,7 +2397,7 @@ var GuildMember = class _GuildMember extends Base {
2305
2397
  /** PATCH member (`/members/@me` when editing the bot). */
2306
2398
  async edit(options) {
2307
2399
  const isMe = this.client.user?.id === this.id;
2308
- const route = isMe ? Routes14.guildMemberMe(this.guild.id) : Routes14.guildMember(this.guild.id, this.id);
2400
+ const route = isMe ? Routes15.guildMemberMe(this.guild.id) : Routes15.guildMember(this.guild.id, this.id);
2309
2401
  const data = await this.client.rest.patch(route, {
2310
2402
  body: toMemberEditBody(options),
2311
2403
  auth: true
@@ -2434,7 +2526,7 @@ var GuildMemberManager = class extends Collection7 {
2434
2526
  if (options?.limit != null) params.set("limit", String(options.limit));
2435
2527
  if (options?.after) params.set("after", options.after);
2436
2528
  const qs2 = params.toString();
2437
- const url = Routes15.guildMembers(this.guild.id) + (qs2 ? `?${qs2}` : "");
2529
+ const url = Routes16.guildMembers(this.guild.id) + (qs2 ? `?${qs2}` : "");
2438
2530
  const data = await this.guild.client.rest.get(url, { auth: true });
2439
2531
  const members = [];
2440
2532
  for (const m of data) {
@@ -2457,7 +2549,7 @@ var GuildMemberManager = class extends Collection7 {
2457
2549
  */
2458
2550
  async search(options = {}) {
2459
2551
  const data = await this.guild.client.rest.post(
2460
- Routes15.guildMembersSearch(this.guild.id),
2552
+ Routes16.guildMembersSearch(this.guild.id),
2461
2553
  { body: toMemberSearchBody(options), auth: true }
2462
2554
  );
2463
2555
  const offset = options.offset ?? 0;
@@ -2483,7 +2575,7 @@ var GuildMemberManager = class extends Collection7 {
2483
2575
  };
2484
2576
 
2485
2577
  // src/structures/Role.ts
2486
- import { Routes as Routes16 } from "@fluxerjs/types";
2578
+ import { Routes as Routes17 } from "@fluxerjs/types";
2487
2579
  import { ALL_PERMISSIONS_BIGINT as ALL_PERMISSIONS_BIGINT2, PermissionFlags as PermissionFlags4, PermissionsBitField as PermissionsBitField2 } from "@fluxerjs/util";
2488
2580
 
2489
2581
  // src/structures/roleOptions.ts
@@ -2596,7 +2688,7 @@ var Role = class _Role extends Base {
2596
2688
  */
2597
2689
  async edit(options) {
2598
2690
  const body = toRoleRequestBody(options);
2599
- const data = await this.client.rest.patch(Routes16.guildRole(this.guildId, this.id), {
2691
+ const data = await this.client.rest.patch(Routes17.guildRole(this.guildId, this.id), {
2600
2692
  body: Object.keys(body).length ? body : void 0,
2601
2693
  auth: true
2602
2694
  });
@@ -2607,18 +2699,18 @@ var Role = class _Role extends Base {
2607
2699
  * DELETE role. Requires Manage Roles.
2608
2700
  */
2609
2701
  async delete() {
2610
- await this.client.rest.delete(Routes16.guildRole(this.guildId, this.id), { auth: true });
2702
+ await this.client.rest.delete(Routes17.guildRole(this.guildId, this.id), { auth: true });
2611
2703
  this.client.guilds.get(this.guildId)?.roles.delete(this.id);
2612
2704
  }
2613
2705
  };
2614
2706
 
2615
2707
  // src/structures/guild/admin.ts
2616
- import { Routes as Routes17 } from "@fluxerjs/types";
2708
+ import { Routes as Routes18 } from "@fluxerjs/types";
2617
2709
 
2618
2710
  // src/structures/guild/http.ts
2619
- import { FluxerAPIError as FluxerAPIError3 } from "@fluxerjs/rest";
2711
+ import { FluxerAPIError as FluxerAPIError4 } from "@fluxerjs/rest";
2620
2712
  function httpStatus(err) {
2621
- if (err instanceof FluxerAPIError3) return err.statusCode;
2713
+ if (err instanceof FluxerAPIError4) return err.statusCode;
2622
2714
  if (typeof err === "object" && err !== null && "statusCode" in err) {
2623
2715
  const code = err.statusCode;
2624
2716
  return typeof code === "number" ? code : void 0;
@@ -2718,7 +2810,7 @@ function toVanityPayload(data) {
2718
2810
  return { code: data.code ?? null, uses: data.uses };
2719
2811
  }
2720
2812
  async function fetchAuditLogs(guild, options) {
2721
- const url = Routes17.guildAuditLogs(guild.id) + qs({
2813
+ const url = Routes18.guildAuditLogs(guild.id) + qs({
2722
2814
  limit: options?.limit,
2723
2815
  before: options?.before,
2724
2816
  after: options?.after,
@@ -2739,7 +2831,7 @@ async function fetchAuditLogs(guild, options) {
2739
2831
  };
2740
2832
  }
2741
2833
  async function editGuild(guild, options) {
2742
- const data = await guild.client.rest.patch(Routes17.guild(guild.id), {
2834
+ const data = await guild.client.rest.patch(Routes18.guild(guild.id), {
2743
2835
  body: toGuildEditBody(options),
2744
2836
  auth: true
2745
2837
  });
@@ -2747,13 +2839,13 @@ async function editGuild(guild, options) {
2747
2839
  return guild;
2748
2840
  }
2749
2841
  async function fetchVanityURL(guild) {
2750
- const data = await guild.client.rest.get(Routes17.guildVanityUrl(guild.id), {
2842
+ const data = await guild.client.rest.get(Routes18.guildVanityUrl(guild.id), {
2751
2843
  auth: true
2752
2844
  });
2753
2845
  return toVanityPayload(data);
2754
2846
  }
2755
2847
  async function editVanityURL(guild, code) {
2756
- const data = await guild.client.rest.patch(Routes17.guildVanityUrl(guild.id), {
2848
+ const data = await guild.client.rest.patch(Routes18.guildVanityUrl(guild.id), {
2757
2849
  body: { code },
2758
2850
  auth: true
2759
2851
  });
@@ -2761,14 +2853,14 @@ async function editVanityURL(guild, code) {
2761
2853
  return toVanityPayload(data);
2762
2854
  }
2763
2855
  async function fetchDiscoveryStatus(guild) {
2764
- const data = await guild.client.rest.get(Routes17.guildDiscovery(guild.id), {
2856
+ const data = await guild.client.rest.get(Routes18.guildDiscovery(guild.id), {
2765
2857
  auth: true
2766
2858
  });
2767
2859
  return toDiscoveryStatusPayload(data);
2768
2860
  }
2769
2861
  async function applyForDiscovery(guild, options) {
2770
2862
  const data = await guild.client.rest.post(
2771
- Routes17.guildDiscovery(guild.id),
2863
+ Routes18.guildDiscovery(guild.id),
2772
2864
  {
2773
2865
  body: toDiscoveryBody(options),
2774
2866
  auth: true
@@ -2778,7 +2870,7 @@ async function applyForDiscovery(guild, options) {
2778
2870
  }
2779
2871
  async function editDiscoveryApplication(guild, options) {
2780
2872
  const data = await guild.client.rest.patch(
2781
- Routes17.guildDiscovery(guild.id),
2873
+ Routes18.guildDiscovery(guild.id),
2782
2874
  {
2783
2875
  body: toDiscoveryBody(options),
2784
2876
  auth: true
@@ -2787,28 +2879,28 @@ async function editDiscoveryApplication(guild, options) {
2787
2879
  return toDiscoveryApplicationPayload(data);
2788
2880
  }
2789
2881
  async function withdrawDiscoveryApplication(guild) {
2790
- await guild.client.rest.delete(Routes17.guildDiscovery(guild.id), { auth: true });
2882
+ await guild.client.rest.delete(Routes18.guildDiscovery(guild.id), { auth: true });
2791
2883
  }
2792
2884
  async function deleteGuild(guild, options) {
2793
2885
  const body = options ? toSudoBody(options) : {};
2794
- await guild.client.rest.post(Routes17.guildDelete(guild.id), {
2886
+ await guild.client.rest.post(Routes18.guildDelete(guild.id), {
2795
2887
  body,
2796
2888
  auth: true
2797
2889
  });
2798
2890
  guild.client.guilds.delete(guild.id);
2799
2891
  }
2800
2892
  async function transferOwnership(guild, newOwnerId, password) {
2801
- await guild.client.rest.post(Routes17.guildTransferOwnership(guild.id), {
2893
+ await guild.client.rest.post(Routes18.guildTransferOwnership(guild.id), {
2802
2894
  body: { new_owner_id: newOwnerId, ...password != null && { password } },
2803
2895
  auth: true
2804
2896
  });
2805
2897
  }
2806
2898
 
2807
2899
  // src/structures/guild/channels.ts
2808
- import { Routes as Routes20 } from "@fluxerjs/types";
2900
+ import { Routes as Routes21 } from "@fluxerjs/types";
2809
2901
 
2810
2902
  // src/structures/GuildEmoji.ts
2811
- import { Routes as Routes18 } from "@fluxerjs/types";
2903
+ import { Routes as Routes19 } from "@fluxerjs/types";
2812
2904
  var GuildEmoji = class extends Base {
2813
2905
  client;
2814
2906
  id;
@@ -2836,7 +2928,7 @@ var GuildEmoji = class extends Base {
2836
2928
  }
2837
2929
  /** Delete this emoji. Requires Manage Emojis and Stickers permission. */
2838
2930
  async delete() {
2839
- await this.client.rest.delete(Routes18.guildEmoji(this.guildId, this.id), {
2931
+ await this.client.rest.delete(Routes19.guildEmoji(this.guildId, this.id), {
2840
2932
  auth: true
2841
2933
  });
2842
2934
  const guild = this.client.guilds.get(this.guildId);
@@ -2847,7 +2939,7 @@ var GuildEmoji = class extends Base {
2847
2939
  * Requires Manage Emojis and Stickers permission.
2848
2940
  */
2849
2941
  async edit(options) {
2850
- const data = await this.client.rest.patch(Routes18.guildEmoji(this.guildId, this.id), {
2942
+ const data = await this.client.rest.patch(Routes19.guildEmoji(this.guildId, this.id), {
2851
2943
  body: options,
2852
2944
  auth: true
2853
2945
  });
@@ -2857,7 +2949,7 @@ var GuildEmoji = class extends Base {
2857
2949
  };
2858
2950
 
2859
2951
  // src/structures/GuildSticker.ts
2860
- import { Routes as Routes19 } from "@fluxerjs/types";
2952
+ import { Routes as Routes20 } from "@fluxerjs/types";
2861
2953
  var GuildSticker = class extends Base {
2862
2954
  client;
2863
2955
  id;
@@ -2888,7 +2980,7 @@ var GuildSticker = class extends Base {
2888
2980
  }
2889
2981
  /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
2890
2982
  async delete() {
2891
- await this.client.rest.delete(Routes19.guildSticker(this.guildId, this.id), {
2983
+ await this.client.rest.delete(Routes20.guildSticker(this.guildId, this.id), {
2892
2984
  auth: true
2893
2985
  });
2894
2986
  }
@@ -2897,7 +2989,7 @@ var GuildSticker = class extends Base {
2897
2989
  * Requires Manage Emojis and Stickers permission.
2898
2990
  */
2899
2991
  async edit(options) {
2900
- const data = await this.client.rest.patch(Routes19.guildSticker(this.guildId, this.id), {
2992
+ const data = await this.client.rest.patch(Routes20.guildSticker(this.guildId, this.id), {
2901
2993
  body: options,
2902
2994
  auth: true
2903
2995
  });
@@ -2952,14 +3044,14 @@ function cacheSticker(guild, data) {
2952
3044
 
2953
3045
  // src/structures/guild/channels.ts
2954
3046
  async function createChannel(guild, data) {
2955
- const created = await guild.client.rest.post(Routes20.guildChannels(guild.id), {
3047
+ const created = await guild.client.rest.post(Routes21.guildChannels(guild.id), {
2956
3048
  body: data,
2957
3049
  auth: true
2958
3050
  });
2959
3051
  return cacheChannel(guild, created);
2960
3052
  }
2961
3053
  async function fetchChannels(guild) {
2962
- const data = await guild.client.rest.get(Routes20.guildChannels(guild.id));
3054
+ const data = await guild.client.rest.get(Routes21.guildChannels(guild.id));
2963
3055
  const channels = [];
2964
3056
  for (const ch of data) {
2965
3057
  const channel = cacheChannel(guild, ch);
@@ -2968,17 +3060,17 @@ async function fetchChannels(guild) {
2968
3060
  return channels;
2969
3061
  }
2970
3062
  async function setChannelPositions(guild, updates) {
2971
- await guild.client.rest.patch(Routes20.guildChannels(guild.id), {
3063
+ await guild.client.rest.patch(Routes21.guildChannels(guild.id), {
2972
3064
  body: toChannelPositionBody(updates),
2973
3065
  auth: true
2974
3066
  });
2975
3067
  }
2976
3068
  async function fetchWebhooks(guild) {
2977
- const data = await guild.client.rest.get(Routes20.guildWebhooks(guild.id));
3069
+ const data = await guild.client.rest.get(Routes21.guildWebhooks(guild.id));
2978
3070
  return data.map((w) => new Webhook(guild.client, w));
2979
3071
  }
2980
3072
  async function fetchInvites(guild) {
2981
- const data = await guild.client.rest.get(Routes20.guildInvites(guild.id));
3073
+ const data = await guild.client.rest.get(Routes21.guildInvites(guild.id));
2982
3074
  return data.map((invite) => new Invite(guild.client, invite));
2983
3075
  }
2984
3076
  async function fetchInvite(guild, codeOrUrl) {
@@ -2986,14 +3078,14 @@ async function fetchInvite(guild, codeOrUrl) {
2986
3078
  }
2987
3079
 
2988
3080
  // src/structures/guild/emojis.ts
2989
- import { Routes as Routes21 } from "@fluxerjs/types";
3081
+ import { Routes as Routes22 } from "@fluxerjs/types";
2990
3082
  async function fetchEmojis(guild) {
2991
- const data = await guild.client.rest.get(Routes21.guildEmojis(guild.id));
3083
+ const data = await guild.client.rest.get(Routes22.guildEmojis(guild.id));
2992
3084
  return data.map((e) => cacheEmoji(guild, e));
2993
3085
  }
2994
3086
  async function fetchEmoji(guild, emojiId) {
2995
3087
  try {
2996
- const data = await guild.client.rest.get(Routes21.guildEmoji(guild.id, emojiId));
3088
+ const data = await guild.client.rest.get(Routes22.guildEmoji(guild.id, emojiId));
2997
3089
  return cacheEmoji(guild, data);
2998
3090
  } catch (err) {
2999
3091
  rethrowNotFound2(
@@ -3004,14 +3096,14 @@ async function fetchEmoji(guild, emojiId) {
3004
3096
  }
3005
3097
  }
3006
3098
  async function createEmoji(guild, options) {
3007
- const data = await guild.client.rest.post(Routes21.guildEmojis(guild.id), {
3099
+ const data = await guild.client.rest.post(Routes22.guildEmojis(guild.id), {
3008
3100
  body: options,
3009
3101
  auth: true
3010
3102
  });
3011
3103
  return cacheEmoji(guild, data);
3012
3104
  }
3013
3105
  async function cloneEmoji(guild, sourceEmojiId) {
3014
- const data = await guild.client.rest.post(Routes21.guildEmojisClone(guild.id), {
3106
+ const data = await guild.client.rest.post(Routes22.guildEmojisClone(guild.id), {
3015
3107
  body: { source_emoji_id: sourceEmojiId },
3016
3108
  auth: true
3017
3109
  });
@@ -3019,18 +3111,18 @@ async function cloneEmoji(guild, sourceEmojiId) {
3019
3111
  }
3020
3112
  async function createEmojisBulk(guild, emojis) {
3021
3113
  const data = await guild.client.rest.post(
3022
- Routes21.guildEmojisBulk(guild.id),
3114
+ Routes22.guildEmojisBulk(guild.id),
3023
3115
  { body: { emojis }, auth: true }
3024
3116
  );
3025
3117
  return { success: data.success.map((e) => cacheEmoji(guild, e)), failed: data.failed };
3026
3118
  }
3027
3119
 
3028
3120
  // src/structures/guild/members.ts
3029
- import { Routes as Routes22 } from "@fluxerjs/types";
3121
+ import { Routes as Routes23 } from "@fluxerjs/types";
3030
3122
  async function fetchMember(guild, userId) {
3031
3123
  try {
3032
3124
  const data = await guild.client.rest.get(
3033
- Routes22.guildMember(guild.id, userId)
3125
+ Routes23.guildMember(guild.id, userId)
3034
3126
  );
3035
3127
  return cacheMember(guild, data);
3036
3128
  } catch (err) {
@@ -3043,17 +3135,17 @@ async function fetchMember(guild, userId) {
3043
3135
  }
3044
3136
  async function fetchMe(guild) {
3045
3137
  const data = await guild.client.rest.get(
3046
- Routes22.guildMemberMe(guild.id),
3138
+ Routes23.guildMemberMe(guild.id),
3047
3139
  { auth: true }
3048
3140
  );
3049
3141
  return cacheMember(guild, data);
3050
3142
  }
3051
3143
 
3052
3144
  // src/structures/guild/moderation.ts
3053
- import { Routes as Routes24 } from "@fluxerjs/types";
3145
+ import { Routes as Routes25 } from "@fluxerjs/types";
3054
3146
 
3055
3147
  // src/structures/GuildBan.ts
3056
- import { Routes as Routes23 } from "@fluxerjs/types";
3148
+ import { Routes as Routes24 } from "@fluxerjs/types";
3057
3149
  var GuildBan = class extends Base {
3058
3150
  client;
3059
3151
  guildId;
@@ -3075,7 +3167,7 @@ var GuildBan = class extends Base {
3075
3167
  * Requires Ban Members permission.
3076
3168
  */
3077
3169
  async unban() {
3078
- await this.client.rest.delete(Routes23.guildBan(this.guildId, this.user.id), {
3170
+ await this.client.rest.delete(Routes24.guildBan(this.guildId, this.user.id), {
3079
3171
  auth: true
3080
3172
  });
3081
3173
  }
@@ -3084,40 +3176,40 @@ var GuildBan = class extends Base {
3084
3176
  // src/structures/guild/moderation.ts
3085
3177
  async function ban(guild, userId, options) {
3086
3178
  const body = options ? toGuildBanBody(options) : {};
3087
- await guild.client.rest.put(Routes24.guildBan(guild.id, userId), {
3179
+ await guild.client.rest.put(Routes25.guildBan(guild.id, userId), {
3088
3180
  body: Object.keys(body).length ? body : void 0,
3089
3181
  auth: true
3090
3182
  });
3091
3183
  }
3092
3184
  async function fetchBans(guild) {
3093
- const data = await guild.client.rest.get(Routes24.guildBans(guild.id));
3185
+ const data = await guild.client.rest.get(Routes25.guildBans(guild.id));
3094
3186
  return data.map((b) => new GuildBan(guild.client, { ...b, guild_id: guild.id }, guild.id));
3095
3187
  }
3096
3188
  async function unban(guild, userId) {
3097
- await guild.client.rest.delete(Routes24.guildBan(guild.id, userId), { auth: true });
3189
+ await guild.client.rest.delete(Routes25.guildBan(guild.id, userId), { auth: true });
3098
3190
  }
3099
3191
  async function kick(guild, userId) {
3100
- await guild.client.rest.delete(Routes24.guildMember(guild.id, userId), { auth: true });
3192
+ await guild.client.rest.delete(Routes25.guildMember(guild.id, userId), { auth: true });
3101
3193
  }
3102
3194
 
3103
3195
  // src/structures/guild/roles.ts
3104
- import { Routes as Routes25 } from "@fluxerjs/types";
3196
+ import { Routes as Routes26 } from "@fluxerjs/types";
3105
3197
  import { parseRoleMention } from "@fluxerjs/util";
3106
3198
  async function createRole(guild, options = {}) {
3107
3199
  const body = toRoleRequestBody(options);
3108
- const data = await guild.client.rest.post(Routes25.guildRoles(guild.id), {
3200
+ const data = await guild.client.rest.post(Routes26.guildRoles(guild.id), {
3109
3201
  body: Object.keys(body).length ? body : void 0,
3110
3202
  auth: true
3111
3203
  });
3112
3204
  return cacheRole(guild, data);
3113
3205
  }
3114
3206
  async function fetchRoles(guild) {
3115
- const data = await guild.client.rest.get(Routes25.guildRoles(guild.id));
3207
+ const data = await guild.client.rest.get(Routes26.guildRoles(guild.id));
3116
3208
  return data.map((r) => cacheRole(guild, r));
3117
3209
  }
3118
3210
  async function fetchRole(guild, roleId2) {
3119
3211
  try {
3120
- const data = await guild.client.rest.get(Routes25.guildRole(guild.id, roleId2));
3212
+ const data = await guild.client.rest.get(Routes26.guildRole(guild.id, roleId2));
3121
3213
  return cacheRole(guild, data);
3122
3214
  } catch (err) {
3123
3215
  rethrowNotFound2(
@@ -3135,7 +3227,7 @@ async function resolveRoleId(guild, arg) {
3135
3227
  const needle = trimmed.toLowerCase();
3136
3228
  const cached = guild.roles.find((r) => r.name?.toLowerCase() === needle);
3137
3229
  if (cached) return cached.id;
3138
- const roles = await guild.client.rest.get(Routes25.guildRoles(guild.id));
3230
+ const roles = await guild.client.rest.get(Routes26.guildRoles(guild.id));
3139
3231
  const role = roles.find((r) => r.name?.toLowerCase() === needle);
3140
3232
  if (!role) return null;
3141
3233
  cacheRole(guild, role);
@@ -3144,7 +3236,7 @@ async function resolveRoleId(guild, arg) {
3144
3236
  async function setRolePositions(guild, updates) {
3145
3237
  return replaceRoles(
3146
3238
  guild,
3147
- await guild.client.rest.patch(Routes25.guildRoles(guild.id), {
3239
+ await guild.client.rest.patch(Routes26.guildRoles(guild.id), {
3148
3240
  body: updates,
3149
3241
  auth: true
3150
3242
  })
@@ -3153,7 +3245,7 @@ async function setRolePositions(guild, updates) {
3153
3245
  async function setRoleHoistPositions(guild, updates) {
3154
3246
  return replaceRoles(
3155
3247
  guild,
3156
- await guild.client.rest.patch(Routes25.guildRolesHoistPositions(guild.id), {
3248
+ await guild.client.rest.patch(Routes26.guildRolesHoistPositions(guild.id), {
3157
3249
  body: updates.map((u) => ({
3158
3250
  id: u.id,
3159
3251
  ...u.hoistPosition !== void 0 ? { hoist_position: u.hoistPosition } : {}
@@ -3165,23 +3257,23 @@ async function setRoleHoistPositions(guild, updates) {
3165
3257
  async function resetRoleHoistPositions(guild) {
3166
3258
  return replaceRoles(
3167
3259
  guild,
3168
- await guild.client.rest.delete(Routes25.guildRolesHoistPositions(guild.id), {
3260
+ await guild.client.rest.delete(Routes26.guildRolesHoistPositions(guild.id), {
3169
3261
  auth: true
3170
3262
  })
3171
3263
  );
3172
3264
  }
3173
3265
 
3174
3266
  // src/structures/guild/stickers.ts
3175
- import { Routes as Routes26 } from "@fluxerjs/types";
3267
+ import { Routes as Routes27 } from "@fluxerjs/types";
3176
3268
  async function createSticker(guild, options) {
3177
- const data = await guild.client.rest.post(Routes26.guildStickers(guild.id), {
3269
+ const data = await guild.client.rest.post(Routes27.guildStickers(guild.id), {
3178
3270
  body: options,
3179
3271
  auth: true
3180
3272
  });
3181
3273
  return cacheSticker(guild, data);
3182
3274
  }
3183
3275
  async function cloneSticker(guild, sourceStickerId) {
3184
- const data = await guild.client.rest.post(Routes26.guildStickersClone(guild.id), {
3276
+ const data = await guild.client.rest.post(Routes27.guildStickersClone(guild.id), {
3185
3277
  body: { source_sticker_id: sourceStickerId },
3186
3278
  auth: true
3187
3279
  });
@@ -3189,17 +3281,17 @@ async function cloneSticker(guild, sourceStickerId) {
3189
3281
  }
3190
3282
  async function createStickersBulk(guild, stickers) {
3191
3283
  const data = await guild.client.rest.post(
3192
- Routes26.guildStickersBulk(guild.id),
3284
+ Routes27.guildStickersBulk(guild.id),
3193
3285
  { body: { stickers }, auth: true }
3194
3286
  );
3195
3287
  return { success: data.success.map((s) => cacheSticker(guild, s)), failed: data.failed };
3196
3288
  }
3197
3289
  async function fetchStickers(guild) {
3198
- const data = await guild.client.rest.get(Routes26.guildStickers(guild.id));
3290
+ const data = await guild.client.rest.get(Routes27.guildStickers(guild.id));
3199
3291
  return data.map((s) => cacheSticker(guild, s));
3200
3292
  }
3201
3293
  async function fetchSticker(guild, stickerId) {
3202
- const data = await guild.client.rest.get(Routes26.guildSticker(guild.id, stickerId));
3294
+ const data = await guild.client.rest.get(Routes27.guildSticker(guild.id, stickerId));
3203
3295
  return cacheSticker(guild, data);
3204
3296
  }
3205
3297
 
@@ -3546,13 +3638,13 @@ var GuildManager = class extends Collection9 {
3546
3638
  const cached = this.get(guildId);
3547
3639
  if (cached) return cached;
3548
3640
  try {
3549
- const data = await this.client.rest.get(Routes27.guild(guildId));
3641
+ const data = await this.client.rest.get(Routes28.guild(guildId));
3550
3642
  const guild = new Guild(this.client, data);
3551
3643
  this.set(guild.id, guild);
3552
3644
  return guild;
3553
3645
  } catch (err) {
3554
- if (err instanceof RateLimitError3) throw err;
3555
- if (err instanceof FluxerAPIError4 && err.statusCode === 404) {
3646
+ if (err instanceof RateLimitError4) throw err;
3647
+ if (err instanceof FluxerAPIError5 && err.statusCode === 404) {
3556
3648
  throw new FluxerError(`Guild ${guildId} not found`, {
3557
3649
  code: ErrorCodes.GuildNotFound,
3558
3650
  cause: err
@@ -3573,7 +3665,7 @@ var DEFAULT_CACHE_LIMITS = {
3573
3665
  };
3574
3666
 
3575
3667
  // src/structures/User.ts
3576
- import { Routes as Routes28 } from "@fluxerjs/types";
3668
+ import { Routes as Routes29 } from "@fluxerjs/types";
3577
3669
  var User = class extends Base {
3578
3670
  /** Parent client instance. */
3579
3671
  client;
@@ -3663,7 +3755,7 @@ var User = class extends Base {
3663
3755
  * @returns DM channel instance (cached if already open)
3664
3756
  */
3665
3757
  async createDM() {
3666
- const data = await this.client.rest.post(Routes28.userMeChannels(), {
3758
+ const data = await this.client.rest.post(Routes29.userMeChannels(), {
3667
3759
  body: { recipient_id: this.id },
3668
3760
  auth: true
3669
3761
  });
@@ -3684,7 +3776,7 @@ var User = class extends Base {
3684
3776
  // src/client/UserManager.ts
3685
3777
  import { Collection as Collection10 } from "@fluxerjs/collection";
3686
3778
  import {
3687
- Routes as Routes29
3779
+ Routes as Routes30
3688
3780
  } from "@fluxerjs/types";
3689
3781
  var soft = (p) => p.catch(() => null);
3690
3782
  var UserManager = class extends Collection10 {
@@ -3716,7 +3808,7 @@ var UserManager = class extends Collection10 {
3716
3808
  }
3717
3809
  /** Fetch a user by ID and update cache. */
3718
3810
  async fetch(userId) {
3719
- const data = await this.client.rest.get(Routes29.user(userId));
3811
+ const data = await this.client.rest.get(Routes30.user(userId));
3720
3812
  return this.client.getOrCreateUser(data);
3721
3813
  }
3722
3814
  /**
@@ -3730,10 +3822,10 @@ var UserManager = class extends Collection10 {
3730
3822
  async fetchWithProfile(userId, options) {
3731
3823
  const guildId = options?.guildId ?? void 0;
3732
3824
  const [userData, globalProfileRaw, serverProfileRaw, memberData] = await Promise.all([
3733
- this.client.rest.get(Routes29.user(userId)),
3734
- soft(this.client.rest.get(Routes29.userProfile(userId))),
3735
- guildId ? soft(this.client.rest.get(Routes29.userProfile(userId, guildId))) : null,
3736
- guildId ? soft(this.client.rest.get(Routes29.guildMember(guildId, userId))) : null
3825
+ this.client.rest.get(Routes30.user(userId)),
3826
+ soft(this.client.rest.get(Routes30.userProfile(userId))),
3827
+ guildId ? soft(this.client.rest.get(Routes30.userProfile(userId, guildId))) : null,
3828
+ guildId ? soft(this.client.rest.get(Routes30.guildMember(guildId, userId))) : null
3737
3829
  ]);
3738
3830
  const user = this.client.getOrCreateUser(userData);
3739
3831
  let member = null;
@@ -3763,7 +3855,7 @@ var UserManager = class extends Collection10 {
3763
3855
 
3764
3856
  // src/client/PackManager.ts
3765
3857
  import {
3766
- Routes as Routes30
3858
+ Routes as Routes31
3767
3859
  } from "@fluxerjs/types";
3768
3860
  function toPackSummaryPayload(data) {
3769
3861
  return {
@@ -3819,7 +3911,7 @@ var PackManager = class {
3819
3911
  }
3820
3912
  /** Fetch the current user's pack dashboard (camelCase summaries). */
3821
3913
  async fetchDashboard() {
3822
- const data = await this.client.rest.get(Routes30.packs());
3914
+ const data = await this.client.rest.get(Routes31.packs());
3823
3915
  return {
3824
3916
  emoji: mapDashboardSection(data.emoji),
3825
3917
  sticker: mapDashboardSection(data.sticker)
@@ -3827,49 +3919,49 @@ var PackManager = class {
3827
3919
  }
3828
3920
  /** Create a pack. */
3829
3921
  async create(packType, body) {
3830
- const data = await this.client.rest.post(Routes30.packsByType(packType), {
3922
+ const data = await this.client.rest.post(Routes31.packsByType(packType), {
3831
3923
  body
3832
3924
  });
3833
3925
  return toPackSummaryPayload(data);
3834
3926
  }
3835
3927
  /** Edit a pack. */
3836
3928
  async edit(packId, body) {
3837
- const data = await this.client.rest.patch(Routes30.pack(packId), { body });
3929
+ const data = await this.client.rest.patch(Routes31.pack(packId), { body });
3838
3930
  return toPackSummaryPayload(data);
3839
3931
  }
3840
3932
  /** Delete a pack. */
3841
3933
  async delete(packId) {
3842
- await this.client.rest.delete(Routes30.pack(packId));
3934
+ await this.client.rest.delete(Routes31.pack(packId));
3843
3935
  }
3844
3936
  /** Install a pack for the current user. */
3845
3937
  async install(packId) {
3846
- await this.client.rest.post(Routes30.packInstall(packId));
3938
+ await this.client.rest.post(Routes31.packInstall(packId));
3847
3939
  }
3848
3940
  /** Uninstall a pack for the current user. */
3849
3941
  async uninstall(packId) {
3850
- await this.client.rest.delete(Routes30.packInstall(packId));
3942
+ await this.client.rest.delete(Routes31.packInstall(packId));
3851
3943
  }
3852
3944
  /** List invites for a pack. */
3853
3945
  async listInvites(packId) {
3854
- const data = await this.client.rest.get(Routes30.packInvites(packId));
3946
+ const data = await this.client.rest.get(Routes31.packInvites(packId));
3855
3947
  return data.map(toInvitePayload);
3856
3948
  }
3857
3949
  /** Create an invite for a pack. */
3858
3950
  async createInvite(packId, options = {}) {
3859
3951
  const body = toPackInviteBody(options);
3860
- const data = await this.client.rest.post(Routes30.packInvites(packId), {
3952
+ const data = await this.client.rest.post(Routes31.packInvites(packId), {
3861
3953
  body: Object.keys(body).length ? body : void 0
3862
3954
  });
3863
3955
  return toInvitePayload(data);
3864
3956
  }
3865
3957
  /** List emojis in a pack. */
3866
3958
  async listEmojis(packId) {
3867
- const data = await this.client.rest.get(Routes30.packEmojis(packId));
3959
+ const data = await this.client.rest.get(Routes31.packEmojis(packId));
3868
3960
  return data.map(toEmojiPayload);
3869
3961
  }
3870
3962
  /** Create an emoji in a pack. */
3871
3963
  async createEmoji(packId, options) {
3872
- const data = await this.client.rest.post(Routes30.packEmojis(packId), {
3964
+ const data = await this.client.rest.post(Routes31.packEmojis(packId), {
3873
3965
  body: toEmojiCreateBody(options)
3874
3966
  });
3875
3967
  return toEmojiPayload(data);
@@ -3877,7 +3969,7 @@ var PackManager = class {
3877
3969
  /** Bulk-create emojis in a pack. */
3878
3970
  async createEmojisBulk(packId, emojis) {
3879
3971
  const data = await this.client.rest.post(
3880
- Routes30.packEmojisBulk(packId),
3972
+ Routes31.packEmojisBulk(packId),
3881
3973
  { body: { emojis: emojis.map(toEmojiCreateBody) } }
3882
3974
  );
3883
3975
  return {
@@ -3887,23 +3979,23 @@ var PackManager = class {
3887
3979
  }
3888
3980
  /** Edit an emoji in a pack. */
3889
3981
  async editEmoji(packId, emojiId, options) {
3890
- const data = await this.client.rest.patch(Routes30.packEmoji(packId, emojiId), {
3982
+ const data = await this.client.rest.patch(Routes31.packEmoji(packId, emojiId), {
3891
3983
  body: toEmojiEditBody(options)
3892
3984
  });
3893
3985
  return toEmojiPayload(data);
3894
3986
  }
3895
3987
  /** Delete an emoji from a pack. */
3896
3988
  async deleteEmoji(packId, emojiId) {
3897
- await this.client.rest.delete(Routes30.packEmoji(packId, emojiId));
3989
+ await this.client.rest.delete(Routes31.packEmoji(packId, emojiId));
3898
3990
  }
3899
3991
  /** List stickers in a pack. */
3900
3992
  async listStickers(packId) {
3901
- const data = await this.client.rest.get(Routes30.packStickers(packId));
3993
+ const data = await this.client.rest.get(Routes31.packStickers(packId));
3902
3994
  return data.map(toStickerPayload);
3903
3995
  }
3904
3996
  /** Create a sticker in a pack. */
3905
3997
  async createSticker(packId, options) {
3906
- const data = await this.client.rest.post(Routes30.packStickers(packId), {
3998
+ const data = await this.client.rest.post(Routes31.packStickers(packId), {
3907
3999
  body: toStickerCreateBody(options)
3908
4000
  });
3909
4001
  return toStickerPayload(data);
@@ -3911,7 +4003,7 @@ var PackManager = class {
3911
4003
  /** Bulk-create stickers in a pack. */
3912
4004
  async createStickersBulk(packId, stickers) {
3913
4005
  const data = await this.client.rest.post(
3914
- Routes30.packStickersBulk(packId),
4006
+ Routes31.packStickersBulk(packId),
3915
4007
  { body: { stickers: stickers.map(toStickerCreateBody) } }
3916
4008
  );
3917
4009
  return {
@@ -3921,14 +4013,14 @@ var PackManager = class {
3921
4013
  }
3922
4014
  /** Edit a sticker in a pack. */
3923
4015
  async editSticker(packId, stickerId, options) {
3924
- const data = await this.client.rest.patch(Routes30.packSticker(packId, stickerId), {
4016
+ const data = await this.client.rest.patch(Routes31.packSticker(packId, stickerId), {
3925
4017
  body: toStickerEditBody(options)
3926
4018
  });
3927
4019
  return toStickerPayload(data);
3928
4020
  }
3929
4021
  /** Delete a sticker from a pack. */
3930
4022
  async deleteSticker(packId, stickerId) {
3931
- await this.client.rest.delete(Routes30.packSticker(packId, stickerId));
4023
+ await this.client.rest.delete(Routes31.packSticker(packId, stickerId));
3932
4024
  }
3933
4025
  };
3934
4026
 
@@ -3947,19 +4039,10 @@ function createEventMethods(client) {
3947
4039
 
3948
4040
  // src/client/clientEmoji.ts
3949
4041
  import { Collection as Collection11 } from "@fluxerjs/collection";
3950
- import { Routes as Routes31 } from "@fluxerjs/types";
4042
+ import { Routes as Routes32 } from "@fluxerjs/types";
3951
4043
  import { formatEmoji, getUnicodeFromShortcode, parseEmoji } from "@fluxerjs/util";
3952
- async function assertEmojiInGuild(client, emojiId, guildId) {
3953
- const emojis = await client.rest.get(Routes31.guildEmojis(guildId));
3954
- if (!emojis.some((e) => e.id === emojiId)) {
3955
- throw new FluxerError("Custom emoji is from another server. Use an emoji from this server.", {
3956
- code: ErrorCodes.EmojiNotInGuild
3957
- });
3958
- }
3959
- }
3960
4044
  async function resolveClientEmoji(client, emoji, guildId) {
3961
4045
  if (typeof emoji === "object" && emoji.id) {
3962
- if (guildId) await assertEmojiInGuild(client, emoji.id, guildId);
3963
4046
  return formatEmoji({ name: emoji.name, id: emoji.id, animated: emoji.animated });
3964
4047
  }
3965
4048
  const parsed = parseEmoji(
@@ -3969,14 +4052,13 @@ async function resolveClientEmoji(client, emoji, guildId) {
3969
4052
  throw new FluxerError("Invalid emoji", { code: ErrorCodes.InvalidEmoji });
3970
4053
  }
3971
4054
  if (parsed.id) {
3972
- if (guildId) await assertEmojiInGuild(client, parsed.id, guildId);
3973
4055
  return formatEmoji(parsed);
3974
4056
  }
3975
4057
  if (!/^\w+$/.test(parsed.name)) return parsed.name;
3976
4058
  const unicodeFromShortcode = getUnicodeFromShortcode(parsed.name);
3977
4059
  if (unicodeFromShortcode) return unicodeFromShortcode;
3978
4060
  if (guildId) {
3979
- const emojis = await client.rest.get(Routes31.guildEmojis(guildId));
4061
+ const emojis = await client.rest.get(Routes32.guildEmojis(guildId));
3980
4062
  const found = emojis.find((e) => e.name && e.name.toLowerCase() === parsed.name.toLowerCase());
3981
4063
  if (found) return formatEmoji({ ...parsed, id: found.id, animated: found.animated });
3982
4064
  throw new FluxerError(
@@ -3993,28 +4075,28 @@ async function resolveClientEmoji(client, emoji, guildId) {
3993
4075
  return parsed.name;
3994
4076
  }
3995
4077
  async function fetchInstance(client) {
3996
- const raw = await client.rest.get(Routes31.instanceDiscovery(), { auth: false });
4078
+ const raw = await client.rest.get(Routes32.instanceDiscovery(), { auth: false });
3997
4079
  return parseInstanceDiscovery(raw);
3998
4080
  }
3999
4081
  function fetchGatewayInfo(client) {
4000
- return client.rest.get(Routes31.gatewayBot());
4082
+ return client.rest.get(Routes32.gatewayBot());
4001
4083
  }
4002
4084
  function fetchEmojiMetadata(client, emojiId) {
4003
- return client.rest.get(Routes31.emojiMetadata(emojiId), { auth: true });
4085
+ return client.rest.get(Routes32.emojiMetadata(emojiId), { auth: true });
4004
4086
  }
4005
4087
  function fetchStickerMetadata(client, stickerId) {
4006
- return client.rest.get(Routes31.stickerMetadata(stickerId), { auth: true });
4088
+ return client.rest.get(Routes32.stickerMetadata(stickerId), { auth: true });
4007
4089
  }
4008
4090
  function fetchApplication(client) {
4009
- return client.rest.get(Routes31.applicationsMe(), { auth: true });
4091
+ return client.rest.get(Routes32.applicationsMe(), { auth: true });
4010
4092
  }
4011
4093
  async function fetchOAuthApplications(client) {
4012
- const data = await client.rest.get(Routes31.oauth2ApplicationsMe(), { auth: true });
4094
+ const data = await client.rest.get(Routes32.oauth2ApplicationsMe(), { auth: true });
4013
4095
  return Array.isArray(data) ? data : data.applications ?? [];
4014
4096
  }
4015
4097
  function checkUsernameTag(client, username, discriminator) {
4016
4098
  const params = new URLSearchParams({ username, discriminator });
4017
- return client.rest.get(`${Routes31.checkUsernameTag()}?${params}`, { auth: true });
4099
+ return client.rest.get(`${Routes32.checkUsernameTag()}?${params}`, { auth: true });
4018
4100
  }
4019
4101
  function assertChannelIdBatch(name, channelIds) {
4020
4102
  if (channelIds.length < 1 || channelIds.length > 100) {
@@ -4025,14 +4107,14 @@ function assertChannelIdBatch(name, channelIds) {
4025
4107
  }
4026
4108
  function preloadMessages(client, channelIds) {
4027
4109
  assertChannelIdBatch("preloadMessages", channelIds);
4028
- return client.rest.post(Routes31.preloadMessages(), {
4110
+ return client.rest.post(Routes32.preloadMessages(), {
4029
4111
  body: { channels: channelIds },
4030
4112
  auth: true
4031
4113
  });
4032
4114
  }
4033
4115
  function preloadMessagesAlt(client, channelIds) {
4034
4116
  assertChannelIdBatch("preloadMessagesAlt", channelIds);
4035
- return client.rest.post(Routes31.preloadMessagesAlt(), {
4117
+ return client.rest.post(Routes32.preloadMessagesAlt(), {
4036
4118
  body: { channels: channelIds },
4037
4119
  auth: true
4038
4120
  });
@@ -4040,7 +4122,7 @@ function preloadMessagesAlt(client, channelIds) {
4040
4122
  async function bulkFetchMessages(client, requests, options = {}) {
4041
4123
  validateBulkMessageFetchRequests(requests);
4042
4124
  const wire = toBulkFetchWire(requests);
4043
- const data = await client.rest.post(Routes31.channelsMessagesBulk(), {
4125
+ const data = await client.rest.post(Routes32.channelsMessagesBulk(), {
4044
4126
  body: { requests: wire },
4045
4127
  auth: true
4046
4128
  });
@@ -4127,62 +4209,6 @@ function buildRegistry(...maps) {
4127
4209
  return registry;
4128
4210
  }
4129
4211
 
4130
- // src/structures/MessageReaction.ts
4131
- import { Routes as Routes32 } from "@fluxerjs/types";
4132
- import { FluxerAPIError as FluxerAPIError5, RateLimitError as RateLimitError4 } from "@fluxerjs/rest";
4133
- var MessageReaction = class extends Base {
4134
- client;
4135
- messageId;
4136
- channelId;
4137
- guildId;
4138
- emoji;
4139
- /** Raw gateway payload for low-level access. */
4140
- _data;
4141
- constructor(client, data) {
4142
- super();
4143
- this.client = client;
4144
- this._data = data;
4145
- this.messageId = data.message_id;
4146
- this.channelId = data.channel_id;
4147
- this.guildId = data.guild_id ?? null;
4148
- this.emoji = {
4149
- name: data.emoji.name,
4150
- ...data.emoji.id !== void 0 ? { id: data.emoji.id } : {},
4151
- ...data.emoji.animated !== void 0 ? { animated: data.emoji.animated } : {}
4152
- };
4153
- }
4154
- /** Emoji as a string: unicode or "name:id" for custom. */
4155
- get emojiIdentifier() {
4156
- return this.emoji.id ? `${this.emoji.name}:${this.emoji.id}` : this.emoji.name;
4157
- }
4158
- /** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
4159
- get guild() {
4160
- return this.guildId ? this.client.guilds.get(this.guildId) ?? null : null;
4161
- }
4162
- /**
4163
- * Fetch the message this reaction belongs to.
4164
- * Use when you need to edit, delete, or otherwise interact with the message.
4165
- * @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
4166
- */
4167
- async fetchMessage() {
4168
- try {
4169
- const data = await this.client.rest.get(
4170
- Routes32.channelMessage(this.channelId, this.messageId)
4171
- );
4172
- return new Message(this.client, data);
4173
- } catch (err) {
4174
- if (err instanceof RateLimitError4) throw err;
4175
- if (err instanceof FluxerAPIError5 && err.statusCode === 404) {
4176
- throw new FluxerError(`Message ${this.messageId} not found in channel ${this.channelId}`, {
4177
- code: ErrorCodes.MessageNotFound,
4178
- cause: err
4179
- });
4180
- }
4181
- throw err instanceof FluxerError ? err : new FluxerError(String(err), { cause: err });
4182
- }
4183
- }
4184
- };
4185
-
4186
4212
  // src/client/eventHandlers/helpers.ts
4187
4213
  function unknownUser(id) {
4188
4214
  return { id, username: "Unknown", discriminator: "0" };
@@ -4220,7 +4246,9 @@ function emitReaction(event) {
4220
4246
  return (client, d) => {
4221
4247
  const data = d;
4222
4248
  const reaction = new MessageReaction(client, data);
4223
- const user = client.getOrCreateUser(unknownUser(data.user_id));
4249
+ const guild = data.guild_id ? client.guilds.get(data.guild_id) : void 0;
4250
+ const member = guild && data.member ? cacheMember2(client, guild, { ...data.member, guild_id: data.guild_id }) : null;
4251
+ const user = member?.user ?? client.users.get(data.user_id) ?? client.getOrCreateUser(unknownUser(data.user_id));
4224
4252
  const payload = {
4225
4253
  reaction,
4226
4254
  user,
@@ -4330,14 +4358,15 @@ var messageHandlers = {
4330
4358
  };
4331
4359
 
4332
4360
  // src/util/guildUtils.ts
4333
- function normalizeGuildPayload(raw) {
4334
- if (!raw || typeof raw !== "object") return null;
4335
- const o = raw;
4336
- if (typeof o.id !== "string" || o.id.length === 0) return null;
4337
- if ("name" in o && typeof o.name !== "string") return null;
4338
- if ("owner_id" in o && typeof o.owner_id !== "string") return null;
4339
- if ("features" in o && !Array.isArray(o.features)) return null;
4340
- if ("afk_timeout" in o && typeof o.afk_timeout !== "number") return null;
4361
+ function isRecord2(value) {
4362
+ return value !== null && typeof value === "object" && !Array.isArray(value);
4363
+ }
4364
+ function isValidGuildPayload(o) {
4365
+ if (!Object.hasOwn(o, "id") || typeof o.id !== "string" || o.id.length === 0) return false;
4366
+ if ("name" in o && typeof o.name !== "string") return false;
4367
+ if ("owner_id" in o && typeof o.owner_id !== "string") return false;
4368
+ if ("features" in o && !Array.isArray(o.features)) return false;
4369
+ if ("afk_timeout" in o && typeof o.afk_timeout !== "number") return false;
4341
4370
  for (const key of [
4342
4371
  "verification_level",
4343
4372
  "mfa_level",
@@ -4345,10 +4374,32 @@ function normalizeGuildPayload(raw) {
4345
4374
  "explicit_content_filter",
4346
4375
  "default_message_notifications"
4347
4376
  ]) {
4348
- if (key in o && typeof o[key] !== "number") return null;
4377
+ if (key in o && typeof o[key] !== "number") return false;
4378
+ }
4379
+ if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return false;
4380
+ if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return false;
4381
+ return true;
4382
+ }
4383
+ function isHydratableGuildPayload(o) {
4384
+ return isValidGuildPayload(o) && Object.hasOwn(o, "name") && typeof o.name === "string" && Object.hasOwn(o, "owner_id") && typeof o.owner_id === "string";
4385
+ }
4386
+ function normalizeGuildSnapshotPayload(raw) {
4387
+ if (!isRecord2(raw)) return null;
4388
+ const flatPayload = isHydratableGuildPayload(raw) && (raw.roles === void 0 || Array.isArray(raw.roles)) ? raw : null;
4389
+ let nestedPayload = null;
4390
+ if (Object.hasOwn(raw, "properties") && isRecord2(raw.properties)) {
4391
+ const properties = raw.properties;
4392
+ const rolesValid = raw.roles === void 0 || Array.isArray(raw.roles);
4393
+ if (rolesValid && isHydratableGuildPayload(properties) && raw.id === properties.id) {
4394
+ nestedPayload = { ...properties };
4395
+ if (raw.roles !== void 0) nestedPayload.roles = raw.roles;
4396
+ }
4349
4397
  }
4350
- if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return null;
4351
- if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return null;
4398
+ if (flatPayload === null === (nestedPayload === null)) return null;
4399
+ return flatPayload ?? nestedPayload;
4400
+ }
4401
+ function normalizeGuildUpdatePayload(raw) {
4402
+ if (!isRecord2(raw) || !isValidGuildPayload(raw)) return null;
4352
4403
  return raw;
4353
4404
  }
4354
4405
 
@@ -4360,7 +4411,6 @@ function markGuildUnavailable(client, id) {
4360
4411
  client.emit(Events.GuildUnavailable, guild);
4361
4412
  }
4362
4413
  function refreshRecoveredGuild(guild, data) {
4363
- guild._patch(data);
4364
4414
  if (data.roles !== void 0) {
4365
4415
  guild.roles.clear();
4366
4416
  for (const role of data.roles) {
@@ -4389,13 +4439,16 @@ var guildHandlers = {
4389
4439
  }
4390
4440
  return;
4391
4441
  }
4392
- const guildData = normalizeGuildPayload(d);
4442
+ const guildData = normalizeGuildSnapshotPayload(d);
4393
4443
  if (!guildData) return;
4394
4444
  const g = d;
4395
4445
  const existing = client.guilds.get(guildData.id);
4396
4446
  const recovered = existing?.available === false;
4397
4447
  const guild = recovered && existing ? existing : new Guild(client, guildData);
4398
- if (recovered) refreshRecoveredGuild(guild, g);
4448
+ if (recovered) {
4449
+ guild._patch(guildData);
4450
+ refreshRecoveredGuild(guild, g);
4451
+ }
4399
4452
  client.guilds.set(guild.id, guild);
4400
4453
  for (const ch of g.channels ?? []) {
4401
4454
  const channel = Channel.from(client, ch);
@@ -4413,7 +4466,7 @@ var guildHandlers = {
4413
4466
  client._onGuildReceived(guild.id);
4414
4467
  },
4415
4468
  GUILD_UPDATE(client, d) {
4416
- const guildData = normalizeGuildPayload(d);
4469
+ const guildData = normalizeGuildUpdatePayload(d);
4417
4470
  if (!guildData) return;
4418
4471
  const existing = client.guilds.get(guildData.id);
4419
4472
  if (existing) {
@@ -4960,22 +5013,21 @@ function hydrateReadyGuilds(client, guilds, waitForGuilds) {
4960
5013
  if (pending !== null && g.id) pending.add(g.id);
4961
5014
  continue;
4962
5015
  }
4963
- const guildData = normalizeGuildPayload(g);
5016
+ const guildData = normalizeGuildSnapshotPayload(g);
4964
5017
  if (!guildData) continue;
4965
5018
  const guild = new Guild(client, guildData);
4966
5019
  client.guilds.set(guild.id, guild);
4967
- const withCh = g;
4968
- for (const ch of withCh.channels ?? []) {
5020
+ for (const ch of g.channels ?? []) {
4969
5021
  const channel = Channel.from(client, ch);
4970
5022
  if (channel) {
4971
5023
  client.channels.set(channel.id, channel);
4972
5024
  guild.channels.set(channel.id, channel);
4973
5025
  }
4974
5026
  }
4975
- if (withCh.voice_states?.length) {
5027
+ if (g.voice_states?.length) {
4976
5028
  client.emit(Events.VoiceStatesSync, {
4977
5029
  guildId: guild.id,
4978
- voiceStates: withCh.voice_states
5030
+ voiceStates: g.voice_states
4979
5031
  });
4980
5032
  }
4981
5033
  }
@@ -5091,11 +5143,11 @@ var Client = class _Client extends EventEmitter3 {
5091
5143
  */
5092
5144
  instance;
5093
5145
  /** Guild cache and manager. */
5094
- guilds = new GuildManager(this);
5146
+ guilds;
5095
5147
  /** Channel cache and manager. */
5096
- channels = new ChannelManager(this);
5148
+ channels;
5097
5149
  /** User cache and manager. */
5098
- users = new UserManager(this);
5150
+ users;
5099
5151
  /** Emoji/sticker pack REST wrappers (`/packs/*`). */
5100
5152
  packs = new PackManager(this);
5101
5153
  /** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
@@ -5122,6 +5174,9 @@ var Client = class _Client extends EventEmitter3 {
5122
5174
  cache: { ...DEFAULT_CACHE_LIMITS, ...options.cache },
5123
5175
  defaultReplyPing: options.defaultReplyPing ?? true
5124
5176
  };
5177
+ this.guilds = new GuildManager(this);
5178
+ this.channels = new ChannelManager(this);
5179
+ this.users = new UserManager(this);
5125
5180
  const restApi = options.rest?.api;
5126
5181
  if (options.instance !== void 0) {
5127
5182
  this.instance = resolveInstanceEndpoints(options.instance);