@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.js CHANGED
@@ -91,6 +91,13 @@ var Events = {
91
91
  VoiceSignal: "voiceSignal",
92
92
  OperatorPassUpdate: "operatorPassUpdate",
93
93
  VoiceStatesSync: "voiceStatesSync",
94
+ VoiceJoinQueued: "voiceJoinQueued",
95
+ StageInstanceCreate: "stageInstanceCreate",
96
+ StageInstanceUpdate: "stageInstanceUpdate",
97
+ StageInstanceDelete: "stageInstanceDelete",
98
+ StageCountsUpdate: "stageCountsUpdate",
99
+ StageVoiceStatesSync: "stageVoiceStatesSync",
100
+ StageAudienceListUpdate: "stageAudienceListUpdate",
94
101
  WebhooksUpdate: "webhooksUpdate",
95
102
  Resumed: "resumed",
96
103
  Error: "error",
@@ -112,8 +119,8 @@ var import_util2 = require("@fluxerjs/util");
112
119
  // src/ClientCore/Client.ts
113
120
  var import_node_events3 = require("events");
114
121
  var import_rest3 = require("@fluxerjs/rest");
115
- var import_types45 = require("@fluxerjs/types");
116
- var import_util26 = require("@fluxerjs/util");
122
+ var import_types46 = require("@fluxerjs/types");
123
+ var import_util27 = require("@fluxerjs/util");
117
124
 
118
125
  // src/Domain/Message/Message.ts
119
126
  var import_builders3 = require("@fluxerjs/builders");
@@ -1571,11 +1578,11 @@ var Channel = class extends Base {
1571
1578
  * Checks {@link ChannelType}, not whether `send` exists on the instance.
1572
1579
  */
1573
1580
  isTextBased() {
1574
- return this.type === import_types7.ChannelType.GuildText || this.type === import_types7.ChannelType.GuildAnnouncement || this.type === import_types7.ChannelType.GuildVoice || this.type === import_types7.ChannelType.DM || this.type === import_types7.ChannelType.GroupDM || this.type === import_types7.ChannelType.DMPersonalNotes || this.type === import_types7.ChannelType.AnnouncementThread || this.type === import_types7.ChannelType.PublicThread || this.type === import_types7.ChannelType.PrivateThread;
1581
+ return this.type === import_types7.ChannelType.GuildText || this.type === import_types7.ChannelType.GuildAnnouncement || this.type === import_types7.ChannelType.GuildVoice || this.type === import_types7.ChannelType.GuildStageVoice || this.type === import_types7.ChannelType.DM || this.type === import_types7.ChannelType.GroupDM || this.type === import_types7.ChannelType.DMPersonalNotes || this.type === import_types7.ChannelType.AnnouncementThread || this.type === import_types7.ChannelType.PublicThread || this.type === import_types7.ChannelType.PrivateThread;
1575
1582
  }
1576
1583
  /** Check if this is a guild channel, including threads, forums, and media channels. */
1577
1584
  isGuild() {
1578
- return this.type === import_types7.ChannelType.GuildText || this.type === import_types7.ChannelType.GuildAnnouncement || this.type === import_types7.ChannelType.GuildVoice || this.type === import_types7.ChannelType.GuildCategory || this.type === import_types7.ChannelType.GuildLink || this.type === import_types7.ChannelType.AnnouncementThread || this.type === import_types7.ChannelType.PublicThread || this.type === import_types7.ChannelType.PrivateThread || this.type === import_types7.ChannelType.GuildForum || this.type === import_types7.ChannelType.GuildMedia;
1585
+ return this.type === import_types7.ChannelType.GuildText || this.type === import_types7.ChannelType.GuildAnnouncement || this.type === import_types7.ChannelType.GuildVoice || this.type === import_types7.ChannelType.GuildStageVoice || this.type === import_types7.ChannelType.GuildCategory || this.type === import_types7.ChannelType.GuildLink || this.type === import_types7.ChannelType.AnnouncementThread || this.type === import_types7.ChannelType.PublicThread || this.type === import_types7.ChannelType.PrivateThread || this.type === import_types7.ChannelType.GuildForum || this.type === import_types7.ChannelType.GuildMedia;
1579
1586
  }
1580
1587
  /** Check if this is a thread (public, private, or announcement). */
1581
1588
  isThread() {
@@ -1609,10 +1616,18 @@ var Channel = class extends Base {
1609
1616
  isPersonalNotes() {
1610
1617
  return this.type === import_types7.ChannelType.DMPersonalNotes;
1611
1618
  }
1612
- /** Check if this is a voice channel. */
1619
+ /** Check if this is a voice channel (type 2 only; see {@link isVoiceBased} to include stages). */
1613
1620
  isVoice() {
1614
1621
  return this.type === import_types7.ChannelType.GuildVoice;
1615
1622
  }
1623
+ /** Check if this is a stage channel (type 13). */
1624
+ isStage() {
1625
+ return this.type === import_types7.ChannelType.GuildStageVoice;
1626
+ }
1627
+ /** Check if this is a voice or stage channel, i.e. one `@fluxerjs/voice` can join. */
1628
+ isVoiceBased() {
1629
+ return this.type === import_types7.ChannelType.GuildVoice || this.type === import_types7.ChannelType.GuildStageVoice;
1630
+ }
1616
1631
  /** Check if this is a link channel. */
1617
1632
  isLink() {
1618
1633
  return this.type === import_types7.ChannelType.GuildLink;
@@ -2623,8 +2638,8 @@ var PartialMessage = class {
2623
2638
  };
2624
2639
 
2625
2640
  // src/Domain/User.ts
2626
- var import_types21 = require("@fluxerjs/types");
2627
- var import_util14 = require("@fluxerjs/util");
2641
+ var import_types22 = require("@fluxerjs/types");
2642
+ var import_util15 = require("@fluxerjs/util");
2628
2643
 
2629
2644
  // src/Domain/Channel/Dm.ts
2630
2645
  var import_types12 = require("@fluxerjs/types");
@@ -2763,11 +2778,11 @@ var DMChannel = class extends TextCapable(Channel) {
2763
2778
  };
2764
2779
 
2765
2780
  // src/Domain/Channel/Forum.ts
2766
- var import_types19 = require("@fluxerjs/types");
2781
+ var import_types20 = require("@fluxerjs/types");
2767
2782
 
2768
2783
  // src/Domain/Channel/Guild.ts
2769
- var import_types16 = require("@fluxerjs/types");
2770
- var import_util13 = require("@fluxerjs/util");
2784
+ var import_types17 = require("@fluxerjs/types");
2785
+ var import_util14 = require("@fluxerjs/util");
2771
2786
 
2772
2787
  // src/Domain/Invite.ts
2773
2788
  var import_types13 = require("@fluxerjs/types");
@@ -3357,6 +3372,127 @@ var PermissionOverwriteManager = class {
3357
3372
  }
3358
3373
  };
3359
3374
 
3375
+ // src/Domain/StageInstance.ts
3376
+ var import_types16 = require("@fluxerjs/types");
3377
+ var import_util13 = require("@fluxerjs/util");
3378
+ var StageInstance = class extends Base {
3379
+ client;
3380
+ id;
3381
+ guildId;
3382
+ channelId;
3383
+ topic;
3384
+ /** Always {@link StageInstancePrivacyLevel.GuildOnly} on Fluxer. */
3385
+ privacyLevel;
3386
+ /** Always `true` on Fluxer. */
3387
+ discoverableDisabled;
3388
+ /** Always null on Fluxer. */
3389
+ guildScheduledEventId;
3390
+ constructor(client, data) {
3391
+ super();
3392
+ this.client = client;
3393
+ this.id = data.id;
3394
+ this.guildId = data.guild_id;
3395
+ this.channelId = data.channel_id;
3396
+ this.topic = data.topic;
3397
+ this.privacyLevel = data.privacy_level ?? import_types16.StageInstancePrivacyLevel.GuildOnly;
3398
+ this.discoverableDisabled = data.discoverable_disabled ?? true;
3399
+ this.guildScheduledEventId = data.guild_scheduled_event_id ?? null;
3400
+ }
3401
+ /** @internal Patch in place from a newer payload. */
3402
+ _patch(data) {
3403
+ if (data.topic !== void 0) this.topic = data.topic;
3404
+ if (data.privacy_level !== void 0) this.privacyLevel = data.privacy_level;
3405
+ if (data.discoverable_disabled !== void 0) {
3406
+ this.discoverableDisabled = data.discoverable_disabled;
3407
+ }
3408
+ if (data.guild_scheduled_event_id !== void 0) {
3409
+ this.guildScheduledEventId = data.guild_scheduled_event_id ?? null;
3410
+ }
3411
+ }
3412
+ get guild() {
3413
+ return this.client.guilds.get(this.guildId) ?? null;
3414
+ }
3415
+ get channel() {
3416
+ const channel = this.client.channels.get(this.channelId);
3417
+ return channel?.isStage() ? channel : null;
3418
+ }
3419
+ /** Unix timestamp (ms) when the stage started, from its snowflake ID. */
3420
+ get createdTimestamp() {
3421
+ return import_util13.SnowflakeUtil.timestampFromSnowflake(this.id);
3422
+ }
3423
+ get createdAt() {
3424
+ return import_util13.SnowflakeUtil.dateFromSnowflake(this.id);
3425
+ }
3426
+ /**
3427
+ * Change the live stage. Needs a stage moderator.
3428
+ * Fires `STAGE_INSTANCE_UPDATE`.
3429
+ */
3430
+ async edit(options) {
3431
+ const body = {};
3432
+ if (options.topic !== void 0) body.topic = options.topic;
3433
+ const data = await this.client.rest.patch(
3434
+ import_types16.Routes.stageInstance(this.channelId),
3435
+ { body, auth: true, ...auditReasonHeaders(options.reason) }
3436
+ );
3437
+ this._patch(data);
3438
+ return this;
3439
+ }
3440
+ /** Change the stage topic. Shorthand for {@link edit}. */
3441
+ async setTopic(topic, reason) {
3442
+ return this.edit({ topic, reason });
3443
+ }
3444
+ /**
3445
+ * End the stage. Needs a stage moderator. Speakers move to the audience, raised hands are
3446
+ * lowered, and everyone stays connected unless `disconnectAll` is set.
3447
+ */
3448
+ async delete(options = {}) {
3449
+ const route = import_types16.Routes.stageInstance(this.channelId) + (options.disconnectAll ? "?disconnect_all=true" : "");
3450
+ await this.client.rest.delete(route, { auth: true, ...auditReasonHeaders(options.reason) });
3451
+ }
3452
+ toJSON() {
3453
+ return {
3454
+ id: this.id,
3455
+ guild_id: this.guildId,
3456
+ channel_id: this.channelId,
3457
+ topic: this.topic,
3458
+ privacy_level: this.privacyLevel,
3459
+ discoverable_disabled: this.discoverableDisabled,
3460
+ guild_scheduled_event_id: this.guildScheduledEventId
3461
+ };
3462
+ }
3463
+ };
3464
+
3465
+ // src/Domain/Channel/StageSync.ts
3466
+ function syncStageInstances(guild, instances) {
3467
+ const seen = /* @__PURE__ */ new Set();
3468
+ for (const data of instances) {
3469
+ seen.add(data.id);
3470
+ const existing = guild.stageInstances.get(data.id);
3471
+ if (existing) existing._patch(data);
3472
+ else guild.stageInstances.set(data.id, new StageInstance(guild.client, data));
3473
+ }
3474
+ for (const id of [...guild.stageInstances.keys()]) {
3475
+ if (!seen.has(id)) guild.stageInstances.delete(id);
3476
+ }
3477
+ }
3478
+ function applyStageCounts(guild, counts) {
3479
+ for (const count of counts) {
3480
+ const channel = guild.channels.get(count.channel_id);
3481
+ if (channel?.isStage()) channel._patchCounts(count);
3482
+ }
3483
+ }
3484
+ function cacheStageInstance(client, data) {
3485
+ const guild = client.guilds.get(data.guild_id);
3486
+ const existing = guild?.stageInstances.get(data.id);
3487
+ if (existing) {
3488
+ existing._patch(data);
3489
+ return existing;
3490
+ }
3491
+ const instance = new StageInstance(client, data);
3492
+ guild?.stageInstances.set(instance.id, instance);
3493
+ return instance;
3494
+ }
3495
+
3360
3496
  // src/Domain/Channel/ThreadBind.ts
3361
3497
  var factory;
3362
3498
  var managers = /* @__PURE__ */ new WeakMap();
@@ -3411,7 +3547,7 @@ var GuildChannel = class extends Channel {
3411
3547
  }
3412
3548
  /** Create a webhook for this channel. Requires Manage Webhooks. */
3413
3549
  async createWebhook(options) {
3414
- const data = await this.client.rest.post(import_types16.Routes.channelWebhooks(this.id), {
3550
+ const data = await this.client.rest.post(import_types17.Routes.channelWebhooks(this.id), {
3415
3551
  body: options,
3416
3552
  auth: true
3417
3553
  });
@@ -3419,13 +3555,13 @@ var GuildChannel = class extends Channel {
3419
3555
  }
3420
3556
  /** Fetch all webhooks in this channel. Requires Manage Webhooks. */
3421
3557
  async fetchWebhooks() {
3422
- const data = await this.client.rest.get(import_types16.Routes.channelWebhooks(this.id));
3558
+ const data = await this.client.rest.get(import_types17.Routes.channelWebhooks(this.id));
3423
3559
  return data.map((w) => new Webhook(this.client, w));
3424
3560
  }
3425
3561
  /** Create an invite for this channel. Requires Create Instant Invite. */
3426
3562
  async createInvite(options) {
3427
3563
  const body = options ? toChannelInviteBody(options) : {};
3428
- const data = await this.client.rest.post(import_types16.Routes.channelInvites(this.id), {
3564
+ const data = await this.client.rest.post(import_types17.Routes.channelInvites(this.id), {
3429
3565
  body: Object.keys(body).length ? body : void 0,
3430
3566
  auth: true
3431
3567
  });
@@ -3433,7 +3569,7 @@ var GuildChannel = class extends Channel {
3433
3569
  }
3434
3570
  /** Fetch all invites for this channel. Requires Manage Channels. */
3435
3571
  async fetchInvites() {
3436
- const data = await this.client.rest.get(import_types16.Routes.channelInvites(this.id));
3572
+ const data = await this.client.rest.get(import_types17.Routes.channelInvites(this.id));
3437
3573
  return data.map((i) => new Invite(this.client, i));
3438
3574
  }
3439
3575
  /** Check if the bot can send messages in this channel (cache-only; needs `members.me`). */
@@ -3442,7 +3578,7 @@ var GuildChannel = class extends Channel {
3442
3578
  const me = this.client.guilds.get(this.guildId)?.members.me;
3443
3579
  if (!me) return false;
3444
3580
  const perms = me.permissionsIn(this);
3445
- return perms.has(import_util13.PermissionFlags.ViewChannel) && perms.has(import_util13.PermissionFlags.SendMessages);
3581
+ return perms.has(import_util14.PermissionFlags.ViewChannel) && perms.has(import_util14.PermissionFlags.SendMessages);
3446
3582
  }
3447
3583
  /**
3448
3584
  * Like {@link canSendMessage}, but hydrates `members.me` via REST when missing.
@@ -3463,7 +3599,7 @@ var GuildChannel = class extends Channel {
3463
3599
  }
3464
3600
  /** Edit this channel's settings. Requires Manage Channels. */
3465
3601
  async edit(options) {
3466
- const data = await this.client.rest.patch(import_types16.Routes.channel(this.id), {
3602
+ const data = await this.client.rest.patch(import_types17.Routes.channel(this.id), {
3467
3603
  body: toChannelEditBody(options),
3468
3604
  auth: true,
3469
3605
  ...auditReasonHeaders(options.reason)
@@ -3545,7 +3681,7 @@ var TextChannel = class extends TextCapable(GuildChannel) {
3545
3681
  * Sends only those fields. The thread-parent update body does not accept a channel rename.
3546
3682
  */
3547
3683
  async editThreadDefaults(options) {
3548
- const data = await this.client.rest.patch(import_types16.Routes.channel(this.id), {
3684
+ const data = await this.client.rest.patch(import_types17.Routes.channel(this.id), {
3549
3685
  body: toThreadParentEditBody(options),
3550
3686
  auth: true,
3551
3687
  ...auditReasonHeaders(options.reason)
@@ -3561,14 +3697,14 @@ var AnnouncementChannel = class extends TextChannel {
3561
3697
  */
3562
3698
  async follow(webhookChannelId) {
3563
3699
  return this.client.rest.post(
3564
- import_types16.Routes.channelFollowers(this.id),
3700
+ import_types17.Routes.channelFollowers(this.id),
3565
3701
  { body: { webhook_channel_id: webhookChannelId }, auth: true }
3566
3702
  );
3567
3703
  }
3568
3704
  /** Fetch follower counts for this announcement channel. */
3569
3705
  async fetchFollowerStats() {
3570
3706
  return this.client.rest.get(
3571
- import_types16.Routes.channelFollowerStats(this.id),
3707
+ import_types17.Routes.channelFollowerStats(this.id),
3572
3708
  { auth: true }
3573
3709
  );
3574
3710
  }
@@ -3643,6 +3779,96 @@ var VoiceChannel = class extends TextCapable(GuildChannel) {
3643
3779
  if ("rtc_p2p" in data) this.rtcP2p = data.rtc_p2p ?? false;
3644
3780
  }
3645
3781
  };
3782
+ var StageChannel = class extends VoiceChannel {
3783
+ /** Last known stage counts, or null until Fluxer sends them. */
3784
+ counts = null;
3785
+ /** The cached live stage of this channel, or null when the stage isn't live (or not cached). */
3786
+ get stageInstance() {
3787
+ const guild = this.client.guilds.get(this.guildId);
3788
+ if (!guild) return null;
3789
+ for (const instance of guild.stageInstances.values()) {
3790
+ if (instance.channelId === this.id) return instance;
3791
+ }
3792
+ return null;
3793
+ }
3794
+ /** Whether the stage is live according to the cache. */
3795
+ get isLive() {
3796
+ return this.stageInstance !== null;
3797
+ }
3798
+ /**
3799
+ * Start a stage in this channel. Needs a stage moderator (`MANAGE_CHANNELS`, `MUTE_MEMBERS` and
3800
+ * `MOVE_MEMBERS`). When the caller is connected to the stage, they become a speaker.
3801
+ */
3802
+ async createStageInstance(options) {
3803
+ const body = { channel_id: this.id, topic: options.topic };
3804
+ if (options.sendStartNotification !== void 0) {
3805
+ body.send_start_notification = options.sendStartNotification;
3806
+ }
3807
+ const data = await this.client.rest.post(import_types17.Routes.stageInstances(), {
3808
+ body,
3809
+ auth: true,
3810
+ ...auditReasonHeaders(options.reason)
3811
+ });
3812
+ return cacheStageInstance(this.client, data);
3813
+ }
3814
+ /** Fetch the live stage of this channel. Rejects with `UNKNOWN_STAGE_INSTANCE` when not live. */
3815
+ async fetchStageInstance() {
3816
+ const data = await this.client.rest.get(import_types17.Routes.stageInstance(this.id), {
3817
+ auth: true
3818
+ });
3819
+ return cacheStageInstance(this.client, data);
3820
+ }
3821
+ /**
3822
+ * Move a member (or yourself when `user` is omitted) between the audience and the speakers.
3823
+ *
3824
+ * - Yourself, `false`: become a speaker (needs `MUTE_MEMBERS`), or accept an open invite.
3825
+ * - Yourself, `true`: move to the audience, or decline an invite.
3826
+ * - Another member, `false`: invite them to speak (a bot becomes a speaker at once). Needs `MUTE_MEMBERS`.
3827
+ * - Another member, `true`: move them to the audience and clear a raised hand or invite.
3828
+ */
3829
+ async setSuppressed(suppressed, user) {
3830
+ const userId = user === void 0 ? "@me" : typeof user === "string" ? user : user.id;
3831
+ const body = {
3832
+ channel_id: this.id,
3833
+ suppress: suppressed
3834
+ };
3835
+ await this.client.rest.patch(import_types17.Routes.guildVoiceState(this.guildId, userId), {
3836
+ body,
3837
+ auth: true
3838
+ });
3839
+ }
3840
+ /** Invite a member to speak (a bot becomes a speaker at once). Needs `MUTE_MEMBERS`. */
3841
+ async inviteToSpeak(user) {
3842
+ await this.setSuppressed(false, user);
3843
+ }
3844
+ /** Move a speaker (or yourself when `user` is omitted) to the audience. */
3845
+ async moveToAudience(user) {
3846
+ await this.setSuppressed(true, user);
3847
+ }
3848
+ /**
3849
+ * Raise (`true`) or lower (`false`) your hand. Raising needs a live stage and
3850
+ * `REQUEST_TO_SPEAK`; lowering also accepts an open invite to speak.
3851
+ */
3852
+ async setRequestToSpeak(raised = true) {
3853
+ const body = {
3854
+ channel_id: this.id,
3855
+ request_to_speak_timestamp: raised ? (/* @__PURE__ */ new Date()).toISOString() : null
3856
+ };
3857
+ await this.client.rest.patch(import_types17.Routes.guildVoiceState(this.guildId, "@me"), {
3858
+ body,
3859
+ auth: true
3860
+ });
3861
+ }
3862
+ /** @internal Apply a stage count object. */
3863
+ _patchCounts(data) {
3864
+ this.counts = {
3865
+ listenerCount: data.listener_count,
3866
+ speakerCount: data.speaker_count,
3867
+ requestCount: data.request_count,
3868
+ videoEnabled: data.video_enabled ?? null
3869
+ };
3870
+ }
3871
+ };
3646
3872
  var LinkChannel = class extends GuildChannel {
3647
3873
  /** External URL this channel links to. */
3648
3874
  url;
@@ -3656,10 +3882,10 @@ var LinkChannel = class extends GuildChannel {
3656
3882
  };
3657
3883
 
3658
3884
  // src/Domain/Channel/ThreadManager.ts
3659
- var import_types18 = require("@fluxerjs/types");
3885
+ var import_types19 = require("@fluxerjs/types");
3660
3886
 
3661
3887
  // src/Domain/Channel/ThreadChannel.ts
3662
- var import_types17 = require("@fluxerjs/types");
3888
+ var import_types18 = require("@fluxerjs/types");
3663
3889
  var ThreadMember = class {
3664
3890
  /** Thread ID. */
3665
3891
  id;
@@ -3786,7 +4012,7 @@ var ThreadChannel = class extends TextCapable(GuildChannel) {
3786
4012
  * `appliedTags` is sent for public and announcement threads. `invitable` is sent for private threads.
3787
4013
  */
3788
4014
  async edit(options) {
3789
- const data = await this.client.rest.patch(import_types17.Routes.channel(this.id), {
4015
+ const data = await this.client.rest.patch(import_types18.Routes.channel(this.id), {
3790
4016
  body: toThreadEditBody(this.type, threadEditFields(options)),
3791
4017
  auth: true,
3792
4018
  ...auditReasonHeaders(options.reason)
@@ -3804,16 +4030,16 @@ var ThreadChannel = class extends TextCapable(GuildChannel) {
3804
4030
  }
3805
4031
  /** Join this thread. */
3806
4032
  async join() {
3807
- await this.client.rest.put(import_types17.Routes.channelThreadMemberMe(this.id), { auth: true });
4033
+ await this.client.rest.put(import_types18.Routes.channelThreadMemberMe(this.id), { auth: true });
3808
4034
  }
3809
4035
  /** Leave this thread. */
3810
4036
  async leave() {
3811
- await this.client.rest.delete(import_types17.Routes.channelThreadMemberMe(this.id), { auth: true });
4037
+ await this.client.rest.delete(import_types18.Routes.channelThreadMemberMe(this.id), { auth: true });
3812
4038
  }
3813
4039
  /** Update the current user's notification settings for this thread. */
3814
4040
  async editSelf(options) {
3815
4041
  const data = await this.client.rest.patch(
3816
- import_types17.Routes.channelThreadMemberMeSettings(this.id),
4042
+ import_types18.Routes.channelThreadMemberMeSettings(this.id),
3817
4043
  { body: toThreadMemberSettingsBody(options), auth: true }
3818
4044
  );
3819
4045
  this.member = data ? new ThreadMember(data) : null;
@@ -3827,7 +4053,7 @@ var ThreadMemberManager = class {
3827
4053
  /** List members of this thread. */
3828
4054
  async fetch(options) {
3829
4055
  const data = await this.thread.client.rest.get(
3830
- withQuery(import_types17.Routes.channelThreadMembers(this.thread.id), {
4056
+ withQuery(import_types18.Routes.channelThreadMembers(this.thread.id), {
3831
4057
  with_member: options?.withMember === void 0 ? void 0 : String(options.withMember),
3832
4058
  after: options?.after,
3833
4059
  limit: options?.limit
@@ -3838,7 +4064,7 @@ var ThreadMemberManager = class {
3838
4064
  /** Fetch one member of this thread. */
3839
4065
  async fetchOne(userId, options) {
3840
4066
  const data = await this.thread.client.rest.get(
3841
- withQuery(import_types17.Routes.channelThreadMember(this.thread.id, userId), {
4067
+ withQuery(import_types18.Routes.channelThreadMember(this.thread.id, userId), {
3842
4068
  with_member: options?.withMember === void 0 ? void 0 : String(options.withMember)
3843
4069
  })
3844
4070
  );
@@ -3846,19 +4072,19 @@ var ThreadMemberManager = class {
3846
4072
  }
3847
4073
  /** Add a user to this thread. Private threads only, unless the caller can manage the parent. */
3848
4074
  async add(userId) {
3849
- await this.thread.client.rest.put(import_types17.Routes.channelThreadMember(this.thread.id, userId), {
4075
+ await this.thread.client.rest.put(import_types18.Routes.channelThreadMember(this.thread.id, userId), {
3850
4076
  auth: true
3851
4077
  });
3852
4078
  }
3853
4079
  /** Remove a user from this thread. */
3854
4080
  async remove(userId) {
3855
- await this.thread.client.rest.delete(import_types17.Routes.channelThreadMember(this.thread.id, userId), {
4081
+ await this.thread.client.rest.delete(import_types18.Routes.channelThreadMember(this.thread.id, userId), {
3856
4082
  auth: true
3857
4083
  });
3858
4084
  }
3859
4085
  };
3860
4086
  function isThreadType(type) {
3861
- return type === import_types17.ChannelType.AnnouncementThread || type === import_types17.ChannelType.PublicThread || type === import_types17.ChannelType.PrivateThread;
4087
+ return type === import_types18.ChannelType.AnnouncementThread || type === import_types18.ChannelType.PublicThread || type === import_types18.ChannelType.PrivateThread;
3862
4088
  }
3863
4089
 
3864
4090
  // src/Domain/Channel/ThreadManager.ts
@@ -3871,13 +4097,13 @@ var ThreadManager = class {
3871
4097
  * Forum and media channels must use {@link createPost}.
3872
4098
  */
3873
4099
  async create(options) {
3874
- if (this.channel.type === import_types18.ChannelType.GuildForum || this.channel.type === import_types18.ChannelType.GuildMedia) {
4100
+ if (this.channel.type === import_types19.ChannelType.GuildForum || this.channel.type === import_types19.ChannelType.GuildMedia) {
3875
4101
  throw new import_util2.FluxerError("Forum and media channels start posts with createPost", {
3876
4102
  code: import_util.ErrorCodes.InvalidChannelType
3877
4103
  });
3878
4104
  }
3879
4105
  const data = await this.channel.client.rest.post(
3880
- import_types18.Routes.channelThreads(this.channel.id),
4106
+ import_types19.Routes.channelThreads(this.channel.id),
3881
4107
  {
3882
4108
  body: toStartThreadBody(this.channel.type, options),
3883
4109
  auth: true,
@@ -3891,7 +4117,7 @@ var ThreadManager = class {
3891
4117
  * The post is a public thread. `message` is its first message.
3892
4118
  */
3893
4119
  async createPost(options) {
3894
- if (this.channel.type !== import_types18.ChannelType.GuildForum && this.channel.type !== import_types18.ChannelType.GuildMedia) {
4120
+ if (this.channel.type !== import_types19.ChannelType.GuildForum && this.channel.type !== import_types19.ChannelType.GuildMedia) {
3895
4121
  throw new import_util2.FluxerError("createPost is for forum and media channels", {
3896
4122
  code: import_util.ErrorCodes.InvalidChannelType
3897
4123
  });
@@ -3901,7 +4127,7 @@ var ThreadManager = class {
3901
4127
  });
3902
4128
  const body = {
3903
4129
  name: options.name,
3904
- type: import_types18.ChannelType.PublicThread,
4130
+ type: import_types19.ChannelType.PublicThread,
3905
4131
  message: toForumThreadMessage(prepared.body)
3906
4132
  };
3907
4133
  if (options.autoArchiveDuration !== void 0) {
@@ -3910,7 +4136,7 @@ var ThreadManager = class {
3910
4136
  if (options.rateLimitPerUser !== void 0) body.rate_limit_per_user = options.rateLimitPerUser;
3911
4137
  if (options.appliedTags !== void 0) body.applied_tags = options.appliedTags;
3912
4138
  const data = await this.channel.client.rest.post(
3913
- import_types18.Routes.channelThreads(this.channel.id),
4139
+ import_types19.Routes.channelThreads(this.channel.id),
3914
4140
  {
3915
4141
  body,
3916
4142
  files: prepared.files,
@@ -3929,7 +4155,7 @@ var ThreadManager = class {
3929
4155
  * `before` is an ISO-8601 archive timestamp.
3930
4156
  */
3931
4157
  async fetchArchived(options) {
3932
- const path = options.type === "private" ? import_types18.Routes.channelThreadsArchivedPrivate(this.channel.id) : import_types18.Routes.channelThreadsArchivedPublic(this.channel.id);
4158
+ const path = options.type === "private" ? import_types19.Routes.channelThreadsArchivedPrivate(this.channel.id) : import_types19.Routes.channelThreadsArchivedPublic(this.channel.id);
3933
4159
  const data = await this.channel.client.rest.get(
3934
4160
  withQuery(path, { before: options.before, limit: options.limit })
3935
4161
  );
@@ -3941,7 +4167,7 @@ var ThreadManager = class {
3941
4167
  */
3942
4168
  async fetchJoinedPrivateArchived(options) {
3943
4169
  const data = await this.channel.client.rest.get(
3944
- withQuery(import_types18.Routes.channelJoinedArchivedPrivateThreads(this.channel.id), {
4170
+ withQuery(import_types19.Routes.channelJoinedArchivedPrivateThreads(this.channel.id), {
3945
4171
  before: options?.before,
3946
4172
  limit: options?.limit
3947
4173
  })
@@ -3954,7 +4180,7 @@ var ThreadManager = class {
3954
4180
  */
3955
4181
  async search(options) {
3956
4182
  const data = await this.channel.client.rest.get(
3957
- withQuery(import_types18.Routes.channelThreadSearch(this.channel.id), {
4183
+ withQuery(import_types19.Routes.channelThreadSearch(this.channel.id), {
3958
4184
  name: options?.name,
3959
4185
  tag: options?.tag,
3960
4186
  tag_setting: options?.tagSetting,
@@ -3982,7 +4208,7 @@ var ThreadManager = class {
3982
4208
  }
3983
4209
  /** Set the auto-archive and slowmode defaults copied onto new threads. */
3984
4210
  async editDefaults(options) {
3985
- return this.channel.client.rest.patch(import_types18.Routes.channel(this.channel.id), {
4211
+ return this.channel.client.rest.patch(import_types19.Routes.channel(this.channel.id), {
3986
4212
  body: toThreadParentEditBody(options),
3987
4213
  auth: true,
3988
4214
  ...auditReasonHeaders(options.reason)
@@ -4000,7 +4226,7 @@ function isSearchNotReady(data) {
4000
4226
  return "code" in data && data.code === "SEARCH_INDEX_NOT_READY";
4001
4227
  }
4002
4228
  async function fetchActiveThreads(client, guildId) {
4003
- const data = await client.rest.get(import_types18.Routes.guildActiveThreads(guildId));
4229
+ const data = await client.rest.get(import_types19.Routes.guildActiveThreads(guildId));
4004
4230
  return fetchedThreadsFrom(client, data);
4005
4231
  }
4006
4232
 
@@ -4059,10 +4285,10 @@ var ThreadOnlyChannel = class extends GuildChannel {
4059
4285
  * `defaultForumLayout` is sent only for forum channels.
4060
4286
  */
4061
4287
  async edit(options) {
4062
- const data = await this.client.rest.patch(import_types19.Routes.channel(this.id), {
4288
+ const data = await this.client.rest.patch(import_types20.Routes.channel(this.id), {
4063
4289
  body: {
4064
4290
  ...toChannelEditBody(options),
4065
- ...forumParentWire(options, this.type === import_types19.ChannelType.GuildForum)
4291
+ ...forumParentWire(options, this.type === import_types20.ChannelType.GuildForum)
4066
4292
  },
4067
4293
  auth: true,
4068
4294
  ...auditReasonHeaders(options.reason)
@@ -4088,7 +4314,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
4088
4314
  }
4089
4315
  /** Set the auto-archive and slowmode defaults copied onto new posts. */
4090
4316
  async editThreadDefaults(options) {
4091
- const data = await this.client.rest.patch(import_types19.Routes.channel(this.id), {
4317
+ const data = await this.client.rest.patch(import_types20.Routes.channel(this.id), {
4092
4318
  body: toThreadParentEditBody(options),
4093
4319
  auth: true,
4094
4320
  ...auditReasonHeaders(options.reason)
@@ -4098,7 +4324,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
4098
4324
  }
4099
4325
  /** Create a tag. The response replaces {@link availableTags}. */
4100
4326
  async createTag(options) {
4101
- const data = await this.client.rest.post(import_types19.Routes.channelTags(this.id), {
4327
+ const data = await this.client.rest.post(import_types20.Routes.channelTags(this.id), {
4102
4328
  body: toForumTagBody(options),
4103
4329
  auth: true,
4104
4330
  ...auditReasonHeaders(options.reason)
@@ -4108,7 +4334,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
4108
4334
  }
4109
4335
  /** Replace a tag. The response replaces {@link availableTags}. */
4110
4336
  async editTag(tagId, options) {
4111
- const data = await this.client.rest.put(import_types19.Routes.channelTag(this.id, tagId), {
4337
+ const data = await this.client.rest.put(import_types20.Routes.channelTag(this.id, tagId), {
4112
4338
  body: toForumTagBody(options),
4113
4339
  auth: true,
4114
4340
  ...auditReasonHeaders(options.reason)
@@ -4118,7 +4344,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
4118
4344
  }
4119
4345
  /** Delete a tag. The response replaces {@link availableTags}. */
4120
4346
  async deleteTag(tagId, reason) {
4121
- const data = await this.client.rest.delete(import_types19.Routes.channelTag(this.id, tagId), {
4347
+ const data = await this.client.rest.delete(import_types20.Routes.channelTag(this.id, tagId), {
4122
4348
  auth: true,
4123
4349
  ...auditReasonHeaders(reason)
4124
4350
  });
@@ -4147,23 +4373,24 @@ var MediaChannel = class extends ThreadOnlyChannel {
4147
4373
  };
4148
4374
 
4149
4375
  // src/Domain/Channel/Factory.ts
4150
- var import_types20 = require("@fluxerjs/types");
4376
+ var import_types21 = require("@fluxerjs/types");
4151
4377
  var GUILD_FACTORIES = {
4152
- [import_types20.ChannelType.GuildText]: (c, d) => new TextChannel(c, d),
4153
- [import_types20.ChannelType.GuildAnnouncement]: (c, d) => new AnnouncementChannel(c, d),
4154
- [import_types20.ChannelType.GuildCategory]: (c, d) => new CategoryChannel(c, d),
4155
- [import_types20.ChannelType.GuildVoice]: (c, d) => new VoiceChannel(c, d),
4156
- [import_types20.ChannelType.GuildLink]: (c, d) => new LinkChannel(c, d),
4157
- [import_types20.ChannelType.AnnouncementThread]: (c, d) => new ThreadChannel(c, d),
4158
- [import_types20.ChannelType.PublicThread]: (c, d) => new ThreadChannel(c, d),
4159
- [import_types20.ChannelType.PrivateThread]: (c, d) => new ThreadChannel(c, d),
4160
- [import_types20.ChannelType.GuildForum]: (c, d) => new ForumChannel(c, d),
4161
- [import_types20.ChannelType.GuildMedia]: (c, d) => new MediaChannel(c, d)
4378
+ [import_types21.ChannelType.GuildText]: (c, d) => new TextChannel(c, d),
4379
+ [import_types21.ChannelType.GuildAnnouncement]: (c, d) => new AnnouncementChannel(c, d),
4380
+ [import_types21.ChannelType.GuildCategory]: (c, d) => new CategoryChannel(c, d),
4381
+ [import_types21.ChannelType.GuildVoice]: (c, d) => new VoiceChannel(c, d),
4382
+ [import_types21.ChannelType.GuildStageVoice]: (c, d) => new StageChannel(c, d),
4383
+ [import_types21.ChannelType.GuildLink]: (c, d) => new LinkChannel(c, d),
4384
+ [import_types21.ChannelType.AnnouncementThread]: (c, d) => new ThreadChannel(c, d),
4385
+ [import_types21.ChannelType.PublicThread]: (c, d) => new ThreadChannel(c, d),
4386
+ [import_types21.ChannelType.PrivateThread]: (c, d) => new ThreadChannel(c, d),
4387
+ [import_types21.ChannelType.GuildForum]: (c, d) => new ForumChannel(c, d),
4388
+ [import_types21.ChannelType.GuildMedia]: (c, d) => new MediaChannel(c, d)
4162
4389
  };
4163
4390
  var DM_TYPES = /* @__PURE__ */ new Set([
4164
- import_types20.ChannelType.DM,
4165
- import_types20.ChannelType.GroupDM,
4166
- import_types20.ChannelType.DMPersonalNotes
4391
+ import_types21.ChannelType.DM,
4392
+ import_types21.ChannelType.GroupDM,
4393
+ import_types21.ChannelType.DMPersonalNotes
4167
4394
  ]);
4168
4395
  function createDM(client, data) {
4169
4396
  return new DMChannel(client, data);
@@ -4274,11 +4501,11 @@ var User = class extends Base {
4274
4501
  */
4275
4502
  /** Unix timestamp (ms) when this account was created, derived from its snowflake ID. */
4276
4503
  get createdTimestamp() {
4277
- return import_util14.SnowflakeUtil.timestampFromSnowflake(this.id);
4504
+ return import_util15.SnowflakeUtil.timestampFromSnowflake(this.id);
4278
4505
  }
4279
4506
  /** Date when this account was created, derived from its snowflake ID. */
4280
4507
  get createdAt() {
4281
- return import_util14.SnowflakeUtil.dateFromSnowflake(this.id);
4508
+ return import_util15.SnowflakeUtil.dateFromSnowflake(this.id);
4282
4509
  }
4283
4510
  toString() {
4284
4511
  return `<@${this.id}>`;
@@ -4288,7 +4515,7 @@ var User = class extends Base {
4288
4515
  * @returns DM channel instance (cached if already open)
4289
4516
  */
4290
4517
  async createDM() {
4291
- const data = await this.client.rest.post(import_types21.Routes.userMeChannels(), {
4518
+ const data = await this.client.rest.post(import_types22.Routes.userMeChannels(), {
4292
4519
  body: { recipient_id: this.id },
4293
4520
  auth: true
4294
4521
  });
@@ -4505,14 +4732,14 @@ var CacheController = class {
4505
4732
 
4506
4733
  // src/ClientCore/ChannelManager.ts
4507
4734
  var import_collection8 = require("@fluxerjs/collection");
4508
- var import_types29 = require("@fluxerjs/types");
4735
+ var import_types30 = require("@fluxerjs/types");
4509
4736
 
4510
4737
  // src/Domain/Guild/Cache.ts
4511
- var import_types28 = require("@fluxerjs/types");
4738
+ var import_types29 = require("@fluxerjs/types");
4512
4739
 
4513
4740
  // src/Domain/Guild/GuildEmoji.ts
4514
- var import_types22 = require("@fluxerjs/types");
4515
- var import_util15 = require("@fluxerjs/util");
4741
+ var import_types23 = require("@fluxerjs/types");
4742
+ var import_util16 = require("@fluxerjs/util");
4516
4743
  var GuildEmoji = class extends Base {
4517
4744
  client;
4518
4745
  id;
@@ -4548,11 +4775,11 @@ var GuildEmoji = class extends Base {
4548
4775
  }
4549
4776
  /** Unix timestamp (ms) when this emoji was created, derived from its snowflake ID. */
4550
4777
  get createdTimestamp() {
4551
- return import_util15.SnowflakeUtil.timestampFromSnowflake(this.id);
4778
+ return import_util16.SnowflakeUtil.timestampFromSnowflake(this.id);
4552
4779
  }
4553
4780
  /** Date when this emoji was created, derived from its snowflake ID. */
4554
4781
  get createdAt() {
4555
- return import_util15.SnowflakeUtil.dateFromSnowflake(this.id);
4782
+ return import_util16.SnowflakeUtil.dateFromSnowflake(this.id);
4556
4783
  }
4557
4784
  /** Renders this emoji for use in message content: `<:name:id>` (or `<a:name:id>` when animated). */
4558
4785
  toString() {
@@ -4560,7 +4787,7 @@ var GuildEmoji = class extends Base {
4560
4787
  }
4561
4788
  /** Delete this emoji. Requires Manage Emojis and Stickers permission. */
4562
4789
  async delete(reason) {
4563
- await this.client.rest.delete(import_types22.Routes.guildEmoji(this.guildId, this.id), {
4790
+ await this.client.rest.delete(import_types23.Routes.guildEmoji(this.guildId, this.id), {
4564
4791
  auth: true,
4565
4792
  ...auditReasonHeaders(reason)
4566
4793
  });
@@ -4573,7 +4800,7 @@ var GuildEmoji = class extends Base {
4573
4800
  */
4574
4801
  async edit(options) {
4575
4802
  const { reason, name } = options;
4576
- const data = await this.client.rest.patch(import_types22.Routes.guildEmoji(this.guildId, this.id), {
4803
+ const data = await this.client.rest.patch(import_types23.Routes.guildEmoji(this.guildId, this.id), {
4577
4804
  body: { name },
4578
4805
  auth: true,
4579
4806
  ...auditReasonHeaders(reason)
@@ -4584,20 +4811,20 @@ var GuildEmoji = class extends Base {
4584
4811
  };
4585
4812
 
4586
4813
  // src/Domain/Guild/GuildMember.ts
4587
- var import_types25 = require("@fluxerjs/types");
4588
- var import_util17 = require("@fluxerjs/util");
4814
+ var import_types26 = require("@fluxerjs/types");
4815
+ var import_util18 = require("@fluxerjs/util");
4589
4816
 
4590
4817
  // src/Helpers/Permissions.ts
4591
- var import_types23 = require("@fluxerjs/types");
4592
- var import_util16 = require("@fluxerjs/util");
4818
+ var import_types24 = require("@fluxerjs/types");
4819
+ var import_util17 = require("@fluxerjs/util");
4593
4820
  function computePermissions(basePermissions, overwrites, memberRoles, memberId, isOwner) {
4594
- if (isOwner) return import_util16.ALL_PERMISSIONS_BIGINT;
4595
- if ((basePermissions & import_util16.PermissionFlags.Administrator) !== 0n) {
4596
- return import_util16.ALL_PERMISSIONS_BIGINT;
4821
+ if (isOwner) return import_util17.ALL_PERMISSIONS_BIGINT;
4822
+ if ((basePermissions & import_util17.PermissionFlags.Administrator) !== 0n) {
4823
+ return import_util17.ALL_PERMISSIONS_BIGINT;
4597
4824
  }
4598
4825
  let perms = basePermissions;
4599
4826
  for (const overwrite of overwrites ?? []) {
4600
- const applies = overwrite.type === import_types23.OverwriteType.Role && memberRoles.includes(overwrite.id) || overwrite.type === import_types23.OverwriteType.Member && overwrite.id === memberId;
4827
+ const applies = overwrite.type === import_types24.OverwriteType.Role && memberRoles.includes(overwrite.id) || overwrite.type === import_types24.OverwriteType.Member && overwrite.id === memberId;
4601
4828
  if (!applies) continue;
4602
4829
  const allow = BigInt(overwrite.allow || "0");
4603
4830
  const deny = BigInt(overwrite.deny || "0");
@@ -4608,7 +4835,7 @@ function computePermissions(basePermissions, overwrites, memberRoles, memberId,
4608
4835
 
4609
4836
  // src/Domain/Guild/GuildMemberRoleManager.ts
4610
4837
  var import_collection7 = require("@fluxerjs/collection");
4611
- var import_types24 = require("@fluxerjs/types");
4838
+ var import_types25 = require("@fluxerjs/types");
4612
4839
  function roleId(roleOrId) {
4613
4840
  return typeof roleOrId === "string" ? roleOrId : roleOrId.id;
4614
4841
  }
@@ -4637,7 +4864,7 @@ var GuildMemberRoleManager = class {
4637
4864
  const id = roleId(roleOrId);
4638
4865
  if (this.ids.includes(id)) return;
4639
4866
  await this.member.client.rest.put(
4640
- import_types24.Routes.guildMemberRole(this.member.guild.id, this.member.id, id)
4867
+ import_types25.Routes.guildMemberRole(this.member.guild.id, this.member.id, id)
4641
4868
  );
4642
4869
  this.ids.push(id);
4643
4870
  }
@@ -4646,13 +4873,13 @@ var GuildMemberRoleManager = class {
4646
4873
  const idx = this.ids.indexOf(id);
4647
4874
  if (idx === -1) return;
4648
4875
  await this.member.client.rest.delete(
4649
- import_types24.Routes.guildMemberRole(this.member.guild.id, this.member.id, id)
4876
+ import_types25.Routes.guildMemberRole(this.member.guild.id, this.member.id, id)
4650
4877
  );
4651
4878
  this.ids.splice(idx, 1);
4652
4879
  }
4653
4880
  async set(roleIds) {
4654
4881
  const data = await this.member.client.rest.patch(
4655
- import_types24.Routes.guildMember(this.member.guild.id, this.member.id),
4882
+ import_types25.Routes.guildMember(this.member.guild.id, this.member.id),
4656
4883
  { body: { roles: roleIds }, auth: true }
4657
4884
  );
4658
4885
  this.ids = data.roles ? [...data.roles] : [];
@@ -4806,7 +5033,7 @@ var GuildMember = class _GuildMember extends Base {
4806
5033
  */
4807
5034
  async edit(options) {
4808
5035
  const isMe = this.client.user?.id === this.id;
4809
- const route = isMe ? import_types25.Routes.guildMemberMe(this.guild.id) : import_types25.Routes.guildMember(this.guild.id, this.id);
5036
+ const route = isMe ? import_types26.Routes.guildMemberMe(this.guild.id) : import_types26.Routes.guildMember(this.guild.id, this.id);
4810
5037
  const data = await this.client.rest.patch(route, {
4811
5038
  body: toMemberEditBody(options),
4812
5039
  auth: true,
@@ -4823,7 +5050,7 @@ var GuildMember = class _GuildMember extends Base {
4823
5050
  * @see {@link permissionsIn} for channel-specific permissions
4824
5051
  */
4825
5052
  get permissions() {
4826
- return new import_util17.PermissionsBitField(this._effectivePermissions([], []));
5053
+ return new import_util18.PermissionsBitField(this._effectivePermissions([], []));
4827
5054
  }
4828
5055
  /**
4829
5056
  * Effective permissions in a channel (roles + overwrites).
@@ -4831,7 +5058,7 @@ var GuildMember = class _GuildMember extends Base {
4831
5058
  * @returns Computed permissions bitfield
4832
5059
  */
4833
5060
  permissionsIn(channel) {
4834
- return new import_util17.PermissionsBitField(
5061
+ return new import_util18.PermissionsBitField(
4835
5062
  this._effectivePermissions(channel.permissionOverwrites.toJSON(), [...this.roles.roleIds])
4836
5063
  );
4837
5064
  }
@@ -4856,19 +5083,19 @@ var GuildMember = class _GuildMember extends Base {
4856
5083
  * False for the guild owner, self, or when the bot lacks Kick Members / role hierarchy.
4857
5084
  */
4858
5085
  get kickable() {
4859
- return this._moderatableWith(import_util17.PermissionFlags.KickMembers);
5086
+ return this._moderatableWith(import_util18.PermissionFlags.KickMembers);
4860
5087
  }
4861
5088
  /**
4862
5089
  * Whether the bot can ban this member (cache-only; needs `members.me`).
4863
5090
  */
4864
5091
  get bannable() {
4865
- return this._moderatableWith(import_util17.PermissionFlags.BanMembers);
5092
+ return this._moderatableWith(import_util18.PermissionFlags.BanMembers);
4866
5093
  }
4867
5094
  /**
4868
5095
  * Whether the bot can timeout this member (cache-only; needs `members.me`).
4869
5096
  */
4870
5097
  get moderatable() {
4871
- return this._moderatableWith(import_util17.PermissionFlags.ModerateMembers);
5098
+ return this._moderatableWith(import_util18.PermissionFlags.ModerateMembers);
4872
5099
  }
4873
5100
  _moderatableWith(flag) {
4874
5101
  const me = this.guild.members.me;
@@ -4919,8 +5146,8 @@ var GuildMember = class _GuildMember extends Base {
4919
5146
  };
4920
5147
 
4921
5148
  // src/Domain/Guild/GuildSticker.ts
4922
- var import_types26 = require("@fluxerjs/types");
4923
- var import_util18 = require("@fluxerjs/util");
5149
+ var import_types27 = require("@fluxerjs/types");
5150
+ var import_util19 = require("@fluxerjs/util");
4924
5151
  var GuildSticker = class extends Base {
4925
5152
  client;
4926
5153
  id;
@@ -4962,15 +5189,15 @@ var GuildSticker = class extends Base {
4962
5189
  }
4963
5190
  /** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
4964
5191
  get createdTimestamp() {
4965
- return import_util18.SnowflakeUtil.timestampFromSnowflake(this.id);
5192
+ return import_util19.SnowflakeUtil.timestampFromSnowflake(this.id);
4966
5193
  }
4967
5194
  /** Date when this sticker was created, derived from its snowflake ID. */
4968
5195
  get createdAt() {
4969
- return import_util18.SnowflakeUtil.dateFromSnowflake(this.id);
5196
+ return import_util19.SnowflakeUtil.dateFromSnowflake(this.id);
4970
5197
  }
4971
5198
  /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
4972
5199
  async delete(reason) {
4973
- await this.client.rest.delete(import_types26.Routes.guildSticker(this.guildId, this.id), {
5200
+ await this.client.rest.delete(import_types27.Routes.guildSticker(this.guildId, this.id), {
4974
5201
  auth: true,
4975
5202
  ...auditReasonHeaders(reason)
4976
5203
  });
@@ -4983,7 +5210,7 @@ var GuildSticker = class extends Base {
4983
5210
  */
4984
5211
  async edit(options) {
4985
5212
  const { reason, ...body } = options;
4986
- const data = await this.client.rest.patch(import_types26.Routes.guildSticker(this.guildId, this.id), {
5213
+ const data = await this.client.rest.patch(import_types27.Routes.guildSticker(this.guildId, this.id), {
4987
5214
  body,
4988
5215
  auth: true,
4989
5216
  ...auditReasonHeaders(reason)
@@ -4996,8 +5223,8 @@ var GuildSticker = class extends Base {
4996
5223
  };
4997
5224
 
4998
5225
  // src/Domain/Guild/Role.ts
4999
- var import_types27 = require("@fluxerjs/types");
5000
- var import_util19 = require("@fluxerjs/util");
5226
+ var import_types28 = require("@fluxerjs/types");
5227
+ var import_util20 = require("@fluxerjs/util");
5001
5228
  var Role = class _Role extends Base {
5002
5229
  /** Parent client instance. */
5003
5230
  client;
@@ -5048,8 +5275,8 @@ var Role = class _Role extends Base {
5048
5275
  } catch {
5049
5276
  bits = 0n;
5050
5277
  }
5051
- return new import_util19.PermissionsBitField(
5052
- (bits & import_util19.PermissionFlags.Administrator) !== 0n ? import_util19.ALL_PERMISSIONS_BIGINT : bits
5278
+ return new import_util20.PermissionsBitField(
5279
+ (bits & import_util20.PermissionFlags.Administrator) !== 0n ? import_util20.ALL_PERMISSIONS_BIGINT : bits
5053
5280
  );
5054
5281
  }
5055
5282
  /**
@@ -5066,11 +5293,11 @@ var Role = class _Role extends Base {
5066
5293
  */
5067
5294
  /** Unix timestamp (ms) when this role was created, derived from its snowflake ID. */
5068
5295
  get createdTimestamp() {
5069
- return import_util19.SnowflakeUtil.timestampFromSnowflake(this.id);
5296
+ return import_util20.SnowflakeUtil.timestampFromSnowflake(this.id);
5070
5297
  }
5071
5298
  /** Date when this role was created, derived from its snowflake ID. */
5072
5299
  get createdAt() {
5073
- return import_util19.SnowflakeUtil.dateFromSnowflake(this.id);
5300
+ return import_util20.SnowflakeUtil.dateFromSnowflake(this.id);
5074
5301
  }
5075
5302
  toString() {
5076
5303
  return `<@&${this.id}>`;
@@ -5116,7 +5343,7 @@ var Role = class _Role extends Base {
5116
5343
  */
5117
5344
  async edit(options) {
5118
5345
  const body = toRoleEditBody(options);
5119
- const data = await this.client.rest.patch(import_types27.Routes.guildRole(this.guildId, this.id), {
5346
+ const data = await this.client.rest.patch(import_types28.Routes.guildRole(this.guildId, this.id), {
5120
5347
  body: Object.keys(body).length ? body : void 0,
5121
5348
  auth: true,
5122
5349
  ...auditReasonHeaders(options.reason)
@@ -5129,7 +5356,7 @@ var Role = class _Role extends Base {
5129
5356
  * @param reason - Audit log reason (`X-Audit-Log-Reason`)
5130
5357
  */
5131
5358
  async delete(reason) {
5132
- await this.client.rest.delete(import_types27.Routes.guildRole(this.guildId, this.id), {
5359
+ await this.client.rest.delete(import_types28.Routes.guildRole(this.guildId, this.id), {
5133
5360
  auth: true,
5134
5361
  ...auditReasonHeaders(reason)
5135
5362
  });
@@ -5230,7 +5457,7 @@ function syncChannels(guild, channels) {
5230
5457
  }
5231
5458
  }
5232
5459
  function isThreadChannelType(type) {
5233
- return type === import_types28.ChannelType.AnnouncementThread || type === import_types28.ChannelType.PublicThread || type === import_types28.ChannelType.PrivateThread;
5460
+ return type === import_types29.ChannelType.AnnouncementThread || type === import_types29.ChannelType.PublicThread || type === import_types29.ChannelType.PrivateThread;
5234
5461
  }
5235
5462
  function syncThreads(guild, threads, alsoKeep = /* @__PURE__ */ new Set()) {
5236
5463
  const keep = new Set(alsoKeep);
@@ -5319,7 +5546,7 @@ var ChannelManager = class extends import_collection8.LimitedCollection {
5319
5546
  async fetchFresh(channelId) {
5320
5547
  try {
5321
5548
  const data = assertApiObjectWithId(
5322
- await this.client.rest.get(import_types29.Routes.channel(channelId)),
5549
+ await this.client.rest.get(import_types30.Routes.channel(channelId)),
5323
5550
  "channels.fetch()"
5324
5551
  );
5325
5552
  const existing = this.get(channelId);
@@ -5372,7 +5599,7 @@ var ChannelManager = class extends import_collection8.LimitedCollection {
5372
5599
  defaultAllowedMentions: this.client.options.defaultAllowedMentions
5373
5600
  });
5374
5601
  const data = await this.client.rest.post(
5375
- import_types29.Routes.channelMessages(channelId),
5602
+ import_types30.Routes.channelMessages(channelId),
5376
5603
  postPayload
5377
5604
  );
5378
5605
  this.client._addMessageToCache(channelId, data);
@@ -5382,28 +5609,28 @@ var ChannelManager = class extends import_collection8.LimitedCollection {
5382
5609
 
5383
5610
  // src/ClientCore/ClientEmoji.ts
5384
5611
  var import_collection9 = require("@fluxerjs/collection");
5385
- var import_types30 = require("@fluxerjs/types");
5386
- var import_util20 = require("@fluxerjs/util");
5612
+ var import_types31 = require("@fluxerjs/types");
5613
+ var import_util21 = require("@fluxerjs/util");
5387
5614
  async function resolveClientEmoji(client, emoji, guildId) {
5388
5615
  if (typeof emoji === "object" && emoji.id) {
5389
- return (0, import_util20.formatEmoji)({ name: emoji.name, id: emoji.id, animated: emoji.animated });
5616
+ return (0, import_util21.formatEmoji)({ name: emoji.name, id: emoji.id, animated: emoji.animated });
5390
5617
  }
5391
- const parsed = (0, import_util20.parseEmoji)(
5618
+ const parsed = (0, import_util21.parseEmoji)(
5392
5619
  typeof emoji === "string" ? emoji : emoji.id ? `:${emoji.name}:` : emoji.name
5393
5620
  );
5394
5621
  if (!parsed) {
5395
5622
  throw new import_util2.FluxerError("Invalid emoji", { code: import_util.ErrorCodes.InvalidEmoji });
5396
5623
  }
5397
5624
  if (parsed.id) {
5398
- return (0, import_util20.formatEmoji)(parsed);
5625
+ return (0, import_util21.formatEmoji)(parsed);
5399
5626
  }
5400
5627
  if (!/^\w+$/.test(parsed.name)) return parsed.name;
5401
- const unicodeFromShortcode = (0, import_util20.getUnicodeFromShortcode)(parsed.name);
5628
+ const unicodeFromShortcode = (0, import_util21.getUnicodeFromShortcode)(parsed.name);
5402
5629
  if (unicodeFromShortcode) return unicodeFromShortcode;
5403
5630
  if (guildId) {
5404
- const emojis = await client.rest.get(import_types30.Routes.guildEmojis(guildId));
5631
+ const emojis = await client.rest.get(import_types31.Routes.guildEmojis(guildId));
5405
5632
  const found = emojis.find((e) => e.name && e.name.toLowerCase() === parsed.name.toLowerCase());
5406
- if (found) return (0, import_util20.formatEmoji)({ ...parsed, id: found.id, animated: found.animated });
5633
+ if (found) return (0, import_util21.formatEmoji)({ ...parsed, id: found.id, animated: found.animated });
5407
5634
  throw new import_util2.FluxerError(
5408
5635
  `Custom emoji ":${parsed.name}:" not found in guild. Use name:id or <:name:id> format.`,
5409
5636
  { code: import_util.ErrorCodes.EmojiNotFound }
@@ -5418,26 +5645,26 @@ async function resolveClientEmoji(client, emoji, guildId) {
5418
5645
  return parsed.name;
5419
5646
  }
5420
5647
  async function fetchInstance(client) {
5421
- const raw = await client.rest.get(import_types30.Routes.instanceDiscovery(), {
5648
+ const raw = await client.rest.get(import_types31.Routes.instanceDiscovery(), {
5422
5649
  auth: false,
5423
5650
  unversioned: true
5424
5651
  });
5425
5652
  return parseInstanceDiscovery(raw);
5426
5653
  }
5427
5654
  function fetchGatewayInfo(client) {
5428
- return client.rest.get(import_types30.Routes.gatewayBot());
5655
+ return client.rest.get(import_types31.Routes.gatewayBot());
5429
5656
  }
5430
5657
  function fetchEmojiMetadata(client, emojiId) {
5431
- return client.rest.get(import_types30.Routes.emojiMetadata(emojiId), { auth: true });
5658
+ return client.rest.get(import_types31.Routes.emojiMetadata(emojiId), { auth: true });
5432
5659
  }
5433
5660
  function fetchStickerMetadata(client, stickerId) {
5434
- return client.rest.get(import_types30.Routes.stickerMetadata(stickerId), { auth: true });
5661
+ return client.rest.get(import_types31.Routes.stickerMetadata(stickerId), { auth: true });
5435
5662
  }
5436
5663
  function fetchApplication(client) {
5437
- return client.rest.get(import_types30.Routes.applicationsMe(), { auth: true });
5664
+ return client.rest.get(import_types31.Routes.applicationsMe(), { auth: true });
5438
5665
  }
5439
5666
  async function fetchOAuthApplications(client) {
5440
- const data = await client.rest.get(import_types30.Routes.oauth2ApplicationsMe(), { auth: true });
5667
+ const data = await client.rest.get(import_types31.Routes.oauth2ApplicationsMe(), { auth: true });
5441
5668
  if (Array.isArray(data)) return data;
5442
5669
  if (data && typeof data === "object" && "applications" in data && Array.isArray(data.applications)) {
5443
5670
  return data.applications;
@@ -5456,14 +5683,14 @@ function assertChannelIdBatch(name, channelIds) {
5456
5683
  }
5457
5684
  function preloadMessages(client, channelIds) {
5458
5685
  assertChannelIdBatch("preloadMessages", channelIds);
5459
- return client.rest.post(import_types30.Routes.preloadMessages(), {
5686
+ return client.rest.post(import_types31.Routes.preloadMessages(), {
5460
5687
  body: { channels: channelIds },
5461
5688
  auth: true
5462
5689
  });
5463
5690
  }
5464
5691
  function preloadMessagesAlt(client, channelIds) {
5465
5692
  assertChannelIdBatch("preloadMessagesAlt", channelIds);
5466
- return client.rest.post(import_types30.Routes.preloadMessagesAlt(), {
5693
+ return client.rest.post(import_types31.Routes.preloadMessagesAlt(), {
5467
5694
  body: { channels: channelIds },
5468
5695
  auth: true
5469
5696
  });
@@ -5471,7 +5698,7 @@ function preloadMessagesAlt(client, channelIds) {
5471
5698
  async function bulkFetchMessages(client, requests, options = {}) {
5472
5699
  validateBulkMessageFetchRequests(requests);
5473
5700
  const wire = toBulkFetchWire(requests);
5474
- const data = await client.rest.post(import_types30.Routes.channelsMessagesBulk(), {
5701
+ const data = await client.rest.post(import_types31.Routes.channelsMessagesBulk(), {
5475
5702
  body: { requests: wire },
5476
5703
  auth: true
5477
5704
  });
@@ -5488,7 +5715,7 @@ async function bulkFetchMessages(client, requests, options = {}) {
5488
5715
  };
5489
5716
  }
5490
5717
  async function searchMessages(client, options = {}) {
5491
- const data = await client.rest.post(import_types30.Routes.searchMessages(), {
5718
+ const data = await client.rest.post(import_types31.Routes.searchMessages(), {
5492
5719
  body: toMessageSearchBody(options),
5493
5720
  auth: true
5494
5721
  });
@@ -5496,19 +5723,19 @@ async function searchMessages(client, options = {}) {
5496
5723
  }
5497
5724
  function fetchEmojiSource(client, emojiId) {
5498
5725
  return client.rest.get(
5499
- import_types30.Routes.emojiSource(emojiId),
5726
+ import_types31.Routes.emojiSource(emojiId),
5500
5727
  { auth: true }
5501
5728
  );
5502
5729
  }
5503
5730
  function fetchStickerSource(client, stickerId) {
5504
5731
  return client.rest.get(
5505
- import_types30.Routes.stickerSource(stickerId),
5732
+ import_types31.Routes.stickerSource(stickerId),
5506
5733
  { auth: true }
5507
5734
  );
5508
5735
  }
5509
5736
  function fetchDiscoveryCategories(client) {
5510
5737
  return client.rest.get(
5511
- import_types30.Routes.discoveryCategories(),
5738
+ import_types31.Routes.discoveryCategories(),
5512
5739
  { auth: true }
5513
5740
  );
5514
5741
  }
@@ -5523,18 +5750,18 @@ function searchDiscoveryGuilds(client, options = {}) {
5523
5750
  if (options.offset !== void 0) params.set("offset", String(options.offset));
5524
5751
  const qs2 = params.toString();
5525
5752
  return client.rest.get(
5526
- qs2 ? `${import_types30.Routes.discoveryGuilds()}?${qs2}` : import_types30.Routes.discoveryGuilds(),
5753
+ qs2 ? `${import_types31.Routes.discoveryGuilds()}?${qs2}` : import_types31.Routes.discoveryGuilds(),
5527
5754
  { auth: true }
5528
5755
  );
5529
5756
  }
5530
5757
  function fetchExperiments(client) {
5531
- return client.rest.get(import_types30.Routes.experiments(), {
5758
+ return client.rest.get(import_types31.Routes.experiments(), {
5532
5759
  auth: true
5533
5760
  });
5534
5761
  }
5535
5762
  function refreshAttachmentUrls(client, attachmentUrls) {
5536
5763
  return client.rest.post(
5537
- import_types30.Routes.attachmentsRefreshUrls(),
5764
+ import_types31.Routes.attachmentsRefreshUrls(),
5538
5765
  { body: { attachment_urls: attachmentUrls }, auth: true }
5539
5766
  );
5540
5767
  }
@@ -5546,13 +5773,13 @@ function fetchInstanceBadges(client, options = {}) {
5546
5773
  if (options.version !== void 0) params.set("version", options.version);
5547
5774
  const qs2 = params.toString();
5548
5775
  return client.rest.get(
5549
- qs2 ? `${import_types30.Routes.instanceBadges()}?${qs2}` : import_types30.Routes.instanceBadges(),
5776
+ qs2 ? `${import_types31.Routes.instanceBadges()}?${qs2}` : import_types31.Routes.instanceBadges(),
5550
5777
  { auth: false }
5551
5778
  );
5552
5779
  }
5553
5780
  function fetchChannelPostData(client, channelId, threadIds) {
5554
5781
  return client.rest.post(
5555
- import_types30.Routes.channelPostData(channelId),
5782
+ import_types31.Routes.channelPostData(channelId),
5556
5783
  { body: { thread_ids: threadIds }, auth: true }
5557
5784
  );
5558
5785
  }
@@ -5575,12 +5802,12 @@ var import_ws = require("@fluxerjs/ws");
5575
5802
 
5576
5803
  // src/Domain/Guild/Guild.ts
5577
5804
  var import_collection12 = require("@fluxerjs/collection");
5578
- var import_types40 = require("@fluxerjs/types");
5579
- var import_util22 = require("@fluxerjs/util");
5805
+ var import_types41 = require("@fluxerjs/types");
5806
+ var import_util23 = require("@fluxerjs/util");
5580
5807
 
5581
5808
  // src/ClientCore/GuildMemberManager.ts
5582
5809
  var import_collection10 = require("@fluxerjs/collection");
5583
- var import_types31 = require("@fluxerjs/types");
5810
+ var import_types32 = require("@fluxerjs/types");
5584
5811
  var GuildMemberManager = class extends import_collection10.LimitedCollection {
5585
5812
  constructor(guild) {
5586
5813
  super({ maxSize: guild.client.cache.limits.members });
@@ -5641,7 +5868,7 @@ var GuildMemberManager = class extends import_collection10.LimitedCollection {
5641
5868
  if (options?.limit != null) params.set("limit", String(options.limit));
5642
5869
  if (options?.after) params.set("after", options.after);
5643
5870
  const qs2 = params.toString();
5644
- const url = import_types31.Routes.guildMembers(this.guild.id) + (qs2 ? `?${qs2}` : "");
5871
+ const url = import_types32.Routes.guildMembers(this.guild.id) + (qs2 ? `?${qs2}` : "");
5645
5872
  const data = assertApiArray(
5646
5873
  await this.guild.client.rest.get(url, { auth: true }),
5647
5874
  "members.fetch()"
@@ -5668,7 +5895,7 @@ var GuildMemberManager = class extends import_collection10.LimitedCollection {
5668
5895
  */
5669
5896
  async search(options = {}) {
5670
5897
  const data = await this.guild.client.rest.post(
5671
- import_types31.Routes.guildMembersSearch(this.guild.id),
5898
+ import_types32.Routes.guildMembersSearch(this.guild.id),
5672
5899
  { body: toMemberSearchBody(options), auth: true }
5673
5900
  );
5674
5901
  const offset = options.offset ?? 0;
@@ -5694,7 +5921,7 @@ var GuildMemberManager = class extends import_collection10.LimitedCollection {
5694
5921
  };
5695
5922
 
5696
5923
  // src/Domain/Guild/Admin.ts
5697
- var import_types32 = require("@fluxerjs/types");
5924
+ var import_types33 = require("@fluxerjs/types");
5698
5925
  function toAuditLogEntryPayload(entry, guildId) {
5699
5926
  return {
5700
5927
  id: entry.id,
@@ -5715,7 +5942,7 @@ function toVanityPayload(data) {
5715
5942
  return { code: data.code ?? null, uses: data.uses };
5716
5943
  }
5717
5944
  async function fetchAuditLogs(guild, options) {
5718
- const url = import_types32.Routes.guildAuditLogs(guild.id) + qs({
5945
+ const url = import_types33.Routes.guildAuditLogs(guild.id) + qs({
5719
5946
  limit: options?.limit,
5720
5947
  before: options?.before,
5721
5948
  after: options?.after,
@@ -5739,7 +5966,7 @@ async function fetchAuditLogs(guild, options) {
5739
5966
  };
5740
5967
  }
5741
5968
  async function editGuild(guild, options) {
5742
- const data = await guild.client.rest.patch(import_types32.Routes.guild(guild.id), {
5969
+ const data = await guild.client.rest.patch(import_types33.Routes.guild(guild.id), {
5743
5970
  body: toGuildEditBody(options),
5744
5971
  auth: true
5745
5972
  });
@@ -5747,13 +5974,13 @@ async function editGuild(guild, options) {
5747
5974
  return guild;
5748
5975
  }
5749
5976
  async function fetchVanityURL(guild) {
5750
- const data = await guild.client.rest.get(import_types32.Routes.guildVanityUrl(guild.id), {
5977
+ const data = await guild.client.rest.get(import_types33.Routes.guildVanityUrl(guild.id), {
5751
5978
  auth: true
5752
5979
  });
5753
5980
  return toVanityPayload(data);
5754
5981
  }
5755
5982
  async function editVanityURL(guild, code) {
5756
- const data = await guild.client.rest.patch(import_types32.Routes.guildVanityUrl(guild.id), {
5983
+ const data = await guild.client.rest.patch(import_types33.Routes.guildVanityUrl(guild.id), {
5757
5984
  body: { code },
5758
5985
  auth: true
5759
5986
  });
@@ -5761,14 +5988,14 @@ async function editVanityURL(guild, code) {
5761
5988
  return toVanityPayload(data);
5762
5989
  }
5763
5990
  async function fetchDiscoveryStatus(guild) {
5764
- const data = await guild.client.rest.get(import_types32.Routes.guildDiscovery(guild.id), {
5991
+ const data = await guild.client.rest.get(import_types33.Routes.guildDiscovery(guild.id), {
5765
5992
  auth: true
5766
5993
  });
5767
5994
  return toDiscoveryStatusPayload(data);
5768
5995
  }
5769
5996
  async function applyForDiscovery(guild, options) {
5770
5997
  const data = await guild.client.rest.post(
5771
- import_types32.Routes.guildDiscovery(guild.id),
5998
+ import_types33.Routes.guildDiscovery(guild.id),
5772
5999
  {
5773
6000
  body: toDiscoveryBody(options),
5774
6001
  auth: true
@@ -5778,7 +6005,7 @@ async function applyForDiscovery(guild, options) {
5778
6005
  }
5779
6006
  async function editDiscoveryApplication(guild, options) {
5780
6007
  const data = await guild.client.rest.patch(
5781
- import_types32.Routes.guildDiscovery(guild.id),
6008
+ import_types33.Routes.guildDiscovery(guild.id),
5782
6009
  {
5783
6010
  body: toDiscoveryBody(options),
5784
6011
  auth: true
@@ -5787,34 +6014,34 @@ async function editDiscoveryApplication(guild, options) {
5787
6014
  return toDiscoveryApplicationPayload(data);
5788
6015
  }
5789
6016
  async function withdrawDiscoveryApplication(guild) {
5790
- await guild.client.rest.delete(import_types32.Routes.guildDiscovery(guild.id), { auth: true });
6017
+ await guild.client.rest.delete(import_types33.Routes.guildDiscovery(guild.id), { auth: true });
5791
6018
  }
5792
6019
  async function deleteGuild(guild, options) {
5793
6020
  const body = options ? toSudoBody(options) : {};
5794
- await guild.client.rest.post(import_types32.Routes.guildDelete(guild.id), {
6021
+ await guild.client.rest.post(import_types33.Routes.guildDelete(guild.id), {
5795
6022
  body,
5796
6023
  auth: true
5797
6024
  });
5798
6025
  guild.client.guilds.delete(guild.id);
5799
6026
  }
5800
6027
  async function transferOwnership(guild, newOwnerId, password) {
5801
- await guild.client.rest.post(import_types32.Routes.guildTransferOwnership(guild.id), {
6028
+ await guild.client.rest.post(import_types33.Routes.guildTransferOwnership(guild.id), {
5802
6029
  body: { new_owner_id: newOwnerId, ...password != null && { password } },
5803
6030
  auth: true
5804
6031
  });
5805
6032
  }
5806
6033
 
5807
6034
  // src/Domain/Guild/Channels.ts
5808
- var import_types33 = require("@fluxerjs/types");
6035
+ var import_types34 = require("@fluxerjs/types");
5809
6036
  async function createChannel(guild, options) {
5810
- const created = await guild.client.rest.post(import_types33.Routes.guildChannels(guild.id), {
6037
+ const created = await guild.client.rest.post(import_types34.Routes.guildChannels(guild.id), {
5811
6038
  body: toChannelCreateBody(options),
5812
6039
  auth: true
5813
6040
  });
5814
6041
  return cacheChannel(guild, created);
5815
6042
  }
5816
6043
  async function fetchChannels(guild) {
5817
- const raw = await guild.client.rest.get(import_types33.Routes.guildChannels(guild.id));
6044
+ const raw = await guild.client.rest.get(import_types34.Routes.guildChannels(guild.id));
5818
6045
  if (!Array.isArray(raw))
5819
6046
  throw new TypeError(
5820
6047
  "guild.fetchChannels() received an invalid API payload (expected an array)"
@@ -5828,17 +6055,17 @@ async function fetchChannels(guild) {
5828
6055
  return channels;
5829
6056
  }
5830
6057
  async function setChannelPositions(guild, updates) {
5831
- await guild.client.rest.patch(import_types33.Routes.guildChannels(guild.id), {
6058
+ await guild.client.rest.patch(import_types34.Routes.guildChannels(guild.id), {
5832
6059
  body: toChannelPositionBody(updates),
5833
6060
  auth: true
5834
6061
  });
5835
6062
  }
5836
6063
  async function fetchWebhooks(guild) {
5837
- const data = await guild.client.rest.get(import_types33.Routes.guildWebhooks(guild.id));
6064
+ const data = await guild.client.rest.get(import_types34.Routes.guildWebhooks(guild.id));
5838
6065
  return data.map((w) => new Webhook(guild.client, w));
5839
6066
  }
5840
6067
  async function fetchInvites(guild) {
5841
- const data = await guild.client.rest.get(import_types33.Routes.guildInvites(guild.id));
6068
+ const data = await guild.client.rest.get(import_types34.Routes.guildInvites(guild.id));
5842
6069
  return data.map((invite) => new Invite(guild.client, invite));
5843
6070
  }
5844
6071
  async function fetchInvite(guild, codeOrUrl) {
@@ -5858,14 +6085,14 @@ function resolveGuildOnlineCount(data) {
5858
6085
  }
5859
6086
 
5860
6087
  // src/Domain/Guild/Emojis.ts
5861
- var import_types34 = require("@fluxerjs/types");
6088
+ var import_types35 = require("@fluxerjs/types");
5862
6089
  async function fetchEmojis(guild) {
5863
- const data = await guild.client.rest.get(import_types34.Routes.guildEmojis(guild.id));
6090
+ const data = await guild.client.rest.get(import_types35.Routes.guildEmojis(guild.id));
5864
6091
  return data.map((e) => cacheEmoji(guild, e));
5865
6092
  }
5866
6093
  async function fetchEmoji(guild, emojiId) {
5867
6094
  try {
5868
- const data = await guild.client.rest.get(import_types34.Routes.guildEmoji(guild.id, emojiId));
6095
+ const data = await guild.client.rest.get(import_types35.Routes.guildEmoji(guild.id, emojiId));
5869
6096
  return cacheEmoji(guild, data);
5870
6097
  } catch (err) {
5871
6098
  rethrowMapped(err, {
@@ -5876,7 +6103,7 @@ async function fetchEmoji(guild, emojiId) {
5876
6103
  }
5877
6104
  async function createEmoji(guild, options) {
5878
6105
  const { reason, ...body } = options;
5879
- const data = await guild.client.rest.post(import_types34.Routes.guildEmojis(guild.id), {
6106
+ const data = await guild.client.rest.post(import_types35.Routes.guildEmojis(guild.id), {
5880
6107
  body,
5881
6108
  auth: true,
5882
6109
  ...auditReasonHeaders(reason)
@@ -5884,7 +6111,7 @@ async function createEmoji(guild, options) {
5884
6111
  return cacheEmoji(guild, data);
5885
6112
  }
5886
6113
  async function cloneEmoji(guild, sourceEmojiId) {
5887
- const data = await guild.client.rest.post(import_types34.Routes.guildEmojisClone(guild.id), {
6114
+ const data = await guild.client.rest.post(import_types35.Routes.guildEmojisClone(guild.id), {
5888
6115
  body: { source_emoji_id: sourceEmojiId },
5889
6116
  auth: true
5890
6117
  });
@@ -5892,7 +6119,7 @@ async function cloneEmoji(guild, sourceEmojiId) {
5892
6119
  }
5893
6120
  async function createEmojisBulk(guild, emojis) {
5894
6121
  const data = await guild.client.rest.post(
5895
- import_types34.Routes.guildEmojisBulk(guild.id),
6122
+ import_types35.Routes.guildEmojisBulk(guild.id),
5896
6123
  { body: { emojis }, auth: true }
5897
6124
  );
5898
6125
  return { success: data.success.map((e) => cacheEmoji(guild, e)), failed: data.failed };
@@ -5912,12 +6139,12 @@ var GuildRoleManager = class extends import_collection11.LimitedCollection {
5912
6139
  };
5913
6140
 
5914
6141
  // src/Domain/Guild/MemberHttp.ts
5915
- var import_types35 = require("@fluxerjs/types");
6142
+ var import_types36 = require("@fluxerjs/types");
5916
6143
  async function fetchMember(guild, userId) {
5917
6144
  const id = normalizeSnowflakeId(userId, "members.fetch()");
5918
6145
  try {
5919
6146
  const data = await guild.client.rest.get(
5920
- import_types35.Routes.guildMember(guild.id, id)
6147
+ import_types36.Routes.guildMember(guild.id, id)
5921
6148
  );
5922
6149
  if (!data?.user?.id) {
5923
6150
  throw new TypeError("members.fetch() received an invalid API payload (missing user.id)");
@@ -5935,7 +6162,7 @@ async function fetchMember(guild, userId) {
5935
6162
  }
5936
6163
  async function fetchMe(guild) {
5937
6164
  const data = await guild.client.rest.get(
5938
- import_types35.Routes.guildMemberMe(guild.id),
6165
+ import_types36.Routes.guildMemberMe(guild.id),
5939
6166
  { auth: true }
5940
6167
  );
5941
6168
  if (!data?.user?.id) {
@@ -5945,10 +6172,10 @@ async function fetchMe(guild) {
5945
6172
  }
5946
6173
 
5947
6174
  // src/Domain/Guild/Moderation.ts
5948
- var import_types37 = require("@fluxerjs/types");
6175
+ var import_types38 = require("@fluxerjs/types");
5949
6176
 
5950
6177
  // src/Domain/Guild/GuildBan.ts
5951
- var import_types36 = require("@fluxerjs/types");
6178
+ var import_types37 = require("@fluxerjs/types");
5952
6179
  function parseOptionalDate2(value) {
5953
6180
  if (value == null || value === "") return null;
5954
6181
  const date = new Date(value);
@@ -5975,7 +6202,7 @@ var GuildBan = class extends Base {
5975
6202
  * Requires Ban Members permission.
5976
6203
  */
5977
6204
  async unban(reason) {
5978
- await this.client.rest.delete(import_types36.Routes.guildBan(this.guildId, this.user.id), {
6205
+ await this.client.rest.delete(import_types37.Routes.guildBan(this.guildId, this.user.id), {
5979
6206
  auth: true,
5980
6207
  ...auditReasonHeaders(reason)
5981
6208
  });
@@ -5985,39 +6212,39 @@ var GuildBan = class extends Base {
5985
6212
  // src/Domain/Guild/Moderation.ts
5986
6213
  async function ban(guild, userId, options) {
5987
6214
  const body = options ? toGuildBanBody(options) : {};
5988
- await guild.client.rest.put(import_types37.Routes.guildBan(guild.id, userId), {
6215
+ await guild.client.rest.put(import_types38.Routes.guildBan(guild.id, userId), {
5989
6216
  body: Object.keys(body).length ? body : void 0,
5990
6217
  auth: true,
5991
6218
  ...auditReasonHeaders(options?.reason)
5992
6219
  });
5993
6220
  }
5994
6221
  async function fetchBan(guild, userId) {
5995
- const data = await guild.client.rest.get(import_types37.Routes.guildBan(guild.id, userId));
6222
+ const data = await guild.client.rest.get(import_types38.Routes.guildBan(guild.id, userId));
5996
6223
  return new GuildBan(guild.client, { ...data, guild_id: guild.id }, guild.id);
5997
6224
  }
5998
6225
  async function fetchBans(guild) {
5999
- const data = await guild.client.rest.get(import_types37.Routes.guildBans(guild.id));
6226
+ const data = await guild.client.rest.get(import_types38.Routes.guildBans(guild.id));
6000
6227
  return data.map((b) => new GuildBan(guild.client, { ...b, guild_id: guild.id }, guild.id));
6001
6228
  }
6002
6229
  async function unban(guild, userId, reason) {
6003
- await guild.client.rest.delete(import_types37.Routes.guildBan(guild.id, userId), {
6230
+ await guild.client.rest.delete(import_types38.Routes.guildBan(guild.id, userId), {
6004
6231
  auth: true,
6005
6232
  ...auditReasonHeaders(reason)
6006
6233
  });
6007
6234
  }
6008
6235
  async function kick(guild, userId, reason) {
6009
- await guild.client.rest.delete(import_types37.Routes.guildMember(guild.id, userId), {
6236
+ await guild.client.rest.delete(import_types38.Routes.guildMember(guild.id, userId), {
6010
6237
  auth: true,
6011
6238
  ...auditReasonHeaders(reason)
6012
6239
  });
6013
6240
  }
6014
6241
 
6015
6242
  // src/Domain/Guild/Roles.ts
6016
- var import_types38 = require("@fluxerjs/types");
6017
- var import_util21 = require("@fluxerjs/util");
6243
+ var import_types39 = require("@fluxerjs/types");
6244
+ var import_util22 = require("@fluxerjs/util");
6018
6245
  async function createRole(guild, options = {}) {
6019
6246
  const body = toRoleCreateBody(options);
6020
- const data = await guild.client.rest.post(import_types38.Routes.guildRoles(guild.id), {
6247
+ const data = await guild.client.rest.post(import_types39.Routes.guildRoles(guild.id), {
6021
6248
  body: Object.keys(body).length ? body : void 0,
6022
6249
  auth: true,
6023
6250
  ...auditReasonHeaders(options.reason)
@@ -6025,14 +6252,14 @@ async function createRole(guild, options = {}) {
6025
6252
  return cacheRole(guild, data);
6026
6253
  }
6027
6254
  async function fetchRoles(guild) {
6028
- const data = await guild.client.rest.get(import_types38.Routes.guildRoles(guild.id));
6255
+ const data = await guild.client.rest.get(import_types39.Routes.guildRoles(guild.id));
6029
6256
  if (!Array.isArray(data))
6030
6257
  throw new TypeError("guild.fetchRoles() received an invalid API payload (expected an array)");
6031
6258
  return data.map((r) => cacheRole(guild, r));
6032
6259
  }
6033
6260
  async function fetchRole(guild, roleId2) {
6034
6261
  try {
6035
- const data = await guild.client.rest.get(import_types38.Routes.guildRole(guild.id, roleId2));
6262
+ const data = await guild.client.rest.get(import_types39.Routes.guildRole(guild.id, roleId2));
6036
6263
  return cacheRole(guild, data);
6037
6264
  } catch (err) {
6038
6265
  rethrowMapped(err, {
@@ -6042,14 +6269,14 @@ async function fetchRole(guild, roleId2) {
6042
6269
  }
6043
6270
  }
6044
6271
  async function resolveRoleId(guild, arg) {
6045
- const parsed = (0, import_util21.parseRoleMention)(arg);
6272
+ const parsed = (0, import_util22.parseRoleMention)(arg);
6046
6273
  if (parsed) return parsed;
6047
6274
  const trimmed = arg.trim();
6048
6275
  if (/^\d{17,19}$/.test(trimmed)) return trimmed;
6049
6276
  const needle = trimmed.toLowerCase();
6050
6277
  const cached = guild.roles.find((r) => r.name?.toLowerCase() === needle);
6051
6278
  if (cached) return cached.id;
6052
- const roles = await guild.client.rest.get(import_types38.Routes.guildRoles(guild.id));
6279
+ const roles = await guild.client.rest.get(import_types39.Routes.guildRoles(guild.id));
6053
6280
  const role = roles.find((r) => r.name?.toLowerCase() === needle);
6054
6281
  if (!role) return null;
6055
6282
  cacheRole(guild, role);
@@ -6058,7 +6285,7 @@ async function resolveRoleId(guild, arg) {
6058
6285
  async function setRolePositions(guild, updates) {
6059
6286
  return replaceRoles(
6060
6287
  guild,
6061
- await guild.client.rest.patch(import_types38.Routes.guildRoles(guild.id), {
6288
+ await guild.client.rest.patch(import_types39.Routes.guildRoles(guild.id), {
6062
6289
  body: updates,
6063
6290
  auth: true
6064
6291
  })
@@ -6067,7 +6294,7 @@ async function setRolePositions(guild, updates) {
6067
6294
  async function setRoleHoistPositions(guild, updates) {
6068
6295
  return replaceRoles(
6069
6296
  guild,
6070
- await guild.client.rest.patch(import_types38.Routes.guildRolesHoistPositions(guild.id), {
6297
+ await guild.client.rest.patch(import_types39.Routes.guildRolesHoistPositions(guild.id), {
6071
6298
  body: updates.map((u) => ({
6072
6299
  id: u.id,
6073
6300
  ...u.hoistPosition !== void 0 ? { hoist_position: u.hoistPosition } : {}
@@ -6079,17 +6306,17 @@ async function setRoleHoistPositions(guild, updates) {
6079
6306
  async function resetRoleHoistPositions(guild) {
6080
6307
  return replaceRoles(
6081
6308
  guild,
6082
- await guild.client.rest.delete(import_types38.Routes.guildRolesHoistPositions(guild.id), {
6309
+ await guild.client.rest.delete(import_types39.Routes.guildRolesHoistPositions(guild.id), {
6083
6310
  auth: true
6084
6311
  })
6085
6312
  );
6086
6313
  }
6087
6314
 
6088
6315
  // src/Domain/Guild/Stickers.ts
6089
- var import_types39 = require("@fluxerjs/types");
6316
+ var import_types40 = require("@fluxerjs/types");
6090
6317
  async function createSticker(guild, options) {
6091
6318
  const { reason, ...body } = options;
6092
- const data = await guild.client.rest.post(import_types39.Routes.guildStickers(guild.id), {
6319
+ const data = await guild.client.rest.post(import_types40.Routes.guildStickers(guild.id), {
6093
6320
  body,
6094
6321
  auth: true,
6095
6322
  ...auditReasonHeaders(reason)
@@ -6097,7 +6324,7 @@ async function createSticker(guild, options) {
6097
6324
  return cacheSticker(guild, data);
6098
6325
  }
6099
6326
  async function cloneSticker(guild, sourceStickerId) {
6100
- const data = await guild.client.rest.post(import_types39.Routes.guildStickersClone(guild.id), {
6327
+ const data = await guild.client.rest.post(import_types40.Routes.guildStickersClone(guild.id), {
6101
6328
  body: { source_sticker_id: sourceStickerId },
6102
6329
  auth: true
6103
6330
  });
@@ -6105,17 +6332,17 @@ async function cloneSticker(guild, sourceStickerId) {
6105
6332
  }
6106
6333
  async function createStickersBulk(guild, stickers) {
6107
6334
  const data = await guild.client.rest.post(
6108
- import_types39.Routes.guildStickersBulk(guild.id),
6335
+ import_types40.Routes.guildStickersBulk(guild.id),
6109
6336
  { body: { stickers }, auth: true }
6110
6337
  );
6111
6338
  return { success: data.success.map((s) => cacheSticker(guild, s)), failed: data.failed };
6112
6339
  }
6113
6340
  async function fetchStickers(guild) {
6114
- const data = await guild.client.rest.get(import_types39.Routes.guildStickers(guild.id));
6341
+ const data = await guild.client.rest.get(import_types40.Routes.guildStickers(guild.id));
6115
6342
  return data.map((s) => cacheSticker(guild, s));
6116
6343
  }
6117
6344
  async function fetchSticker(guild, stickerId) {
6118
- const data = await guild.client.rest.get(import_types39.Routes.guildSticker(guild.id, stickerId));
6345
+ const data = await guild.client.rest.get(import_types40.Routes.guildSticker(guild.id, stickerId));
6119
6346
  return cacheSticker(guild, data);
6120
6347
  }
6121
6348
 
@@ -6204,6 +6431,10 @@ var Guild = class extends Base {
6204
6431
  emojis;
6205
6432
  /** Cached stickers in this guild. */
6206
6433
  stickers;
6434
+ /** Live stages in this guild's stage channels, keyed by stage instance ID. */
6435
+ stageInstances;
6436
+ /** Most participants a stage can have while speakers use video, or null if unknown. */
6437
+ maxStageVideoChannelUsers;
6207
6438
  /**
6208
6439
  * Construct a guild from API data.
6209
6440
  * @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE
@@ -6220,6 +6451,7 @@ var Guild = class extends Base {
6220
6451
  this.roles = new GuildRoleManager(this.id, { maxSize: client.cache.limits.roles });
6221
6452
  this.emojis = new import_collection12.LimitedCollection({ maxSize: client.cache.limits.emojis });
6222
6453
  this.stickers = new import_collection12.LimitedCollection({ maxSize: client.cache.limits.stickers });
6454
+ this.stageInstances = new import_collection12.Collection();
6223
6455
  this.name = data.name ?? "";
6224
6456
  this.icon = data.icon ?? null;
6225
6457
  this.banner = data.banner ?? null;
@@ -6237,7 +6469,7 @@ var Guild = class extends Base {
6237
6469
  this.systemChannelFlags = data.system_channel_flags ?? 0;
6238
6470
  this.splashCardAlignment = data.splash_card_alignment ?? 0;
6239
6471
  this.embedSplash = data.embed_splash ?? null;
6240
- this.nsfwLevel = data.nsfw_level ?? import_types40.GuildNSFWLevel.Safe;
6472
+ this.nsfwLevel = data.nsfw_level ?? import_types41.GuildNSFWLevel.Safe;
6241
6473
  this.nsfw = data.nsfw ?? false;
6242
6474
  this.contentWarningLevel = data.content_warning_level ?? 0;
6243
6475
  this.contentWarningText = data.content_warning_text ?? null;
@@ -6249,6 +6481,7 @@ var Guild = class extends Base {
6249
6481
  this.bannerHeight = data.banner_height ?? null;
6250
6482
  this.splashWidth = data.splash_width ?? null;
6251
6483
  this.splashHeight = data.splash_height ?? null;
6484
+ this.maxStageVideoChannelUsers = data.max_stage_video_channel_users ?? null;
6252
6485
  this.memberCount = resolveGuildMemberCount(data) ?? null;
6253
6486
  this.onlineCount = resolveGuildOnlineCount(data) ?? null;
6254
6487
  for (const r of data.roles ?? []) {
@@ -6285,7 +6518,7 @@ var Guild = class extends Base {
6285
6518
  this.splashCardAlignment = data.splash_card_alignment ?? 0;
6286
6519
  }
6287
6520
  if (data.embed_splash !== void 0) this.embedSplash = data.embed_splash ?? null;
6288
- if (data.nsfw_level !== void 0) this.nsfwLevel = data.nsfw_level ?? import_types40.GuildNSFWLevel.Safe;
6521
+ if (data.nsfw_level !== void 0) this.nsfwLevel = data.nsfw_level ?? import_types41.GuildNSFWLevel.Safe;
6289
6522
  if (data.nsfw !== void 0) this.nsfw = data.nsfw ?? false;
6290
6523
  if (data.content_warning_level !== void 0) {
6291
6524
  this.contentWarningLevel = data.content_warning_level ?? 0;
@@ -6305,6 +6538,9 @@ var Guild = class extends Base {
6305
6538
  if (data.banner_height !== void 0) this.bannerHeight = data.banner_height ?? null;
6306
6539
  if (data.splash_width !== void 0) this.splashWidth = data.splash_width ?? null;
6307
6540
  if (data.splash_height !== void 0) this.splashHeight = data.splash_height ?? null;
6541
+ if (data.max_stage_video_channel_users !== void 0) {
6542
+ this.maxStageVideoChannelUsers = data.max_stage_video_channel_users ?? null;
6543
+ }
6308
6544
  const memberCount = resolveGuildMemberCount(data);
6309
6545
  if (memberCount !== void 0) this.memberCount = memberCount;
6310
6546
  const onlineCount = resolveGuildOnlineCount(data);
@@ -6320,11 +6556,11 @@ var Guild = class extends Base {
6320
6556
  }
6321
6557
  /** Unix timestamp (ms) when this guild was created, derived from its snowflake ID. */
6322
6558
  get createdTimestamp() {
6323
- return import_util22.SnowflakeUtil.timestampFromSnowflake(this.id);
6559
+ return import_util23.SnowflakeUtil.timestampFromSnowflake(this.id);
6324
6560
  }
6325
6561
  /** Date when this guild was created, derived from its snowflake ID. */
6326
6562
  get createdAt() {
6327
- return import_util22.SnowflakeUtil.dateFromSnowflake(this.id);
6563
+ return import_util23.SnowflakeUtil.dateFromSnowflake(this.id);
6328
6564
  }
6329
6565
  /** The guild's name. */
6330
6566
  toString() {
@@ -6525,7 +6761,7 @@ var Guild = class extends Base {
6525
6761
  };
6526
6762
 
6527
6763
  // src/Domain/Guild/Payload.ts
6528
- var import_util23 = require("@fluxerjs/util");
6764
+ var import_util24 = require("@fluxerjs/util");
6529
6765
  var TOP_LEVEL_COUNT_KEYS = [
6530
6766
  "member_count",
6531
6767
  "online_count",
@@ -6565,10 +6801,10 @@ function mergeTopLevelSnapshotFields(properties, raw) {
6565
6801
  return out;
6566
6802
  }
6567
6803
  function normalizeGuildSnapshotPayload(raw) {
6568
- if (!(0, import_util23.isRecord)(raw)) return null;
6804
+ if (!(0, import_util24.isRecord)(raw)) return null;
6569
6805
  const flatPayload = isHydratableGuildPayload(raw) && (raw.roles === void 0 || Array.isArray(raw.roles)) ? raw : null;
6570
6806
  let nestedPayload = null;
6571
- if (Object.hasOwn(raw, "properties") && (0, import_util23.isRecord)(raw.properties)) {
6807
+ if (Object.hasOwn(raw, "properties") && (0, import_util24.isRecord)(raw.properties)) {
6572
6808
  const properties = raw.properties;
6573
6809
  const rolesValid = raw.roles === void 0 || Array.isArray(raw.roles);
6574
6810
  if (rolesValid && isHydratableGuildPayload(properties) && raw.id === properties.id) {
@@ -6580,7 +6816,7 @@ function normalizeGuildSnapshotPayload(raw) {
6580
6816
  return flatPayload ?? nestedPayload;
6581
6817
  }
6582
6818
  function normalizeGuildUpdatePayload(raw) {
6583
- if (!(0, import_util23.isRecord)(raw) || !isValidGuildPayload(raw)) return null;
6819
+ if (!(0, import_util24.isRecord)(raw) || !isValidGuildPayload(raw)) return null;
6584
6820
  return raw;
6585
6821
  }
6586
6822
 
@@ -6610,6 +6846,8 @@ function upsertGuildFromSnapshot(client, guildData, resources = {}) {
6610
6846
  if (resources.members !== void 0) mergeMembers(guild, resources.members);
6611
6847
  if (resources.emojis !== void 0) syncEmojis(guild, resources.emojis);
6612
6848
  if (resources.stickers !== void 0) syncStickers(guild, resources.stickers);
6849
+ if (resources.stageInstances !== void 0) syncStageInstances(guild, resources.stageInstances);
6850
+ if (resources.stageCounts !== void 0) applyStageCounts(guild, resources.stageCounts);
6613
6851
  if (resources.channels !== void 0) guild.partial = false;
6614
6852
  return { guild, created, recovered };
6615
6853
  }
@@ -6624,7 +6862,9 @@ function applyGuildSnapshotFromGateway(client, raw) {
6624
6862
  emojis: g.emojis,
6625
6863
  stickers: g.stickers,
6626
6864
  // A channel list without `threads` means this session has no viewable threads.
6627
- threads: g.channels !== void 0 ? g.threads ?? [] : g.threads
6865
+ threads: g.channels !== void 0 ? g.threads ?? [] : g.threads,
6866
+ stageInstances: g.stage_instances,
6867
+ stageCounts: g.stage_counts
6628
6868
  });
6629
6869
  if (g.voice_states?.length) {
6630
6870
  client.emit(Events.VoiceStatesSync, {
@@ -6636,23 +6876,23 @@ function applyGuildSnapshotFromGateway(client, raw) {
6636
6876
  }
6637
6877
 
6638
6878
  // src/ClientCore/ClientUser.ts
6639
- var import_types41 = require("@fluxerjs/types");
6879
+ var import_types42 = require("@fluxerjs/types");
6640
6880
  var ClientUser = class extends User {
6641
6881
  /** Broadcast presence (gateway opcode 3) on all shards. */
6642
6882
  setPresence(presence) {
6643
6883
  this.client.options.presence = presence;
6644
6884
  const wire = toPresenceWire(presence);
6645
- this.client._sendToAllShards({ op: import_types41.GatewayOpcodes.PresenceUpdate, d: wire });
6885
+ this.client._sendToAllShards({ op: import_types42.GatewayOpcodes.PresenceUpdate, d: wire });
6646
6886
  }
6647
6887
  /** GET /users/@me — refresh the logged-in user from REST and patch this instance. */
6648
6888
  async fetch() {
6649
- const data = await this.client.rest.get(import_types41.Routes.currentUser(), { auth: true });
6889
+ const data = await this.client.rest.get(import_types42.Routes.currentUser(), { auth: true });
6650
6890
  this._patch(data);
6651
6891
  return this;
6652
6892
  }
6653
6893
  /** GET /users/@me/guilds — returns camelCase partial guilds. */
6654
6894
  async fetchGuilds(options) {
6655
- const path = import_types41.Routes.currentUserGuilds() + (options?.withCounts ? "?with_counts=true" : "");
6895
+ const path = import_types42.Routes.currentUserGuilds() + (options?.withCounts ? "?with_counts=true" : "");
6656
6896
  const data = await this.client.rest.get(path, { auth: true });
6657
6897
  return data.map((g) => ({
6658
6898
  id: g.id,
@@ -6676,7 +6916,7 @@ var ClientUser = class extends User {
6676
6916
  */
6677
6917
  async leaveGuild(guildId, options) {
6678
6918
  const body = options ? toSudoBody(options) : void 0;
6679
- await this.client.rest.delete(import_types41.Routes.leaveGuild(guildId), {
6919
+ await this.client.rest.delete(import_types42.Routes.leaveGuild(guildId), {
6680
6920
  body: body && Object.keys(body).length ? body : void 0,
6681
6921
  auth: true
6682
6922
  });
@@ -6684,7 +6924,7 @@ var ClientUser = class extends User {
6684
6924
  /** Delete every message authored by the caller across a guild (sudo). */
6685
6925
  async bulkDeleteMyMessagesInGuild(guildId, options) {
6686
6926
  const body = options ? toSudoBody(options) : void 0;
6687
- await this.client.rest.post(import_types41.Routes.guildBulkDeleteMine(guildId), {
6927
+ await this.client.rest.post(import_types42.Routes.guildBulkDeleteMine(guildId), {
6688
6928
  body: body && Object.keys(body).length ? body : void 0,
6689
6929
  auth: true
6690
6930
  });
@@ -6692,7 +6932,7 @@ var ClientUser = class extends User {
6692
6932
  };
6693
6933
 
6694
6934
  // src/ClientCore/EventHandlers/Helpers.ts
6695
- var import_util24 = require("@fluxerjs/util");
6935
+ var import_util25 = require("@fluxerjs/util");
6696
6936
  function unknownUser(id) {
6697
6937
  return { id };
6698
6938
  }
@@ -6999,50 +7239,50 @@ var guildHandlers = {
6999
7239
  };
7000
7240
 
7001
7241
  // src/ClientCore/EventHandlers/Invites.ts
7002
- var import_types42 = require("@fluxerjs/types");
7242
+ var import_types43 = require("@fluxerjs/types");
7003
7243
  function normalizeInviteCreate(client, payload) {
7004
- const raw = (0, import_util24.asRecord)(payload);
7005
- const code = (0, import_util24.str)(raw?.code);
7244
+ const raw = (0, import_util25.asRecord)(payload);
7245
+ const code = (0, import_util25.str)(raw?.code);
7006
7246
  if (!raw || !code) return null;
7007
- const typeNum = (0, import_util24.num)(raw.type);
7008
- const type = typeNum === import_types42.InviteType.GroupDM ? import_types42.InviteType.GroupDM : import_types42.InviteType.Guild;
7247
+ const typeNum = (0, import_util25.num)(raw.type);
7248
+ const type = typeNum === import_types43.InviteType.GroupDM ? import_types43.InviteType.GroupDM : import_types43.InviteType.Guild;
7009
7249
  const shared = {
7010
7250
  code,
7011
7251
  inviter: raw.inviter ?? null,
7012
- member_count: (0, import_util24.num)(raw.member_count),
7252
+ member_count: (0, import_util25.num)(raw.member_count),
7013
7253
  expires_at: raw.expires_at ?? void 0,
7014
7254
  temporary: typeof raw.temporary === "boolean" ? raw.temporary : void 0,
7015
- created_at: (0, import_util24.str)(raw.created_at),
7016
- uses: (0, import_util24.num)(raw.uses),
7017
- max_uses: (0, import_util24.num)(raw.max_uses),
7018
- max_age: (0, import_util24.num)(raw.max_age)
7255
+ created_at: (0, import_util25.str)(raw.created_at),
7256
+ uses: (0, import_util25.num)(raw.uses),
7257
+ max_uses: (0, import_util25.num)(raw.max_uses),
7258
+ max_age: (0, import_util25.num)(raw.max_age)
7019
7259
  };
7020
- const guildObj = (0, import_util24.asRecord)(raw.guild);
7021
- const channelObj = (0, import_util24.asRecord)(raw.channel);
7022
- const guildId = (0, import_util24.str)(guildObj?.id) ?? (0, import_util24.str)(raw.guild_id) ?? "0";
7023
- const channelId = (0, import_util24.str)(channelObj?.id) ?? (0, import_util24.str)(raw.channel_id) ?? "0";
7260
+ const guildObj = (0, import_util25.asRecord)(raw.guild);
7261
+ const channelObj = (0, import_util25.asRecord)(raw.channel);
7262
+ const guildId = (0, import_util25.str)(guildObj?.id) ?? (0, import_util25.str)(raw.guild_id) ?? "0";
7263
+ const channelId = (0, import_util25.str)(channelObj?.id) ?? (0, import_util25.str)(raw.channel_id) ?? "0";
7024
7264
  const cachedGuild = guildId !== "0" ? client.guilds.get(guildId) : null;
7025
7265
  const cachedChannel2 = channelId !== "0" ? client.channels.get(channelId) : null;
7026
7266
  const channel = {
7027
7267
  id: channelId,
7028
- type: (0, import_util24.num)(channelObj?.type) ?? cachedChannel2?.type ?? import_types42.ChannelType.GuildText,
7029
- name: (0, import_util24.str)(channelObj?.name) ?? cachedChannel2?.name ?? null,
7268
+ type: (0, import_util25.num)(channelObj?.type) ?? cachedChannel2?.type ?? import_types43.ChannelType.GuildText,
7269
+ name: (0, import_util25.str)(channelObj?.name) ?? cachedChannel2?.name ?? null,
7030
7270
  icon: channelObj?.icon ?? null
7031
7271
  };
7032
- if (type === import_types42.InviteType.GroupDM) return { ...shared, type, channel };
7272
+ if (type === import_types43.InviteType.GroupDM) return { ...shared, type, channel };
7033
7273
  return {
7034
7274
  ...shared,
7035
- type: import_types42.InviteType.Guild,
7275
+ type: import_types43.InviteType.Guild,
7036
7276
  guild: {
7037
7277
  id: guildId,
7038
- name: (0, import_util24.str)(guildObj?.name) ?? cachedGuild?.name ?? "Unknown Guild",
7278
+ name: (0, import_util25.str)(guildObj?.name) ?? cachedGuild?.name ?? "Unknown Guild",
7039
7279
  icon: guildObj?.icon ?? null,
7040
7280
  banner: guildObj?.banner ?? null,
7041
7281
  splash: guildObj?.splash ?? null,
7042
7282
  features: Array.isArray(guildObj?.features) ? guildObj.features : void 0
7043
7283
  },
7044
7284
  channel,
7045
- presence_count: (0, import_util24.num)(raw.presence_count)
7285
+ presence_count: (0, import_util25.num)(raw.presence_count)
7046
7286
  };
7047
7287
  }
7048
7288
  var inviteHandlers = {
@@ -7153,7 +7393,7 @@ var memberHandlers = {
7153
7393
  };
7154
7394
 
7155
7395
  // src/ClientCore/EventHandlers/Messages.ts
7156
- var import_util25 = require("@fluxerjs/util");
7396
+ var import_util26 = require("@fluxerjs/util");
7157
7397
  function cachedTextChannel(client, channelId) {
7158
7398
  const channel = client.channels.get(channelId);
7159
7399
  return channel?.isTextBased() ? channel : null;
@@ -7169,7 +7409,7 @@ function toPartialMessage(client, args) {
7169
7409
  const cached = args.cached;
7170
7410
  const authorId = args.authorId ?? cached?.author?.id ?? null;
7171
7411
  const author = cached?.author ? client.getOrCreateUser(cached.author) : authorId ? client.users.get(authorId) ?? null : null;
7172
- const createdAt = cached?.timestamp ? new Date(cached.timestamp) : import_util25.SnowflakeUtil.isValid(args.id) ? import_util25.SnowflakeUtil.dateFromSnowflake(args.id) : null;
7412
+ const createdAt = cached?.timestamp ? new Date(cached.timestamp) : import_util26.SnowflakeUtil.isValid(args.id) ? import_util26.SnowflakeUtil.dateFromSnowflake(args.id) : null;
7173
7413
  return new PartialMessage(client, {
7174
7414
  id: args.id,
7175
7415
  channelId: args.channelId,
@@ -7433,6 +7673,46 @@ var passthroughHandlers = {
7433
7673
  WEBAUTHN_CREDENTIALS_UPDATE: pass(Events.WebAuthnCredentialsUpdate)
7434
7674
  };
7435
7675
 
7676
+ // src/ClientCore/EventHandlers/Stages.ts
7677
+ var stageHandlers = {
7678
+ STAGE_INSTANCE_CREATE(client, d) {
7679
+ const instance = cacheStageInstance(client, d);
7680
+ client.emit(Events.StageInstanceCreate, instance);
7681
+ },
7682
+ STAGE_INSTANCE_UPDATE(client, d) {
7683
+ const data = d;
7684
+ const cached = client.guilds.get(data.guild_id)?.stageInstances.get(data.id);
7685
+ const old = cached ? new StageInstance(client, cached.toJSON()) : null;
7686
+ const instance = cacheStageInstance(client, data);
7687
+ client.emit(Events.StageInstanceUpdate, old, instance);
7688
+ },
7689
+ STAGE_INSTANCE_DELETE(client, d) {
7690
+ const data = d;
7691
+ const guild = client.guilds.get(data.guild_id);
7692
+ const instance = guild?.stageInstances.get(data.id) ?? new StageInstance(client, data);
7693
+ instance._patch(data);
7694
+ guild?.stageInstances.delete(data.id);
7695
+ client.emit(Events.StageInstanceDelete, instance);
7696
+ },
7697
+ STAGE_COUNTS_UPDATE(client, d) {
7698
+ const data = d;
7699
+ const channel = client.channels.get(data.channel_id);
7700
+ if (channel?.isStage()) channel._patchCounts(data);
7701
+ const payload = {
7702
+ guildId: data.guild_id,
7703
+ channelId: data.channel_id,
7704
+ listenerCount: data.listener_count,
7705
+ speakerCount: data.speaker_count,
7706
+ requestCount: data.request_count,
7707
+ videoEnabled: data.video_enabled ?? null
7708
+ };
7709
+ client.emit(Events.StageCountsUpdate, payload);
7710
+ },
7711
+ STAGE_VOICE_STATES_SYNC: pass(Events.StageVoiceStatesSync),
7712
+ STAGE_AUDIENCE_LIST_UPDATE: pass(Events.StageAudienceListUpdate),
7713
+ VOICE_JOIN_QUEUED: pass(Events.VoiceJoinQueued)
7714
+ };
7715
+
7436
7716
  // src/ClientCore/EventHandlers/Threads.ts
7437
7717
  function cachedChannel(client, id) {
7438
7718
  const direct = client.channels.get(id);
@@ -7543,7 +7823,8 @@ var eventHandlers = buildRegistry(
7543
7823
  inviteHandlers,
7544
7824
  guildResourceHandlers,
7545
7825
  passthroughHandlers,
7546
- threadHandlers
7826
+ threadHandlers,
7827
+ stageHandlers
7547
7828
  );
7548
7829
 
7549
7830
  // src/ClientCore/GatewayDispatch.ts
@@ -7803,7 +8084,7 @@ async function connectClientGateway(client, token, signal) {
7803
8084
 
7804
8085
  // src/ClientCore/GuildManager.ts
7805
8086
  var import_collection13 = require("@fluxerjs/collection");
7806
- var import_types43 = require("@fluxerjs/types");
8087
+ var import_types44 = require("@fluxerjs/types");
7807
8088
  var GuildManager = class extends import_collection13.LimitedCollection {
7808
8089
  constructor(client) {
7809
8090
  super({
@@ -7863,7 +8144,7 @@ var GuildManager = class extends import_collection13.LimitedCollection {
7863
8144
  return dedupeFetch(this.pendingFetches, id, async () => {
7864
8145
  try {
7865
8146
  const data = assertApiObjectWithId(
7866
- await this.client.rest.get(import_types43.Routes.guild(id)),
8147
+ await this.client.rest.get(import_types44.Routes.guild(id)),
7867
8148
  "guilds.fetch()"
7868
8149
  );
7869
8150
  let guild;
@@ -7972,7 +8253,7 @@ var MessageCache = class {
7972
8253
 
7973
8254
  // src/ClientCore/UserManager.ts
7974
8255
  var import_collection14 = require("@fluxerjs/collection");
7975
- var import_types44 = require("@fluxerjs/types");
8256
+ var import_types45 = require("@fluxerjs/types");
7976
8257
  var soft = (p) => p.catch(() => null);
7977
8258
  var UserManager = class extends import_collection14.LimitedCollection {
7978
8259
  constructor(client) {
@@ -8006,7 +8287,7 @@ var UserManager = class extends import_collection14.LimitedCollection {
8006
8287
  id,
8007
8288
  async () => this.client.getOrCreateUser(
8008
8289
  assertApiObjectWithId(
8009
- await this.client.rest.get(import_types44.Routes.user(id)),
8290
+ await this.client.rest.get(import_types45.Routes.user(id)),
8010
8291
  "users.fetch()"
8011
8292
  )
8012
8293
  )
@@ -8029,10 +8310,10 @@ var UserManager = class extends import_collection14.LimitedCollection {
8029
8310
  async fetchWithProfile(userId, options) {
8030
8311
  const guildId = options?.guildId ?? void 0;
8031
8312
  const [userData, globalProfileRaw, serverProfileRaw, memberData] = await Promise.all([
8032
- this.client.rest.get(import_types44.Routes.user(userId)),
8033
- soft(this.client.rest.get(import_types44.Routes.userProfile(userId))),
8034
- guildId ? soft(this.client.rest.get(import_types44.Routes.userProfile(userId, guildId))) : null,
8035
- guildId ? soft(this.client.rest.get(import_types44.Routes.guildMember(guildId, userId))) : null
8313
+ this.client.rest.get(import_types45.Routes.user(userId)),
8314
+ soft(this.client.rest.get(import_types45.Routes.userProfile(userId))),
8315
+ guildId ? soft(this.client.rest.get(import_types45.Routes.userProfile(userId, guildId))) : null,
8316
+ guildId ? soft(this.client.rest.get(import_types45.Routes.guildMember(guildId, userId))) : null
8036
8317
  ]);
8037
8318
  const user = this.client.getOrCreateUser(userData);
8038
8319
  let member = null;
@@ -8119,7 +8400,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
8119
8400
  cache: resolved.cache,
8120
8401
  defaultReplyPing: options.defaultReplyPing ?? true
8121
8402
  };
8122
- this.logger = options.logger ?? (0, import_util26.createLogger)({
8403
+ this.logger = options.logger ?? (0, import_util27.createLogger)({
8123
8404
  level: options.logLevel ?? "warn"
8124
8405
  });
8125
8406
  this.cache = new CacheController(this, resolved.limits);
@@ -8413,7 +8694,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
8413
8694
  if (options.userIds !== void 0) data.user_ids = [...new Set(options.userIds)];
8414
8695
  if (options.presences !== void 0) data.presences = options.presences;
8415
8696
  if (options.nonce !== void 0) data.nonce = options.nonce;
8416
- this._sendToAllShards({ op: import_types45.GatewayOpcodes.RequestGuildMembers, d: data });
8697
+ this._sendToAllShards({ op: import_types46.GatewayOpcodes.RequestGuildMembers, d: data });
8417
8698
  }
8418
8699
  /**
8419
8700
  * Request guild member/online counts via gateway opcode 15.
@@ -8428,7 +8709,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
8428
8709
  }
8429
8710
  const data = { guild_ids: guildIds };
8430
8711
  if (options.nonce !== void 0) data.nonce = options.nonce;
8431
- this._sendToAllShards({ op: import_types45.GatewayOpcodes.RequestGuildCounts, d: data });
8712
+ this._sendToAllShards({ op: import_types46.GatewayOpcodes.RequestGuildCounts, d: data });
8432
8713
  }
8433
8714
  /**
8434
8715
  * Request per-channel member counts via gateway opcode 16.
@@ -8444,7 +8725,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
8444
8725
  if (options.channelId !== void 0) data.channel_id = options.channelId;
8445
8726
  if (options.channelIds !== void 0) data.channel_ids = [...new Set(options.channelIds)];
8446
8727
  if (options.nonce !== void 0) data.nonce = options.nonce;
8447
- this._sendToAllShards({ op: import_types45.GatewayOpcodes.RequestChannelMemberCounts, d: data });
8728
+ this._sendToAllShards({ op: import_types46.GatewayOpcodes.RequestChannelMemberCounts, d: data });
8448
8729
  }
8449
8730
  /**
8450
8731
  * Request unread counts for posts in one forum or media channel (opcode 28).
@@ -8480,7 +8761,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
8480
8761
  channel_id: options.channelId,
8481
8762
  threads
8482
8763
  };
8483
- this._sendToAllShards({ op: import_types45.GatewayOpcodes.RequestForumUnreads, d: data });
8764
+ this._sendToAllShards({ op: import_types46.GatewayOpcodes.RequestForumUnreads, d: data });
8484
8765
  }
8485
8766
  /**
8486
8767
  * Subscribe to thread traffic in a guild (opcode 14).
@@ -8510,7 +8791,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
8510
8791
  subscription.thread_member_lists = threadIds;
8511
8792
  }
8512
8793
  const data = { subscriptions: { [options.guildId]: subscription } };
8513
- this._sendToAllShards({ op: import_types45.GatewayOpcodes.LazyRequest, d: data });
8794
+ this._sendToAllShards({ op: import_types46.GatewayOpcodes.LazyRequest, d: data });
8514
8795
  }
8515
8796
  /**
8516
8797
  * Broadcast a gateway payload to all shards.
@@ -8615,7 +8896,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
8615
8896
  * @see {@link Routes}
8616
8897
  */
8617
8898
  static get Routes() {
8618
- return import_types45.Routes;
8899
+ return import_types46.Routes;
8619
8900
  }
8620
8901
  };
8621
8902