@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/{SubpathMessage-BAwFSagN.d.mts → SubpathMessage-3ykAJr_F.d.mts} +165 -3
- package/dist/{SubpathMessage-Dq-1tI7E.d.ts → SubpathMessage-nY2WQ8V1.d.ts} +165 -3
- package/dist/client.d.mts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +522 -241
- package/dist/client.mjs +442 -161
- package/dist/cluster.d.mts +1 -1
- package/dist/cluster.d.ts +1 -1
- package/dist/cluster.js +522 -241
- package/dist/cluster.mjs +442 -161
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +563 -278
- package/dist/index.mjs +446 -163
- package/dist/message.d.mts +1 -1
- package/dist/message.d.ts +1 -1
- package/dist/message.js +18 -3
- package/dist/message.mjs +18 -3
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
OverwriteType as OverwriteType2,
|
|
25
25
|
PublicUserFlags,
|
|
26
26
|
RelationshipType,
|
|
27
|
-
Routes as
|
|
27
|
+
Routes as Routes39,
|
|
28
28
|
SplashCardAlignment,
|
|
29
29
|
SystemChannelFlags,
|
|
30
30
|
ThreadAutoArchiveDuration,
|
|
@@ -186,7 +186,7 @@ var CacheController = class {
|
|
|
186
186
|
|
|
187
187
|
// src/ClientCore/ChannelManager.ts
|
|
188
188
|
import { LimitedCollection } from "@fluxerjs/collection";
|
|
189
|
-
import { Routes as
|
|
189
|
+
import { Routes as Routes23 } from "@fluxerjs/types";
|
|
190
190
|
|
|
191
191
|
// src/Domain/Channel/Base.ts
|
|
192
192
|
import { ChannelType as ChannelType3, Routes as Routes7 } from "@fluxerjs/types";
|
|
@@ -1184,6 +1184,13 @@ var Events = {
|
|
|
1184
1184
|
VoiceSignal: "voiceSignal",
|
|
1185
1185
|
OperatorPassUpdate: "operatorPassUpdate",
|
|
1186
1186
|
VoiceStatesSync: "voiceStatesSync",
|
|
1187
|
+
VoiceJoinQueued: "voiceJoinQueued",
|
|
1188
|
+
StageInstanceCreate: "stageInstanceCreate",
|
|
1189
|
+
StageInstanceUpdate: "stageInstanceUpdate",
|
|
1190
|
+
StageInstanceDelete: "stageInstanceDelete",
|
|
1191
|
+
StageCountsUpdate: "stageCountsUpdate",
|
|
1192
|
+
StageVoiceStatesSync: "stageVoiceStatesSync",
|
|
1193
|
+
StageAudienceListUpdate: "stageAudienceListUpdate",
|
|
1187
1194
|
WebhooksUpdate: "webhooksUpdate",
|
|
1188
1195
|
Resumed: "resumed",
|
|
1189
1196
|
Error: "error",
|
|
@@ -2574,11 +2581,11 @@ var Channel = class extends Base {
|
|
|
2574
2581
|
* Checks {@link ChannelType}, not whether `send` exists on the instance.
|
|
2575
2582
|
*/
|
|
2576
2583
|
isTextBased() {
|
|
2577
|
-
return this.type === ChannelType3.GuildText || this.type === ChannelType3.GuildAnnouncement || this.type === ChannelType3.GuildVoice || this.type === ChannelType3.DM || this.type === ChannelType3.GroupDM || this.type === ChannelType3.DMPersonalNotes || this.type === ChannelType3.AnnouncementThread || this.type === ChannelType3.PublicThread || this.type === ChannelType3.PrivateThread;
|
|
2584
|
+
return this.type === ChannelType3.GuildText || this.type === ChannelType3.GuildAnnouncement || this.type === ChannelType3.GuildVoice || this.type === ChannelType3.GuildStageVoice || this.type === ChannelType3.DM || this.type === ChannelType3.GroupDM || this.type === ChannelType3.DMPersonalNotes || this.type === ChannelType3.AnnouncementThread || this.type === ChannelType3.PublicThread || this.type === ChannelType3.PrivateThread;
|
|
2578
2585
|
}
|
|
2579
2586
|
/** Check if this is a guild channel, including threads, forums, and media channels. */
|
|
2580
2587
|
isGuild() {
|
|
2581
|
-
return this.type === ChannelType3.GuildText || this.type === ChannelType3.GuildAnnouncement || this.type === ChannelType3.GuildVoice || this.type === ChannelType3.GuildCategory || this.type === ChannelType3.GuildLink || this.type === ChannelType3.AnnouncementThread || this.type === ChannelType3.PublicThread || this.type === ChannelType3.PrivateThread || this.type === ChannelType3.GuildForum || this.type === ChannelType3.GuildMedia;
|
|
2588
|
+
return this.type === ChannelType3.GuildText || this.type === ChannelType3.GuildAnnouncement || this.type === ChannelType3.GuildVoice || this.type === ChannelType3.GuildStageVoice || this.type === ChannelType3.GuildCategory || this.type === ChannelType3.GuildLink || this.type === ChannelType3.AnnouncementThread || this.type === ChannelType3.PublicThread || this.type === ChannelType3.PrivateThread || this.type === ChannelType3.GuildForum || this.type === ChannelType3.GuildMedia;
|
|
2582
2589
|
}
|
|
2583
2590
|
/** Check if this is a thread (public, private, or announcement). */
|
|
2584
2591
|
isThread() {
|
|
@@ -2612,10 +2619,18 @@ var Channel = class extends Base {
|
|
|
2612
2619
|
isPersonalNotes() {
|
|
2613
2620
|
return this.type === ChannelType3.DMPersonalNotes;
|
|
2614
2621
|
}
|
|
2615
|
-
/** Check if this is a voice channel. */
|
|
2622
|
+
/** Check if this is a voice channel (type 2 only; see {@link isVoiceBased} to include stages). */
|
|
2616
2623
|
isVoice() {
|
|
2617
2624
|
return this.type === ChannelType3.GuildVoice;
|
|
2618
2625
|
}
|
|
2626
|
+
/** Check if this is a stage channel (type 13). */
|
|
2627
|
+
isStage() {
|
|
2628
|
+
return this.type === ChannelType3.GuildStageVoice;
|
|
2629
|
+
}
|
|
2630
|
+
/** Check if this is a voice or stage channel, i.e. one `@fluxerjs/voice` can join. */
|
|
2631
|
+
isVoiceBased() {
|
|
2632
|
+
return this.type === ChannelType3.GuildVoice || this.type === ChannelType3.GuildStageVoice;
|
|
2633
|
+
}
|
|
2619
2634
|
/** Check if this is a link channel. */
|
|
2620
2635
|
isLink() {
|
|
2621
2636
|
return this.type === ChannelType3.GuildLink;
|
|
@@ -2928,11 +2943,11 @@ var DMChannel = class extends TextCapable(Channel) {
|
|
|
2928
2943
|
// src/Domain/Channel/Forum.ts
|
|
2929
2944
|
import {
|
|
2930
2945
|
ChannelType as ChannelType7,
|
|
2931
|
-
Routes as
|
|
2946
|
+
Routes as Routes17
|
|
2932
2947
|
} from "@fluxerjs/types";
|
|
2933
2948
|
|
|
2934
2949
|
// src/Domain/Channel/Guild.ts
|
|
2935
|
-
import { Routes as
|
|
2950
|
+
import { Routes as Routes14 } from "@fluxerjs/types";
|
|
2936
2951
|
import { PermissionFlags } from "@fluxerjs/util";
|
|
2937
2952
|
|
|
2938
2953
|
// src/Domain/Invite.ts
|
|
@@ -3531,6 +3546,127 @@ var PermissionOverwriteManager = class {
|
|
|
3531
3546
|
}
|
|
3532
3547
|
};
|
|
3533
3548
|
|
|
3549
|
+
// src/Domain/StageInstance.ts
|
|
3550
|
+
import { Routes as Routes13, StageInstancePrivacyLevel } from "@fluxerjs/types";
|
|
3551
|
+
import { SnowflakeUtil as SnowflakeUtil5 } from "@fluxerjs/util";
|
|
3552
|
+
var StageInstance = class extends Base {
|
|
3553
|
+
client;
|
|
3554
|
+
id;
|
|
3555
|
+
guildId;
|
|
3556
|
+
channelId;
|
|
3557
|
+
topic;
|
|
3558
|
+
/** Always {@link StageInstancePrivacyLevel.GuildOnly} on Fluxer. */
|
|
3559
|
+
privacyLevel;
|
|
3560
|
+
/** Always `true` on Fluxer. */
|
|
3561
|
+
discoverableDisabled;
|
|
3562
|
+
/** Always null on Fluxer. */
|
|
3563
|
+
guildScheduledEventId;
|
|
3564
|
+
constructor(client, data) {
|
|
3565
|
+
super();
|
|
3566
|
+
this.client = client;
|
|
3567
|
+
this.id = data.id;
|
|
3568
|
+
this.guildId = data.guild_id;
|
|
3569
|
+
this.channelId = data.channel_id;
|
|
3570
|
+
this.topic = data.topic;
|
|
3571
|
+
this.privacyLevel = data.privacy_level ?? StageInstancePrivacyLevel.GuildOnly;
|
|
3572
|
+
this.discoverableDisabled = data.discoverable_disabled ?? true;
|
|
3573
|
+
this.guildScheduledEventId = data.guild_scheduled_event_id ?? null;
|
|
3574
|
+
}
|
|
3575
|
+
/** @internal Patch in place from a newer payload. */
|
|
3576
|
+
_patch(data) {
|
|
3577
|
+
if (data.topic !== void 0) this.topic = data.topic;
|
|
3578
|
+
if (data.privacy_level !== void 0) this.privacyLevel = data.privacy_level;
|
|
3579
|
+
if (data.discoverable_disabled !== void 0) {
|
|
3580
|
+
this.discoverableDisabled = data.discoverable_disabled;
|
|
3581
|
+
}
|
|
3582
|
+
if (data.guild_scheduled_event_id !== void 0) {
|
|
3583
|
+
this.guildScheduledEventId = data.guild_scheduled_event_id ?? null;
|
|
3584
|
+
}
|
|
3585
|
+
}
|
|
3586
|
+
get guild() {
|
|
3587
|
+
return this.client.guilds.get(this.guildId) ?? null;
|
|
3588
|
+
}
|
|
3589
|
+
get channel() {
|
|
3590
|
+
const channel = this.client.channels.get(this.channelId);
|
|
3591
|
+
return channel?.isStage() ? channel : null;
|
|
3592
|
+
}
|
|
3593
|
+
/** Unix timestamp (ms) when the stage started, from its snowflake ID. */
|
|
3594
|
+
get createdTimestamp() {
|
|
3595
|
+
return SnowflakeUtil5.timestampFromSnowflake(this.id);
|
|
3596
|
+
}
|
|
3597
|
+
get createdAt() {
|
|
3598
|
+
return SnowflakeUtil5.dateFromSnowflake(this.id);
|
|
3599
|
+
}
|
|
3600
|
+
/**
|
|
3601
|
+
* Change the live stage. Needs a stage moderator.
|
|
3602
|
+
* Fires `STAGE_INSTANCE_UPDATE`.
|
|
3603
|
+
*/
|
|
3604
|
+
async edit(options) {
|
|
3605
|
+
const body = {};
|
|
3606
|
+
if (options.topic !== void 0) body.topic = options.topic;
|
|
3607
|
+
const data = await this.client.rest.patch(
|
|
3608
|
+
Routes13.stageInstance(this.channelId),
|
|
3609
|
+
{ body, auth: true, ...auditReasonHeaders(options.reason) }
|
|
3610
|
+
);
|
|
3611
|
+
this._patch(data);
|
|
3612
|
+
return this;
|
|
3613
|
+
}
|
|
3614
|
+
/** Change the stage topic. Shorthand for {@link edit}. */
|
|
3615
|
+
async setTopic(topic, reason) {
|
|
3616
|
+
return this.edit({ topic, reason });
|
|
3617
|
+
}
|
|
3618
|
+
/**
|
|
3619
|
+
* End the stage. Needs a stage moderator. Speakers move to the audience, raised hands are
|
|
3620
|
+
* lowered, and everyone stays connected unless `disconnectAll` is set.
|
|
3621
|
+
*/
|
|
3622
|
+
async delete(options = {}) {
|
|
3623
|
+
const route = Routes13.stageInstance(this.channelId) + (options.disconnectAll ? "?disconnect_all=true" : "");
|
|
3624
|
+
await this.client.rest.delete(route, { auth: true, ...auditReasonHeaders(options.reason) });
|
|
3625
|
+
}
|
|
3626
|
+
toJSON() {
|
|
3627
|
+
return {
|
|
3628
|
+
id: this.id,
|
|
3629
|
+
guild_id: this.guildId,
|
|
3630
|
+
channel_id: this.channelId,
|
|
3631
|
+
topic: this.topic,
|
|
3632
|
+
privacy_level: this.privacyLevel,
|
|
3633
|
+
discoverable_disabled: this.discoverableDisabled,
|
|
3634
|
+
guild_scheduled_event_id: this.guildScheduledEventId
|
|
3635
|
+
};
|
|
3636
|
+
}
|
|
3637
|
+
};
|
|
3638
|
+
|
|
3639
|
+
// src/Domain/Channel/StageSync.ts
|
|
3640
|
+
function syncStageInstances(guild, instances) {
|
|
3641
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3642
|
+
for (const data of instances) {
|
|
3643
|
+
seen.add(data.id);
|
|
3644
|
+
const existing = guild.stageInstances.get(data.id);
|
|
3645
|
+
if (existing) existing._patch(data);
|
|
3646
|
+
else guild.stageInstances.set(data.id, new StageInstance(guild.client, data));
|
|
3647
|
+
}
|
|
3648
|
+
for (const id of [...guild.stageInstances.keys()]) {
|
|
3649
|
+
if (!seen.has(id)) guild.stageInstances.delete(id);
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
function applyStageCounts(guild, counts) {
|
|
3653
|
+
for (const count of counts) {
|
|
3654
|
+
const channel = guild.channels.get(count.channel_id);
|
|
3655
|
+
if (channel?.isStage()) channel._patchCounts(count);
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
function cacheStageInstance(client, data) {
|
|
3659
|
+
const guild = client.guilds.get(data.guild_id);
|
|
3660
|
+
const existing = guild?.stageInstances.get(data.id);
|
|
3661
|
+
if (existing) {
|
|
3662
|
+
existing._patch(data);
|
|
3663
|
+
return existing;
|
|
3664
|
+
}
|
|
3665
|
+
const instance = new StageInstance(client, data);
|
|
3666
|
+
guild?.stageInstances.set(instance.id, instance);
|
|
3667
|
+
return instance;
|
|
3668
|
+
}
|
|
3669
|
+
|
|
3534
3670
|
// src/Domain/Channel/ThreadBind.ts
|
|
3535
3671
|
var factory;
|
|
3536
3672
|
var managers = /* @__PURE__ */ new WeakMap();
|
|
@@ -3585,7 +3721,7 @@ var GuildChannel = class extends Channel {
|
|
|
3585
3721
|
}
|
|
3586
3722
|
/** Create a webhook for this channel. Requires Manage Webhooks. */
|
|
3587
3723
|
async createWebhook(options) {
|
|
3588
|
-
const data = await this.client.rest.post(
|
|
3724
|
+
const data = await this.client.rest.post(Routes14.channelWebhooks(this.id), {
|
|
3589
3725
|
body: options,
|
|
3590
3726
|
auth: true
|
|
3591
3727
|
});
|
|
@@ -3593,13 +3729,13 @@ var GuildChannel = class extends Channel {
|
|
|
3593
3729
|
}
|
|
3594
3730
|
/** Fetch all webhooks in this channel. Requires Manage Webhooks. */
|
|
3595
3731
|
async fetchWebhooks() {
|
|
3596
|
-
const data = await this.client.rest.get(
|
|
3732
|
+
const data = await this.client.rest.get(Routes14.channelWebhooks(this.id));
|
|
3597
3733
|
return data.map((w) => new Webhook(this.client, w));
|
|
3598
3734
|
}
|
|
3599
3735
|
/** Create an invite for this channel. Requires Create Instant Invite. */
|
|
3600
3736
|
async createInvite(options) {
|
|
3601
3737
|
const body = options ? toChannelInviteBody(options) : {};
|
|
3602
|
-
const data = await this.client.rest.post(
|
|
3738
|
+
const data = await this.client.rest.post(Routes14.channelInvites(this.id), {
|
|
3603
3739
|
body: Object.keys(body).length ? body : void 0,
|
|
3604
3740
|
auth: true
|
|
3605
3741
|
});
|
|
@@ -3607,7 +3743,7 @@ var GuildChannel = class extends Channel {
|
|
|
3607
3743
|
}
|
|
3608
3744
|
/** Fetch all invites for this channel. Requires Manage Channels. */
|
|
3609
3745
|
async fetchInvites() {
|
|
3610
|
-
const data = await this.client.rest.get(
|
|
3746
|
+
const data = await this.client.rest.get(Routes14.channelInvites(this.id));
|
|
3611
3747
|
return data.map((i) => new Invite(this.client, i));
|
|
3612
3748
|
}
|
|
3613
3749
|
/** Check if the bot can send messages in this channel (cache-only; needs `members.me`). */
|
|
@@ -3637,7 +3773,7 @@ var GuildChannel = class extends Channel {
|
|
|
3637
3773
|
}
|
|
3638
3774
|
/** Edit this channel's settings. Requires Manage Channels. */
|
|
3639
3775
|
async edit(options) {
|
|
3640
|
-
const data = await this.client.rest.patch(
|
|
3776
|
+
const data = await this.client.rest.patch(Routes14.channel(this.id), {
|
|
3641
3777
|
body: toChannelEditBody(options),
|
|
3642
3778
|
auth: true,
|
|
3643
3779
|
...auditReasonHeaders(options.reason)
|
|
@@ -3719,7 +3855,7 @@ var TextChannel = class extends TextCapable(GuildChannel) {
|
|
|
3719
3855
|
* Sends only those fields. The thread-parent update body does not accept a channel rename.
|
|
3720
3856
|
*/
|
|
3721
3857
|
async editThreadDefaults(options) {
|
|
3722
|
-
const data = await this.client.rest.patch(
|
|
3858
|
+
const data = await this.client.rest.patch(Routes14.channel(this.id), {
|
|
3723
3859
|
body: toThreadParentEditBody(options),
|
|
3724
3860
|
auth: true,
|
|
3725
3861
|
...auditReasonHeaders(options.reason)
|
|
@@ -3735,14 +3871,14 @@ var AnnouncementChannel = class extends TextChannel {
|
|
|
3735
3871
|
*/
|
|
3736
3872
|
async follow(webhookChannelId) {
|
|
3737
3873
|
return this.client.rest.post(
|
|
3738
|
-
|
|
3874
|
+
Routes14.channelFollowers(this.id),
|
|
3739
3875
|
{ body: { webhook_channel_id: webhookChannelId }, auth: true }
|
|
3740
3876
|
);
|
|
3741
3877
|
}
|
|
3742
3878
|
/** Fetch follower counts for this announcement channel. */
|
|
3743
3879
|
async fetchFollowerStats() {
|
|
3744
3880
|
return this.client.rest.get(
|
|
3745
|
-
|
|
3881
|
+
Routes14.channelFollowerStats(this.id),
|
|
3746
3882
|
{ auth: true }
|
|
3747
3883
|
);
|
|
3748
3884
|
}
|
|
@@ -3817,6 +3953,96 @@ var VoiceChannel = class extends TextCapable(GuildChannel) {
|
|
|
3817
3953
|
if ("rtc_p2p" in data) this.rtcP2p = data.rtc_p2p ?? false;
|
|
3818
3954
|
}
|
|
3819
3955
|
};
|
|
3956
|
+
var StageChannel = class extends VoiceChannel {
|
|
3957
|
+
/** Last known stage counts, or null until Fluxer sends them. */
|
|
3958
|
+
counts = null;
|
|
3959
|
+
/** The cached live stage of this channel, or null when the stage isn't live (or not cached). */
|
|
3960
|
+
get stageInstance() {
|
|
3961
|
+
const guild = this.client.guilds.get(this.guildId);
|
|
3962
|
+
if (!guild) return null;
|
|
3963
|
+
for (const instance of guild.stageInstances.values()) {
|
|
3964
|
+
if (instance.channelId === this.id) return instance;
|
|
3965
|
+
}
|
|
3966
|
+
return null;
|
|
3967
|
+
}
|
|
3968
|
+
/** Whether the stage is live according to the cache. */
|
|
3969
|
+
get isLive() {
|
|
3970
|
+
return this.stageInstance !== null;
|
|
3971
|
+
}
|
|
3972
|
+
/**
|
|
3973
|
+
* Start a stage in this channel. Needs a stage moderator (`MANAGE_CHANNELS`, `MUTE_MEMBERS` and
|
|
3974
|
+
* `MOVE_MEMBERS`). When the caller is connected to the stage, they become a speaker.
|
|
3975
|
+
*/
|
|
3976
|
+
async createStageInstance(options) {
|
|
3977
|
+
const body = { channel_id: this.id, topic: options.topic };
|
|
3978
|
+
if (options.sendStartNotification !== void 0) {
|
|
3979
|
+
body.send_start_notification = options.sendStartNotification;
|
|
3980
|
+
}
|
|
3981
|
+
const data = await this.client.rest.post(Routes14.stageInstances(), {
|
|
3982
|
+
body,
|
|
3983
|
+
auth: true,
|
|
3984
|
+
...auditReasonHeaders(options.reason)
|
|
3985
|
+
});
|
|
3986
|
+
return cacheStageInstance(this.client, data);
|
|
3987
|
+
}
|
|
3988
|
+
/** Fetch the live stage of this channel. Rejects with `UNKNOWN_STAGE_INSTANCE` when not live. */
|
|
3989
|
+
async fetchStageInstance() {
|
|
3990
|
+
const data = await this.client.rest.get(Routes14.stageInstance(this.id), {
|
|
3991
|
+
auth: true
|
|
3992
|
+
});
|
|
3993
|
+
return cacheStageInstance(this.client, data);
|
|
3994
|
+
}
|
|
3995
|
+
/**
|
|
3996
|
+
* Move a member (or yourself when `user` is omitted) between the audience and the speakers.
|
|
3997
|
+
*
|
|
3998
|
+
* - Yourself, `false`: become a speaker (needs `MUTE_MEMBERS`), or accept an open invite.
|
|
3999
|
+
* - Yourself, `true`: move to the audience, or decline an invite.
|
|
4000
|
+
* - Another member, `false`: invite them to speak (a bot becomes a speaker at once). Needs `MUTE_MEMBERS`.
|
|
4001
|
+
* - Another member, `true`: move them to the audience and clear a raised hand or invite.
|
|
4002
|
+
*/
|
|
4003
|
+
async setSuppressed(suppressed, user) {
|
|
4004
|
+
const userId = user === void 0 ? "@me" : typeof user === "string" ? user : user.id;
|
|
4005
|
+
const body = {
|
|
4006
|
+
channel_id: this.id,
|
|
4007
|
+
suppress: suppressed
|
|
4008
|
+
};
|
|
4009
|
+
await this.client.rest.patch(Routes14.guildVoiceState(this.guildId, userId), {
|
|
4010
|
+
body,
|
|
4011
|
+
auth: true
|
|
4012
|
+
});
|
|
4013
|
+
}
|
|
4014
|
+
/** Invite a member to speak (a bot becomes a speaker at once). Needs `MUTE_MEMBERS`. */
|
|
4015
|
+
async inviteToSpeak(user) {
|
|
4016
|
+
await this.setSuppressed(false, user);
|
|
4017
|
+
}
|
|
4018
|
+
/** Move a speaker (or yourself when `user` is omitted) to the audience. */
|
|
4019
|
+
async moveToAudience(user) {
|
|
4020
|
+
await this.setSuppressed(true, user);
|
|
4021
|
+
}
|
|
4022
|
+
/**
|
|
4023
|
+
* Raise (`true`) or lower (`false`) your hand. Raising needs a live stage and
|
|
4024
|
+
* `REQUEST_TO_SPEAK`; lowering also accepts an open invite to speak.
|
|
4025
|
+
*/
|
|
4026
|
+
async setRequestToSpeak(raised = true) {
|
|
4027
|
+
const body = {
|
|
4028
|
+
channel_id: this.id,
|
|
4029
|
+
request_to_speak_timestamp: raised ? (/* @__PURE__ */ new Date()).toISOString() : null
|
|
4030
|
+
};
|
|
4031
|
+
await this.client.rest.patch(Routes14.guildVoiceState(this.guildId, "@me"), {
|
|
4032
|
+
body,
|
|
4033
|
+
auth: true
|
|
4034
|
+
});
|
|
4035
|
+
}
|
|
4036
|
+
/** @internal Apply a stage count object. */
|
|
4037
|
+
_patchCounts(data) {
|
|
4038
|
+
this.counts = {
|
|
4039
|
+
listenerCount: data.listener_count,
|
|
4040
|
+
speakerCount: data.speaker_count,
|
|
4041
|
+
requestCount: data.request_count,
|
|
4042
|
+
videoEnabled: data.video_enabled ?? null
|
|
4043
|
+
};
|
|
4044
|
+
}
|
|
4045
|
+
};
|
|
3820
4046
|
var LinkChannel = class extends GuildChannel {
|
|
3821
4047
|
/** External URL this channel links to. */
|
|
3822
4048
|
url;
|
|
@@ -3830,10 +4056,10 @@ var LinkChannel = class extends GuildChannel {
|
|
|
3830
4056
|
};
|
|
3831
4057
|
|
|
3832
4058
|
// src/Domain/Channel/ThreadManager.ts
|
|
3833
|
-
import { ChannelType as ChannelType6, Routes as
|
|
4059
|
+
import { ChannelType as ChannelType6, Routes as Routes16 } from "@fluxerjs/types";
|
|
3834
4060
|
|
|
3835
4061
|
// src/Domain/Channel/ThreadChannel.ts
|
|
3836
|
-
import { ChannelType as ChannelType5, Routes as
|
|
4062
|
+
import { ChannelType as ChannelType5, Routes as Routes15 } from "@fluxerjs/types";
|
|
3837
4063
|
var ThreadMember = class {
|
|
3838
4064
|
/** Thread ID. */
|
|
3839
4065
|
id;
|
|
@@ -3960,7 +4186,7 @@ var ThreadChannel = class extends TextCapable(GuildChannel) {
|
|
|
3960
4186
|
* `appliedTags` is sent for public and announcement threads. `invitable` is sent for private threads.
|
|
3961
4187
|
*/
|
|
3962
4188
|
async edit(options) {
|
|
3963
|
-
const data = await this.client.rest.patch(
|
|
4189
|
+
const data = await this.client.rest.patch(Routes15.channel(this.id), {
|
|
3964
4190
|
body: toThreadEditBody(this.type, threadEditFields(options)),
|
|
3965
4191
|
auth: true,
|
|
3966
4192
|
...auditReasonHeaders(options.reason)
|
|
@@ -3978,16 +4204,16 @@ var ThreadChannel = class extends TextCapable(GuildChannel) {
|
|
|
3978
4204
|
}
|
|
3979
4205
|
/** Join this thread. */
|
|
3980
4206
|
async join() {
|
|
3981
|
-
await this.client.rest.put(
|
|
4207
|
+
await this.client.rest.put(Routes15.channelThreadMemberMe(this.id), { auth: true });
|
|
3982
4208
|
}
|
|
3983
4209
|
/** Leave this thread. */
|
|
3984
4210
|
async leave() {
|
|
3985
|
-
await this.client.rest.delete(
|
|
4211
|
+
await this.client.rest.delete(Routes15.channelThreadMemberMe(this.id), { auth: true });
|
|
3986
4212
|
}
|
|
3987
4213
|
/** Update the current user's notification settings for this thread. */
|
|
3988
4214
|
async editSelf(options) {
|
|
3989
4215
|
const data = await this.client.rest.patch(
|
|
3990
|
-
|
|
4216
|
+
Routes15.channelThreadMemberMeSettings(this.id),
|
|
3991
4217
|
{ body: toThreadMemberSettingsBody(options), auth: true }
|
|
3992
4218
|
);
|
|
3993
4219
|
this.member = data ? new ThreadMember(data) : null;
|
|
@@ -4001,7 +4227,7 @@ var ThreadMemberManager = class {
|
|
|
4001
4227
|
/** List members of this thread. */
|
|
4002
4228
|
async fetch(options) {
|
|
4003
4229
|
const data = await this.thread.client.rest.get(
|
|
4004
|
-
withQuery(
|
|
4230
|
+
withQuery(Routes15.channelThreadMembers(this.thread.id), {
|
|
4005
4231
|
with_member: options?.withMember === void 0 ? void 0 : String(options.withMember),
|
|
4006
4232
|
after: options?.after,
|
|
4007
4233
|
limit: options?.limit
|
|
@@ -4012,7 +4238,7 @@ var ThreadMemberManager = class {
|
|
|
4012
4238
|
/** Fetch one member of this thread. */
|
|
4013
4239
|
async fetchOne(userId, options) {
|
|
4014
4240
|
const data = await this.thread.client.rest.get(
|
|
4015
|
-
withQuery(
|
|
4241
|
+
withQuery(Routes15.channelThreadMember(this.thread.id, userId), {
|
|
4016
4242
|
with_member: options?.withMember === void 0 ? void 0 : String(options.withMember)
|
|
4017
4243
|
})
|
|
4018
4244
|
);
|
|
@@ -4020,13 +4246,13 @@ var ThreadMemberManager = class {
|
|
|
4020
4246
|
}
|
|
4021
4247
|
/** Add a user to this thread. Private threads only, unless the caller can manage the parent. */
|
|
4022
4248
|
async add(userId) {
|
|
4023
|
-
await this.thread.client.rest.put(
|
|
4249
|
+
await this.thread.client.rest.put(Routes15.channelThreadMember(this.thread.id, userId), {
|
|
4024
4250
|
auth: true
|
|
4025
4251
|
});
|
|
4026
4252
|
}
|
|
4027
4253
|
/** Remove a user from this thread. */
|
|
4028
4254
|
async remove(userId) {
|
|
4029
|
-
await this.thread.client.rest.delete(
|
|
4255
|
+
await this.thread.client.rest.delete(Routes15.channelThreadMember(this.thread.id, userId), {
|
|
4030
4256
|
auth: true
|
|
4031
4257
|
});
|
|
4032
4258
|
}
|
|
@@ -4051,7 +4277,7 @@ var ThreadManager = class {
|
|
|
4051
4277
|
});
|
|
4052
4278
|
}
|
|
4053
4279
|
const data = await this.channel.client.rest.post(
|
|
4054
|
-
|
|
4280
|
+
Routes16.channelThreads(this.channel.id),
|
|
4055
4281
|
{
|
|
4056
4282
|
body: toStartThreadBody(this.channel.type, options),
|
|
4057
4283
|
auth: true,
|
|
@@ -4084,7 +4310,7 @@ var ThreadManager = class {
|
|
|
4084
4310
|
if (options.rateLimitPerUser !== void 0) body.rate_limit_per_user = options.rateLimitPerUser;
|
|
4085
4311
|
if (options.appliedTags !== void 0) body.applied_tags = options.appliedTags;
|
|
4086
4312
|
const data = await this.channel.client.rest.post(
|
|
4087
|
-
|
|
4313
|
+
Routes16.channelThreads(this.channel.id),
|
|
4088
4314
|
{
|
|
4089
4315
|
body,
|
|
4090
4316
|
files: prepared.files,
|
|
@@ -4103,7 +4329,7 @@ var ThreadManager = class {
|
|
|
4103
4329
|
* `before` is an ISO-8601 archive timestamp.
|
|
4104
4330
|
*/
|
|
4105
4331
|
async fetchArchived(options) {
|
|
4106
|
-
const path = options.type === "private" ?
|
|
4332
|
+
const path = options.type === "private" ? Routes16.channelThreadsArchivedPrivate(this.channel.id) : Routes16.channelThreadsArchivedPublic(this.channel.id);
|
|
4107
4333
|
const data = await this.channel.client.rest.get(
|
|
4108
4334
|
withQuery(path, { before: options.before, limit: options.limit })
|
|
4109
4335
|
);
|
|
@@ -4115,7 +4341,7 @@ var ThreadManager = class {
|
|
|
4115
4341
|
*/
|
|
4116
4342
|
async fetchJoinedPrivateArchived(options) {
|
|
4117
4343
|
const data = await this.channel.client.rest.get(
|
|
4118
|
-
withQuery(
|
|
4344
|
+
withQuery(Routes16.channelJoinedArchivedPrivateThreads(this.channel.id), {
|
|
4119
4345
|
before: options?.before,
|
|
4120
4346
|
limit: options?.limit
|
|
4121
4347
|
})
|
|
@@ -4128,7 +4354,7 @@ var ThreadManager = class {
|
|
|
4128
4354
|
*/
|
|
4129
4355
|
async search(options) {
|
|
4130
4356
|
const data = await this.channel.client.rest.get(
|
|
4131
|
-
withQuery(
|
|
4357
|
+
withQuery(Routes16.channelThreadSearch(this.channel.id), {
|
|
4132
4358
|
name: options?.name,
|
|
4133
4359
|
tag: options?.tag,
|
|
4134
4360
|
tag_setting: options?.tagSetting,
|
|
@@ -4156,7 +4382,7 @@ var ThreadManager = class {
|
|
|
4156
4382
|
}
|
|
4157
4383
|
/** Set the auto-archive and slowmode defaults copied onto new threads. */
|
|
4158
4384
|
async editDefaults(options) {
|
|
4159
|
-
return this.channel.client.rest.patch(
|
|
4385
|
+
return this.channel.client.rest.patch(Routes16.channel(this.channel.id), {
|
|
4160
4386
|
body: toThreadParentEditBody(options),
|
|
4161
4387
|
auth: true,
|
|
4162
4388
|
...auditReasonHeaders(options.reason)
|
|
@@ -4174,7 +4400,7 @@ function isSearchNotReady(data) {
|
|
|
4174
4400
|
return "code" in data && data.code === "SEARCH_INDEX_NOT_READY";
|
|
4175
4401
|
}
|
|
4176
4402
|
async function fetchActiveThreads(client, guildId) {
|
|
4177
|
-
const data = await client.rest.get(
|
|
4403
|
+
const data = await client.rest.get(Routes16.guildActiveThreads(guildId));
|
|
4178
4404
|
return fetchedThreadsFrom(client, data);
|
|
4179
4405
|
}
|
|
4180
4406
|
|
|
@@ -4233,7 +4459,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4233
4459
|
* `defaultForumLayout` is sent only for forum channels.
|
|
4234
4460
|
*/
|
|
4235
4461
|
async edit(options) {
|
|
4236
|
-
const data = await this.client.rest.patch(
|
|
4462
|
+
const data = await this.client.rest.patch(Routes17.channel(this.id), {
|
|
4237
4463
|
body: {
|
|
4238
4464
|
...toChannelEditBody(options),
|
|
4239
4465
|
...forumParentWire(options, this.type === ChannelType7.GuildForum)
|
|
@@ -4262,7 +4488,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4262
4488
|
}
|
|
4263
4489
|
/** Set the auto-archive and slowmode defaults copied onto new posts. */
|
|
4264
4490
|
async editThreadDefaults(options) {
|
|
4265
|
-
const data = await this.client.rest.patch(
|
|
4491
|
+
const data = await this.client.rest.patch(Routes17.channel(this.id), {
|
|
4266
4492
|
body: toThreadParentEditBody(options),
|
|
4267
4493
|
auth: true,
|
|
4268
4494
|
...auditReasonHeaders(options.reason)
|
|
@@ -4272,7 +4498,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4272
4498
|
}
|
|
4273
4499
|
/** Create a tag. The response replaces {@link availableTags}. */
|
|
4274
4500
|
async createTag(options) {
|
|
4275
|
-
const data = await this.client.rest.post(
|
|
4501
|
+
const data = await this.client.rest.post(Routes17.channelTags(this.id), {
|
|
4276
4502
|
body: toForumTagBody(options),
|
|
4277
4503
|
auth: true,
|
|
4278
4504
|
...auditReasonHeaders(options.reason)
|
|
@@ -4282,7 +4508,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4282
4508
|
}
|
|
4283
4509
|
/** Replace a tag. The response replaces {@link availableTags}. */
|
|
4284
4510
|
async editTag(tagId, options) {
|
|
4285
|
-
const data = await this.client.rest.put(
|
|
4511
|
+
const data = await this.client.rest.put(Routes17.channelTag(this.id, tagId), {
|
|
4286
4512
|
body: toForumTagBody(options),
|
|
4287
4513
|
auth: true,
|
|
4288
4514
|
...auditReasonHeaders(options.reason)
|
|
@@ -4292,7 +4518,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4292
4518
|
}
|
|
4293
4519
|
/** Delete a tag. The response replaces {@link availableTags}. */
|
|
4294
4520
|
async deleteTag(tagId, reason) {
|
|
4295
|
-
const data = await this.client.rest.delete(
|
|
4521
|
+
const data = await this.client.rest.delete(Routes17.channelTag(this.id, tagId), {
|
|
4296
4522
|
auth: true,
|
|
4297
4523
|
...auditReasonHeaders(reason)
|
|
4298
4524
|
});
|
|
@@ -4327,6 +4553,7 @@ var GUILD_FACTORIES = {
|
|
|
4327
4553
|
[ChannelType8.GuildAnnouncement]: (c, d) => new AnnouncementChannel(c, d),
|
|
4328
4554
|
[ChannelType8.GuildCategory]: (c, d) => new CategoryChannel(c, d),
|
|
4329
4555
|
[ChannelType8.GuildVoice]: (c, d) => new VoiceChannel(c, d),
|
|
4556
|
+
[ChannelType8.GuildStageVoice]: (c, d) => new StageChannel(c, d),
|
|
4330
4557
|
[ChannelType8.GuildLink]: (c, d) => new LinkChannel(c, d),
|
|
4331
4558
|
[ChannelType8.AnnouncementThread]: (c, d) => new ThreadChannel(c, d),
|
|
4332
4559
|
[ChannelType8.PublicThread]: (c, d) => new ThreadChannel(c, d),
|
|
@@ -4360,8 +4587,8 @@ bindThreadManager((channel) => new ThreadManager(channel));
|
|
|
4360
4587
|
import { ChannelType as ChannelType9 } from "@fluxerjs/types";
|
|
4361
4588
|
|
|
4362
4589
|
// src/Domain/Guild/GuildEmoji.ts
|
|
4363
|
-
import { Routes as
|
|
4364
|
-
import { SnowflakeUtil as
|
|
4590
|
+
import { Routes as Routes18 } from "@fluxerjs/types";
|
|
4591
|
+
import { SnowflakeUtil as SnowflakeUtil6 } from "@fluxerjs/util";
|
|
4365
4592
|
var GuildEmoji = class extends Base {
|
|
4366
4593
|
client;
|
|
4367
4594
|
id;
|
|
@@ -4397,11 +4624,11 @@ var GuildEmoji = class extends Base {
|
|
|
4397
4624
|
}
|
|
4398
4625
|
/** Unix timestamp (ms) when this emoji was created, derived from its snowflake ID. */
|
|
4399
4626
|
get createdTimestamp() {
|
|
4400
|
-
return
|
|
4627
|
+
return SnowflakeUtil6.timestampFromSnowflake(this.id);
|
|
4401
4628
|
}
|
|
4402
4629
|
/** Date when this emoji was created, derived from its snowflake ID. */
|
|
4403
4630
|
get createdAt() {
|
|
4404
|
-
return
|
|
4631
|
+
return SnowflakeUtil6.dateFromSnowflake(this.id);
|
|
4405
4632
|
}
|
|
4406
4633
|
/** Renders this emoji for use in message content: `<:name:id>` (or `<a:name:id>` when animated). */
|
|
4407
4634
|
toString() {
|
|
@@ -4409,7 +4636,7 @@ var GuildEmoji = class extends Base {
|
|
|
4409
4636
|
}
|
|
4410
4637
|
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
4411
4638
|
async delete(reason) {
|
|
4412
|
-
await this.client.rest.delete(
|
|
4639
|
+
await this.client.rest.delete(Routes18.guildEmoji(this.guildId, this.id), {
|
|
4413
4640
|
auth: true,
|
|
4414
4641
|
...auditReasonHeaders(reason)
|
|
4415
4642
|
});
|
|
@@ -4422,7 +4649,7 @@ var GuildEmoji = class extends Base {
|
|
|
4422
4649
|
*/
|
|
4423
4650
|
async edit(options) {
|
|
4424
4651
|
const { reason, name } = options;
|
|
4425
|
-
const data = await this.client.rest.patch(
|
|
4652
|
+
const data = await this.client.rest.patch(Routes18.guildEmoji(this.guildId, this.id), {
|
|
4426
4653
|
body: { name },
|
|
4427
4654
|
auth: true,
|
|
4428
4655
|
...auditReasonHeaders(reason)
|
|
@@ -4433,7 +4660,7 @@ var GuildEmoji = class extends Base {
|
|
|
4433
4660
|
};
|
|
4434
4661
|
|
|
4435
4662
|
// src/Domain/Guild/GuildMember.ts
|
|
4436
|
-
import { Routes as
|
|
4663
|
+
import { Routes as Routes20 } from "@fluxerjs/types";
|
|
4437
4664
|
import { PermissionFlags as PermissionFlags3, PermissionsBitField as PermissionsBitField2 } from "@fluxerjs/util";
|
|
4438
4665
|
|
|
4439
4666
|
// src/Helpers/Permissions.ts
|
|
@@ -4457,7 +4684,7 @@ function computePermissions(basePermissions, overwrites, memberRoles, memberId,
|
|
|
4457
4684
|
|
|
4458
4685
|
// src/Domain/Guild/GuildMemberRoleManager.ts
|
|
4459
4686
|
import { Collection as Collection7 } from "@fluxerjs/collection";
|
|
4460
|
-
import { Routes as
|
|
4687
|
+
import { Routes as Routes19 } from "@fluxerjs/types";
|
|
4461
4688
|
function roleId(roleOrId) {
|
|
4462
4689
|
return typeof roleOrId === "string" ? roleOrId : roleOrId.id;
|
|
4463
4690
|
}
|
|
@@ -4486,7 +4713,7 @@ var GuildMemberRoleManager = class {
|
|
|
4486
4713
|
const id = roleId(roleOrId);
|
|
4487
4714
|
if (this.ids.includes(id)) return;
|
|
4488
4715
|
await this.member.client.rest.put(
|
|
4489
|
-
|
|
4716
|
+
Routes19.guildMemberRole(this.member.guild.id, this.member.id, id)
|
|
4490
4717
|
);
|
|
4491
4718
|
this.ids.push(id);
|
|
4492
4719
|
}
|
|
@@ -4495,13 +4722,13 @@ var GuildMemberRoleManager = class {
|
|
|
4495
4722
|
const idx = this.ids.indexOf(id);
|
|
4496
4723
|
if (idx === -1) return;
|
|
4497
4724
|
await this.member.client.rest.delete(
|
|
4498
|
-
|
|
4725
|
+
Routes19.guildMemberRole(this.member.guild.id, this.member.id, id)
|
|
4499
4726
|
);
|
|
4500
4727
|
this.ids.splice(idx, 1);
|
|
4501
4728
|
}
|
|
4502
4729
|
async set(roleIds) {
|
|
4503
4730
|
const data = await this.member.client.rest.patch(
|
|
4504
|
-
|
|
4731
|
+
Routes19.guildMember(this.member.guild.id, this.member.id),
|
|
4505
4732
|
{ body: { roles: roleIds }, auth: true }
|
|
4506
4733
|
);
|
|
4507
4734
|
this.ids = data.roles ? [...data.roles] : [];
|
|
@@ -4655,7 +4882,7 @@ var GuildMember = class _GuildMember extends Base {
|
|
|
4655
4882
|
*/
|
|
4656
4883
|
async edit(options) {
|
|
4657
4884
|
const isMe = this.client.user?.id === this.id;
|
|
4658
|
-
const route = isMe ?
|
|
4885
|
+
const route = isMe ? Routes20.guildMemberMe(this.guild.id) : Routes20.guildMember(this.guild.id, this.id);
|
|
4659
4886
|
const data = await this.client.rest.patch(route, {
|
|
4660
4887
|
body: toMemberEditBody(options),
|
|
4661
4888
|
auth: true,
|
|
@@ -4768,8 +4995,8 @@ var GuildMember = class _GuildMember extends Base {
|
|
|
4768
4995
|
};
|
|
4769
4996
|
|
|
4770
4997
|
// src/Domain/Guild/GuildSticker.ts
|
|
4771
|
-
import { Routes as
|
|
4772
|
-
import { SnowflakeUtil as
|
|
4998
|
+
import { Routes as Routes21 } from "@fluxerjs/types";
|
|
4999
|
+
import { SnowflakeUtil as SnowflakeUtil7 } from "@fluxerjs/util";
|
|
4773
5000
|
var GuildSticker = class extends Base {
|
|
4774
5001
|
client;
|
|
4775
5002
|
id;
|
|
@@ -4811,15 +5038,15 @@ var GuildSticker = class extends Base {
|
|
|
4811
5038
|
}
|
|
4812
5039
|
/** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
|
|
4813
5040
|
get createdTimestamp() {
|
|
4814
|
-
return
|
|
5041
|
+
return SnowflakeUtil7.timestampFromSnowflake(this.id);
|
|
4815
5042
|
}
|
|
4816
5043
|
/** Date when this sticker was created, derived from its snowflake ID. */
|
|
4817
5044
|
get createdAt() {
|
|
4818
|
-
return
|
|
5045
|
+
return SnowflakeUtil7.dateFromSnowflake(this.id);
|
|
4819
5046
|
}
|
|
4820
5047
|
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
4821
5048
|
async delete(reason) {
|
|
4822
|
-
await this.client.rest.delete(
|
|
5049
|
+
await this.client.rest.delete(Routes21.guildSticker(this.guildId, this.id), {
|
|
4823
5050
|
auth: true,
|
|
4824
5051
|
...auditReasonHeaders(reason)
|
|
4825
5052
|
});
|
|
@@ -4832,7 +5059,7 @@ var GuildSticker = class extends Base {
|
|
|
4832
5059
|
*/
|
|
4833
5060
|
async edit(options) {
|
|
4834
5061
|
const { reason, ...body } = options;
|
|
4835
|
-
const data = await this.client.rest.patch(
|
|
5062
|
+
const data = await this.client.rest.patch(Routes21.guildSticker(this.guildId, this.id), {
|
|
4836
5063
|
body,
|
|
4837
5064
|
auth: true,
|
|
4838
5065
|
...auditReasonHeaders(reason)
|
|
@@ -4845,12 +5072,12 @@ var GuildSticker = class extends Base {
|
|
|
4845
5072
|
};
|
|
4846
5073
|
|
|
4847
5074
|
// src/Domain/Guild/Role.ts
|
|
4848
|
-
import { Routes as
|
|
5075
|
+
import { Routes as Routes22 } from "@fluxerjs/types";
|
|
4849
5076
|
import {
|
|
4850
5077
|
ALL_PERMISSIONS_BIGINT as ALL_PERMISSIONS_BIGINT2,
|
|
4851
5078
|
PermissionFlags as PermissionFlags4,
|
|
4852
5079
|
PermissionsBitField as PermissionsBitField3,
|
|
4853
|
-
SnowflakeUtil as
|
|
5080
|
+
SnowflakeUtil as SnowflakeUtil8
|
|
4854
5081
|
} from "@fluxerjs/util";
|
|
4855
5082
|
var Role = class _Role extends Base {
|
|
4856
5083
|
/** Parent client instance. */
|
|
@@ -4920,11 +5147,11 @@ var Role = class _Role extends Base {
|
|
|
4920
5147
|
*/
|
|
4921
5148
|
/** Unix timestamp (ms) when this role was created, derived from its snowflake ID. */
|
|
4922
5149
|
get createdTimestamp() {
|
|
4923
|
-
return
|
|
5150
|
+
return SnowflakeUtil8.timestampFromSnowflake(this.id);
|
|
4924
5151
|
}
|
|
4925
5152
|
/** Date when this role was created, derived from its snowflake ID. */
|
|
4926
5153
|
get createdAt() {
|
|
4927
|
-
return
|
|
5154
|
+
return SnowflakeUtil8.dateFromSnowflake(this.id);
|
|
4928
5155
|
}
|
|
4929
5156
|
toString() {
|
|
4930
5157
|
return `<@&${this.id}>`;
|
|
@@ -4970,7 +5197,7 @@ var Role = class _Role extends Base {
|
|
|
4970
5197
|
*/
|
|
4971
5198
|
async edit(options) {
|
|
4972
5199
|
const body = toRoleEditBody(options);
|
|
4973
|
-
const data = await this.client.rest.patch(
|
|
5200
|
+
const data = await this.client.rest.patch(Routes22.guildRole(this.guildId, this.id), {
|
|
4974
5201
|
body: Object.keys(body).length ? body : void 0,
|
|
4975
5202
|
auth: true,
|
|
4976
5203
|
...auditReasonHeaders(options.reason)
|
|
@@ -4983,7 +5210,7 @@ var Role = class _Role extends Base {
|
|
|
4983
5210
|
* @param reason - Audit log reason (`X-Audit-Log-Reason`)
|
|
4984
5211
|
*/
|
|
4985
5212
|
async delete(reason) {
|
|
4986
|
-
await this.client.rest.delete(
|
|
5213
|
+
await this.client.rest.delete(Routes22.guildRole(this.guildId, this.id), {
|
|
4987
5214
|
auth: true,
|
|
4988
5215
|
...auditReasonHeaders(reason)
|
|
4989
5216
|
});
|
|
@@ -5173,7 +5400,7 @@ var ChannelManager = class extends LimitedCollection {
|
|
|
5173
5400
|
async fetchFresh(channelId) {
|
|
5174
5401
|
try {
|
|
5175
5402
|
const data = assertApiObjectWithId(
|
|
5176
|
-
await this.client.rest.get(
|
|
5403
|
+
await this.client.rest.get(Routes23.channel(channelId)),
|
|
5177
5404
|
"channels.fetch()"
|
|
5178
5405
|
);
|
|
5179
5406
|
const existing = this.get(channelId);
|
|
@@ -5226,7 +5453,7 @@ var ChannelManager = class extends LimitedCollection {
|
|
|
5226
5453
|
defaultAllowedMentions: this.client.options.defaultAllowedMentions
|
|
5227
5454
|
});
|
|
5228
5455
|
const data = await this.client.rest.post(
|
|
5229
|
-
|
|
5456
|
+
Routes23.channelMessages(channelId),
|
|
5230
5457
|
postPayload
|
|
5231
5458
|
);
|
|
5232
5459
|
this.client._addMessageToCache(channelId, data);
|
|
@@ -5237,12 +5464,12 @@ var ChannelManager = class extends LimitedCollection {
|
|
|
5237
5464
|
// src/ClientCore/Client.ts
|
|
5238
5465
|
import { EventEmitter as EventEmitter3 } from "events";
|
|
5239
5466
|
import { REST } from "@fluxerjs/rest";
|
|
5240
|
-
import { GatewayOpcodes as GatewayOpcodes2, Routes as
|
|
5467
|
+
import { GatewayOpcodes as GatewayOpcodes2, Routes as Routes38 } from "@fluxerjs/types";
|
|
5241
5468
|
import { createLogger } from "@fluxerjs/util";
|
|
5242
5469
|
|
|
5243
5470
|
// src/Domain/User.ts
|
|
5244
|
-
import { Routes as
|
|
5245
|
-
import { SnowflakeUtil as
|
|
5471
|
+
import { Routes as Routes24 } from "@fluxerjs/types";
|
|
5472
|
+
import { SnowflakeUtil as SnowflakeUtil9 } from "@fluxerjs/util";
|
|
5246
5473
|
var User = class extends Base {
|
|
5247
5474
|
/** Parent client instance. */
|
|
5248
5475
|
client;
|
|
@@ -5334,11 +5561,11 @@ var User = class extends Base {
|
|
|
5334
5561
|
*/
|
|
5335
5562
|
/** Unix timestamp (ms) when this account was created, derived from its snowflake ID. */
|
|
5336
5563
|
get createdTimestamp() {
|
|
5337
|
-
return
|
|
5564
|
+
return SnowflakeUtil9.timestampFromSnowflake(this.id);
|
|
5338
5565
|
}
|
|
5339
5566
|
/** Date when this account was created, derived from its snowflake ID. */
|
|
5340
5567
|
get createdAt() {
|
|
5341
|
-
return
|
|
5568
|
+
return SnowflakeUtil9.dateFromSnowflake(this.id);
|
|
5342
5569
|
}
|
|
5343
5570
|
toString() {
|
|
5344
5571
|
return `<@${this.id}>`;
|
|
@@ -5348,7 +5575,7 @@ var User = class extends Base {
|
|
|
5348
5575
|
* @returns DM channel instance (cached if already open)
|
|
5349
5576
|
*/
|
|
5350
5577
|
async createDM() {
|
|
5351
|
-
const data = await this.client.rest.post(
|
|
5578
|
+
const data = await this.client.rest.post(Routes24.userMeChannels(), {
|
|
5352
5579
|
body: { recipient_id: this.id },
|
|
5353
5580
|
auth: true
|
|
5354
5581
|
});
|
|
@@ -5426,7 +5653,7 @@ function resolveCacheLimits(input) {
|
|
|
5426
5653
|
|
|
5427
5654
|
// src/ClientCore/ClientEmoji.ts
|
|
5428
5655
|
import { Collection as Collection8 } from "@fluxerjs/collection";
|
|
5429
|
-
import { Routes as
|
|
5656
|
+
import { Routes as Routes25 } from "@fluxerjs/types";
|
|
5430
5657
|
import { formatEmoji, getUnicodeFromShortcode, parseEmoji } from "@fluxerjs/util";
|
|
5431
5658
|
async function resolveClientEmoji(client, emoji, guildId) {
|
|
5432
5659
|
if (typeof emoji === "object" && emoji.id) {
|
|
@@ -5445,7 +5672,7 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
5445
5672
|
const unicodeFromShortcode = getUnicodeFromShortcode(parsed.name);
|
|
5446
5673
|
if (unicodeFromShortcode) return unicodeFromShortcode;
|
|
5447
5674
|
if (guildId) {
|
|
5448
|
-
const emojis = await client.rest.get(
|
|
5675
|
+
const emojis = await client.rest.get(Routes25.guildEmojis(guildId));
|
|
5449
5676
|
const found = emojis.find((e) => e.name && e.name.toLowerCase() === parsed.name.toLowerCase());
|
|
5450
5677
|
if (found) return formatEmoji({ ...parsed, id: found.id, animated: found.animated });
|
|
5451
5678
|
throw new FluxerError(
|
|
@@ -5462,26 +5689,26 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
5462
5689
|
return parsed.name;
|
|
5463
5690
|
}
|
|
5464
5691
|
async function fetchInstance(client) {
|
|
5465
|
-
const raw = await client.rest.get(
|
|
5692
|
+
const raw = await client.rest.get(Routes25.instanceDiscovery(), {
|
|
5466
5693
|
auth: false,
|
|
5467
5694
|
unversioned: true
|
|
5468
5695
|
});
|
|
5469
5696
|
return parseInstanceDiscovery(raw);
|
|
5470
5697
|
}
|
|
5471
5698
|
function fetchGatewayInfo(client) {
|
|
5472
|
-
return client.rest.get(
|
|
5699
|
+
return client.rest.get(Routes25.gatewayBot());
|
|
5473
5700
|
}
|
|
5474
5701
|
function fetchEmojiMetadata(client, emojiId) {
|
|
5475
|
-
return client.rest.get(
|
|
5702
|
+
return client.rest.get(Routes25.emojiMetadata(emojiId), { auth: true });
|
|
5476
5703
|
}
|
|
5477
5704
|
function fetchStickerMetadata(client, stickerId) {
|
|
5478
|
-
return client.rest.get(
|
|
5705
|
+
return client.rest.get(Routes25.stickerMetadata(stickerId), { auth: true });
|
|
5479
5706
|
}
|
|
5480
5707
|
function fetchApplication(client) {
|
|
5481
|
-
return client.rest.get(
|
|
5708
|
+
return client.rest.get(Routes25.applicationsMe(), { auth: true });
|
|
5482
5709
|
}
|
|
5483
5710
|
async function fetchOAuthApplications(client) {
|
|
5484
|
-
const data = await client.rest.get(
|
|
5711
|
+
const data = await client.rest.get(Routes25.oauth2ApplicationsMe(), { auth: true });
|
|
5485
5712
|
if (Array.isArray(data)) return data;
|
|
5486
5713
|
if (data && typeof data === "object" && "applications" in data && Array.isArray(data.applications)) {
|
|
5487
5714
|
return data.applications;
|
|
@@ -5500,14 +5727,14 @@ function assertChannelIdBatch(name, channelIds) {
|
|
|
5500
5727
|
}
|
|
5501
5728
|
function preloadMessages(client, channelIds) {
|
|
5502
5729
|
assertChannelIdBatch("preloadMessages", channelIds);
|
|
5503
|
-
return client.rest.post(
|
|
5730
|
+
return client.rest.post(Routes25.preloadMessages(), {
|
|
5504
5731
|
body: { channels: channelIds },
|
|
5505
5732
|
auth: true
|
|
5506
5733
|
});
|
|
5507
5734
|
}
|
|
5508
5735
|
function preloadMessagesAlt(client, channelIds) {
|
|
5509
5736
|
assertChannelIdBatch("preloadMessagesAlt", channelIds);
|
|
5510
|
-
return client.rest.post(
|
|
5737
|
+
return client.rest.post(Routes25.preloadMessagesAlt(), {
|
|
5511
5738
|
body: { channels: channelIds },
|
|
5512
5739
|
auth: true
|
|
5513
5740
|
});
|
|
@@ -5515,7 +5742,7 @@ function preloadMessagesAlt(client, channelIds) {
|
|
|
5515
5742
|
async function bulkFetchMessages(client, requests, options = {}) {
|
|
5516
5743
|
validateBulkMessageFetchRequests(requests);
|
|
5517
5744
|
const wire = toBulkFetchWire(requests);
|
|
5518
|
-
const data = await client.rest.post(
|
|
5745
|
+
const data = await client.rest.post(Routes25.channelsMessagesBulk(), {
|
|
5519
5746
|
body: { requests: wire },
|
|
5520
5747
|
auth: true
|
|
5521
5748
|
});
|
|
@@ -5532,7 +5759,7 @@ async function bulkFetchMessages(client, requests, options = {}) {
|
|
|
5532
5759
|
};
|
|
5533
5760
|
}
|
|
5534
5761
|
async function searchMessages(client, options = {}) {
|
|
5535
|
-
const data = await client.rest.post(
|
|
5762
|
+
const data = await client.rest.post(Routes25.searchMessages(), {
|
|
5536
5763
|
body: toMessageSearchBody(options),
|
|
5537
5764
|
auth: true
|
|
5538
5765
|
});
|
|
@@ -5540,19 +5767,19 @@ async function searchMessages(client, options = {}) {
|
|
|
5540
5767
|
}
|
|
5541
5768
|
function fetchEmojiSource(client, emojiId) {
|
|
5542
5769
|
return client.rest.get(
|
|
5543
|
-
|
|
5770
|
+
Routes25.emojiSource(emojiId),
|
|
5544
5771
|
{ auth: true }
|
|
5545
5772
|
);
|
|
5546
5773
|
}
|
|
5547
5774
|
function fetchStickerSource(client, stickerId) {
|
|
5548
5775
|
return client.rest.get(
|
|
5549
|
-
|
|
5776
|
+
Routes25.stickerSource(stickerId),
|
|
5550
5777
|
{ auth: true }
|
|
5551
5778
|
);
|
|
5552
5779
|
}
|
|
5553
5780
|
function fetchDiscoveryCategories(client) {
|
|
5554
5781
|
return client.rest.get(
|
|
5555
|
-
|
|
5782
|
+
Routes25.discoveryCategories(),
|
|
5556
5783
|
{ auth: true }
|
|
5557
5784
|
);
|
|
5558
5785
|
}
|
|
@@ -5567,18 +5794,18 @@ function searchDiscoveryGuilds(client, options = {}) {
|
|
|
5567
5794
|
if (options.offset !== void 0) params.set("offset", String(options.offset));
|
|
5568
5795
|
const qs2 = params.toString();
|
|
5569
5796
|
return client.rest.get(
|
|
5570
|
-
qs2 ? `${
|
|
5797
|
+
qs2 ? `${Routes25.discoveryGuilds()}?${qs2}` : Routes25.discoveryGuilds(),
|
|
5571
5798
|
{ auth: true }
|
|
5572
5799
|
);
|
|
5573
5800
|
}
|
|
5574
5801
|
function fetchExperiments(client) {
|
|
5575
|
-
return client.rest.get(
|
|
5802
|
+
return client.rest.get(Routes25.experiments(), {
|
|
5576
5803
|
auth: true
|
|
5577
5804
|
});
|
|
5578
5805
|
}
|
|
5579
5806
|
function refreshAttachmentUrls(client, attachmentUrls) {
|
|
5580
5807
|
return client.rest.post(
|
|
5581
|
-
|
|
5808
|
+
Routes25.attachmentsRefreshUrls(),
|
|
5582
5809
|
{ body: { attachment_urls: attachmentUrls }, auth: true }
|
|
5583
5810
|
);
|
|
5584
5811
|
}
|
|
@@ -5590,13 +5817,13 @@ function fetchInstanceBadges(client, options = {}) {
|
|
|
5590
5817
|
if (options.version !== void 0) params.set("version", options.version);
|
|
5591
5818
|
const qs2 = params.toString();
|
|
5592
5819
|
return client.rest.get(
|
|
5593
|
-
qs2 ? `${
|
|
5820
|
+
qs2 ? `${Routes25.instanceBadges()}?${qs2}` : Routes25.instanceBadges(),
|
|
5594
5821
|
{ auth: false }
|
|
5595
5822
|
);
|
|
5596
5823
|
}
|
|
5597
5824
|
function fetchChannelPostData(client, channelId, threadIds) {
|
|
5598
5825
|
return client.rest.post(
|
|
5599
|
-
|
|
5826
|
+
Routes25.channelPostData(channelId),
|
|
5600
5827
|
{ body: { thread_ids: threadIds }, auth: true }
|
|
5601
5828
|
);
|
|
5602
5829
|
}
|
|
@@ -5618,13 +5845,13 @@ function createEventMethods(client) {
|
|
|
5618
5845
|
import { GatewayCloseCodes, WebSocketManager } from "@fluxerjs/ws";
|
|
5619
5846
|
|
|
5620
5847
|
// src/Domain/Guild/Guild.ts
|
|
5621
|
-
import { LimitedCollection as LimitedCollection4 } from "@fluxerjs/collection";
|
|
5848
|
+
import { Collection as Collection9, LimitedCollection as LimitedCollection4 } from "@fluxerjs/collection";
|
|
5622
5849
|
import { GuildNSFWLevel } from "@fluxerjs/types";
|
|
5623
|
-
import { SnowflakeUtil as
|
|
5850
|
+
import { SnowflakeUtil as SnowflakeUtil10 } from "@fluxerjs/util";
|
|
5624
5851
|
|
|
5625
5852
|
// src/ClientCore/GuildMemberManager.ts
|
|
5626
5853
|
import { LimitedCollection as LimitedCollection2 } from "@fluxerjs/collection";
|
|
5627
|
-
import { Routes as
|
|
5854
|
+
import { Routes as Routes26 } from "@fluxerjs/types";
|
|
5628
5855
|
var GuildMemberManager = class extends LimitedCollection2 {
|
|
5629
5856
|
constructor(guild) {
|
|
5630
5857
|
super({ maxSize: guild.client.cache.limits.members });
|
|
@@ -5685,7 +5912,7 @@ var GuildMemberManager = class extends LimitedCollection2 {
|
|
|
5685
5912
|
if (options?.limit != null) params.set("limit", String(options.limit));
|
|
5686
5913
|
if (options?.after) params.set("after", options.after);
|
|
5687
5914
|
const qs2 = params.toString();
|
|
5688
|
-
const url =
|
|
5915
|
+
const url = Routes26.guildMembers(this.guild.id) + (qs2 ? `?${qs2}` : "");
|
|
5689
5916
|
const data = assertApiArray(
|
|
5690
5917
|
await this.guild.client.rest.get(url, { auth: true }),
|
|
5691
5918
|
"members.fetch()"
|
|
@@ -5712,7 +5939,7 @@ var GuildMemberManager = class extends LimitedCollection2 {
|
|
|
5712
5939
|
*/
|
|
5713
5940
|
async search(options = {}) {
|
|
5714
5941
|
const data = await this.guild.client.rest.post(
|
|
5715
|
-
|
|
5942
|
+
Routes26.guildMembersSearch(this.guild.id),
|
|
5716
5943
|
{ body: toMemberSearchBody(options), auth: true }
|
|
5717
5944
|
);
|
|
5718
5945
|
const offset = options.offset ?? 0;
|
|
@@ -5738,7 +5965,7 @@ var GuildMemberManager = class extends LimitedCollection2 {
|
|
|
5738
5965
|
};
|
|
5739
5966
|
|
|
5740
5967
|
// src/Domain/Guild/Admin.ts
|
|
5741
|
-
import { Routes as
|
|
5968
|
+
import { Routes as Routes27 } from "@fluxerjs/types";
|
|
5742
5969
|
function toAuditLogEntryPayload(entry, guildId) {
|
|
5743
5970
|
return {
|
|
5744
5971
|
id: entry.id,
|
|
@@ -5759,7 +5986,7 @@ function toVanityPayload(data) {
|
|
|
5759
5986
|
return { code: data.code ?? null, uses: data.uses };
|
|
5760
5987
|
}
|
|
5761
5988
|
async function fetchAuditLogs(guild, options) {
|
|
5762
|
-
const url =
|
|
5989
|
+
const url = Routes27.guildAuditLogs(guild.id) + qs({
|
|
5763
5990
|
limit: options?.limit,
|
|
5764
5991
|
before: options?.before,
|
|
5765
5992
|
after: options?.after,
|
|
@@ -5783,7 +6010,7 @@ async function fetchAuditLogs(guild, options) {
|
|
|
5783
6010
|
};
|
|
5784
6011
|
}
|
|
5785
6012
|
async function editGuild(guild, options) {
|
|
5786
|
-
const data = await guild.client.rest.patch(
|
|
6013
|
+
const data = await guild.client.rest.patch(Routes27.guild(guild.id), {
|
|
5787
6014
|
body: toGuildEditBody(options),
|
|
5788
6015
|
auth: true
|
|
5789
6016
|
});
|
|
@@ -5791,13 +6018,13 @@ async function editGuild(guild, options) {
|
|
|
5791
6018
|
return guild;
|
|
5792
6019
|
}
|
|
5793
6020
|
async function fetchVanityURL(guild) {
|
|
5794
|
-
const data = await guild.client.rest.get(
|
|
6021
|
+
const data = await guild.client.rest.get(Routes27.guildVanityUrl(guild.id), {
|
|
5795
6022
|
auth: true
|
|
5796
6023
|
});
|
|
5797
6024
|
return toVanityPayload(data);
|
|
5798
6025
|
}
|
|
5799
6026
|
async function editVanityURL(guild, code) {
|
|
5800
|
-
const data = await guild.client.rest.patch(
|
|
6027
|
+
const data = await guild.client.rest.patch(Routes27.guildVanityUrl(guild.id), {
|
|
5801
6028
|
body: { code },
|
|
5802
6029
|
auth: true
|
|
5803
6030
|
});
|
|
@@ -5805,14 +6032,14 @@ async function editVanityURL(guild, code) {
|
|
|
5805
6032
|
return toVanityPayload(data);
|
|
5806
6033
|
}
|
|
5807
6034
|
async function fetchDiscoveryStatus(guild) {
|
|
5808
|
-
const data = await guild.client.rest.get(
|
|
6035
|
+
const data = await guild.client.rest.get(Routes27.guildDiscovery(guild.id), {
|
|
5809
6036
|
auth: true
|
|
5810
6037
|
});
|
|
5811
6038
|
return toDiscoveryStatusPayload(data);
|
|
5812
6039
|
}
|
|
5813
6040
|
async function applyForDiscovery(guild, options) {
|
|
5814
6041
|
const data = await guild.client.rest.post(
|
|
5815
|
-
|
|
6042
|
+
Routes27.guildDiscovery(guild.id),
|
|
5816
6043
|
{
|
|
5817
6044
|
body: toDiscoveryBody(options),
|
|
5818
6045
|
auth: true
|
|
@@ -5822,7 +6049,7 @@ async function applyForDiscovery(guild, options) {
|
|
|
5822
6049
|
}
|
|
5823
6050
|
async function editDiscoveryApplication(guild, options) {
|
|
5824
6051
|
const data = await guild.client.rest.patch(
|
|
5825
|
-
|
|
6052
|
+
Routes27.guildDiscovery(guild.id),
|
|
5826
6053
|
{
|
|
5827
6054
|
body: toDiscoveryBody(options),
|
|
5828
6055
|
auth: true
|
|
@@ -5831,34 +6058,34 @@ async function editDiscoveryApplication(guild, options) {
|
|
|
5831
6058
|
return toDiscoveryApplicationPayload(data);
|
|
5832
6059
|
}
|
|
5833
6060
|
async function withdrawDiscoveryApplication(guild) {
|
|
5834
|
-
await guild.client.rest.delete(
|
|
6061
|
+
await guild.client.rest.delete(Routes27.guildDiscovery(guild.id), { auth: true });
|
|
5835
6062
|
}
|
|
5836
6063
|
async function deleteGuild(guild, options) {
|
|
5837
6064
|
const body = options ? toSudoBody(options) : {};
|
|
5838
|
-
await guild.client.rest.post(
|
|
6065
|
+
await guild.client.rest.post(Routes27.guildDelete(guild.id), {
|
|
5839
6066
|
body,
|
|
5840
6067
|
auth: true
|
|
5841
6068
|
});
|
|
5842
6069
|
guild.client.guilds.delete(guild.id);
|
|
5843
6070
|
}
|
|
5844
6071
|
async function transferOwnership(guild, newOwnerId, password) {
|
|
5845
|
-
await guild.client.rest.post(
|
|
6072
|
+
await guild.client.rest.post(Routes27.guildTransferOwnership(guild.id), {
|
|
5846
6073
|
body: { new_owner_id: newOwnerId, ...password != null && { password } },
|
|
5847
6074
|
auth: true
|
|
5848
6075
|
});
|
|
5849
6076
|
}
|
|
5850
6077
|
|
|
5851
6078
|
// src/Domain/Guild/Channels.ts
|
|
5852
|
-
import { Routes as
|
|
6079
|
+
import { Routes as Routes28 } from "@fluxerjs/types";
|
|
5853
6080
|
async function createChannel(guild, options) {
|
|
5854
|
-
const created = await guild.client.rest.post(
|
|
6081
|
+
const created = await guild.client.rest.post(Routes28.guildChannels(guild.id), {
|
|
5855
6082
|
body: toChannelCreateBody(options),
|
|
5856
6083
|
auth: true
|
|
5857
6084
|
});
|
|
5858
6085
|
return cacheChannel(guild, created);
|
|
5859
6086
|
}
|
|
5860
6087
|
async function fetchChannels(guild) {
|
|
5861
|
-
const raw = await guild.client.rest.get(
|
|
6088
|
+
const raw = await guild.client.rest.get(Routes28.guildChannels(guild.id));
|
|
5862
6089
|
if (!Array.isArray(raw))
|
|
5863
6090
|
throw new TypeError(
|
|
5864
6091
|
"guild.fetchChannels() received an invalid API payload (expected an array)"
|
|
@@ -5872,17 +6099,17 @@ async function fetchChannels(guild) {
|
|
|
5872
6099
|
return channels;
|
|
5873
6100
|
}
|
|
5874
6101
|
async function setChannelPositions(guild, updates) {
|
|
5875
|
-
await guild.client.rest.patch(
|
|
6102
|
+
await guild.client.rest.patch(Routes28.guildChannels(guild.id), {
|
|
5876
6103
|
body: toChannelPositionBody(updates),
|
|
5877
6104
|
auth: true
|
|
5878
6105
|
});
|
|
5879
6106
|
}
|
|
5880
6107
|
async function fetchWebhooks(guild) {
|
|
5881
|
-
const data = await guild.client.rest.get(
|
|
6108
|
+
const data = await guild.client.rest.get(Routes28.guildWebhooks(guild.id));
|
|
5882
6109
|
return data.map((w) => new Webhook(guild.client, w));
|
|
5883
6110
|
}
|
|
5884
6111
|
async function fetchInvites(guild) {
|
|
5885
|
-
const data = await guild.client.rest.get(
|
|
6112
|
+
const data = await guild.client.rest.get(Routes28.guildInvites(guild.id));
|
|
5886
6113
|
return data.map((invite) => new Invite(guild.client, invite));
|
|
5887
6114
|
}
|
|
5888
6115
|
async function fetchInvite(guild, codeOrUrl) {
|
|
@@ -5902,14 +6129,14 @@ function resolveGuildOnlineCount(data) {
|
|
|
5902
6129
|
}
|
|
5903
6130
|
|
|
5904
6131
|
// src/Domain/Guild/Emojis.ts
|
|
5905
|
-
import { Routes as
|
|
6132
|
+
import { Routes as Routes29 } from "@fluxerjs/types";
|
|
5906
6133
|
async function fetchEmojis(guild) {
|
|
5907
|
-
const data = await guild.client.rest.get(
|
|
6134
|
+
const data = await guild.client.rest.get(Routes29.guildEmojis(guild.id));
|
|
5908
6135
|
return data.map((e) => cacheEmoji(guild, e));
|
|
5909
6136
|
}
|
|
5910
6137
|
async function fetchEmoji(guild, emojiId) {
|
|
5911
6138
|
try {
|
|
5912
|
-
const data = await guild.client.rest.get(
|
|
6139
|
+
const data = await guild.client.rest.get(Routes29.guildEmoji(guild.id, emojiId));
|
|
5913
6140
|
return cacheEmoji(guild, data);
|
|
5914
6141
|
} catch (err) {
|
|
5915
6142
|
rethrowMapped(err, {
|
|
@@ -5920,7 +6147,7 @@ async function fetchEmoji(guild, emojiId) {
|
|
|
5920
6147
|
}
|
|
5921
6148
|
async function createEmoji(guild, options) {
|
|
5922
6149
|
const { reason, ...body } = options;
|
|
5923
|
-
const data = await guild.client.rest.post(
|
|
6150
|
+
const data = await guild.client.rest.post(Routes29.guildEmojis(guild.id), {
|
|
5924
6151
|
body,
|
|
5925
6152
|
auth: true,
|
|
5926
6153
|
...auditReasonHeaders(reason)
|
|
@@ -5928,7 +6155,7 @@ async function createEmoji(guild, options) {
|
|
|
5928
6155
|
return cacheEmoji(guild, data);
|
|
5929
6156
|
}
|
|
5930
6157
|
async function cloneEmoji(guild, sourceEmojiId) {
|
|
5931
|
-
const data = await guild.client.rest.post(
|
|
6158
|
+
const data = await guild.client.rest.post(Routes29.guildEmojisClone(guild.id), {
|
|
5932
6159
|
body: { source_emoji_id: sourceEmojiId },
|
|
5933
6160
|
auth: true
|
|
5934
6161
|
});
|
|
@@ -5936,7 +6163,7 @@ async function cloneEmoji(guild, sourceEmojiId) {
|
|
|
5936
6163
|
}
|
|
5937
6164
|
async function createEmojisBulk(guild, emojis) {
|
|
5938
6165
|
const data = await guild.client.rest.post(
|
|
5939
|
-
|
|
6166
|
+
Routes29.guildEmojisBulk(guild.id),
|
|
5940
6167
|
{ body: { emojis }, auth: true }
|
|
5941
6168
|
);
|
|
5942
6169
|
return { success: data.success.map((e) => cacheEmoji(guild, e)), failed: data.failed };
|
|
@@ -5956,12 +6183,12 @@ var GuildRoleManager = class extends LimitedCollection3 {
|
|
|
5956
6183
|
};
|
|
5957
6184
|
|
|
5958
6185
|
// src/Domain/Guild/MemberHttp.ts
|
|
5959
|
-
import { Routes as
|
|
6186
|
+
import { Routes as Routes30 } from "@fluxerjs/types";
|
|
5960
6187
|
async function fetchMember(guild, userId) {
|
|
5961
6188
|
const id = normalizeSnowflakeId(userId, "members.fetch()");
|
|
5962
6189
|
try {
|
|
5963
6190
|
const data = await guild.client.rest.get(
|
|
5964
|
-
|
|
6191
|
+
Routes30.guildMember(guild.id, id)
|
|
5965
6192
|
);
|
|
5966
6193
|
if (!data?.user?.id) {
|
|
5967
6194
|
throw new TypeError("members.fetch() received an invalid API payload (missing user.id)");
|
|
@@ -5979,7 +6206,7 @@ async function fetchMember(guild, userId) {
|
|
|
5979
6206
|
}
|
|
5980
6207
|
async function fetchMe(guild) {
|
|
5981
6208
|
const data = await guild.client.rest.get(
|
|
5982
|
-
|
|
6209
|
+
Routes30.guildMemberMe(guild.id),
|
|
5983
6210
|
{ auth: true }
|
|
5984
6211
|
);
|
|
5985
6212
|
if (!data?.user?.id) {
|
|
@@ -5989,10 +6216,10 @@ async function fetchMe(guild) {
|
|
|
5989
6216
|
}
|
|
5990
6217
|
|
|
5991
6218
|
// src/Domain/Guild/Moderation.ts
|
|
5992
|
-
import { Routes as
|
|
6219
|
+
import { Routes as Routes32 } from "@fluxerjs/types";
|
|
5993
6220
|
|
|
5994
6221
|
// src/Domain/Guild/GuildBan.ts
|
|
5995
|
-
import { Routes as
|
|
6222
|
+
import { Routes as Routes31 } from "@fluxerjs/types";
|
|
5996
6223
|
function parseOptionalDate2(value) {
|
|
5997
6224
|
if (value == null || value === "") return null;
|
|
5998
6225
|
const date = new Date(value);
|
|
@@ -6019,7 +6246,7 @@ var GuildBan = class extends Base {
|
|
|
6019
6246
|
* Requires Ban Members permission.
|
|
6020
6247
|
*/
|
|
6021
6248
|
async unban(reason) {
|
|
6022
|
-
await this.client.rest.delete(
|
|
6249
|
+
await this.client.rest.delete(Routes31.guildBan(this.guildId, this.user.id), {
|
|
6023
6250
|
auth: true,
|
|
6024
6251
|
...auditReasonHeaders(reason)
|
|
6025
6252
|
});
|
|
@@ -6029,39 +6256,39 @@ var GuildBan = class extends Base {
|
|
|
6029
6256
|
// src/Domain/Guild/Moderation.ts
|
|
6030
6257
|
async function ban(guild, userId, options) {
|
|
6031
6258
|
const body = options ? toGuildBanBody(options) : {};
|
|
6032
|
-
await guild.client.rest.put(
|
|
6259
|
+
await guild.client.rest.put(Routes32.guildBan(guild.id, userId), {
|
|
6033
6260
|
body: Object.keys(body).length ? body : void 0,
|
|
6034
6261
|
auth: true,
|
|
6035
6262
|
...auditReasonHeaders(options?.reason)
|
|
6036
6263
|
});
|
|
6037
6264
|
}
|
|
6038
6265
|
async function fetchBan(guild, userId) {
|
|
6039
|
-
const data = await guild.client.rest.get(
|
|
6266
|
+
const data = await guild.client.rest.get(Routes32.guildBan(guild.id, userId));
|
|
6040
6267
|
return new GuildBan(guild.client, { ...data, guild_id: guild.id }, guild.id);
|
|
6041
6268
|
}
|
|
6042
6269
|
async function fetchBans(guild) {
|
|
6043
|
-
const data = await guild.client.rest.get(
|
|
6270
|
+
const data = await guild.client.rest.get(Routes32.guildBans(guild.id));
|
|
6044
6271
|
return data.map((b) => new GuildBan(guild.client, { ...b, guild_id: guild.id }, guild.id));
|
|
6045
6272
|
}
|
|
6046
6273
|
async function unban(guild, userId, reason) {
|
|
6047
|
-
await guild.client.rest.delete(
|
|
6274
|
+
await guild.client.rest.delete(Routes32.guildBan(guild.id, userId), {
|
|
6048
6275
|
auth: true,
|
|
6049
6276
|
...auditReasonHeaders(reason)
|
|
6050
6277
|
});
|
|
6051
6278
|
}
|
|
6052
6279
|
async function kick(guild, userId, reason) {
|
|
6053
|
-
await guild.client.rest.delete(
|
|
6280
|
+
await guild.client.rest.delete(Routes32.guildMember(guild.id, userId), {
|
|
6054
6281
|
auth: true,
|
|
6055
6282
|
...auditReasonHeaders(reason)
|
|
6056
6283
|
});
|
|
6057
6284
|
}
|
|
6058
6285
|
|
|
6059
6286
|
// src/Domain/Guild/Roles.ts
|
|
6060
|
-
import { Routes as
|
|
6287
|
+
import { Routes as Routes33 } from "@fluxerjs/types";
|
|
6061
6288
|
import { parseRoleMention } from "@fluxerjs/util";
|
|
6062
6289
|
async function createRole(guild, options = {}) {
|
|
6063
6290
|
const body = toRoleCreateBody(options);
|
|
6064
|
-
const data = await guild.client.rest.post(
|
|
6291
|
+
const data = await guild.client.rest.post(Routes33.guildRoles(guild.id), {
|
|
6065
6292
|
body: Object.keys(body).length ? body : void 0,
|
|
6066
6293
|
auth: true,
|
|
6067
6294
|
...auditReasonHeaders(options.reason)
|
|
@@ -6069,14 +6296,14 @@ async function createRole(guild, options = {}) {
|
|
|
6069
6296
|
return cacheRole(guild, data);
|
|
6070
6297
|
}
|
|
6071
6298
|
async function fetchRoles(guild) {
|
|
6072
|
-
const data = await guild.client.rest.get(
|
|
6299
|
+
const data = await guild.client.rest.get(Routes33.guildRoles(guild.id));
|
|
6073
6300
|
if (!Array.isArray(data))
|
|
6074
6301
|
throw new TypeError("guild.fetchRoles() received an invalid API payload (expected an array)");
|
|
6075
6302
|
return data.map((r) => cacheRole(guild, r));
|
|
6076
6303
|
}
|
|
6077
6304
|
async function fetchRole(guild, roleId2) {
|
|
6078
6305
|
try {
|
|
6079
|
-
const data = await guild.client.rest.get(
|
|
6306
|
+
const data = await guild.client.rest.get(Routes33.guildRole(guild.id, roleId2));
|
|
6080
6307
|
return cacheRole(guild, data);
|
|
6081
6308
|
} catch (err) {
|
|
6082
6309
|
rethrowMapped(err, {
|
|
@@ -6093,7 +6320,7 @@ async function resolveRoleId(guild, arg) {
|
|
|
6093
6320
|
const needle = trimmed.toLowerCase();
|
|
6094
6321
|
const cached = guild.roles.find((r) => r.name?.toLowerCase() === needle);
|
|
6095
6322
|
if (cached) return cached.id;
|
|
6096
|
-
const roles = await guild.client.rest.get(
|
|
6323
|
+
const roles = await guild.client.rest.get(Routes33.guildRoles(guild.id));
|
|
6097
6324
|
const role = roles.find((r) => r.name?.toLowerCase() === needle);
|
|
6098
6325
|
if (!role) return null;
|
|
6099
6326
|
cacheRole(guild, role);
|
|
@@ -6102,7 +6329,7 @@ async function resolveRoleId(guild, arg) {
|
|
|
6102
6329
|
async function setRolePositions(guild, updates) {
|
|
6103
6330
|
return replaceRoles(
|
|
6104
6331
|
guild,
|
|
6105
|
-
await guild.client.rest.patch(
|
|
6332
|
+
await guild.client.rest.patch(Routes33.guildRoles(guild.id), {
|
|
6106
6333
|
body: updates,
|
|
6107
6334
|
auth: true
|
|
6108
6335
|
})
|
|
@@ -6111,7 +6338,7 @@ async function setRolePositions(guild, updates) {
|
|
|
6111
6338
|
async function setRoleHoistPositions(guild, updates) {
|
|
6112
6339
|
return replaceRoles(
|
|
6113
6340
|
guild,
|
|
6114
|
-
await guild.client.rest.patch(
|
|
6341
|
+
await guild.client.rest.patch(Routes33.guildRolesHoistPositions(guild.id), {
|
|
6115
6342
|
body: updates.map((u) => ({
|
|
6116
6343
|
id: u.id,
|
|
6117
6344
|
...u.hoistPosition !== void 0 ? { hoist_position: u.hoistPosition } : {}
|
|
@@ -6123,17 +6350,17 @@ async function setRoleHoistPositions(guild, updates) {
|
|
|
6123
6350
|
async function resetRoleHoistPositions(guild) {
|
|
6124
6351
|
return replaceRoles(
|
|
6125
6352
|
guild,
|
|
6126
|
-
await guild.client.rest.delete(
|
|
6353
|
+
await guild.client.rest.delete(Routes33.guildRolesHoistPositions(guild.id), {
|
|
6127
6354
|
auth: true
|
|
6128
6355
|
})
|
|
6129
6356
|
);
|
|
6130
6357
|
}
|
|
6131
6358
|
|
|
6132
6359
|
// src/Domain/Guild/Stickers.ts
|
|
6133
|
-
import { Routes as
|
|
6360
|
+
import { Routes as Routes34 } from "@fluxerjs/types";
|
|
6134
6361
|
async function createSticker(guild, options) {
|
|
6135
6362
|
const { reason, ...body } = options;
|
|
6136
|
-
const data = await guild.client.rest.post(
|
|
6363
|
+
const data = await guild.client.rest.post(Routes34.guildStickers(guild.id), {
|
|
6137
6364
|
body,
|
|
6138
6365
|
auth: true,
|
|
6139
6366
|
...auditReasonHeaders(reason)
|
|
@@ -6141,7 +6368,7 @@ async function createSticker(guild, options) {
|
|
|
6141
6368
|
return cacheSticker(guild, data);
|
|
6142
6369
|
}
|
|
6143
6370
|
async function cloneSticker(guild, sourceStickerId) {
|
|
6144
|
-
const data = await guild.client.rest.post(
|
|
6371
|
+
const data = await guild.client.rest.post(Routes34.guildStickersClone(guild.id), {
|
|
6145
6372
|
body: { source_sticker_id: sourceStickerId },
|
|
6146
6373
|
auth: true
|
|
6147
6374
|
});
|
|
@@ -6149,17 +6376,17 @@ async function cloneSticker(guild, sourceStickerId) {
|
|
|
6149
6376
|
}
|
|
6150
6377
|
async function createStickersBulk(guild, stickers) {
|
|
6151
6378
|
const data = await guild.client.rest.post(
|
|
6152
|
-
|
|
6379
|
+
Routes34.guildStickersBulk(guild.id),
|
|
6153
6380
|
{ body: { stickers }, auth: true }
|
|
6154
6381
|
);
|
|
6155
6382
|
return { success: data.success.map((s) => cacheSticker(guild, s)), failed: data.failed };
|
|
6156
6383
|
}
|
|
6157
6384
|
async function fetchStickers(guild) {
|
|
6158
|
-
const data = await guild.client.rest.get(
|
|
6385
|
+
const data = await guild.client.rest.get(Routes34.guildStickers(guild.id));
|
|
6159
6386
|
return data.map((s) => cacheSticker(guild, s));
|
|
6160
6387
|
}
|
|
6161
6388
|
async function fetchSticker(guild, stickerId) {
|
|
6162
|
-
const data = await guild.client.rest.get(
|
|
6389
|
+
const data = await guild.client.rest.get(Routes34.guildSticker(guild.id, stickerId));
|
|
6163
6390
|
return cacheSticker(guild, data);
|
|
6164
6391
|
}
|
|
6165
6392
|
|
|
@@ -6248,6 +6475,10 @@ var Guild = class extends Base {
|
|
|
6248
6475
|
emojis;
|
|
6249
6476
|
/** Cached stickers in this guild. */
|
|
6250
6477
|
stickers;
|
|
6478
|
+
/** Live stages in this guild's stage channels, keyed by stage instance ID. */
|
|
6479
|
+
stageInstances;
|
|
6480
|
+
/** Most participants a stage can have while speakers use video, or null if unknown. */
|
|
6481
|
+
maxStageVideoChannelUsers;
|
|
6251
6482
|
/**
|
|
6252
6483
|
* Construct a guild from API data.
|
|
6253
6484
|
* @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE
|
|
@@ -6264,6 +6495,7 @@ var Guild = class extends Base {
|
|
|
6264
6495
|
this.roles = new GuildRoleManager(this.id, { maxSize: client.cache.limits.roles });
|
|
6265
6496
|
this.emojis = new LimitedCollection4({ maxSize: client.cache.limits.emojis });
|
|
6266
6497
|
this.stickers = new LimitedCollection4({ maxSize: client.cache.limits.stickers });
|
|
6498
|
+
this.stageInstances = new Collection9();
|
|
6267
6499
|
this.name = data.name ?? "";
|
|
6268
6500
|
this.icon = data.icon ?? null;
|
|
6269
6501
|
this.banner = data.banner ?? null;
|
|
@@ -6293,6 +6525,7 @@ var Guild = class extends Base {
|
|
|
6293
6525
|
this.bannerHeight = data.banner_height ?? null;
|
|
6294
6526
|
this.splashWidth = data.splash_width ?? null;
|
|
6295
6527
|
this.splashHeight = data.splash_height ?? null;
|
|
6528
|
+
this.maxStageVideoChannelUsers = data.max_stage_video_channel_users ?? null;
|
|
6296
6529
|
this.memberCount = resolveGuildMemberCount(data) ?? null;
|
|
6297
6530
|
this.onlineCount = resolveGuildOnlineCount(data) ?? null;
|
|
6298
6531
|
for (const r of data.roles ?? []) {
|
|
@@ -6349,6 +6582,9 @@ var Guild = class extends Base {
|
|
|
6349
6582
|
if (data.banner_height !== void 0) this.bannerHeight = data.banner_height ?? null;
|
|
6350
6583
|
if (data.splash_width !== void 0) this.splashWidth = data.splash_width ?? null;
|
|
6351
6584
|
if (data.splash_height !== void 0) this.splashHeight = data.splash_height ?? null;
|
|
6585
|
+
if (data.max_stage_video_channel_users !== void 0) {
|
|
6586
|
+
this.maxStageVideoChannelUsers = data.max_stage_video_channel_users ?? null;
|
|
6587
|
+
}
|
|
6352
6588
|
const memberCount = resolveGuildMemberCount(data);
|
|
6353
6589
|
if (memberCount !== void 0) this.memberCount = memberCount;
|
|
6354
6590
|
const onlineCount = resolveGuildOnlineCount(data);
|
|
@@ -6364,11 +6600,11 @@ var Guild = class extends Base {
|
|
|
6364
6600
|
}
|
|
6365
6601
|
/** Unix timestamp (ms) when this guild was created, derived from its snowflake ID. */
|
|
6366
6602
|
get createdTimestamp() {
|
|
6367
|
-
return
|
|
6603
|
+
return SnowflakeUtil10.timestampFromSnowflake(this.id);
|
|
6368
6604
|
}
|
|
6369
6605
|
/** Date when this guild was created, derived from its snowflake ID. */
|
|
6370
6606
|
get createdAt() {
|
|
6371
|
-
return
|
|
6607
|
+
return SnowflakeUtil10.dateFromSnowflake(this.id);
|
|
6372
6608
|
}
|
|
6373
6609
|
/** The guild's name. */
|
|
6374
6610
|
toString() {
|
|
@@ -6654,6 +6890,8 @@ function upsertGuildFromSnapshot(client, guildData, resources = {}) {
|
|
|
6654
6890
|
if (resources.members !== void 0) mergeMembers(guild, resources.members);
|
|
6655
6891
|
if (resources.emojis !== void 0) syncEmojis(guild, resources.emojis);
|
|
6656
6892
|
if (resources.stickers !== void 0) syncStickers(guild, resources.stickers);
|
|
6893
|
+
if (resources.stageInstances !== void 0) syncStageInstances(guild, resources.stageInstances);
|
|
6894
|
+
if (resources.stageCounts !== void 0) applyStageCounts(guild, resources.stageCounts);
|
|
6657
6895
|
if (resources.channels !== void 0) guild.partial = false;
|
|
6658
6896
|
return { guild, created, recovered };
|
|
6659
6897
|
}
|
|
@@ -6668,7 +6906,9 @@ function applyGuildSnapshotFromGateway(client, raw) {
|
|
|
6668
6906
|
emojis: g.emojis,
|
|
6669
6907
|
stickers: g.stickers,
|
|
6670
6908
|
// A channel list without `threads` means this session has no viewable threads.
|
|
6671
|
-
threads: g.channels !== void 0 ? g.threads ?? [] : g.threads
|
|
6909
|
+
threads: g.channels !== void 0 ? g.threads ?? [] : g.threads,
|
|
6910
|
+
stageInstances: g.stage_instances,
|
|
6911
|
+
stageCounts: g.stage_counts
|
|
6672
6912
|
});
|
|
6673
6913
|
if (g.voice_states?.length) {
|
|
6674
6914
|
client.emit(Events.VoiceStatesSync, {
|
|
@@ -6680,7 +6920,7 @@ function applyGuildSnapshotFromGateway(client, raw) {
|
|
|
6680
6920
|
}
|
|
6681
6921
|
|
|
6682
6922
|
// src/ClientCore/ClientUser.ts
|
|
6683
|
-
import { GatewayOpcodes, Routes as
|
|
6923
|
+
import { GatewayOpcodes, Routes as Routes35 } from "@fluxerjs/types";
|
|
6684
6924
|
var ClientUser = class extends User {
|
|
6685
6925
|
/** Broadcast presence (gateway opcode 3) on all shards. */
|
|
6686
6926
|
setPresence(presence) {
|
|
@@ -6690,13 +6930,13 @@ var ClientUser = class extends User {
|
|
|
6690
6930
|
}
|
|
6691
6931
|
/** GET /users/@me — refresh the logged-in user from REST and patch this instance. */
|
|
6692
6932
|
async fetch() {
|
|
6693
|
-
const data = await this.client.rest.get(
|
|
6933
|
+
const data = await this.client.rest.get(Routes35.currentUser(), { auth: true });
|
|
6694
6934
|
this._patch(data);
|
|
6695
6935
|
return this;
|
|
6696
6936
|
}
|
|
6697
6937
|
/** GET /users/@me/guilds — returns camelCase partial guilds. */
|
|
6698
6938
|
async fetchGuilds(options) {
|
|
6699
|
-
const path =
|
|
6939
|
+
const path = Routes35.currentUserGuilds() + (options?.withCounts ? "?with_counts=true" : "");
|
|
6700
6940
|
const data = await this.client.rest.get(path, { auth: true });
|
|
6701
6941
|
return data.map((g) => ({
|
|
6702
6942
|
id: g.id,
|
|
@@ -6720,7 +6960,7 @@ var ClientUser = class extends User {
|
|
|
6720
6960
|
*/
|
|
6721
6961
|
async leaveGuild(guildId, options) {
|
|
6722
6962
|
const body = options ? toSudoBody(options) : void 0;
|
|
6723
|
-
await this.client.rest.delete(
|
|
6963
|
+
await this.client.rest.delete(Routes35.leaveGuild(guildId), {
|
|
6724
6964
|
body: body && Object.keys(body).length ? body : void 0,
|
|
6725
6965
|
auth: true
|
|
6726
6966
|
});
|
|
@@ -6728,7 +6968,7 @@ var ClientUser = class extends User {
|
|
|
6728
6968
|
/** Delete every message authored by the caller across a guild (sudo). */
|
|
6729
6969
|
async bulkDeleteMyMessagesInGuild(guildId, options) {
|
|
6730
6970
|
const body = options ? toSudoBody(options) : void 0;
|
|
6731
|
-
await this.client.rest.post(
|
|
6971
|
+
await this.client.rest.post(Routes35.guildBulkDeleteMine(guildId), {
|
|
6732
6972
|
body: body && Object.keys(body).length ? body : void 0,
|
|
6733
6973
|
auth: true
|
|
6734
6974
|
});
|
|
@@ -7200,7 +7440,7 @@ var memberHandlers = {
|
|
|
7200
7440
|
};
|
|
7201
7441
|
|
|
7202
7442
|
// src/ClientCore/EventHandlers/Messages.ts
|
|
7203
|
-
import { SnowflakeUtil as
|
|
7443
|
+
import { SnowflakeUtil as SnowflakeUtil11 } from "@fluxerjs/util";
|
|
7204
7444
|
function cachedTextChannel(client, channelId) {
|
|
7205
7445
|
const channel = client.channels.get(channelId);
|
|
7206
7446
|
return channel?.isTextBased() ? channel : null;
|
|
@@ -7216,7 +7456,7 @@ function toPartialMessage(client, args) {
|
|
|
7216
7456
|
const cached = args.cached;
|
|
7217
7457
|
const authorId = args.authorId ?? cached?.author?.id ?? null;
|
|
7218
7458
|
const author = cached?.author ? client.getOrCreateUser(cached.author) : authorId ? client.users.get(authorId) ?? null : null;
|
|
7219
|
-
const createdAt = cached?.timestamp ? new Date(cached.timestamp) :
|
|
7459
|
+
const createdAt = cached?.timestamp ? new Date(cached.timestamp) : SnowflakeUtil11.isValid(args.id) ? SnowflakeUtil11.dateFromSnowflake(args.id) : null;
|
|
7220
7460
|
return new PartialMessage(client, {
|
|
7221
7461
|
id: args.id,
|
|
7222
7462
|
channelId: args.channelId,
|
|
@@ -7480,6 +7720,46 @@ var passthroughHandlers = {
|
|
|
7480
7720
|
WEBAUTHN_CREDENTIALS_UPDATE: pass(Events.WebAuthnCredentialsUpdate)
|
|
7481
7721
|
};
|
|
7482
7722
|
|
|
7723
|
+
// src/ClientCore/EventHandlers/Stages.ts
|
|
7724
|
+
var stageHandlers = {
|
|
7725
|
+
STAGE_INSTANCE_CREATE(client, d) {
|
|
7726
|
+
const instance = cacheStageInstance(client, d);
|
|
7727
|
+
client.emit(Events.StageInstanceCreate, instance);
|
|
7728
|
+
},
|
|
7729
|
+
STAGE_INSTANCE_UPDATE(client, d) {
|
|
7730
|
+
const data = d;
|
|
7731
|
+
const cached = client.guilds.get(data.guild_id)?.stageInstances.get(data.id);
|
|
7732
|
+
const old = cached ? new StageInstance(client, cached.toJSON()) : null;
|
|
7733
|
+
const instance = cacheStageInstance(client, data);
|
|
7734
|
+
client.emit(Events.StageInstanceUpdate, old, instance);
|
|
7735
|
+
},
|
|
7736
|
+
STAGE_INSTANCE_DELETE(client, d) {
|
|
7737
|
+
const data = d;
|
|
7738
|
+
const guild = client.guilds.get(data.guild_id);
|
|
7739
|
+
const instance = guild?.stageInstances.get(data.id) ?? new StageInstance(client, data);
|
|
7740
|
+
instance._patch(data);
|
|
7741
|
+
guild?.stageInstances.delete(data.id);
|
|
7742
|
+
client.emit(Events.StageInstanceDelete, instance);
|
|
7743
|
+
},
|
|
7744
|
+
STAGE_COUNTS_UPDATE(client, d) {
|
|
7745
|
+
const data = d;
|
|
7746
|
+
const channel = client.channels.get(data.channel_id);
|
|
7747
|
+
if (channel?.isStage()) channel._patchCounts(data);
|
|
7748
|
+
const payload = {
|
|
7749
|
+
guildId: data.guild_id,
|
|
7750
|
+
channelId: data.channel_id,
|
|
7751
|
+
listenerCount: data.listener_count,
|
|
7752
|
+
speakerCount: data.speaker_count,
|
|
7753
|
+
requestCount: data.request_count,
|
|
7754
|
+
videoEnabled: data.video_enabled ?? null
|
|
7755
|
+
};
|
|
7756
|
+
client.emit(Events.StageCountsUpdate, payload);
|
|
7757
|
+
},
|
|
7758
|
+
STAGE_VOICE_STATES_SYNC: pass(Events.StageVoiceStatesSync),
|
|
7759
|
+
STAGE_AUDIENCE_LIST_UPDATE: pass(Events.StageAudienceListUpdate),
|
|
7760
|
+
VOICE_JOIN_QUEUED: pass(Events.VoiceJoinQueued)
|
|
7761
|
+
};
|
|
7762
|
+
|
|
7483
7763
|
// src/ClientCore/EventHandlers/Threads.ts
|
|
7484
7764
|
function cachedChannel(client, id) {
|
|
7485
7765
|
const direct = client.channels.get(id);
|
|
@@ -7590,7 +7870,8 @@ var eventHandlers = buildRegistry(
|
|
|
7590
7870
|
inviteHandlers,
|
|
7591
7871
|
guildResourceHandlers,
|
|
7592
7872
|
passthroughHandlers,
|
|
7593
|
-
threadHandlers
|
|
7873
|
+
threadHandlers,
|
|
7874
|
+
stageHandlers
|
|
7594
7875
|
);
|
|
7595
7876
|
|
|
7596
7877
|
// src/ClientCore/GatewayDispatch.ts
|
|
@@ -7850,7 +8131,7 @@ async function connectClientGateway(client, token, signal) {
|
|
|
7850
8131
|
|
|
7851
8132
|
// src/ClientCore/GuildManager.ts
|
|
7852
8133
|
import { LimitedCollection as LimitedCollection5 } from "@fluxerjs/collection";
|
|
7853
|
-
import { Routes as
|
|
8134
|
+
import { Routes as Routes36 } from "@fluxerjs/types";
|
|
7854
8135
|
var GuildManager = class extends LimitedCollection5 {
|
|
7855
8136
|
constructor(client) {
|
|
7856
8137
|
super({
|
|
@@ -7910,7 +8191,7 @@ var GuildManager = class extends LimitedCollection5 {
|
|
|
7910
8191
|
return dedupeFetch(this.pendingFetches, id, async () => {
|
|
7911
8192
|
try {
|
|
7912
8193
|
const data = assertApiObjectWithId(
|
|
7913
|
-
await this.client.rest.get(
|
|
8194
|
+
await this.client.rest.get(Routes36.guild(id)),
|
|
7914
8195
|
"guilds.fetch()"
|
|
7915
8196
|
);
|
|
7916
8197
|
let guild;
|
|
@@ -8020,7 +8301,7 @@ var MessageCache = class {
|
|
|
8020
8301
|
// src/ClientCore/UserManager.ts
|
|
8021
8302
|
import { LimitedCollection as LimitedCollection6 } from "@fluxerjs/collection";
|
|
8022
8303
|
import {
|
|
8023
|
-
Routes as
|
|
8304
|
+
Routes as Routes37
|
|
8024
8305
|
} from "@fluxerjs/types";
|
|
8025
8306
|
var soft = (p) => p.catch(() => null);
|
|
8026
8307
|
var UserManager = class extends LimitedCollection6 {
|
|
@@ -8055,7 +8336,7 @@ var UserManager = class extends LimitedCollection6 {
|
|
|
8055
8336
|
id,
|
|
8056
8337
|
async () => this.client.getOrCreateUser(
|
|
8057
8338
|
assertApiObjectWithId(
|
|
8058
|
-
await this.client.rest.get(
|
|
8339
|
+
await this.client.rest.get(Routes37.user(id)),
|
|
8059
8340
|
"users.fetch()"
|
|
8060
8341
|
)
|
|
8061
8342
|
)
|
|
@@ -8078,10 +8359,10 @@ var UserManager = class extends LimitedCollection6 {
|
|
|
8078
8359
|
async fetchWithProfile(userId, options) {
|
|
8079
8360
|
const guildId = options?.guildId ?? void 0;
|
|
8080
8361
|
const [userData, globalProfileRaw, serverProfileRaw, memberData] = await Promise.all([
|
|
8081
|
-
this.client.rest.get(
|
|
8082
|
-
soft(this.client.rest.get(
|
|
8083
|
-
guildId ? soft(this.client.rest.get(
|
|
8084
|
-
guildId ? soft(this.client.rest.get(
|
|
8362
|
+
this.client.rest.get(Routes37.user(userId)),
|
|
8363
|
+
soft(this.client.rest.get(Routes37.userProfile(userId))),
|
|
8364
|
+
guildId ? soft(this.client.rest.get(Routes37.userProfile(userId, guildId))) : null,
|
|
8365
|
+
guildId ? soft(this.client.rest.get(Routes37.guildMember(guildId, userId))) : null
|
|
8085
8366
|
]);
|
|
8086
8367
|
const user = this.client.getOrCreateUser(userData);
|
|
8087
8368
|
let member = null;
|
|
@@ -8664,7 +8945,7 @@ var Client = class _Client extends EventEmitter3 {
|
|
|
8664
8945
|
* @see {@link Routes}
|
|
8665
8946
|
*/
|
|
8666
8947
|
static get Routes() {
|
|
8667
|
-
return
|
|
8948
|
+
return Routes38;
|
|
8668
8949
|
}
|
|
8669
8950
|
};
|
|
8670
8951
|
|
|
@@ -9077,9 +9358,11 @@ export {
|
|
|
9077
9358
|
ReactionCollector,
|
|
9078
9359
|
RelationshipType,
|
|
9079
9360
|
Role,
|
|
9080
|
-
|
|
9361
|
+
Routes39 as Routes,
|
|
9081
9362
|
STATIC_CDN_URL,
|
|
9082
9363
|
SplashCardAlignment,
|
|
9364
|
+
StageChannel,
|
|
9365
|
+
StageInstance,
|
|
9083
9366
|
SystemChannelFlags,
|
|
9084
9367
|
TextChannel,
|
|
9085
9368
|
ThreadAutoArchiveDuration,
|