@fluxerjs/core 3.4.0 → 3.5.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
@@ -62,6 +62,13 @@ var Events = {
62
62
  VoiceSignal: "voiceSignal",
63
63
  OperatorPassUpdate: "operatorPassUpdate",
64
64
  VoiceStatesSync: "voiceStatesSync",
65
+ VoiceJoinQueued: "voiceJoinQueued",
66
+ StageInstanceCreate: "stageInstanceCreate",
67
+ StageInstanceUpdate: "stageInstanceUpdate",
68
+ StageInstanceDelete: "stageInstanceDelete",
69
+ StageCountsUpdate: "stageCountsUpdate",
70
+ StageVoiceStatesSync: "stageVoiceStatesSync",
71
+ StageAudienceListUpdate: "stageAudienceListUpdate",
65
72
  WebhooksUpdate: "webhooksUpdate",
66
73
  Resumed: "resumed",
67
74
  Error: "error",
@@ -83,7 +90,7 @@ import { FluxerError } from "@fluxerjs/util";
83
90
  // src/ClientCore/Client.ts
84
91
  import { EventEmitter as EventEmitter3 } from "events";
85
92
  import { REST } from "@fluxerjs/rest";
86
- import { GatewayOpcodes as GatewayOpcodes2, Routes as Routes37 } from "@fluxerjs/types";
93
+ import { GatewayOpcodes as GatewayOpcodes2, Routes as Routes38 } from "@fluxerjs/types";
87
94
  import { createLogger } from "@fluxerjs/util";
88
95
 
89
96
  // src/Domain/Message/Message.ts
@@ -1547,11 +1554,11 @@ var Channel = class extends Base {
1547
1554
  * Checks {@link ChannelType}, not whether `send` exists on the instance.
1548
1555
  */
1549
1556
  isTextBased() {
1550
- return this.type === ChannelType3.GuildText || this.type === ChannelType3.GuildAnnouncement || this.type === ChannelType3.GuildVoice || this.type === ChannelType3.DM || this.type === ChannelType3.GroupDM || this.type === ChannelType3.DMPersonalNotes || this.type === ChannelType3.AnnouncementThread || this.type === ChannelType3.PublicThread || this.type === ChannelType3.PrivateThread;
1557
+ return this.type === ChannelType3.GuildText || this.type === ChannelType3.GuildAnnouncement || this.type === ChannelType3.GuildVoice || this.type === ChannelType3.GuildStageVoice || this.type === ChannelType3.DM || this.type === ChannelType3.GroupDM || this.type === ChannelType3.DMPersonalNotes || this.type === ChannelType3.AnnouncementThread || this.type === ChannelType3.PublicThread || this.type === ChannelType3.PrivateThread;
1551
1558
  }
1552
1559
  /** Check if this is a guild channel, including threads, forums, and media channels. */
1553
1560
  isGuild() {
1554
- return this.type === ChannelType3.GuildText || this.type === ChannelType3.GuildAnnouncement || this.type === ChannelType3.GuildVoice || this.type === ChannelType3.GuildCategory || this.type === ChannelType3.GuildLink || this.type === ChannelType3.AnnouncementThread || this.type === ChannelType3.PublicThread || this.type === ChannelType3.PrivateThread || this.type === ChannelType3.GuildForum || this.type === ChannelType3.GuildMedia;
1561
+ return this.type === ChannelType3.GuildText || this.type === ChannelType3.GuildAnnouncement || this.type === ChannelType3.GuildVoice || this.type === ChannelType3.GuildStageVoice || this.type === ChannelType3.GuildCategory || this.type === ChannelType3.GuildLink || this.type === ChannelType3.AnnouncementThread || this.type === ChannelType3.PublicThread || this.type === ChannelType3.PrivateThread || this.type === ChannelType3.GuildForum || this.type === ChannelType3.GuildMedia;
1555
1562
  }
1556
1563
  /** Check if this is a thread (public, private, or announcement). */
1557
1564
  isThread() {
@@ -1585,10 +1592,18 @@ var Channel = class extends Base {
1585
1592
  isPersonalNotes() {
1586
1593
  return this.type === ChannelType3.DMPersonalNotes;
1587
1594
  }
1588
- /** Check if this is a voice channel. */
1595
+ /** Check if this is a voice channel (type 2 only; see {@link isVoiceBased} to include stages). */
1589
1596
  isVoice() {
1590
1597
  return this.type === ChannelType3.GuildVoice;
1591
1598
  }
1599
+ /** Check if this is a stage channel (type 13). */
1600
+ isStage() {
1601
+ return this.type === ChannelType3.GuildStageVoice;
1602
+ }
1603
+ /** Check if this is a voice or stage channel, i.e. one `@fluxerjs/voice` can join. */
1604
+ isVoiceBased() {
1605
+ return this.type === ChannelType3.GuildVoice || this.type === ChannelType3.GuildStageVoice;
1606
+ }
1592
1607
  /** Check if this is a link channel. */
1593
1608
  isLink() {
1594
1609
  return this.type === ChannelType3.GuildLink;
@@ -2599,8 +2614,8 @@ var PartialMessage = class {
2599
2614
  };
2600
2615
 
2601
2616
  // src/Domain/User.ts
2602
- import { Routes as Routes17 } from "@fluxerjs/types";
2603
- import { SnowflakeUtil as SnowflakeUtil5 } from "@fluxerjs/util";
2617
+ import { Routes as Routes18 } from "@fluxerjs/types";
2618
+ import { SnowflakeUtil as SnowflakeUtil6 } from "@fluxerjs/util";
2604
2619
 
2605
2620
  // src/Domain/Channel/Dm.ts
2606
2621
  import { ChannelType as ChannelType4, Routes as Routes9 } from "@fluxerjs/types";
@@ -2741,11 +2756,11 @@ var DMChannel = class extends TextCapable(Channel) {
2741
2756
  // src/Domain/Channel/Forum.ts
2742
2757
  import {
2743
2758
  ChannelType as ChannelType7,
2744
- Routes as Routes16
2759
+ Routes as Routes17
2745
2760
  } from "@fluxerjs/types";
2746
2761
 
2747
2762
  // src/Domain/Channel/Guild.ts
2748
- import { Routes as Routes13 } from "@fluxerjs/types";
2763
+ import { Routes as Routes14 } from "@fluxerjs/types";
2749
2764
  import { PermissionFlags } from "@fluxerjs/util";
2750
2765
 
2751
2766
  // src/Domain/Invite.ts
@@ -3344,6 +3359,127 @@ var PermissionOverwriteManager = class {
3344
3359
  }
3345
3360
  };
3346
3361
 
3362
+ // src/Domain/StageInstance.ts
3363
+ import { Routes as Routes13, StageInstancePrivacyLevel } from "@fluxerjs/types";
3364
+ import { SnowflakeUtil as SnowflakeUtil5 } from "@fluxerjs/util";
3365
+ var StageInstance = class extends Base {
3366
+ client;
3367
+ id;
3368
+ guildId;
3369
+ channelId;
3370
+ topic;
3371
+ /** Always {@link StageInstancePrivacyLevel.GuildOnly} on Fluxer. */
3372
+ privacyLevel;
3373
+ /** Always `true` on Fluxer. */
3374
+ discoverableDisabled;
3375
+ /** Always null on Fluxer. */
3376
+ guildScheduledEventId;
3377
+ constructor(client, data) {
3378
+ super();
3379
+ this.client = client;
3380
+ this.id = data.id;
3381
+ this.guildId = data.guild_id;
3382
+ this.channelId = data.channel_id;
3383
+ this.topic = data.topic;
3384
+ this.privacyLevel = data.privacy_level ?? StageInstancePrivacyLevel.GuildOnly;
3385
+ this.discoverableDisabled = data.discoverable_disabled ?? true;
3386
+ this.guildScheduledEventId = data.guild_scheduled_event_id ?? null;
3387
+ }
3388
+ /** @internal Patch in place from a newer payload. */
3389
+ _patch(data) {
3390
+ if (data.topic !== void 0) this.topic = data.topic;
3391
+ if (data.privacy_level !== void 0) this.privacyLevel = data.privacy_level;
3392
+ if (data.discoverable_disabled !== void 0) {
3393
+ this.discoverableDisabled = data.discoverable_disabled;
3394
+ }
3395
+ if (data.guild_scheduled_event_id !== void 0) {
3396
+ this.guildScheduledEventId = data.guild_scheduled_event_id ?? null;
3397
+ }
3398
+ }
3399
+ get guild() {
3400
+ return this.client.guilds.get(this.guildId) ?? null;
3401
+ }
3402
+ get channel() {
3403
+ const channel = this.client.channels.get(this.channelId);
3404
+ return channel?.isStage() ? channel : null;
3405
+ }
3406
+ /** Unix timestamp (ms) when the stage started, from its snowflake ID. */
3407
+ get createdTimestamp() {
3408
+ return SnowflakeUtil5.timestampFromSnowflake(this.id);
3409
+ }
3410
+ get createdAt() {
3411
+ return SnowflakeUtil5.dateFromSnowflake(this.id);
3412
+ }
3413
+ /**
3414
+ * Change the live stage. Needs a stage moderator.
3415
+ * Fires `STAGE_INSTANCE_UPDATE`.
3416
+ */
3417
+ async edit(options) {
3418
+ const body = {};
3419
+ if (options.topic !== void 0) body.topic = options.topic;
3420
+ const data = await this.client.rest.patch(
3421
+ Routes13.stageInstance(this.channelId),
3422
+ { body, auth: true, ...auditReasonHeaders(options.reason) }
3423
+ );
3424
+ this._patch(data);
3425
+ return this;
3426
+ }
3427
+ /** Change the stage topic. Shorthand for {@link edit}. */
3428
+ async setTopic(topic, reason) {
3429
+ return this.edit({ topic, reason });
3430
+ }
3431
+ /**
3432
+ * End the stage. Needs a stage moderator. Speakers move to the audience, raised hands are
3433
+ * lowered, and everyone stays connected unless `disconnectAll` is set.
3434
+ */
3435
+ async delete(options = {}) {
3436
+ const route = Routes13.stageInstance(this.channelId) + (options.disconnectAll ? "?disconnect_all=true" : "");
3437
+ await this.client.rest.delete(route, { auth: true, ...auditReasonHeaders(options.reason) });
3438
+ }
3439
+ toJSON() {
3440
+ return {
3441
+ id: this.id,
3442
+ guild_id: this.guildId,
3443
+ channel_id: this.channelId,
3444
+ topic: this.topic,
3445
+ privacy_level: this.privacyLevel,
3446
+ discoverable_disabled: this.discoverableDisabled,
3447
+ guild_scheduled_event_id: this.guildScheduledEventId
3448
+ };
3449
+ }
3450
+ };
3451
+
3452
+ // src/Domain/Channel/StageSync.ts
3453
+ function syncStageInstances(guild, instances) {
3454
+ const seen = /* @__PURE__ */ new Set();
3455
+ for (const data of instances) {
3456
+ seen.add(data.id);
3457
+ const existing = guild.stageInstances.get(data.id);
3458
+ if (existing) existing._patch(data);
3459
+ else guild.stageInstances.set(data.id, new StageInstance(guild.client, data));
3460
+ }
3461
+ for (const id of [...guild.stageInstances.keys()]) {
3462
+ if (!seen.has(id)) guild.stageInstances.delete(id);
3463
+ }
3464
+ }
3465
+ function applyStageCounts(guild, counts) {
3466
+ for (const count of counts) {
3467
+ const channel = guild.channels.get(count.channel_id);
3468
+ if (channel?.isStage()) channel._patchCounts(count);
3469
+ }
3470
+ }
3471
+ function cacheStageInstance(client, data) {
3472
+ const guild = client.guilds.get(data.guild_id);
3473
+ const existing = guild?.stageInstances.get(data.id);
3474
+ if (existing) {
3475
+ existing._patch(data);
3476
+ return existing;
3477
+ }
3478
+ const instance = new StageInstance(client, data);
3479
+ guild?.stageInstances.set(instance.id, instance);
3480
+ return instance;
3481
+ }
3482
+
3347
3483
  // src/Domain/Channel/ThreadBind.ts
3348
3484
  var factory;
3349
3485
  var managers = /* @__PURE__ */ new WeakMap();
@@ -3398,7 +3534,7 @@ var GuildChannel = class extends Channel {
3398
3534
  }
3399
3535
  /** Create a webhook for this channel. Requires Manage Webhooks. */
3400
3536
  async createWebhook(options) {
3401
- const data = await this.client.rest.post(Routes13.channelWebhooks(this.id), {
3537
+ const data = await this.client.rest.post(Routes14.channelWebhooks(this.id), {
3402
3538
  body: options,
3403
3539
  auth: true
3404
3540
  });
@@ -3406,13 +3542,13 @@ var GuildChannel = class extends Channel {
3406
3542
  }
3407
3543
  /** Fetch all webhooks in this channel. Requires Manage Webhooks. */
3408
3544
  async fetchWebhooks() {
3409
- const data = await this.client.rest.get(Routes13.channelWebhooks(this.id));
3545
+ const data = await this.client.rest.get(Routes14.channelWebhooks(this.id));
3410
3546
  return data.map((w) => new Webhook(this.client, w));
3411
3547
  }
3412
3548
  /** Create an invite for this channel. Requires Create Instant Invite. */
3413
3549
  async createInvite(options) {
3414
3550
  const body = options ? toChannelInviteBody(options) : {};
3415
- const data = await this.client.rest.post(Routes13.channelInvites(this.id), {
3551
+ const data = await this.client.rest.post(Routes14.channelInvites(this.id), {
3416
3552
  body: Object.keys(body).length ? body : void 0,
3417
3553
  auth: true
3418
3554
  });
@@ -3420,7 +3556,7 @@ var GuildChannel = class extends Channel {
3420
3556
  }
3421
3557
  /** Fetch all invites for this channel. Requires Manage Channels. */
3422
3558
  async fetchInvites() {
3423
- const data = await this.client.rest.get(Routes13.channelInvites(this.id));
3559
+ const data = await this.client.rest.get(Routes14.channelInvites(this.id));
3424
3560
  return data.map((i) => new Invite(this.client, i));
3425
3561
  }
3426
3562
  /** Check if the bot can send messages in this channel (cache-only; needs `members.me`). */
@@ -3450,7 +3586,7 @@ var GuildChannel = class extends Channel {
3450
3586
  }
3451
3587
  /** Edit this channel's settings. Requires Manage Channels. */
3452
3588
  async edit(options) {
3453
- const data = await this.client.rest.patch(Routes13.channel(this.id), {
3589
+ const data = await this.client.rest.patch(Routes14.channel(this.id), {
3454
3590
  body: toChannelEditBody(options),
3455
3591
  auth: true,
3456
3592
  ...auditReasonHeaders(options.reason)
@@ -3532,7 +3668,7 @@ var TextChannel = class extends TextCapable(GuildChannel) {
3532
3668
  * Sends only those fields. The thread-parent update body does not accept a channel rename.
3533
3669
  */
3534
3670
  async editThreadDefaults(options) {
3535
- const data = await this.client.rest.patch(Routes13.channel(this.id), {
3671
+ const data = await this.client.rest.patch(Routes14.channel(this.id), {
3536
3672
  body: toThreadParentEditBody(options),
3537
3673
  auth: true,
3538
3674
  ...auditReasonHeaders(options.reason)
@@ -3548,14 +3684,14 @@ var AnnouncementChannel = class extends TextChannel {
3548
3684
  */
3549
3685
  async follow(webhookChannelId) {
3550
3686
  return this.client.rest.post(
3551
- Routes13.channelFollowers(this.id),
3687
+ Routes14.channelFollowers(this.id),
3552
3688
  { body: { webhook_channel_id: webhookChannelId }, auth: true }
3553
3689
  );
3554
3690
  }
3555
3691
  /** Fetch follower counts for this announcement channel. */
3556
3692
  async fetchFollowerStats() {
3557
3693
  return this.client.rest.get(
3558
- Routes13.channelFollowerStats(this.id),
3694
+ Routes14.channelFollowerStats(this.id),
3559
3695
  { auth: true }
3560
3696
  );
3561
3697
  }
@@ -3630,6 +3766,96 @@ var VoiceChannel = class extends TextCapable(GuildChannel) {
3630
3766
  if ("rtc_p2p" in data) this.rtcP2p = data.rtc_p2p ?? false;
3631
3767
  }
3632
3768
  };
3769
+ var StageChannel = class extends VoiceChannel {
3770
+ /** Last known stage counts, or null until Fluxer sends them. */
3771
+ counts = null;
3772
+ /** The cached live stage of this channel, or null when the stage isn't live (or not cached). */
3773
+ get stageInstance() {
3774
+ const guild = this.client.guilds.get(this.guildId);
3775
+ if (!guild) return null;
3776
+ for (const instance of guild.stageInstances.values()) {
3777
+ if (instance.channelId === this.id) return instance;
3778
+ }
3779
+ return null;
3780
+ }
3781
+ /** Whether the stage is live according to the cache. */
3782
+ get isLive() {
3783
+ return this.stageInstance !== null;
3784
+ }
3785
+ /**
3786
+ * Start a stage in this channel. Needs a stage moderator (`MANAGE_CHANNELS`, `MUTE_MEMBERS` and
3787
+ * `MOVE_MEMBERS`). When the caller is connected to the stage, they become a speaker.
3788
+ */
3789
+ async createStageInstance(options) {
3790
+ const body = { channel_id: this.id, topic: options.topic };
3791
+ if (options.sendStartNotification !== void 0) {
3792
+ body.send_start_notification = options.sendStartNotification;
3793
+ }
3794
+ const data = await this.client.rest.post(Routes14.stageInstances(), {
3795
+ body,
3796
+ auth: true,
3797
+ ...auditReasonHeaders(options.reason)
3798
+ });
3799
+ return cacheStageInstance(this.client, data);
3800
+ }
3801
+ /** Fetch the live stage of this channel. Rejects with `UNKNOWN_STAGE_INSTANCE` when not live. */
3802
+ async fetchStageInstance() {
3803
+ const data = await this.client.rest.get(Routes14.stageInstance(this.id), {
3804
+ auth: true
3805
+ });
3806
+ return cacheStageInstance(this.client, data);
3807
+ }
3808
+ /**
3809
+ * Move a member (or yourself when `user` is omitted) between the audience and the speakers.
3810
+ *
3811
+ * - Yourself, `false`: become a speaker (needs `MUTE_MEMBERS`), or accept an open invite.
3812
+ * - Yourself, `true`: move to the audience, or decline an invite.
3813
+ * - Another member, `false`: invite them to speak (a bot becomes a speaker at once). Needs `MUTE_MEMBERS`.
3814
+ * - Another member, `true`: move them to the audience and clear a raised hand or invite.
3815
+ */
3816
+ async setSuppressed(suppressed, user) {
3817
+ const userId = user === void 0 ? "@me" : typeof user === "string" ? user : user.id;
3818
+ const body = {
3819
+ channel_id: this.id,
3820
+ suppress: suppressed
3821
+ };
3822
+ await this.client.rest.patch(Routes14.guildVoiceState(this.guildId, userId), {
3823
+ body,
3824
+ auth: true
3825
+ });
3826
+ }
3827
+ /** Invite a member to speak (a bot becomes a speaker at once). Needs `MUTE_MEMBERS`. */
3828
+ async inviteToSpeak(user) {
3829
+ await this.setSuppressed(false, user);
3830
+ }
3831
+ /** Move a speaker (or yourself when `user` is omitted) to the audience. */
3832
+ async moveToAudience(user) {
3833
+ await this.setSuppressed(true, user);
3834
+ }
3835
+ /**
3836
+ * Raise (`true`) or lower (`false`) your hand. Raising needs a live stage and
3837
+ * `REQUEST_TO_SPEAK`; lowering also accepts an open invite to speak.
3838
+ */
3839
+ async setRequestToSpeak(raised = true) {
3840
+ const body = {
3841
+ channel_id: this.id,
3842
+ request_to_speak_timestamp: raised ? (/* @__PURE__ */ new Date()).toISOString() : null
3843
+ };
3844
+ await this.client.rest.patch(Routes14.guildVoiceState(this.guildId, "@me"), {
3845
+ body,
3846
+ auth: true
3847
+ });
3848
+ }
3849
+ /** @internal Apply a stage count object. */
3850
+ _patchCounts(data) {
3851
+ this.counts = {
3852
+ listenerCount: data.listener_count,
3853
+ speakerCount: data.speaker_count,
3854
+ requestCount: data.request_count,
3855
+ videoEnabled: data.video_enabled ?? null
3856
+ };
3857
+ }
3858
+ };
3633
3859
  var LinkChannel = class extends GuildChannel {
3634
3860
  /** External URL this channel links to. */
3635
3861
  url;
@@ -3643,10 +3869,10 @@ var LinkChannel = class extends GuildChannel {
3643
3869
  };
3644
3870
 
3645
3871
  // src/Domain/Channel/ThreadManager.ts
3646
- import { ChannelType as ChannelType6, Routes as Routes15 } from "@fluxerjs/types";
3872
+ import { ChannelType as ChannelType6, Routes as Routes16 } from "@fluxerjs/types";
3647
3873
 
3648
3874
  // src/Domain/Channel/ThreadChannel.ts
3649
- import { ChannelType as ChannelType5, Routes as Routes14 } from "@fluxerjs/types";
3875
+ import { ChannelType as ChannelType5, Routes as Routes15 } from "@fluxerjs/types";
3650
3876
  var ThreadMember = class {
3651
3877
  /** Thread ID. */
3652
3878
  id;
@@ -3773,7 +3999,7 @@ var ThreadChannel = class extends TextCapable(GuildChannel) {
3773
3999
  * `appliedTags` is sent for public and announcement threads. `invitable` is sent for private threads.
3774
4000
  */
3775
4001
  async edit(options) {
3776
- const data = await this.client.rest.patch(Routes14.channel(this.id), {
4002
+ const data = await this.client.rest.patch(Routes15.channel(this.id), {
3777
4003
  body: toThreadEditBody(this.type, threadEditFields(options)),
3778
4004
  auth: true,
3779
4005
  ...auditReasonHeaders(options.reason)
@@ -3791,16 +4017,16 @@ var ThreadChannel = class extends TextCapable(GuildChannel) {
3791
4017
  }
3792
4018
  /** Join this thread. */
3793
4019
  async join() {
3794
- await this.client.rest.put(Routes14.channelThreadMemberMe(this.id), { auth: true });
4020
+ await this.client.rest.put(Routes15.channelThreadMemberMe(this.id), { auth: true });
3795
4021
  }
3796
4022
  /** Leave this thread. */
3797
4023
  async leave() {
3798
- await this.client.rest.delete(Routes14.channelThreadMemberMe(this.id), { auth: true });
4024
+ await this.client.rest.delete(Routes15.channelThreadMemberMe(this.id), { auth: true });
3799
4025
  }
3800
4026
  /** Update the current user's notification settings for this thread. */
3801
4027
  async editSelf(options) {
3802
4028
  const data = await this.client.rest.patch(
3803
- Routes14.channelThreadMemberMeSettings(this.id),
4029
+ Routes15.channelThreadMemberMeSettings(this.id),
3804
4030
  { body: toThreadMemberSettingsBody(options), auth: true }
3805
4031
  );
3806
4032
  this.member = data ? new ThreadMember(data) : null;
@@ -3814,7 +4040,7 @@ var ThreadMemberManager = class {
3814
4040
  /** List members of this thread. */
3815
4041
  async fetch(options) {
3816
4042
  const data = await this.thread.client.rest.get(
3817
- withQuery(Routes14.channelThreadMembers(this.thread.id), {
4043
+ withQuery(Routes15.channelThreadMembers(this.thread.id), {
3818
4044
  with_member: options?.withMember === void 0 ? void 0 : String(options.withMember),
3819
4045
  after: options?.after,
3820
4046
  limit: options?.limit
@@ -3825,7 +4051,7 @@ var ThreadMemberManager = class {
3825
4051
  /** Fetch one member of this thread. */
3826
4052
  async fetchOne(userId, options) {
3827
4053
  const data = await this.thread.client.rest.get(
3828
- withQuery(Routes14.channelThreadMember(this.thread.id, userId), {
4054
+ withQuery(Routes15.channelThreadMember(this.thread.id, userId), {
3829
4055
  with_member: options?.withMember === void 0 ? void 0 : String(options.withMember)
3830
4056
  })
3831
4057
  );
@@ -3833,13 +4059,13 @@ var ThreadMemberManager = class {
3833
4059
  }
3834
4060
  /** Add a user to this thread. Private threads only, unless the caller can manage the parent. */
3835
4061
  async add(userId) {
3836
- await this.thread.client.rest.put(Routes14.channelThreadMember(this.thread.id, userId), {
4062
+ await this.thread.client.rest.put(Routes15.channelThreadMember(this.thread.id, userId), {
3837
4063
  auth: true
3838
4064
  });
3839
4065
  }
3840
4066
  /** Remove a user from this thread. */
3841
4067
  async remove(userId) {
3842
- await this.thread.client.rest.delete(Routes14.channelThreadMember(this.thread.id, userId), {
4068
+ await this.thread.client.rest.delete(Routes15.channelThreadMember(this.thread.id, userId), {
3843
4069
  auth: true
3844
4070
  });
3845
4071
  }
@@ -3864,7 +4090,7 @@ var ThreadManager = class {
3864
4090
  });
3865
4091
  }
3866
4092
  const data = await this.channel.client.rest.post(
3867
- Routes15.channelThreads(this.channel.id),
4093
+ Routes16.channelThreads(this.channel.id),
3868
4094
  {
3869
4095
  body: toStartThreadBody(this.channel.type, options),
3870
4096
  auth: true,
@@ -3897,7 +4123,7 @@ var ThreadManager = class {
3897
4123
  if (options.rateLimitPerUser !== void 0) body.rate_limit_per_user = options.rateLimitPerUser;
3898
4124
  if (options.appliedTags !== void 0) body.applied_tags = options.appliedTags;
3899
4125
  const data = await this.channel.client.rest.post(
3900
- Routes15.channelThreads(this.channel.id),
4126
+ Routes16.channelThreads(this.channel.id),
3901
4127
  {
3902
4128
  body,
3903
4129
  files: prepared.files,
@@ -3916,7 +4142,7 @@ var ThreadManager = class {
3916
4142
  * `before` is an ISO-8601 archive timestamp.
3917
4143
  */
3918
4144
  async fetchArchived(options) {
3919
- const path = options.type === "private" ? Routes15.channelThreadsArchivedPrivate(this.channel.id) : Routes15.channelThreadsArchivedPublic(this.channel.id);
4145
+ const path = options.type === "private" ? Routes16.channelThreadsArchivedPrivate(this.channel.id) : Routes16.channelThreadsArchivedPublic(this.channel.id);
3920
4146
  const data = await this.channel.client.rest.get(
3921
4147
  withQuery(path, { before: options.before, limit: options.limit })
3922
4148
  );
@@ -3928,7 +4154,7 @@ var ThreadManager = class {
3928
4154
  */
3929
4155
  async fetchJoinedPrivateArchived(options) {
3930
4156
  const data = await this.channel.client.rest.get(
3931
- withQuery(Routes15.channelJoinedArchivedPrivateThreads(this.channel.id), {
4157
+ withQuery(Routes16.channelJoinedArchivedPrivateThreads(this.channel.id), {
3932
4158
  before: options?.before,
3933
4159
  limit: options?.limit
3934
4160
  })
@@ -3941,7 +4167,7 @@ var ThreadManager = class {
3941
4167
  */
3942
4168
  async search(options) {
3943
4169
  const data = await this.channel.client.rest.get(
3944
- withQuery(Routes15.channelThreadSearch(this.channel.id), {
4170
+ withQuery(Routes16.channelThreadSearch(this.channel.id), {
3945
4171
  name: options?.name,
3946
4172
  tag: options?.tag,
3947
4173
  tag_setting: options?.tagSetting,
@@ -3969,7 +4195,7 @@ var ThreadManager = class {
3969
4195
  }
3970
4196
  /** Set the auto-archive and slowmode defaults copied onto new threads. */
3971
4197
  async editDefaults(options) {
3972
- return this.channel.client.rest.patch(Routes15.channel(this.channel.id), {
4198
+ return this.channel.client.rest.patch(Routes16.channel(this.channel.id), {
3973
4199
  body: toThreadParentEditBody(options),
3974
4200
  auth: true,
3975
4201
  ...auditReasonHeaders(options.reason)
@@ -3987,7 +4213,7 @@ function isSearchNotReady(data) {
3987
4213
  return "code" in data && data.code === "SEARCH_INDEX_NOT_READY";
3988
4214
  }
3989
4215
  async function fetchActiveThreads(client, guildId) {
3990
- const data = await client.rest.get(Routes15.guildActiveThreads(guildId));
4216
+ const data = await client.rest.get(Routes16.guildActiveThreads(guildId));
3991
4217
  return fetchedThreadsFrom(client, data);
3992
4218
  }
3993
4219
 
@@ -4046,7 +4272,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
4046
4272
  * `defaultForumLayout` is sent only for forum channels.
4047
4273
  */
4048
4274
  async edit(options) {
4049
- const data = await this.client.rest.patch(Routes16.channel(this.id), {
4275
+ const data = await this.client.rest.patch(Routes17.channel(this.id), {
4050
4276
  body: {
4051
4277
  ...toChannelEditBody(options),
4052
4278
  ...forumParentWire(options, this.type === ChannelType7.GuildForum)
@@ -4075,7 +4301,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
4075
4301
  }
4076
4302
  /** Set the auto-archive and slowmode defaults copied onto new posts. */
4077
4303
  async editThreadDefaults(options) {
4078
- const data = await this.client.rest.patch(Routes16.channel(this.id), {
4304
+ const data = await this.client.rest.patch(Routes17.channel(this.id), {
4079
4305
  body: toThreadParentEditBody(options),
4080
4306
  auth: true,
4081
4307
  ...auditReasonHeaders(options.reason)
@@ -4085,7 +4311,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
4085
4311
  }
4086
4312
  /** Create a tag. The response replaces {@link availableTags}. */
4087
4313
  async createTag(options) {
4088
- const data = await this.client.rest.post(Routes16.channelTags(this.id), {
4314
+ const data = await this.client.rest.post(Routes17.channelTags(this.id), {
4089
4315
  body: toForumTagBody(options),
4090
4316
  auth: true,
4091
4317
  ...auditReasonHeaders(options.reason)
@@ -4095,7 +4321,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
4095
4321
  }
4096
4322
  /** Replace a tag. The response replaces {@link availableTags}. */
4097
4323
  async editTag(tagId, options) {
4098
- const data = await this.client.rest.put(Routes16.channelTag(this.id, tagId), {
4324
+ const data = await this.client.rest.put(Routes17.channelTag(this.id, tagId), {
4099
4325
  body: toForumTagBody(options),
4100
4326
  auth: true,
4101
4327
  ...auditReasonHeaders(options.reason)
@@ -4105,7 +4331,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
4105
4331
  }
4106
4332
  /** Delete a tag. The response replaces {@link availableTags}. */
4107
4333
  async deleteTag(tagId, reason) {
4108
- const data = await this.client.rest.delete(Routes16.channelTag(this.id, tagId), {
4334
+ const data = await this.client.rest.delete(Routes17.channelTag(this.id, tagId), {
4109
4335
  auth: true,
4110
4336
  ...auditReasonHeaders(reason)
4111
4337
  });
@@ -4140,6 +4366,7 @@ var GUILD_FACTORIES = {
4140
4366
  [ChannelType8.GuildAnnouncement]: (c, d) => new AnnouncementChannel(c, d),
4141
4367
  [ChannelType8.GuildCategory]: (c, d) => new CategoryChannel(c, d),
4142
4368
  [ChannelType8.GuildVoice]: (c, d) => new VoiceChannel(c, d),
4369
+ [ChannelType8.GuildStageVoice]: (c, d) => new StageChannel(c, d),
4143
4370
  [ChannelType8.GuildLink]: (c, d) => new LinkChannel(c, d),
4144
4371
  [ChannelType8.AnnouncementThread]: (c, d) => new ThreadChannel(c, d),
4145
4372
  [ChannelType8.PublicThread]: (c, d) => new ThreadChannel(c, d),
@@ -4261,11 +4488,11 @@ var User = class extends Base {
4261
4488
  */
4262
4489
  /** Unix timestamp (ms) when this account was created, derived from its snowflake ID. */
4263
4490
  get createdTimestamp() {
4264
- return SnowflakeUtil5.timestampFromSnowflake(this.id);
4491
+ return SnowflakeUtil6.timestampFromSnowflake(this.id);
4265
4492
  }
4266
4493
  /** Date when this account was created, derived from its snowflake ID. */
4267
4494
  get createdAt() {
4268
- return SnowflakeUtil5.dateFromSnowflake(this.id);
4495
+ return SnowflakeUtil6.dateFromSnowflake(this.id);
4269
4496
  }
4270
4497
  toString() {
4271
4498
  return `<@${this.id}>`;
@@ -4275,7 +4502,7 @@ var User = class extends Base {
4275
4502
  * @returns DM channel instance (cached if already open)
4276
4503
  */
4277
4504
  async createDM() {
4278
- const data = await this.client.rest.post(Routes17.userMeChannels(), {
4505
+ const data = await this.client.rest.post(Routes18.userMeChannels(), {
4279
4506
  body: { recipient_id: this.id },
4280
4507
  auth: true
4281
4508
  });
@@ -4492,14 +4719,14 @@ var CacheController = class {
4492
4719
 
4493
4720
  // src/ClientCore/ChannelManager.ts
4494
4721
  import { LimitedCollection } from "@fluxerjs/collection";
4495
- import { Routes as Routes23 } from "@fluxerjs/types";
4722
+ import { Routes as Routes24 } from "@fluxerjs/types";
4496
4723
 
4497
4724
  // src/Domain/Guild/Cache.ts
4498
4725
  import { ChannelType as ChannelType9 } from "@fluxerjs/types";
4499
4726
 
4500
4727
  // src/Domain/Guild/GuildEmoji.ts
4501
- import { Routes as Routes18 } from "@fluxerjs/types";
4502
- import { SnowflakeUtil as SnowflakeUtil6 } from "@fluxerjs/util";
4728
+ import { Routes as Routes19 } from "@fluxerjs/types";
4729
+ import { SnowflakeUtil as SnowflakeUtil7 } from "@fluxerjs/util";
4503
4730
  var GuildEmoji = class extends Base {
4504
4731
  client;
4505
4732
  id;
@@ -4535,11 +4762,11 @@ var GuildEmoji = class extends Base {
4535
4762
  }
4536
4763
  /** Unix timestamp (ms) when this emoji was created, derived from its snowflake ID. */
4537
4764
  get createdTimestamp() {
4538
- return SnowflakeUtil6.timestampFromSnowflake(this.id);
4765
+ return SnowflakeUtil7.timestampFromSnowflake(this.id);
4539
4766
  }
4540
4767
  /** Date when this emoji was created, derived from its snowflake ID. */
4541
4768
  get createdAt() {
4542
- return SnowflakeUtil6.dateFromSnowflake(this.id);
4769
+ return SnowflakeUtil7.dateFromSnowflake(this.id);
4543
4770
  }
4544
4771
  /** Renders this emoji for use in message content: `<:name:id>` (or `<a:name:id>` when animated). */
4545
4772
  toString() {
@@ -4547,7 +4774,7 @@ var GuildEmoji = class extends Base {
4547
4774
  }
4548
4775
  /** Delete this emoji. Requires Manage Emojis and Stickers permission. */
4549
4776
  async delete(reason) {
4550
- await this.client.rest.delete(Routes18.guildEmoji(this.guildId, this.id), {
4777
+ await this.client.rest.delete(Routes19.guildEmoji(this.guildId, this.id), {
4551
4778
  auth: true,
4552
4779
  ...auditReasonHeaders(reason)
4553
4780
  });
@@ -4560,7 +4787,7 @@ var GuildEmoji = class extends Base {
4560
4787
  */
4561
4788
  async edit(options) {
4562
4789
  const { reason, name } = options;
4563
- const data = await this.client.rest.patch(Routes18.guildEmoji(this.guildId, this.id), {
4790
+ const data = await this.client.rest.patch(Routes19.guildEmoji(this.guildId, this.id), {
4564
4791
  body: { name },
4565
4792
  auth: true,
4566
4793
  ...auditReasonHeaders(reason)
@@ -4571,7 +4798,7 @@ var GuildEmoji = class extends Base {
4571
4798
  };
4572
4799
 
4573
4800
  // src/Domain/Guild/GuildMember.ts
4574
- import { Routes as Routes20 } from "@fluxerjs/types";
4801
+ import { Routes as Routes21 } from "@fluxerjs/types";
4575
4802
  import { PermissionFlags as PermissionFlags3, PermissionsBitField as PermissionsBitField2 } from "@fluxerjs/util";
4576
4803
 
4577
4804
  // src/Helpers/Permissions.ts
@@ -4595,7 +4822,7 @@ function computePermissions(basePermissions, overwrites, memberRoles, memberId,
4595
4822
 
4596
4823
  // src/Domain/Guild/GuildMemberRoleManager.ts
4597
4824
  import { Collection as Collection7 } from "@fluxerjs/collection";
4598
- import { Routes as Routes19 } from "@fluxerjs/types";
4825
+ import { Routes as Routes20 } from "@fluxerjs/types";
4599
4826
  function roleId(roleOrId) {
4600
4827
  return typeof roleOrId === "string" ? roleOrId : roleOrId.id;
4601
4828
  }
@@ -4624,7 +4851,7 @@ var GuildMemberRoleManager = class {
4624
4851
  const id = roleId(roleOrId);
4625
4852
  if (this.ids.includes(id)) return;
4626
4853
  await this.member.client.rest.put(
4627
- Routes19.guildMemberRole(this.member.guild.id, this.member.id, id)
4854
+ Routes20.guildMemberRole(this.member.guild.id, this.member.id, id)
4628
4855
  );
4629
4856
  this.ids.push(id);
4630
4857
  }
@@ -4633,13 +4860,13 @@ var GuildMemberRoleManager = class {
4633
4860
  const idx = this.ids.indexOf(id);
4634
4861
  if (idx === -1) return;
4635
4862
  await this.member.client.rest.delete(
4636
- Routes19.guildMemberRole(this.member.guild.id, this.member.id, id)
4863
+ Routes20.guildMemberRole(this.member.guild.id, this.member.id, id)
4637
4864
  );
4638
4865
  this.ids.splice(idx, 1);
4639
4866
  }
4640
4867
  async set(roleIds) {
4641
4868
  const data = await this.member.client.rest.patch(
4642
- Routes19.guildMember(this.member.guild.id, this.member.id),
4869
+ Routes20.guildMember(this.member.guild.id, this.member.id),
4643
4870
  { body: { roles: roleIds }, auth: true }
4644
4871
  );
4645
4872
  this.ids = data.roles ? [...data.roles] : [];
@@ -4793,7 +5020,7 @@ var GuildMember = class _GuildMember extends Base {
4793
5020
  */
4794
5021
  async edit(options) {
4795
5022
  const isMe = this.client.user?.id === this.id;
4796
- const route = isMe ? Routes20.guildMemberMe(this.guild.id) : Routes20.guildMember(this.guild.id, this.id);
5023
+ const route = isMe ? Routes21.guildMemberMe(this.guild.id) : Routes21.guildMember(this.guild.id, this.id);
4797
5024
  const data = await this.client.rest.patch(route, {
4798
5025
  body: toMemberEditBody(options),
4799
5026
  auth: true,
@@ -4906,8 +5133,8 @@ var GuildMember = class _GuildMember extends Base {
4906
5133
  };
4907
5134
 
4908
5135
  // src/Domain/Guild/GuildSticker.ts
4909
- import { Routes as Routes21 } from "@fluxerjs/types";
4910
- import { SnowflakeUtil as SnowflakeUtil7 } from "@fluxerjs/util";
5136
+ import { Routes as Routes22 } from "@fluxerjs/types";
5137
+ import { SnowflakeUtil as SnowflakeUtil8 } from "@fluxerjs/util";
4911
5138
  var GuildSticker = class extends Base {
4912
5139
  client;
4913
5140
  id;
@@ -4949,15 +5176,15 @@ var GuildSticker = class extends Base {
4949
5176
  }
4950
5177
  /** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
4951
5178
  get createdTimestamp() {
4952
- return SnowflakeUtil7.timestampFromSnowflake(this.id);
5179
+ return SnowflakeUtil8.timestampFromSnowflake(this.id);
4953
5180
  }
4954
5181
  /** Date when this sticker was created, derived from its snowflake ID. */
4955
5182
  get createdAt() {
4956
- return SnowflakeUtil7.dateFromSnowflake(this.id);
5183
+ return SnowflakeUtil8.dateFromSnowflake(this.id);
4957
5184
  }
4958
5185
  /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
4959
5186
  async delete(reason) {
4960
- await this.client.rest.delete(Routes21.guildSticker(this.guildId, this.id), {
5187
+ await this.client.rest.delete(Routes22.guildSticker(this.guildId, this.id), {
4961
5188
  auth: true,
4962
5189
  ...auditReasonHeaders(reason)
4963
5190
  });
@@ -4970,7 +5197,7 @@ var GuildSticker = class extends Base {
4970
5197
  */
4971
5198
  async edit(options) {
4972
5199
  const { reason, ...body } = options;
4973
- const data = await this.client.rest.patch(Routes21.guildSticker(this.guildId, this.id), {
5200
+ const data = await this.client.rest.patch(Routes22.guildSticker(this.guildId, this.id), {
4974
5201
  body,
4975
5202
  auth: true,
4976
5203
  ...auditReasonHeaders(reason)
@@ -4983,12 +5210,12 @@ var GuildSticker = class extends Base {
4983
5210
  };
4984
5211
 
4985
5212
  // src/Domain/Guild/Role.ts
4986
- import { Routes as Routes22 } from "@fluxerjs/types";
5213
+ import { Routes as Routes23 } from "@fluxerjs/types";
4987
5214
  import {
4988
5215
  ALL_PERMISSIONS_BIGINT as ALL_PERMISSIONS_BIGINT2,
4989
5216
  PermissionFlags as PermissionFlags4,
4990
5217
  PermissionsBitField as PermissionsBitField3,
4991
- SnowflakeUtil as SnowflakeUtil8
5218
+ SnowflakeUtil as SnowflakeUtil9
4992
5219
  } from "@fluxerjs/util";
4993
5220
  var Role = class _Role extends Base {
4994
5221
  /** Parent client instance. */
@@ -5058,11 +5285,11 @@ var Role = class _Role extends Base {
5058
5285
  */
5059
5286
  /** Unix timestamp (ms) when this role was created, derived from its snowflake ID. */
5060
5287
  get createdTimestamp() {
5061
- return SnowflakeUtil8.timestampFromSnowflake(this.id);
5288
+ return SnowflakeUtil9.timestampFromSnowflake(this.id);
5062
5289
  }
5063
5290
  /** Date when this role was created, derived from its snowflake ID. */
5064
5291
  get createdAt() {
5065
- return SnowflakeUtil8.dateFromSnowflake(this.id);
5292
+ return SnowflakeUtil9.dateFromSnowflake(this.id);
5066
5293
  }
5067
5294
  toString() {
5068
5295
  return `<@&${this.id}>`;
@@ -5108,7 +5335,7 @@ var Role = class _Role extends Base {
5108
5335
  */
5109
5336
  async edit(options) {
5110
5337
  const body = toRoleEditBody(options);
5111
- const data = await this.client.rest.patch(Routes22.guildRole(this.guildId, this.id), {
5338
+ const data = await this.client.rest.patch(Routes23.guildRole(this.guildId, this.id), {
5112
5339
  body: Object.keys(body).length ? body : void 0,
5113
5340
  auth: true,
5114
5341
  ...auditReasonHeaders(options.reason)
@@ -5121,7 +5348,7 @@ var Role = class _Role extends Base {
5121
5348
  * @param reason - Audit log reason (`X-Audit-Log-Reason`)
5122
5349
  */
5123
5350
  async delete(reason) {
5124
- await this.client.rest.delete(Routes22.guildRole(this.guildId, this.id), {
5351
+ await this.client.rest.delete(Routes23.guildRole(this.guildId, this.id), {
5125
5352
  auth: true,
5126
5353
  ...auditReasonHeaders(reason)
5127
5354
  });
@@ -5311,7 +5538,7 @@ var ChannelManager = class extends LimitedCollection {
5311
5538
  async fetchFresh(channelId) {
5312
5539
  try {
5313
5540
  const data = assertApiObjectWithId(
5314
- await this.client.rest.get(Routes23.channel(channelId)),
5541
+ await this.client.rest.get(Routes24.channel(channelId)),
5315
5542
  "channels.fetch()"
5316
5543
  );
5317
5544
  const existing = this.get(channelId);
@@ -5364,7 +5591,7 @@ var ChannelManager = class extends LimitedCollection {
5364
5591
  defaultAllowedMentions: this.client.options.defaultAllowedMentions
5365
5592
  });
5366
5593
  const data = await this.client.rest.post(
5367
- Routes23.channelMessages(channelId),
5594
+ Routes24.channelMessages(channelId),
5368
5595
  postPayload
5369
5596
  );
5370
5597
  this.client._addMessageToCache(channelId, data);
@@ -5374,7 +5601,7 @@ var ChannelManager = class extends LimitedCollection {
5374
5601
 
5375
5602
  // src/ClientCore/ClientEmoji.ts
5376
5603
  import { Collection as Collection8 } from "@fluxerjs/collection";
5377
- import { Routes as Routes24 } from "@fluxerjs/types";
5604
+ import { Routes as Routes25 } from "@fluxerjs/types";
5378
5605
  import { formatEmoji, getUnicodeFromShortcode, parseEmoji } from "@fluxerjs/util";
5379
5606
  async function resolveClientEmoji(client, emoji, guildId) {
5380
5607
  if (typeof emoji === "object" && emoji.id) {
@@ -5393,7 +5620,7 @@ async function resolveClientEmoji(client, emoji, guildId) {
5393
5620
  const unicodeFromShortcode = getUnicodeFromShortcode(parsed.name);
5394
5621
  if (unicodeFromShortcode) return unicodeFromShortcode;
5395
5622
  if (guildId) {
5396
- const emojis = await client.rest.get(Routes24.guildEmojis(guildId));
5623
+ const emojis = await client.rest.get(Routes25.guildEmojis(guildId));
5397
5624
  const found = emojis.find((e) => e.name && e.name.toLowerCase() === parsed.name.toLowerCase());
5398
5625
  if (found) return formatEmoji({ ...parsed, id: found.id, animated: found.animated });
5399
5626
  throw new FluxerError(
@@ -5410,26 +5637,26 @@ async function resolveClientEmoji(client, emoji, guildId) {
5410
5637
  return parsed.name;
5411
5638
  }
5412
5639
  async function fetchInstance(client) {
5413
- const raw = await client.rest.get(Routes24.instanceDiscovery(), {
5640
+ const raw = await client.rest.get(Routes25.instanceDiscovery(), {
5414
5641
  auth: false,
5415
5642
  unversioned: true
5416
5643
  });
5417
5644
  return parseInstanceDiscovery(raw);
5418
5645
  }
5419
5646
  function fetchGatewayInfo(client) {
5420
- return client.rest.get(Routes24.gatewayBot());
5647
+ return client.rest.get(Routes25.gatewayBot());
5421
5648
  }
5422
5649
  function fetchEmojiMetadata(client, emojiId) {
5423
- return client.rest.get(Routes24.emojiMetadata(emojiId), { auth: true });
5650
+ return client.rest.get(Routes25.emojiMetadata(emojiId), { auth: true });
5424
5651
  }
5425
5652
  function fetchStickerMetadata(client, stickerId) {
5426
- return client.rest.get(Routes24.stickerMetadata(stickerId), { auth: true });
5653
+ return client.rest.get(Routes25.stickerMetadata(stickerId), { auth: true });
5427
5654
  }
5428
5655
  function fetchApplication(client) {
5429
- return client.rest.get(Routes24.applicationsMe(), { auth: true });
5656
+ return client.rest.get(Routes25.applicationsMe(), { auth: true });
5430
5657
  }
5431
5658
  async function fetchOAuthApplications(client) {
5432
- const data = await client.rest.get(Routes24.oauth2ApplicationsMe(), { auth: true });
5659
+ const data = await client.rest.get(Routes25.oauth2ApplicationsMe(), { auth: true });
5433
5660
  if (Array.isArray(data)) return data;
5434
5661
  if (data && typeof data === "object" && "applications" in data && Array.isArray(data.applications)) {
5435
5662
  return data.applications;
@@ -5448,14 +5675,14 @@ function assertChannelIdBatch(name, channelIds) {
5448
5675
  }
5449
5676
  function preloadMessages(client, channelIds) {
5450
5677
  assertChannelIdBatch("preloadMessages", channelIds);
5451
- return client.rest.post(Routes24.preloadMessages(), {
5678
+ return client.rest.post(Routes25.preloadMessages(), {
5452
5679
  body: { channels: channelIds },
5453
5680
  auth: true
5454
5681
  });
5455
5682
  }
5456
5683
  function preloadMessagesAlt(client, channelIds) {
5457
5684
  assertChannelIdBatch("preloadMessagesAlt", channelIds);
5458
- return client.rest.post(Routes24.preloadMessagesAlt(), {
5685
+ return client.rest.post(Routes25.preloadMessagesAlt(), {
5459
5686
  body: { channels: channelIds },
5460
5687
  auth: true
5461
5688
  });
@@ -5463,7 +5690,7 @@ function preloadMessagesAlt(client, channelIds) {
5463
5690
  async function bulkFetchMessages(client, requests, options = {}) {
5464
5691
  validateBulkMessageFetchRequests(requests);
5465
5692
  const wire = toBulkFetchWire(requests);
5466
- const data = await client.rest.post(Routes24.channelsMessagesBulk(), {
5693
+ const data = await client.rest.post(Routes25.channelsMessagesBulk(), {
5467
5694
  body: { requests: wire },
5468
5695
  auth: true
5469
5696
  });
@@ -5480,7 +5707,7 @@ async function bulkFetchMessages(client, requests, options = {}) {
5480
5707
  };
5481
5708
  }
5482
5709
  async function searchMessages(client, options = {}) {
5483
- const data = await client.rest.post(Routes24.searchMessages(), {
5710
+ const data = await client.rest.post(Routes25.searchMessages(), {
5484
5711
  body: toMessageSearchBody(options),
5485
5712
  auth: true
5486
5713
  });
@@ -5488,19 +5715,19 @@ async function searchMessages(client, options = {}) {
5488
5715
  }
5489
5716
  function fetchEmojiSource(client, emojiId) {
5490
5717
  return client.rest.get(
5491
- Routes24.emojiSource(emojiId),
5718
+ Routes25.emojiSource(emojiId),
5492
5719
  { auth: true }
5493
5720
  );
5494
5721
  }
5495
5722
  function fetchStickerSource(client, stickerId) {
5496
5723
  return client.rest.get(
5497
- Routes24.stickerSource(stickerId),
5724
+ Routes25.stickerSource(stickerId),
5498
5725
  { auth: true }
5499
5726
  );
5500
5727
  }
5501
5728
  function fetchDiscoveryCategories(client) {
5502
5729
  return client.rest.get(
5503
- Routes24.discoveryCategories(),
5730
+ Routes25.discoveryCategories(),
5504
5731
  { auth: true }
5505
5732
  );
5506
5733
  }
@@ -5515,18 +5742,18 @@ function searchDiscoveryGuilds(client, options = {}) {
5515
5742
  if (options.offset !== void 0) params.set("offset", String(options.offset));
5516
5743
  const qs2 = params.toString();
5517
5744
  return client.rest.get(
5518
- qs2 ? `${Routes24.discoveryGuilds()}?${qs2}` : Routes24.discoveryGuilds(),
5745
+ qs2 ? `${Routes25.discoveryGuilds()}?${qs2}` : Routes25.discoveryGuilds(),
5519
5746
  { auth: true }
5520
5747
  );
5521
5748
  }
5522
5749
  function fetchExperiments(client) {
5523
- return client.rest.get(Routes24.experiments(), {
5750
+ return client.rest.get(Routes25.experiments(), {
5524
5751
  auth: true
5525
5752
  });
5526
5753
  }
5527
5754
  function refreshAttachmentUrls(client, attachmentUrls) {
5528
5755
  return client.rest.post(
5529
- Routes24.attachmentsRefreshUrls(),
5756
+ Routes25.attachmentsRefreshUrls(),
5530
5757
  { body: { attachment_urls: attachmentUrls }, auth: true }
5531
5758
  );
5532
5759
  }
@@ -5538,13 +5765,13 @@ function fetchInstanceBadges(client, options = {}) {
5538
5765
  if (options.version !== void 0) params.set("version", options.version);
5539
5766
  const qs2 = params.toString();
5540
5767
  return client.rest.get(
5541
- qs2 ? `${Routes24.instanceBadges()}?${qs2}` : Routes24.instanceBadges(),
5768
+ qs2 ? `${Routes25.instanceBadges()}?${qs2}` : Routes25.instanceBadges(),
5542
5769
  { auth: false }
5543
5770
  );
5544
5771
  }
5545
5772
  function fetchChannelPostData(client, channelId, threadIds) {
5546
5773
  return client.rest.post(
5547
- Routes24.channelPostData(channelId),
5774
+ Routes25.channelPostData(channelId),
5548
5775
  { body: { thread_ids: threadIds }, auth: true }
5549
5776
  );
5550
5777
  }
@@ -5566,13 +5793,13 @@ function createEventMethods(client) {
5566
5793
  import { GatewayCloseCodes, WebSocketManager } from "@fluxerjs/ws";
5567
5794
 
5568
5795
  // src/Domain/Guild/Guild.ts
5569
- import { LimitedCollection as LimitedCollection4 } from "@fluxerjs/collection";
5796
+ import { Collection as Collection9, LimitedCollection as LimitedCollection4 } from "@fluxerjs/collection";
5570
5797
  import { GuildNSFWLevel } from "@fluxerjs/types";
5571
- import { SnowflakeUtil as SnowflakeUtil9 } from "@fluxerjs/util";
5798
+ import { SnowflakeUtil as SnowflakeUtil10 } from "@fluxerjs/util";
5572
5799
 
5573
5800
  // src/ClientCore/GuildMemberManager.ts
5574
5801
  import { LimitedCollection as LimitedCollection2 } from "@fluxerjs/collection";
5575
- import { Routes as Routes25 } from "@fluxerjs/types";
5802
+ import { Routes as Routes26 } from "@fluxerjs/types";
5576
5803
  var GuildMemberManager = class extends LimitedCollection2 {
5577
5804
  constructor(guild) {
5578
5805
  super({ maxSize: guild.client.cache.limits.members });
@@ -5633,7 +5860,7 @@ var GuildMemberManager = class extends LimitedCollection2 {
5633
5860
  if (options?.limit != null) params.set("limit", String(options.limit));
5634
5861
  if (options?.after) params.set("after", options.after);
5635
5862
  const qs2 = params.toString();
5636
- const url = Routes25.guildMembers(this.guild.id) + (qs2 ? `?${qs2}` : "");
5863
+ const url = Routes26.guildMembers(this.guild.id) + (qs2 ? `?${qs2}` : "");
5637
5864
  const data = assertApiArray(
5638
5865
  await this.guild.client.rest.get(url, { auth: true }),
5639
5866
  "members.fetch()"
@@ -5660,7 +5887,7 @@ var GuildMemberManager = class extends LimitedCollection2 {
5660
5887
  */
5661
5888
  async search(options = {}) {
5662
5889
  const data = await this.guild.client.rest.post(
5663
- Routes25.guildMembersSearch(this.guild.id),
5890
+ Routes26.guildMembersSearch(this.guild.id),
5664
5891
  { body: toMemberSearchBody(options), auth: true }
5665
5892
  );
5666
5893
  const offset = options.offset ?? 0;
@@ -5686,7 +5913,7 @@ var GuildMemberManager = class extends LimitedCollection2 {
5686
5913
  };
5687
5914
 
5688
5915
  // src/Domain/Guild/Admin.ts
5689
- import { Routes as Routes26 } from "@fluxerjs/types";
5916
+ import { Routes as Routes27 } from "@fluxerjs/types";
5690
5917
  function toAuditLogEntryPayload(entry, guildId) {
5691
5918
  return {
5692
5919
  id: entry.id,
@@ -5707,7 +5934,7 @@ function toVanityPayload(data) {
5707
5934
  return { code: data.code ?? null, uses: data.uses };
5708
5935
  }
5709
5936
  async function fetchAuditLogs(guild, options) {
5710
- const url = Routes26.guildAuditLogs(guild.id) + qs({
5937
+ const url = Routes27.guildAuditLogs(guild.id) + qs({
5711
5938
  limit: options?.limit,
5712
5939
  before: options?.before,
5713
5940
  after: options?.after,
@@ -5731,7 +5958,7 @@ async function fetchAuditLogs(guild, options) {
5731
5958
  };
5732
5959
  }
5733
5960
  async function editGuild(guild, options) {
5734
- const data = await guild.client.rest.patch(Routes26.guild(guild.id), {
5961
+ const data = await guild.client.rest.patch(Routes27.guild(guild.id), {
5735
5962
  body: toGuildEditBody(options),
5736
5963
  auth: true
5737
5964
  });
@@ -5739,13 +5966,13 @@ async function editGuild(guild, options) {
5739
5966
  return guild;
5740
5967
  }
5741
5968
  async function fetchVanityURL(guild) {
5742
- const data = await guild.client.rest.get(Routes26.guildVanityUrl(guild.id), {
5969
+ const data = await guild.client.rest.get(Routes27.guildVanityUrl(guild.id), {
5743
5970
  auth: true
5744
5971
  });
5745
5972
  return toVanityPayload(data);
5746
5973
  }
5747
5974
  async function editVanityURL(guild, code) {
5748
- const data = await guild.client.rest.patch(Routes26.guildVanityUrl(guild.id), {
5975
+ const data = await guild.client.rest.patch(Routes27.guildVanityUrl(guild.id), {
5749
5976
  body: { code },
5750
5977
  auth: true
5751
5978
  });
@@ -5753,14 +5980,14 @@ async function editVanityURL(guild, code) {
5753
5980
  return toVanityPayload(data);
5754
5981
  }
5755
5982
  async function fetchDiscoveryStatus(guild) {
5756
- const data = await guild.client.rest.get(Routes26.guildDiscovery(guild.id), {
5983
+ const data = await guild.client.rest.get(Routes27.guildDiscovery(guild.id), {
5757
5984
  auth: true
5758
5985
  });
5759
5986
  return toDiscoveryStatusPayload(data);
5760
5987
  }
5761
5988
  async function applyForDiscovery(guild, options) {
5762
5989
  const data = await guild.client.rest.post(
5763
- Routes26.guildDiscovery(guild.id),
5990
+ Routes27.guildDiscovery(guild.id),
5764
5991
  {
5765
5992
  body: toDiscoveryBody(options),
5766
5993
  auth: true
@@ -5770,7 +5997,7 @@ async function applyForDiscovery(guild, options) {
5770
5997
  }
5771
5998
  async function editDiscoveryApplication(guild, options) {
5772
5999
  const data = await guild.client.rest.patch(
5773
- Routes26.guildDiscovery(guild.id),
6000
+ Routes27.guildDiscovery(guild.id),
5774
6001
  {
5775
6002
  body: toDiscoveryBody(options),
5776
6003
  auth: true
@@ -5779,34 +6006,34 @@ async function editDiscoveryApplication(guild, options) {
5779
6006
  return toDiscoveryApplicationPayload(data);
5780
6007
  }
5781
6008
  async function withdrawDiscoveryApplication(guild) {
5782
- await guild.client.rest.delete(Routes26.guildDiscovery(guild.id), { auth: true });
6009
+ await guild.client.rest.delete(Routes27.guildDiscovery(guild.id), { auth: true });
5783
6010
  }
5784
6011
  async function deleteGuild(guild, options) {
5785
6012
  const body = options ? toSudoBody(options) : {};
5786
- await guild.client.rest.post(Routes26.guildDelete(guild.id), {
6013
+ await guild.client.rest.post(Routes27.guildDelete(guild.id), {
5787
6014
  body,
5788
6015
  auth: true
5789
6016
  });
5790
6017
  guild.client.guilds.delete(guild.id);
5791
6018
  }
5792
6019
  async function transferOwnership(guild, newOwnerId, password) {
5793
- await guild.client.rest.post(Routes26.guildTransferOwnership(guild.id), {
6020
+ await guild.client.rest.post(Routes27.guildTransferOwnership(guild.id), {
5794
6021
  body: { new_owner_id: newOwnerId, ...password != null && { password } },
5795
6022
  auth: true
5796
6023
  });
5797
6024
  }
5798
6025
 
5799
6026
  // src/Domain/Guild/Channels.ts
5800
- import { Routes as Routes27 } from "@fluxerjs/types";
6027
+ import { Routes as Routes28 } from "@fluxerjs/types";
5801
6028
  async function createChannel(guild, options) {
5802
- const created = await guild.client.rest.post(Routes27.guildChannels(guild.id), {
6029
+ const created = await guild.client.rest.post(Routes28.guildChannels(guild.id), {
5803
6030
  body: toChannelCreateBody(options),
5804
6031
  auth: true
5805
6032
  });
5806
6033
  return cacheChannel(guild, created);
5807
6034
  }
5808
6035
  async function fetchChannels(guild) {
5809
- const raw = await guild.client.rest.get(Routes27.guildChannels(guild.id));
6036
+ const raw = await guild.client.rest.get(Routes28.guildChannels(guild.id));
5810
6037
  if (!Array.isArray(raw))
5811
6038
  throw new TypeError(
5812
6039
  "guild.fetchChannels() received an invalid API payload (expected an array)"
@@ -5820,17 +6047,17 @@ async function fetchChannels(guild) {
5820
6047
  return channels;
5821
6048
  }
5822
6049
  async function setChannelPositions(guild, updates) {
5823
- await guild.client.rest.patch(Routes27.guildChannels(guild.id), {
6050
+ await guild.client.rest.patch(Routes28.guildChannels(guild.id), {
5824
6051
  body: toChannelPositionBody(updates),
5825
6052
  auth: true
5826
6053
  });
5827
6054
  }
5828
6055
  async function fetchWebhooks(guild) {
5829
- const data = await guild.client.rest.get(Routes27.guildWebhooks(guild.id));
6056
+ const data = await guild.client.rest.get(Routes28.guildWebhooks(guild.id));
5830
6057
  return data.map((w) => new Webhook(guild.client, w));
5831
6058
  }
5832
6059
  async function fetchInvites(guild) {
5833
- const data = await guild.client.rest.get(Routes27.guildInvites(guild.id));
6060
+ const data = await guild.client.rest.get(Routes28.guildInvites(guild.id));
5834
6061
  return data.map((invite) => new Invite(guild.client, invite));
5835
6062
  }
5836
6063
  async function fetchInvite(guild, codeOrUrl) {
@@ -5850,14 +6077,14 @@ function resolveGuildOnlineCount(data) {
5850
6077
  }
5851
6078
 
5852
6079
  // src/Domain/Guild/Emojis.ts
5853
- import { Routes as Routes28 } from "@fluxerjs/types";
6080
+ import { Routes as Routes29 } from "@fluxerjs/types";
5854
6081
  async function fetchEmojis(guild) {
5855
- const data = await guild.client.rest.get(Routes28.guildEmojis(guild.id));
6082
+ const data = await guild.client.rest.get(Routes29.guildEmojis(guild.id));
5856
6083
  return data.map((e) => cacheEmoji(guild, e));
5857
6084
  }
5858
6085
  async function fetchEmoji(guild, emojiId) {
5859
6086
  try {
5860
- const data = await guild.client.rest.get(Routes28.guildEmoji(guild.id, emojiId));
6087
+ const data = await guild.client.rest.get(Routes29.guildEmoji(guild.id, emojiId));
5861
6088
  return cacheEmoji(guild, data);
5862
6089
  } catch (err) {
5863
6090
  rethrowMapped(err, {
@@ -5868,7 +6095,7 @@ async function fetchEmoji(guild, emojiId) {
5868
6095
  }
5869
6096
  async function createEmoji(guild, options) {
5870
6097
  const { reason, ...body } = options;
5871
- const data = await guild.client.rest.post(Routes28.guildEmojis(guild.id), {
6098
+ const data = await guild.client.rest.post(Routes29.guildEmojis(guild.id), {
5872
6099
  body,
5873
6100
  auth: true,
5874
6101
  ...auditReasonHeaders(reason)
@@ -5876,7 +6103,7 @@ async function createEmoji(guild, options) {
5876
6103
  return cacheEmoji(guild, data);
5877
6104
  }
5878
6105
  async function cloneEmoji(guild, sourceEmojiId) {
5879
- const data = await guild.client.rest.post(Routes28.guildEmojisClone(guild.id), {
6106
+ const data = await guild.client.rest.post(Routes29.guildEmojisClone(guild.id), {
5880
6107
  body: { source_emoji_id: sourceEmojiId },
5881
6108
  auth: true
5882
6109
  });
@@ -5884,7 +6111,7 @@ async function cloneEmoji(guild, sourceEmojiId) {
5884
6111
  }
5885
6112
  async function createEmojisBulk(guild, emojis) {
5886
6113
  const data = await guild.client.rest.post(
5887
- Routes28.guildEmojisBulk(guild.id),
6114
+ Routes29.guildEmojisBulk(guild.id),
5888
6115
  { body: { emojis }, auth: true }
5889
6116
  );
5890
6117
  return { success: data.success.map((e) => cacheEmoji(guild, e)), failed: data.failed };
@@ -5904,12 +6131,12 @@ var GuildRoleManager = class extends LimitedCollection3 {
5904
6131
  };
5905
6132
 
5906
6133
  // src/Domain/Guild/MemberHttp.ts
5907
- import { Routes as Routes29 } from "@fluxerjs/types";
6134
+ import { Routes as Routes30 } from "@fluxerjs/types";
5908
6135
  async function fetchMember(guild, userId) {
5909
6136
  const id = normalizeSnowflakeId(userId, "members.fetch()");
5910
6137
  try {
5911
6138
  const data = await guild.client.rest.get(
5912
- Routes29.guildMember(guild.id, id)
6139
+ Routes30.guildMember(guild.id, id)
5913
6140
  );
5914
6141
  if (!data?.user?.id) {
5915
6142
  throw new TypeError("members.fetch() received an invalid API payload (missing user.id)");
@@ -5927,7 +6154,7 @@ async function fetchMember(guild, userId) {
5927
6154
  }
5928
6155
  async function fetchMe(guild) {
5929
6156
  const data = await guild.client.rest.get(
5930
- Routes29.guildMemberMe(guild.id),
6157
+ Routes30.guildMemberMe(guild.id),
5931
6158
  { auth: true }
5932
6159
  );
5933
6160
  if (!data?.user?.id) {
@@ -5937,10 +6164,10 @@ async function fetchMe(guild) {
5937
6164
  }
5938
6165
 
5939
6166
  // src/Domain/Guild/Moderation.ts
5940
- import { Routes as Routes31 } from "@fluxerjs/types";
6167
+ import { Routes as Routes32 } from "@fluxerjs/types";
5941
6168
 
5942
6169
  // src/Domain/Guild/GuildBan.ts
5943
- import { Routes as Routes30 } from "@fluxerjs/types";
6170
+ import { Routes as Routes31 } from "@fluxerjs/types";
5944
6171
  function parseOptionalDate2(value) {
5945
6172
  if (value == null || value === "") return null;
5946
6173
  const date = new Date(value);
@@ -5967,7 +6194,7 @@ var GuildBan = class extends Base {
5967
6194
  * Requires Ban Members permission.
5968
6195
  */
5969
6196
  async unban(reason) {
5970
- await this.client.rest.delete(Routes30.guildBan(this.guildId, this.user.id), {
6197
+ await this.client.rest.delete(Routes31.guildBan(this.guildId, this.user.id), {
5971
6198
  auth: true,
5972
6199
  ...auditReasonHeaders(reason)
5973
6200
  });
@@ -5977,39 +6204,39 @@ var GuildBan = class extends Base {
5977
6204
  // src/Domain/Guild/Moderation.ts
5978
6205
  async function ban(guild, userId, options) {
5979
6206
  const body = options ? toGuildBanBody(options) : {};
5980
- await guild.client.rest.put(Routes31.guildBan(guild.id, userId), {
6207
+ await guild.client.rest.put(Routes32.guildBan(guild.id, userId), {
5981
6208
  body: Object.keys(body).length ? body : void 0,
5982
6209
  auth: true,
5983
6210
  ...auditReasonHeaders(options?.reason)
5984
6211
  });
5985
6212
  }
5986
6213
  async function fetchBan(guild, userId) {
5987
- const data = await guild.client.rest.get(Routes31.guildBan(guild.id, userId));
6214
+ const data = await guild.client.rest.get(Routes32.guildBan(guild.id, userId));
5988
6215
  return new GuildBan(guild.client, { ...data, guild_id: guild.id }, guild.id);
5989
6216
  }
5990
6217
  async function fetchBans(guild) {
5991
- const data = await guild.client.rest.get(Routes31.guildBans(guild.id));
6218
+ const data = await guild.client.rest.get(Routes32.guildBans(guild.id));
5992
6219
  return data.map((b) => new GuildBan(guild.client, { ...b, guild_id: guild.id }, guild.id));
5993
6220
  }
5994
6221
  async function unban(guild, userId, reason) {
5995
- await guild.client.rest.delete(Routes31.guildBan(guild.id, userId), {
6222
+ await guild.client.rest.delete(Routes32.guildBan(guild.id, userId), {
5996
6223
  auth: true,
5997
6224
  ...auditReasonHeaders(reason)
5998
6225
  });
5999
6226
  }
6000
6227
  async function kick(guild, userId, reason) {
6001
- await guild.client.rest.delete(Routes31.guildMember(guild.id, userId), {
6228
+ await guild.client.rest.delete(Routes32.guildMember(guild.id, userId), {
6002
6229
  auth: true,
6003
6230
  ...auditReasonHeaders(reason)
6004
6231
  });
6005
6232
  }
6006
6233
 
6007
6234
  // src/Domain/Guild/Roles.ts
6008
- import { Routes as Routes32 } from "@fluxerjs/types";
6235
+ import { Routes as Routes33 } from "@fluxerjs/types";
6009
6236
  import { parseRoleMention } from "@fluxerjs/util";
6010
6237
  async function createRole(guild, options = {}) {
6011
6238
  const body = toRoleCreateBody(options);
6012
- const data = await guild.client.rest.post(Routes32.guildRoles(guild.id), {
6239
+ const data = await guild.client.rest.post(Routes33.guildRoles(guild.id), {
6013
6240
  body: Object.keys(body).length ? body : void 0,
6014
6241
  auth: true,
6015
6242
  ...auditReasonHeaders(options.reason)
@@ -6017,14 +6244,14 @@ async function createRole(guild, options = {}) {
6017
6244
  return cacheRole(guild, data);
6018
6245
  }
6019
6246
  async function fetchRoles(guild) {
6020
- const data = await guild.client.rest.get(Routes32.guildRoles(guild.id));
6247
+ const data = await guild.client.rest.get(Routes33.guildRoles(guild.id));
6021
6248
  if (!Array.isArray(data))
6022
6249
  throw new TypeError("guild.fetchRoles() received an invalid API payload (expected an array)");
6023
6250
  return data.map((r) => cacheRole(guild, r));
6024
6251
  }
6025
6252
  async function fetchRole(guild, roleId2) {
6026
6253
  try {
6027
- const data = await guild.client.rest.get(Routes32.guildRole(guild.id, roleId2));
6254
+ const data = await guild.client.rest.get(Routes33.guildRole(guild.id, roleId2));
6028
6255
  return cacheRole(guild, data);
6029
6256
  } catch (err) {
6030
6257
  rethrowMapped(err, {
@@ -6041,7 +6268,7 @@ async function resolveRoleId(guild, arg) {
6041
6268
  const needle = trimmed.toLowerCase();
6042
6269
  const cached = guild.roles.find((r) => r.name?.toLowerCase() === needle);
6043
6270
  if (cached) return cached.id;
6044
- const roles = await guild.client.rest.get(Routes32.guildRoles(guild.id));
6271
+ const roles = await guild.client.rest.get(Routes33.guildRoles(guild.id));
6045
6272
  const role = roles.find((r) => r.name?.toLowerCase() === needle);
6046
6273
  if (!role) return null;
6047
6274
  cacheRole(guild, role);
@@ -6050,7 +6277,7 @@ async function resolveRoleId(guild, arg) {
6050
6277
  async function setRolePositions(guild, updates) {
6051
6278
  return replaceRoles(
6052
6279
  guild,
6053
- await guild.client.rest.patch(Routes32.guildRoles(guild.id), {
6280
+ await guild.client.rest.patch(Routes33.guildRoles(guild.id), {
6054
6281
  body: updates,
6055
6282
  auth: true
6056
6283
  })
@@ -6059,7 +6286,7 @@ async function setRolePositions(guild, updates) {
6059
6286
  async function setRoleHoistPositions(guild, updates) {
6060
6287
  return replaceRoles(
6061
6288
  guild,
6062
- await guild.client.rest.patch(Routes32.guildRolesHoistPositions(guild.id), {
6289
+ await guild.client.rest.patch(Routes33.guildRolesHoistPositions(guild.id), {
6063
6290
  body: updates.map((u) => ({
6064
6291
  id: u.id,
6065
6292
  ...u.hoistPosition !== void 0 ? { hoist_position: u.hoistPosition } : {}
@@ -6071,17 +6298,17 @@ async function setRoleHoistPositions(guild, updates) {
6071
6298
  async function resetRoleHoistPositions(guild) {
6072
6299
  return replaceRoles(
6073
6300
  guild,
6074
- await guild.client.rest.delete(Routes32.guildRolesHoistPositions(guild.id), {
6301
+ await guild.client.rest.delete(Routes33.guildRolesHoistPositions(guild.id), {
6075
6302
  auth: true
6076
6303
  })
6077
6304
  );
6078
6305
  }
6079
6306
 
6080
6307
  // src/Domain/Guild/Stickers.ts
6081
- import { Routes as Routes33 } from "@fluxerjs/types";
6308
+ import { Routes as Routes34 } from "@fluxerjs/types";
6082
6309
  async function createSticker(guild, options) {
6083
6310
  const { reason, ...body } = options;
6084
- const data = await guild.client.rest.post(Routes33.guildStickers(guild.id), {
6311
+ const data = await guild.client.rest.post(Routes34.guildStickers(guild.id), {
6085
6312
  body,
6086
6313
  auth: true,
6087
6314
  ...auditReasonHeaders(reason)
@@ -6089,7 +6316,7 @@ async function createSticker(guild, options) {
6089
6316
  return cacheSticker(guild, data);
6090
6317
  }
6091
6318
  async function cloneSticker(guild, sourceStickerId) {
6092
- const data = await guild.client.rest.post(Routes33.guildStickersClone(guild.id), {
6319
+ const data = await guild.client.rest.post(Routes34.guildStickersClone(guild.id), {
6093
6320
  body: { source_sticker_id: sourceStickerId },
6094
6321
  auth: true
6095
6322
  });
@@ -6097,17 +6324,17 @@ async function cloneSticker(guild, sourceStickerId) {
6097
6324
  }
6098
6325
  async function createStickersBulk(guild, stickers) {
6099
6326
  const data = await guild.client.rest.post(
6100
- Routes33.guildStickersBulk(guild.id),
6327
+ Routes34.guildStickersBulk(guild.id),
6101
6328
  { body: { stickers }, auth: true }
6102
6329
  );
6103
6330
  return { success: data.success.map((s) => cacheSticker(guild, s)), failed: data.failed };
6104
6331
  }
6105
6332
  async function fetchStickers(guild) {
6106
- const data = await guild.client.rest.get(Routes33.guildStickers(guild.id));
6333
+ const data = await guild.client.rest.get(Routes34.guildStickers(guild.id));
6107
6334
  return data.map((s) => cacheSticker(guild, s));
6108
6335
  }
6109
6336
  async function fetchSticker(guild, stickerId) {
6110
- const data = await guild.client.rest.get(Routes33.guildSticker(guild.id, stickerId));
6337
+ const data = await guild.client.rest.get(Routes34.guildSticker(guild.id, stickerId));
6111
6338
  return cacheSticker(guild, data);
6112
6339
  }
6113
6340
 
@@ -6196,6 +6423,10 @@ var Guild = class extends Base {
6196
6423
  emojis;
6197
6424
  /** Cached stickers in this guild. */
6198
6425
  stickers;
6426
+ /** Live stages in this guild's stage channels, keyed by stage instance ID. */
6427
+ stageInstances;
6428
+ /** Most participants a stage can have while speakers use video, or null if unknown. */
6429
+ maxStageVideoChannelUsers;
6199
6430
  /**
6200
6431
  * Construct a guild from API data.
6201
6432
  * @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE
@@ -6212,6 +6443,7 @@ var Guild = class extends Base {
6212
6443
  this.roles = new GuildRoleManager(this.id, { maxSize: client.cache.limits.roles });
6213
6444
  this.emojis = new LimitedCollection4({ maxSize: client.cache.limits.emojis });
6214
6445
  this.stickers = new LimitedCollection4({ maxSize: client.cache.limits.stickers });
6446
+ this.stageInstances = new Collection9();
6215
6447
  this.name = data.name ?? "";
6216
6448
  this.icon = data.icon ?? null;
6217
6449
  this.banner = data.banner ?? null;
@@ -6241,6 +6473,7 @@ var Guild = class extends Base {
6241
6473
  this.bannerHeight = data.banner_height ?? null;
6242
6474
  this.splashWidth = data.splash_width ?? null;
6243
6475
  this.splashHeight = data.splash_height ?? null;
6476
+ this.maxStageVideoChannelUsers = data.max_stage_video_channel_users ?? null;
6244
6477
  this.memberCount = resolveGuildMemberCount(data) ?? null;
6245
6478
  this.onlineCount = resolveGuildOnlineCount(data) ?? null;
6246
6479
  for (const r of data.roles ?? []) {
@@ -6297,6 +6530,9 @@ var Guild = class extends Base {
6297
6530
  if (data.banner_height !== void 0) this.bannerHeight = data.banner_height ?? null;
6298
6531
  if (data.splash_width !== void 0) this.splashWidth = data.splash_width ?? null;
6299
6532
  if (data.splash_height !== void 0) this.splashHeight = data.splash_height ?? null;
6533
+ if (data.max_stage_video_channel_users !== void 0) {
6534
+ this.maxStageVideoChannelUsers = data.max_stage_video_channel_users ?? null;
6535
+ }
6300
6536
  const memberCount = resolveGuildMemberCount(data);
6301
6537
  if (memberCount !== void 0) this.memberCount = memberCount;
6302
6538
  const onlineCount = resolveGuildOnlineCount(data);
@@ -6312,11 +6548,11 @@ var Guild = class extends Base {
6312
6548
  }
6313
6549
  /** Unix timestamp (ms) when this guild was created, derived from its snowflake ID. */
6314
6550
  get createdTimestamp() {
6315
- return SnowflakeUtil9.timestampFromSnowflake(this.id);
6551
+ return SnowflakeUtil10.timestampFromSnowflake(this.id);
6316
6552
  }
6317
6553
  /** Date when this guild was created, derived from its snowflake ID. */
6318
6554
  get createdAt() {
6319
- return SnowflakeUtil9.dateFromSnowflake(this.id);
6555
+ return SnowflakeUtil10.dateFromSnowflake(this.id);
6320
6556
  }
6321
6557
  /** The guild's name. */
6322
6558
  toString() {
@@ -6602,6 +6838,8 @@ function upsertGuildFromSnapshot(client, guildData, resources = {}) {
6602
6838
  if (resources.members !== void 0) mergeMembers(guild, resources.members);
6603
6839
  if (resources.emojis !== void 0) syncEmojis(guild, resources.emojis);
6604
6840
  if (resources.stickers !== void 0) syncStickers(guild, resources.stickers);
6841
+ if (resources.stageInstances !== void 0) syncStageInstances(guild, resources.stageInstances);
6842
+ if (resources.stageCounts !== void 0) applyStageCounts(guild, resources.stageCounts);
6605
6843
  if (resources.channels !== void 0) guild.partial = false;
6606
6844
  return { guild, created, recovered };
6607
6845
  }
@@ -6616,7 +6854,9 @@ function applyGuildSnapshotFromGateway(client, raw) {
6616
6854
  emojis: g.emojis,
6617
6855
  stickers: g.stickers,
6618
6856
  // A channel list without `threads` means this session has no viewable threads.
6619
- threads: g.channels !== void 0 ? g.threads ?? [] : g.threads
6857
+ threads: g.channels !== void 0 ? g.threads ?? [] : g.threads,
6858
+ stageInstances: g.stage_instances,
6859
+ stageCounts: g.stage_counts
6620
6860
  });
6621
6861
  if (g.voice_states?.length) {
6622
6862
  client.emit(Events.VoiceStatesSync, {
@@ -6628,7 +6868,7 @@ function applyGuildSnapshotFromGateway(client, raw) {
6628
6868
  }
6629
6869
 
6630
6870
  // src/ClientCore/ClientUser.ts
6631
- import { GatewayOpcodes, Routes as Routes34 } from "@fluxerjs/types";
6871
+ import { GatewayOpcodes, Routes as Routes35 } from "@fluxerjs/types";
6632
6872
  var ClientUser = class extends User {
6633
6873
  /** Broadcast presence (gateway opcode 3) on all shards. */
6634
6874
  setPresence(presence) {
@@ -6638,13 +6878,13 @@ var ClientUser = class extends User {
6638
6878
  }
6639
6879
  /** GET /users/@me — refresh the logged-in user from REST and patch this instance. */
6640
6880
  async fetch() {
6641
- const data = await this.client.rest.get(Routes34.currentUser(), { auth: true });
6881
+ const data = await this.client.rest.get(Routes35.currentUser(), { auth: true });
6642
6882
  this._patch(data);
6643
6883
  return this;
6644
6884
  }
6645
6885
  /** GET /users/@me/guilds — returns camelCase partial guilds. */
6646
6886
  async fetchGuilds(options) {
6647
- const path = Routes34.currentUserGuilds() + (options?.withCounts ? "?with_counts=true" : "");
6887
+ const path = Routes35.currentUserGuilds() + (options?.withCounts ? "?with_counts=true" : "");
6648
6888
  const data = await this.client.rest.get(path, { auth: true });
6649
6889
  return data.map((g) => ({
6650
6890
  id: g.id,
@@ -6668,7 +6908,7 @@ var ClientUser = class extends User {
6668
6908
  */
6669
6909
  async leaveGuild(guildId, options) {
6670
6910
  const body = options ? toSudoBody(options) : void 0;
6671
- await this.client.rest.delete(Routes34.leaveGuild(guildId), {
6911
+ await this.client.rest.delete(Routes35.leaveGuild(guildId), {
6672
6912
  body: body && Object.keys(body).length ? body : void 0,
6673
6913
  auth: true
6674
6914
  });
@@ -6676,7 +6916,7 @@ var ClientUser = class extends User {
6676
6916
  /** Delete every message authored by the caller across a guild (sudo). */
6677
6917
  async bulkDeleteMyMessagesInGuild(guildId, options) {
6678
6918
  const body = options ? toSudoBody(options) : void 0;
6679
- await this.client.rest.post(Routes34.guildBulkDeleteMine(guildId), {
6919
+ await this.client.rest.post(Routes35.guildBulkDeleteMine(guildId), {
6680
6920
  body: body && Object.keys(body).length ? body : void 0,
6681
6921
  auth: true
6682
6922
  });
@@ -7148,7 +7388,7 @@ var memberHandlers = {
7148
7388
  };
7149
7389
 
7150
7390
  // src/ClientCore/EventHandlers/Messages.ts
7151
- import { SnowflakeUtil as SnowflakeUtil10 } from "@fluxerjs/util";
7391
+ import { SnowflakeUtil as SnowflakeUtil11 } from "@fluxerjs/util";
7152
7392
  function cachedTextChannel(client, channelId) {
7153
7393
  const channel = client.channels.get(channelId);
7154
7394
  return channel?.isTextBased() ? channel : null;
@@ -7164,7 +7404,7 @@ function toPartialMessage(client, args) {
7164
7404
  const cached = args.cached;
7165
7405
  const authorId = args.authorId ?? cached?.author?.id ?? null;
7166
7406
  const author = cached?.author ? client.getOrCreateUser(cached.author) : authorId ? client.users.get(authorId) ?? null : null;
7167
- const createdAt = cached?.timestamp ? new Date(cached.timestamp) : SnowflakeUtil10.isValid(args.id) ? SnowflakeUtil10.dateFromSnowflake(args.id) : null;
7407
+ const createdAt = cached?.timestamp ? new Date(cached.timestamp) : SnowflakeUtil11.isValid(args.id) ? SnowflakeUtil11.dateFromSnowflake(args.id) : null;
7168
7408
  return new PartialMessage(client, {
7169
7409
  id: args.id,
7170
7410
  channelId: args.channelId,
@@ -7428,6 +7668,46 @@ var passthroughHandlers = {
7428
7668
  WEBAUTHN_CREDENTIALS_UPDATE: pass(Events.WebAuthnCredentialsUpdate)
7429
7669
  };
7430
7670
 
7671
+ // src/ClientCore/EventHandlers/Stages.ts
7672
+ var stageHandlers = {
7673
+ STAGE_INSTANCE_CREATE(client, d) {
7674
+ const instance = cacheStageInstance(client, d);
7675
+ client.emit(Events.StageInstanceCreate, instance);
7676
+ },
7677
+ STAGE_INSTANCE_UPDATE(client, d) {
7678
+ const data = d;
7679
+ const cached = client.guilds.get(data.guild_id)?.stageInstances.get(data.id);
7680
+ const old = cached ? new StageInstance(client, cached.toJSON()) : null;
7681
+ const instance = cacheStageInstance(client, data);
7682
+ client.emit(Events.StageInstanceUpdate, old, instance);
7683
+ },
7684
+ STAGE_INSTANCE_DELETE(client, d) {
7685
+ const data = d;
7686
+ const guild = client.guilds.get(data.guild_id);
7687
+ const instance = guild?.stageInstances.get(data.id) ?? new StageInstance(client, data);
7688
+ instance._patch(data);
7689
+ guild?.stageInstances.delete(data.id);
7690
+ client.emit(Events.StageInstanceDelete, instance);
7691
+ },
7692
+ STAGE_COUNTS_UPDATE(client, d) {
7693
+ const data = d;
7694
+ const channel = client.channels.get(data.channel_id);
7695
+ if (channel?.isStage()) channel._patchCounts(data);
7696
+ const payload = {
7697
+ guildId: data.guild_id,
7698
+ channelId: data.channel_id,
7699
+ listenerCount: data.listener_count,
7700
+ speakerCount: data.speaker_count,
7701
+ requestCount: data.request_count,
7702
+ videoEnabled: data.video_enabled ?? null
7703
+ };
7704
+ client.emit(Events.StageCountsUpdate, payload);
7705
+ },
7706
+ STAGE_VOICE_STATES_SYNC: pass(Events.StageVoiceStatesSync),
7707
+ STAGE_AUDIENCE_LIST_UPDATE: pass(Events.StageAudienceListUpdate),
7708
+ VOICE_JOIN_QUEUED: pass(Events.VoiceJoinQueued)
7709
+ };
7710
+
7431
7711
  // src/ClientCore/EventHandlers/Threads.ts
7432
7712
  function cachedChannel(client, id) {
7433
7713
  const direct = client.channels.get(id);
@@ -7538,7 +7818,8 @@ var eventHandlers = buildRegistry(
7538
7818
  inviteHandlers,
7539
7819
  guildResourceHandlers,
7540
7820
  passthroughHandlers,
7541
- threadHandlers
7821
+ threadHandlers,
7822
+ stageHandlers
7542
7823
  );
7543
7824
 
7544
7825
  // src/ClientCore/GatewayDispatch.ts
@@ -7798,7 +8079,7 @@ async function connectClientGateway(client, token, signal) {
7798
8079
 
7799
8080
  // src/ClientCore/GuildManager.ts
7800
8081
  import { LimitedCollection as LimitedCollection5 } from "@fluxerjs/collection";
7801
- import { Routes as Routes35 } from "@fluxerjs/types";
8082
+ import { Routes as Routes36 } from "@fluxerjs/types";
7802
8083
  var GuildManager = class extends LimitedCollection5 {
7803
8084
  constructor(client) {
7804
8085
  super({
@@ -7858,7 +8139,7 @@ var GuildManager = class extends LimitedCollection5 {
7858
8139
  return dedupeFetch(this.pendingFetches, id, async () => {
7859
8140
  try {
7860
8141
  const data = assertApiObjectWithId(
7861
- await this.client.rest.get(Routes35.guild(id)),
8142
+ await this.client.rest.get(Routes36.guild(id)),
7862
8143
  "guilds.fetch()"
7863
8144
  );
7864
8145
  let guild;
@@ -7968,7 +8249,7 @@ var MessageCache = class {
7968
8249
  // src/ClientCore/UserManager.ts
7969
8250
  import { LimitedCollection as LimitedCollection6 } from "@fluxerjs/collection";
7970
8251
  import {
7971
- Routes as Routes36
8252
+ Routes as Routes37
7972
8253
  } from "@fluxerjs/types";
7973
8254
  var soft = (p) => p.catch(() => null);
7974
8255
  var UserManager = class extends LimitedCollection6 {
@@ -8003,7 +8284,7 @@ var UserManager = class extends LimitedCollection6 {
8003
8284
  id,
8004
8285
  async () => this.client.getOrCreateUser(
8005
8286
  assertApiObjectWithId(
8006
- await this.client.rest.get(Routes36.user(id)),
8287
+ await this.client.rest.get(Routes37.user(id)),
8007
8288
  "users.fetch()"
8008
8289
  )
8009
8290
  )
@@ -8026,10 +8307,10 @@ var UserManager = class extends LimitedCollection6 {
8026
8307
  async fetchWithProfile(userId, options) {
8027
8308
  const guildId = options?.guildId ?? void 0;
8028
8309
  const [userData, globalProfileRaw, serverProfileRaw, memberData] = await Promise.all([
8029
- this.client.rest.get(Routes36.user(userId)),
8030
- soft(this.client.rest.get(Routes36.userProfile(userId))),
8031
- guildId ? soft(this.client.rest.get(Routes36.userProfile(userId, guildId))) : null,
8032
- guildId ? soft(this.client.rest.get(Routes36.guildMember(guildId, userId))) : null
8310
+ this.client.rest.get(Routes37.user(userId)),
8311
+ soft(this.client.rest.get(Routes37.userProfile(userId))),
8312
+ guildId ? soft(this.client.rest.get(Routes37.userProfile(userId, guildId))) : null,
8313
+ guildId ? soft(this.client.rest.get(Routes37.guildMember(guildId, userId))) : null
8033
8314
  ]);
8034
8315
  const user = this.client.getOrCreateUser(userData);
8035
8316
  let member = null;
@@ -8612,7 +8893,7 @@ var Client = class _Client extends EventEmitter3 {
8612
8893
  * @see {@link Routes}
8613
8894
  */
8614
8895
  static get Routes() {
8615
- return Routes37;
8896
+ return Routes38;
8616
8897
  }
8617
8898
  };
8618
8899