@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/client.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/ClientCore/Client.ts
|
|
2
2
|
import { EventEmitter as EventEmitter3 } from "events";
|
|
3
3
|
import { REST } from "@fluxerjs/rest";
|
|
4
|
-
import { GatewayOpcodes as GatewayOpcodes2, Routes as
|
|
4
|
+
import { GatewayOpcodes as GatewayOpcodes2, Routes as Routes38 } from "@fluxerjs/types";
|
|
5
5
|
import { createLogger } from "@fluxerjs/util";
|
|
6
6
|
|
|
7
7
|
// src/Domain/Message/Message.ts
|
|
@@ -985,6 +985,13 @@ var Events = {
|
|
|
985
985
|
VoiceSignal: "voiceSignal",
|
|
986
986
|
OperatorPassUpdate: "operatorPassUpdate",
|
|
987
987
|
VoiceStatesSync: "voiceStatesSync",
|
|
988
|
+
VoiceJoinQueued: "voiceJoinQueued",
|
|
989
|
+
StageInstanceCreate: "stageInstanceCreate",
|
|
990
|
+
StageInstanceUpdate: "stageInstanceUpdate",
|
|
991
|
+
StageInstanceDelete: "stageInstanceDelete",
|
|
992
|
+
StageCountsUpdate: "stageCountsUpdate",
|
|
993
|
+
StageVoiceStatesSync: "stageVoiceStatesSync",
|
|
994
|
+
StageAudienceListUpdate: "stageAudienceListUpdate",
|
|
988
995
|
WebhooksUpdate: "webhooksUpdate",
|
|
989
996
|
Resumed: "resumed",
|
|
990
997
|
Error: "error",
|
|
@@ -1544,11 +1551,11 @@ var Channel = class extends Base {
|
|
|
1544
1551
|
* Checks {@link ChannelType}, not whether `send` exists on the instance.
|
|
1545
1552
|
*/
|
|
1546
1553
|
isTextBased() {
|
|
1547
|
-
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;
|
|
1554
|
+
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;
|
|
1548
1555
|
}
|
|
1549
1556
|
/** Check if this is a guild channel, including threads, forums, and media channels. */
|
|
1550
1557
|
isGuild() {
|
|
1551
|
-
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;
|
|
1558
|
+
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;
|
|
1552
1559
|
}
|
|
1553
1560
|
/** Check if this is a thread (public, private, or announcement). */
|
|
1554
1561
|
isThread() {
|
|
@@ -1582,10 +1589,18 @@ var Channel = class extends Base {
|
|
|
1582
1589
|
isPersonalNotes() {
|
|
1583
1590
|
return this.type === ChannelType3.DMPersonalNotes;
|
|
1584
1591
|
}
|
|
1585
|
-
/** Check if this is a voice channel. */
|
|
1592
|
+
/** Check if this is a voice channel (type 2 only; see {@link isVoiceBased} to include stages). */
|
|
1586
1593
|
isVoice() {
|
|
1587
1594
|
return this.type === ChannelType3.GuildVoice;
|
|
1588
1595
|
}
|
|
1596
|
+
/** Check if this is a stage channel (type 13). */
|
|
1597
|
+
isStage() {
|
|
1598
|
+
return this.type === ChannelType3.GuildStageVoice;
|
|
1599
|
+
}
|
|
1600
|
+
/** Check if this is a voice or stage channel, i.e. one `@fluxerjs/voice` can join. */
|
|
1601
|
+
isVoiceBased() {
|
|
1602
|
+
return this.type === ChannelType3.GuildVoice || this.type === ChannelType3.GuildStageVoice;
|
|
1603
|
+
}
|
|
1589
1604
|
/** Check if this is a link channel. */
|
|
1590
1605
|
isLink() {
|
|
1591
1606
|
return this.type === ChannelType3.GuildLink;
|
|
@@ -2596,8 +2611,8 @@ var PartialMessage = class {
|
|
|
2596
2611
|
};
|
|
2597
2612
|
|
|
2598
2613
|
// src/Domain/User.ts
|
|
2599
|
-
import { Routes as
|
|
2600
|
-
import { SnowflakeUtil as
|
|
2614
|
+
import { Routes as Routes18 } from "@fluxerjs/types";
|
|
2615
|
+
import { SnowflakeUtil as SnowflakeUtil6 } from "@fluxerjs/util";
|
|
2601
2616
|
|
|
2602
2617
|
// src/Domain/Channel/Dm.ts
|
|
2603
2618
|
import { ChannelType as ChannelType4, Routes as Routes9 } from "@fluxerjs/types";
|
|
@@ -2738,11 +2753,11 @@ var DMChannel = class extends TextCapable(Channel) {
|
|
|
2738
2753
|
// src/Domain/Channel/Forum.ts
|
|
2739
2754
|
import {
|
|
2740
2755
|
ChannelType as ChannelType7,
|
|
2741
|
-
Routes as
|
|
2756
|
+
Routes as Routes17
|
|
2742
2757
|
} from "@fluxerjs/types";
|
|
2743
2758
|
|
|
2744
2759
|
// src/Domain/Channel/Guild.ts
|
|
2745
|
-
import { Routes as
|
|
2760
|
+
import { Routes as Routes14 } from "@fluxerjs/types";
|
|
2746
2761
|
import { PermissionFlags } from "@fluxerjs/util";
|
|
2747
2762
|
|
|
2748
2763
|
// src/Domain/Invite.ts
|
|
@@ -3341,6 +3356,127 @@ var PermissionOverwriteManager = class {
|
|
|
3341
3356
|
}
|
|
3342
3357
|
};
|
|
3343
3358
|
|
|
3359
|
+
// src/Domain/StageInstance.ts
|
|
3360
|
+
import { Routes as Routes13, StageInstancePrivacyLevel } from "@fluxerjs/types";
|
|
3361
|
+
import { SnowflakeUtil as SnowflakeUtil5 } from "@fluxerjs/util";
|
|
3362
|
+
var StageInstance = class extends Base {
|
|
3363
|
+
client;
|
|
3364
|
+
id;
|
|
3365
|
+
guildId;
|
|
3366
|
+
channelId;
|
|
3367
|
+
topic;
|
|
3368
|
+
/** Always {@link StageInstancePrivacyLevel.GuildOnly} on Fluxer. */
|
|
3369
|
+
privacyLevel;
|
|
3370
|
+
/** Always `true` on Fluxer. */
|
|
3371
|
+
discoverableDisabled;
|
|
3372
|
+
/** Always null on Fluxer. */
|
|
3373
|
+
guildScheduledEventId;
|
|
3374
|
+
constructor(client, data) {
|
|
3375
|
+
super();
|
|
3376
|
+
this.client = client;
|
|
3377
|
+
this.id = data.id;
|
|
3378
|
+
this.guildId = data.guild_id;
|
|
3379
|
+
this.channelId = data.channel_id;
|
|
3380
|
+
this.topic = data.topic;
|
|
3381
|
+
this.privacyLevel = data.privacy_level ?? StageInstancePrivacyLevel.GuildOnly;
|
|
3382
|
+
this.discoverableDisabled = data.discoverable_disabled ?? true;
|
|
3383
|
+
this.guildScheduledEventId = data.guild_scheduled_event_id ?? null;
|
|
3384
|
+
}
|
|
3385
|
+
/** @internal Patch in place from a newer payload. */
|
|
3386
|
+
_patch(data) {
|
|
3387
|
+
if (data.topic !== void 0) this.topic = data.topic;
|
|
3388
|
+
if (data.privacy_level !== void 0) this.privacyLevel = data.privacy_level;
|
|
3389
|
+
if (data.discoverable_disabled !== void 0) {
|
|
3390
|
+
this.discoverableDisabled = data.discoverable_disabled;
|
|
3391
|
+
}
|
|
3392
|
+
if (data.guild_scheduled_event_id !== void 0) {
|
|
3393
|
+
this.guildScheduledEventId = data.guild_scheduled_event_id ?? null;
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3396
|
+
get guild() {
|
|
3397
|
+
return this.client.guilds.get(this.guildId) ?? null;
|
|
3398
|
+
}
|
|
3399
|
+
get channel() {
|
|
3400
|
+
const channel = this.client.channels.get(this.channelId);
|
|
3401
|
+
return channel?.isStage() ? channel : null;
|
|
3402
|
+
}
|
|
3403
|
+
/** Unix timestamp (ms) when the stage started, from its snowflake ID. */
|
|
3404
|
+
get createdTimestamp() {
|
|
3405
|
+
return SnowflakeUtil5.timestampFromSnowflake(this.id);
|
|
3406
|
+
}
|
|
3407
|
+
get createdAt() {
|
|
3408
|
+
return SnowflakeUtil5.dateFromSnowflake(this.id);
|
|
3409
|
+
}
|
|
3410
|
+
/**
|
|
3411
|
+
* Change the live stage. Needs a stage moderator.
|
|
3412
|
+
* Fires `STAGE_INSTANCE_UPDATE`.
|
|
3413
|
+
*/
|
|
3414
|
+
async edit(options) {
|
|
3415
|
+
const body = {};
|
|
3416
|
+
if (options.topic !== void 0) body.topic = options.topic;
|
|
3417
|
+
const data = await this.client.rest.patch(
|
|
3418
|
+
Routes13.stageInstance(this.channelId),
|
|
3419
|
+
{ body, auth: true, ...auditReasonHeaders(options.reason) }
|
|
3420
|
+
);
|
|
3421
|
+
this._patch(data);
|
|
3422
|
+
return this;
|
|
3423
|
+
}
|
|
3424
|
+
/** Change the stage topic. Shorthand for {@link edit}. */
|
|
3425
|
+
async setTopic(topic, reason) {
|
|
3426
|
+
return this.edit({ topic, reason });
|
|
3427
|
+
}
|
|
3428
|
+
/**
|
|
3429
|
+
* End the stage. Needs a stage moderator. Speakers move to the audience, raised hands are
|
|
3430
|
+
* lowered, and everyone stays connected unless `disconnectAll` is set.
|
|
3431
|
+
*/
|
|
3432
|
+
async delete(options = {}) {
|
|
3433
|
+
const route = Routes13.stageInstance(this.channelId) + (options.disconnectAll ? "?disconnect_all=true" : "");
|
|
3434
|
+
await this.client.rest.delete(route, { auth: true, ...auditReasonHeaders(options.reason) });
|
|
3435
|
+
}
|
|
3436
|
+
toJSON() {
|
|
3437
|
+
return {
|
|
3438
|
+
id: this.id,
|
|
3439
|
+
guild_id: this.guildId,
|
|
3440
|
+
channel_id: this.channelId,
|
|
3441
|
+
topic: this.topic,
|
|
3442
|
+
privacy_level: this.privacyLevel,
|
|
3443
|
+
discoverable_disabled: this.discoverableDisabled,
|
|
3444
|
+
guild_scheduled_event_id: this.guildScheduledEventId
|
|
3445
|
+
};
|
|
3446
|
+
}
|
|
3447
|
+
};
|
|
3448
|
+
|
|
3449
|
+
// src/Domain/Channel/StageSync.ts
|
|
3450
|
+
function syncStageInstances(guild, instances) {
|
|
3451
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3452
|
+
for (const data of instances) {
|
|
3453
|
+
seen.add(data.id);
|
|
3454
|
+
const existing = guild.stageInstances.get(data.id);
|
|
3455
|
+
if (existing) existing._patch(data);
|
|
3456
|
+
else guild.stageInstances.set(data.id, new StageInstance(guild.client, data));
|
|
3457
|
+
}
|
|
3458
|
+
for (const id of [...guild.stageInstances.keys()]) {
|
|
3459
|
+
if (!seen.has(id)) guild.stageInstances.delete(id);
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
function applyStageCounts(guild, counts) {
|
|
3463
|
+
for (const count of counts) {
|
|
3464
|
+
const channel = guild.channels.get(count.channel_id);
|
|
3465
|
+
if (channel?.isStage()) channel._patchCounts(count);
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
function cacheStageInstance(client, data) {
|
|
3469
|
+
const guild = client.guilds.get(data.guild_id);
|
|
3470
|
+
const existing = guild?.stageInstances.get(data.id);
|
|
3471
|
+
if (existing) {
|
|
3472
|
+
existing._patch(data);
|
|
3473
|
+
return existing;
|
|
3474
|
+
}
|
|
3475
|
+
const instance = new StageInstance(client, data);
|
|
3476
|
+
guild?.stageInstances.set(instance.id, instance);
|
|
3477
|
+
return instance;
|
|
3478
|
+
}
|
|
3479
|
+
|
|
3344
3480
|
// src/Domain/Channel/ThreadBind.ts
|
|
3345
3481
|
var factory;
|
|
3346
3482
|
var managers = /* @__PURE__ */ new WeakMap();
|
|
@@ -3395,7 +3531,7 @@ var GuildChannel = class extends Channel {
|
|
|
3395
3531
|
}
|
|
3396
3532
|
/** Create a webhook for this channel. Requires Manage Webhooks. */
|
|
3397
3533
|
async createWebhook(options) {
|
|
3398
|
-
const data = await this.client.rest.post(
|
|
3534
|
+
const data = await this.client.rest.post(Routes14.channelWebhooks(this.id), {
|
|
3399
3535
|
body: options,
|
|
3400
3536
|
auth: true
|
|
3401
3537
|
});
|
|
@@ -3403,13 +3539,13 @@ var GuildChannel = class extends Channel {
|
|
|
3403
3539
|
}
|
|
3404
3540
|
/** Fetch all webhooks in this channel. Requires Manage Webhooks. */
|
|
3405
3541
|
async fetchWebhooks() {
|
|
3406
|
-
const data = await this.client.rest.get(
|
|
3542
|
+
const data = await this.client.rest.get(Routes14.channelWebhooks(this.id));
|
|
3407
3543
|
return data.map((w) => new Webhook(this.client, w));
|
|
3408
3544
|
}
|
|
3409
3545
|
/** Create an invite for this channel. Requires Create Instant Invite. */
|
|
3410
3546
|
async createInvite(options) {
|
|
3411
3547
|
const body = options ? toChannelInviteBody(options) : {};
|
|
3412
|
-
const data = await this.client.rest.post(
|
|
3548
|
+
const data = await this.client.rest.post(Routes14.channelInvites(this.id), {
|
|
3413
3549
|
body: Object.keys(body).length ? body : void 0,
|
|
3414
3550
|
auth: true
|
|
3415
3551
|
});
|
|
@@ -3417,7 +3553,7 @@ var GuildChannel = class extends Channel {
|
|
|
3417
3553
|
}
|
|
3418
3554
|
/** Fetch all invites for this channel. Requires Manage Channels. */
|
|
3419
3555
|
async fetchInvites() {
|
|
3420
|
-
const data = await this.client.rest.get(
|
|
3556
|
+
const data = await this.client.rest.get(Routes14.channelInvites(this.id));
|
|
3421
3557
|
return data.map((i) => new Invite(this.client, i));
|
|
3422
3558
|
}
|
|
3423
3559
|
/** Check if the bot can send messages in this channel (cache-only; needs `members.me`). */
|
|
@@ -3447,7 +3583,7 @@ var GuildChannel = class extends Channel {
|
|
|
3447
3583
|
}
|
|
3448
3584
|
/** Edit this channel's settings. Requires Manage Channels. */
|
|
3449
3585
|
async edit(options) {
|
|
3450
|
-
const data = await this.client.rest.patch(
|
|
3586
|
+
const data = await this.client.rest.patch(Routes14.channel(this.id), {
|
|
3451
3587
|
body: toChannelEditBody(options),
|
|
3452
3588
|
auth: true,
|
|
3453
3589
|
...auditReasonHeaders(options.reason)
|
|
@@ -3529,7 +3665,7 @@ var TextChannel = class extends TextCapable(GuildChannel) {
|
|
|
3529
3665
|
* Sends only those fields. The thread-parent update body does not accept a channel rename.
|
|
3530
3666
|
*/
|
|
3531
3667
|
async editThreadDefaults(options) {
|
|
3532
|
-
const data = await this.client.rest.patch(
|
|
3668
|
+
const data = await this.client.rest.patch(Routes14.channel(this.id), {
|
|
3533
3669
|
body: toThreadParentEditBody(options),
|
|
3534
3670
|
auth: true,
|
|
3535
3671
|
...auditReasonHeaders(options.reason)
|
|
@@ -3545,14 +3681,14 @@ var AnnouncementChannel = class extends TextChannel {
|
|
|
3545
3681
|
*/
|
|
3546
3682
|
async follow(webhookChannelId) {
|
|
3547
3683
|
return this.client.rest.post(
|
|
3548
|
-
|
|
3684
|
+
Routes14.channelFollowers(this.id),
|
|
3549
3685
|
{ body: { webhook_channel_id: webhookChannelId }, auth: true }
|
|
3550
3686
|
);
|
|
3551
3687
|
}
|
|
3552
3688
|
/** Fetch follower counts for this announcement channel. */
|
|
3553
3689
|
async fetchFollowerStats() {
|
|
3554
3690
|
return this.client.rest.get(
|
|
3555
|
-
|
|
3691
|
+
Routes14.channelFollowerStats(this.id),
|
|
3556
3692
|
{ auth: true }
|
|
3557
3693
|
);
|
|
3558
3694
|
}
|
|
@@ -3627,6 +3763,96 @@ var VoiceChannel = class extends TextCapable(GuildChannel) {
|
|
|
3627
3763
|
if ("rtc_p2p" in data) this.rtcP2p = data.rtc_p2p ?? false;
|
|
3628
3764
|
}
|
|
3629
3765
|
};
|
|
3766
|
+
var StageChannel = class extends VoiceChannel {
|
|
3767
|
+
/** Last known stage counts, or null until Fluxer sends them. */
|
|
3768
|
+
counts = null;
|
|
3769
|
+
/** The cached live stage of this channel, or null when the stage isn't live (or not cached). */
|
|
3770
|
+
get stageInstance() {
|
|
3771
|
+
const guild = this.client.guilds.get(this.guildId);
|
|
3772
|
+
if (!guild) return null;
|
|
3773
|
+
for (const instance of guild.stageInstances.values()) {
|
|
3774
|
+
if (instance.channelId === this.id) return instance;
|
|
3775
|
+
}
|
|
3776
|
+
return null;
|
|
3777
|
+
}
|
|
3778
|
+
/** Whether the stage is live according to the cache. */
|
|
3779
|
+
get isLive() {
|
|
3780
|
+
return this.stageInstance !== null;
|
|
3781
|
+
}
|
|
3782
|
+
/**
|
|
3783
|
+
* Start a stage in this channel. Needs a stage moderator (`MANAGE_CHANNELS`, `MUTE_MEMBERS` and
|
|
3784
|
+
* `MOVE_MEMBERS`). When the caller is connected to the stage, they become a speaker.
|
|
3785
|
+
*/
|
|
3786
|
+
async createStageInstance(options) {
|
|
3787
|
+
const body = { channel_id: this.id, topic: options.topic };
|
|
3788
|
+
if (options.sendStartNotification !== void 0) {
|
|
3789
|
+
body.send_start_notification = options.sendStartNotification;
|
|
3790
|
+
}
|
|
3791
|
+
const data = await this.client.rest.post(Routes14.stageInstances(), {
|
|
3792
|
+
body,
|
|
3793
|
+
auth: true,
|
|
3794
|
+
...auditReasonHeaders(options.reason)
|
|
3795
|
+
});
|
|
3796
|
+
return cacheStageInstance(this.client, data);
|
|
3797
|
+
}
|
|
3798
|
+
/** Fetch the live stage of this channel. Rejects with `UNKNOWN_STAGE_INSTANCE` when not live. */
|
|
3799
|
+
async fetchStageInstance() {
|
|
3800
|
+
const data = await this.client.rest.get(Routes14.stageInstance(this.id), {
|
|
3801
|
+
auth: true
|
|
3802
|
+
});
|
|
3803
|
+
return cacheStageInstance(this.client, data);
|
|
3804
|
+
}
|
|
3805
|
+
/**
|
|
3806
|
+
* Move a member (or yourself when `user` is omitted) between the audience and the speakers.
|
|
3807
|
+
*
|
|
3808
|
+
* - Yourself, `false`: become a speaker (needs `MUTE_MEMBERS`), or accept an open invite.
|
|
3809
|
+
* - Yourself, `true`: move to the audience, or decline an invite.
|
|
3810
|
+
* - Another member, `false`: invite them to speak (a bot becomes a speaker at once). Needs `MUTE_MEMBERS`.
|
|
3811
|
+
* - Another member, `true`: move them to the audience and clear a raised hand or invite.
|
|
3812
|
+
*/
|
|
3813
|
+
async setSuppressed(suppressed, user) {
|
|
3814
|
+
const userId = user === void 0 ? "@me" : typeof user === "string" ? user : user.id;
|
|
3815
|
+
const body = {
|
|
3816
|
+
channel_id: this.id,
|
|
3817
|
+
suppress: suppressed
|
|
3818
|
+
};
|
|
3819
|
+
await this.client.rest.patch(Routes14.guildVoiceState(this.guildId, userId), {
|
|
3820
|
+
body,
|
|
3821
|
+
auth: true
|
|
3822
|
+
});
|
|
3823
|
+
}
|
|
3824
|
+
/** Invite a member to speak (a bot becomes a speaker at once). Needs `MUTE_MEMBERS`. */
|
|
3825
|
+
async inviteToSpeak(user) {
|
|
3826
|
+
await this.setSuppressed(false, user);
|
|
3827
|
+
}
|
|
3828
|
+
/** Move a speaker (or yourself when `user` is omitted) to the audience. */
|
|
3829
|
+
async moveToAudience(user) {
|
|
3830
|
+
await this.setSuppressed(true, user);
|
|
3831
|
+
}
|
|
3832
|
+
/**
|
|
3833
|
+
* Raise (`true`) or lower (`false`) your hand. Raising needs a live stage and
|
|
3834
|
+
* `REQUEST_TO_SPEAK`; lowering also accepts an open invite to speak.
|
|
3835
|
+
*/
|
|
3836
|
+
async setRequestToSpeak(raised = true) {
|
|
3837
|
+
const body = {
|
|
3838
|
+
channel_id: this.id,
|
|
3839
|
+
request_to_speak_timestamp: raised ? (/* @__PURE__ */ new Date()).toISOString() : null
|
|
3840
|
+
};
|
|
3841
|
+
await this.client.rest.patch(Routes14.guildVoiceState(this.guildId, "@me"), {
|
|
3842
|
+
body,
|
|
3843
|
+
auth: true
|
|
3844
|
+
});
|
|
3845
|
+
}
|
|
3846
|
+
/** @internal Apply a stage count object. */
|
|
3847
|
+
_patchCounts(data) {
|
|
3848
|
+
this.counts = {
|
|
3849
|
+
listenerCount: data.listener_count,
|
|
3850
|
+
speakerCount: data.speaker_count,
|
|
3851
|
+
requestCount: data.request_count,
|
|
3852
|
+
videoEnabled: data.video_enabled ?? null
|
|
3853
|
+
};
|
|
3854
|
+
}
|
|
3855
|
+
};
|
|
3630
3856
|
var LinkChannel = class extends GuildChannel {
|
|
3631
3857
|
/** External URL this channel links to. */
|
|
3632
3858
|
url;
|
|
@@ -3640,10 +3866,10 @@ var LinkChannel = class extends GuildChannel {
|
|
|
3640
3866
|
};
|
|
3641
3867
|
|
|
3642
3868
|
// src/Domain/Channel/ThreadManager.ts
|
|
3643
|
-
import { ChannelType as ChannelType6, Routes as
|
|
3869
|
+
import { ChannelType as ChannelType6, Routes as Routes16 } from "@fluxerjs/types";
|
|
3644
3870
|
|
|
3645
3871
|
// src/Domain/Channel/ThreadChannel.ts
|
|
3646
|
-
import { ChannelType as ChannelType5, Routes as
|
|
3872
|
+
import { ChannelType as ChannelType5, Routes as Routes15 } from "@fluxerjs/types";
|
|
3647
3873
|
var ThreadMember = class {
|
|
3648
3874
|
/** Thread ID. */
|
|
3649
3875
|
id;
|
|
@@ -3770,7 +3996,7 @@ var ThreadChannel = class extends TextCapable(GuildChannel) {
|
|
|
3770
3996
|
* `appliedTags` is sent for public and announcement threads. `invitable` is sent for private threads.
|
|
3771
3997
|
*/
|
|
3772
3998
|
async edit(options) {
|
|
3773
|
-
const data = await this.client.rest.patch(
|
|
3999
|
+
const data = await this.client.rest.patch(Routes15.channel(this.id), {
|
|
3774
4000
|
body: toThreadEditBody(this.type, threadEditFields(options)),
|
|
3775
4001
|
auth: true,
|
|
3776
4002
|
...auditReasonHeaders(options.reason)
|
|
@@ -3788,16 +4014,16 @@ var ThreadChannel = class extends TextCapable(GuildChannel) {
|
|
|
3788
4014
|
}
|
|
3789
4015
|
/** Join this thread. */
|
|
3790
4016
|
async join() {
|
|
3791
|
-
await this.client.rest.put(
|
|
4017
|
+
await this.client.rest.put(Routes15.channelThreadMemberMe(this.id), { auth: true });
|
|
3792
4018
|
}
|
|
3793
4019
|
/** Leave this thread. */
|
|
3794
4020
|
async leave() {
|
|
3795
|
-
await this.client.rest.delete(
|
|
4021
|
+
await this.client.rest.delete(Routes15.channelThreadMemberMe(this.id), { auth: true });
|
|
3796
4022
|
}
|
|
3797
4023
|
/** Update the current user's notification settings for this thread. */
|
|
3798
4024
|
async editSelf(options) {
|
|
3799
4025
|
const data = await this.client.rest.patch(
|
|
3800
|
-
|
|
4026
|
+
Routes15.channelThreadMemberMeSettings(this.id),
|
|
3801
4027
|
{ body: toThreadMemberSettingsBody(options), auth: true }
|
|
3802
4028
|
);
|
|
3803
4029
|
this.member = data ? new ThreadMember(data) : null;
|
|
@@ -3811,7 +4037,7 @@ var ThreadMemberManager = class {
|
|
|
3811
4037
|
/** List members of this thread. */
|
|
3812
4038
|
async fetch(options) {
|
|
3813
4039
|
const data = await this.thread.client.rest.get(
|
|
3814
|
-
withQuery(
|
|
4040
|
+
withQuery(Routes15.channelThreadMembers(this.thread.id), {
|
|
3815
4041
|
with_member: options?.withMember === void 0 ? void 0 : String(options.withMember),
|
|
3816
4042
|
after: options?.after,
|
|
3817
4043
|
limit: options?.limit
|
|
@@ -3822,7 +4048,7 @@ var ThreadMemberManager = class {
|
|
|
3822
4048
|
/** Fetch one member of this thread. */
|
|
3823
4049
|
async fetchOne(userId, options) {
|
|
3824
4050
|
const data = await this.thread.client.rest.get(
|
|
3825
|
-
withQuery(
|
|
4051
|
+
withQuery(Routes15.channelThreadMember(this.thread.id, userId), {
|
|
3826
4052
|
with_member: options?.withMember === void 0 ? void 0 : String(options.withMember)
|
|
3827
4053
|
})
|
|
3828
4054
|
);
|
|
@@ -3830,13 +4056,13 @@ var ThreadMemberManager = class {
|
|
|
3830
4056
|
}
|
|
3831
4057
|
/** Add a user to this thread. Private threads only, unless the caller can manage the parent. */
|
|
3832
4058
|
async add(userId) {
|
|
3833
|
-
await this.thread.client.rest.put(
|
|
4059
|
+
await this.thread.client.rest.put(Routes15.channelThreadMember(this.thread.id, userId), {
|
|
3834
4060
|
auth: true
|
|
3835
4061
|
});
|
|
3836
4062
|
}
|
|
3837
4063
|
/** Remove a user from this thread. */
|
|
3838
4064
|
async remove(userId) {
|
|
3839
|
-
await this.thread.client.rest.delete(
|
|
4065
|
+
await this.thread.client.rest.delete(Routes15.channelThreadMember(this.thread.id, userId), {
|
|
3840
4066
|
auth: true
|
|
3841
4067
|
});
|
|
3842
4068
|
}
|
|
@@ -3861,7 +4087,7 @@ var ThreadManager = class {
|
|
|
3861
4087
|
});
|
|
3862
4088
|
}
|
|
3863
4089
|
const data = await this.channel.client.rest.post(
|
|
3864
|
-
|
|
4090
|
+
Routes16.channelThreads(this.channel.id),
|
|
3865
4091
|
{
|
|
3866
4092
|
body: toStartThreadBody(this.channel.type, options),
|
|
3867
4093
|
auth: true,
|
|
@@ -3894,7 +4120,7 @@ var ThreadManager = class {
|
|
|
3894
4120
|
if (options.rateLimitPerUser !== void 0) body.rate_limit_per_user = options.rateLimitPerUser;
|
|
3895
4121
|
if (options.appliedTags !== void 0) body.applied_tags = options.appliedTags;
|
|
3896
4122
|
const data = await this.channel.client.rest.post(
|
|
3897
|
-
|
|
4123
|
+
Routes16.channelThreads(this.channel.id),
|
|
3898
4124
|
{
|
|
3899
4125
|
body,
|
|
3900
4126
|
files: prepared.files,
|
|
@@ -3913,7 +4139,7 @@ var ThreadManager = class {
|
|
|
3913
4139
|
* `before` is an ISO-8601 archive timestamp.
|
|
3914
4140
|
*/
|
|
3915
4141
|
async fetchArchived(options) {
|
|
3916
|
-
const path = options.type === "private" ?
|
|
4142
|
+
const path = options.type === "private" ? Routes16.channelThreadsArchivedPrivate(this.channel.id) : Routes16.channelThreadsArchivedPublic(this.channel.id);
|
|
3917
4143
|
const data = await this.channel.client.rest.get(
|
|
3918
4144
|
withQuery(path, { before: options.before, limit: options.limit })
|
|
3919
4145
|
);
|
|
@@ -3925,7 +4151,7 @@ var ThreadManager = class {
|
|
|
3925
4151
|
*/
|
|
3926
4152
|
async fetchJoinedPrivateArchived(options) {
|
|
3927
4153
|
const data = await this.channel.client.rest.get(
|
|
3928
|
-
withQuery(
|
|
4154
|
+
withQuery(Routes16.channelJoinedArchivedPrivateThreads(this.channel.id), {
|
|
3929
4155
|
before: options?.before,
|
|
3930
4156
|
limit: options?.limit
|
|
3931
4157
|
})
|
|
@@ -3938,7 +4164,7 @@ var ThreadManager = class {
|
|
|
3938
4164
|
*/
|
|
3939
4165
|
async search(options) {
|
|
3940
4166
|
const data = await this.channel.client.rest.get(
|
|
3941
|
-
withQuery(
|
|
4167
|
+
withQuery(Routes16.channelThreadSearch(this.channel.id), {
|
|
3942
4168
|
name: options?.name,
|
|
3943
4169
|
tag: options?.tag,
|
|
3944
4170
|
tag_setting: options?.tagSetting,
|
|
@@ -3966,7 +4192,7 @@ var ThreadManager = class {
|
|
|
3966
4192
|
}
|
|
3967
4193
|
/** Set the auto-archive and slowmode defaults copied onto new threads. */
|
|
3968
4194
|
async editDefaults(options) {
|
|
3969
|
-
return this.channel.client.rest.patch(
|
|
4195
|
+
return this.channel.client.rest.patch(Routes16.channel(this.channel.id), {
|
|
3970
4196
|
body: toThreadParentEditBody(options),
|
|
3971
4197
|
auth: true,
|
|
3972
4198
|
...auditReasonHeaders(options.reason)
|
|
@@ -3984,7 +4210,7 @@ function isSearchNotReady(data) {
|
|
|
3984
4210
|
return "code" in data && data.code === "SEARCH_INDEX_NOT_READY";
|
|
3985
4211
|
}
|
|
3986
4212
|
async function fetchActiveThreads(client, guildId) {
|
|
3987
|
-
const data = await client.rest.get(
|
|
4213
|
+
const data = await client.rest.get(Routes16.guildActiveThreads(guildId));
|
|
3988
4214
|
return fetchedThreadsFrom(client, data);
|
|
3989
4215
|
}
|
|
3990
4216
|
|
|
@@ -4043,7 +4269,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4043
4269
|
* `defaultForumLayout` is sent only for forum channels.
|
|
4044
4270
|
*/
|
|
4045
4271
|
async edit(options) {
|
|
4046
|
-
const data = await this.client.rest.patch(
|
|
4272
|
+
const data = await this.client.rest.patch(Routes17.channel(this.id), {
|
|
4047
4273
|
body: {
|
|
4048
4274
|
...toChannelEditBody(options),
|
|
4049
4275
|
...forumParentWire(options, this.type === ChannelType7.GuildForum)
|
|
@@ -4072,7 +4298,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4072
4298
|
}
|
|
4073
4299
|
/** Set the auto-archive and slowmode defaults copied onto new posts. */
|
|
4074
4300
|
async editThreadDefaults(options) {
|
|
4075
|
-
const data = await this.client.rest.patch(
|
|
4301
|
+
const data = await this.client.rest.patch(Routes17.channel(this.id), {
|
|
4076
4302
|
body: toThreadParentEditBody(options),
|
|
4077
4303
|
auth: true,
|
|
4078
4304
|
...auditReasonHeaders(options.reason)
|
|
@@ -4082,7 +4308,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4082
4308
|
}
|
|
4083
4309
|
/** Create a tag. The response replaces {@link availableTags}. */
|
|
4084
4310
|
async createTag(options) {
|
|
4085
|
-
const data = await this.client.rest.post(
|
|
4311
|
+
const data = await this.client.rest.post(Routes17.channelTags(this.id), {
|
|
4086
4312
|
body: toForumTagBody(options),
|
|
4087
4313
|
auth: true,
|
|
4088
4314
|
...auditReasonHeaders(options.reason)
|
|
@@ -4092,7 +4318,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4092
4318
|
}
|
|
4093
4319
|
/** Replace a tag. The response replaces {@link availableTags}. */
|
|
4094
4320
|
async editTag(tagId, options) {
|
|
4095
|
-
const data = await this.client.rest.put(
|
|
4321
|
+
const data = await this.client.rest.put(Routes17.channelTag(this.id, tagId), {
|
|
4096
4322
|
body: toForumTagBody(options),
|
|
4097
4323
|
auth: true,
|
|
4098
4324
|
...auditReasonHeaders(options.reason)
|
|
@@ -4102,7 +4328,7 @@ var ThreadOnlyChannel = class extends GuildChannel {
|
|
|
4102
4328
|
}
|
|
4103
4329
|
/** Delete a tag. The response replaces {@link availableTags}. */
|
|
4104
4330
|
async deleteTag(tagId, reason) {
|
|
4105
|
-
const data = await this.client.rest.delete(
|
|
4331
|
+
const data = await this.client.rest.delete(Routes17.channelTag(this.id, tagId), {
|
|
4106
4332
|
auth: true,
|
|
4107
4333
|
...auditReasonHeaders(reason)
|
|
4108
4334
|
});
|
|
@@ -4137,6 +4363,7 @@ var GUILD_FACTORIES = {
|
|
|
4137
4363
|
[ChannelType8.GuildAnnouncement]: (c, d) => new AnnouncementChannel(c, d),
|
|
4138
4364
|
[ChannelType8.GuildCategory]: (c, d) => new CategoryChannel(c, d),
|
|
4139
4365
|
[ChannelType8.GuildVoice]: (c, d) => new VoiceChannel(c, d),
|
|
4366
|
+
[ChannelType8.GuildStageVoice]: (c, d) => new StageChannel(c, d),
|
|
4140
4367
|
[ChannelType8.GuildLink]: (c, d) => new LinkChannel(c, d),
|
|
4141
4368
|
[ChannelType8.AnnouncementThread]: (c, d) => new ThreadChannel(c, d),
|
|
4142
4369
|
[ChannelType8.PublicThread]: (c, d) => new ThreadChannel(c, d),
|
|
@@ -4258,11 +4485,11 @@ var User = class extends Base {
|
|
|
4258
4485
|
*/
|
|
4259
4486
|
/** Unix timestamp (ms) when this account was created, derived from its snowflake ID. */
|
|
4260
4487
|
get createdTimestamp() {
|
|
4261
|
-
return
|
|
4488
|
+
return SnowflakeUtil6.timestampFromSnowflake(this.id);
|
|
4262
4489
|
}
|
|
4263
4490
|
/** Date when this account was created, derived from its snowflake ID. */
|
|
4264
4491
|
get createdAt() {
|
|
4265
|
-
return
|
|
4492
|
+
return SnowflakeUtil6.dateFromSnowflake(this.id);
|
|
4266
4493
|
}
|
|
4267
4494
|
toString() {
|
|
4268
4495
|
return `<@${this.id}>`;
|
|
@@ -4272,7 +4499,7 @@ var User = class extends Base {
|
|
|
4272
4499
|
* @returns DM channel instance (cached if already open)
|
|
4273
4500
|
*/
|
|
4274
4501
|
async createDM() {
|
|
4275
|
-
const data = await this.client.rest.post(
|
|
4502
|
+
const data = await this.client.rest.post(Routes18.userMeChannels(), {
|
|
4276
4503
|
body: { recipient_id: this.id },
|
|
4277
4504
|
auth: true
|
|
4278
4505
|
});
|
|
@@ -4489,14 +4716,14 @@ var CacheController = class {
|
|
|
4489
4716
|
|
|
4490
4717
|
// src/ClientCore/ChannelManager.ts
|
|
4491
4718
|
import { LimitedCollection } from "@fluxerjs/collection";
|
|
4492
|
-
import { Routes as
|
|
4719
|
+
import { Routes as Routes24 } from "@fluxerjs/types";
|
|
4493
4720
|
|
|
4494
4721
|
// src/Domain/Guild/Cache.ts
|
|
4495
4722
|
import { ChannelType as ChannelType9 } from "@fluxerjs/types";
|
|
4496
4723
|
|
|
4497
4724
|
// src/Domain/Guild/GuildEmoji.ts
|
|
4498
|
-
import { Routes as
|
|
4499
|
-
import { SnowflakeUtil as
|
|
4725
|
+
import { Routes as Routes19 } from "@fluxerjs/types";
|
|
4726
|
+
import { SnowflakeUtil as SnowflakeUtil7 } from "@fluxerjs/util";
|
|
4500
4727
|
var GuildEmoji = class extends Base {
|
|
4501
4728
|
client;
|
|
4502
4729
|
id;
|
|
@@ -4532,11 +4759,11 @@ var GuildEmoji = class extends Base {
|
|
|
4532
4759
|
}
|
|
4533
4760
|
/** Unix timestamp (ms) when this emoji was created, derived from its snowflake ID. */
|
|
4534
4761
|
get createdTimestamp() {
|
|
4535
|
-
return
|
|
4762
|
+
return SnowflakeUtil7.timestampFromSnowflake(this.id);
|
|
4536
4763
|
}
|
|
4537
4764
|
/** Date when this emoji was created, derived from its snowflake ID. */
|
|
4538
4765
|
get createdAt() {
|
|
4539
|
-
return
|
|
4766
|
+
return SnowflakeUtil7.dateFromSnowflake(this.id);
|
|
4540
4767
|
}
|
|
4541
4768
|
/** Renders this emoji for use in message content: `<:name:id>` (or `<a:name:id>` when animated). */
|
|
4542
4769
|
toString() {
|
|
@@ -4544,7 +4771,7 @@ var GuildEmoji = class extends Base {
|
|
|
4544
4771
|
}
|
|
4545
4772
|
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
4546
4773
|
async delete(reason) {
|
|
4547
|
-
await this.client.rest.delete(
|
|
4774
|
+
await this.client.rest.delete(Routes19.guildEmoji(this.guildId, this.id), {
|
|
4548
4775
|
auth: true,
|
|
4549
4776
|
...auditReasonHeaders(reason)
|
|
4550
4777
|
});
|
|
@@ -4557,7 +4784,7 @@ var GuildEmoji = class extends Base {
|
|
|
4557
4784
|
*/
|
|
4558
4785
|
async edit(options) {
|
|
4559
4786
|
const { reason, name } = options;
|
|
4560
|
-
const data = await this.client.rest.patch(
|
|
4787
|
+
const data = await this.client.rest.patch(Routes19.guildEmoji(this.guildId, this.id), {
|
|
4561
4788
|
body: { name },
|
|
4562
4789
|
auth: true,
|
|
4563
4790
|
...auditReasonHeaders(reason)
|
|
@@ -4568,7 +4795,7 @@ var GuildEmoji = class extends Base {
|
|
|
4568
4795
|
};
|
|
4569
4796
|
|
|
4570
4797
|
// src/Domain/Guild/GuildMember.ts
|
|
4571
|
-
import { Routes as
|
|
4798
|
+
import { Routes as Routes21 } from "@fluxerjs/types";
|
|
4572
4799
|
import { PermissionFlags as PermissionFlags3, PermissionsBitField as PermissionsBitField2 } from "@fluxerjs/util";
|
|
4573
4800
|
|
|
4574
4801
|
// src/Helpers/Permissions.ts
|
|
@@ -4592,7 +4819,7 @@ function computePermissions(basePermissions, overwrites, memberRoles, memberId,
|
|
|
4592
4819
|
|
|
4593
4820
|
// src/Domain/Guild/GuildMemberRoleManager.ts
|
|
4594
4821
|
import { Collection as Collection7 } from "@fluxerjs/collection";
|
|
4595
|
-
import { Routes as
|
|
4822
|
+
import { Routes as Routes20 } from "@fluxerjs/types";
|
|
4596
4823
|
function roleId(roleOrId) {
|
|
4597
4824
|
return typeof roleOrId === "string" ? roleOrId : roleOrId.id;
|
|
4598
4825
|
}
|
|
@@ -4621,7 +4848,7 @@ var GuildMemberRoleManager = class {
|
|
|
4621
4848
|
const id = roleId(roleOrId);
|
|
4622
4849
|
if (this.ids.includes(id)) return;
|
|
4623
4850
|
await this.member.client.rest.put(
|
|
4624
|
-
|
|
4851
|
+
Routes20.guildMemberRole(this.member.guild.id, this.member.id, id)
|
|
4625
4852
|
);
|
|
4626
4853
|
this.ids.push(id);
|
|
4627
4854
|
}
|
|
@@ -4630,13 +4857,13 @@ var GuildMemberRoleManager = class {
|
|
|
4630
4857
|
const idx = this.ids.indexOf(id);
|
|
4631
4858
|
if (idx === -1) return;
|
|
4632
4859
|
await this.member.client.rest.delete(
|
|
4633
|
-
|
|
4860
|
+
Routes20.guildMemberRole(this.member.guild.id, this.member.id, id)
|
|
4634
4861
|
);
|
|
4635
4862
|
this.ids.splice(idx, 1);
|
|
4636
4863
|
}
|
|
4637
4864
|
async set(roleIds) {
|
|
4638
4865
|
const data = await this.member.client.rest.patch(
|
|
4639
|
-
|
|
4866
|
+
Routes20.guildMember(this.member.guild.id, this.member.id),
|
|
4640
4867
|
{ body: { roles: roleIds }, auth: true }
|
|
4641
4868
|
);
|
|
4642
4869
|
this.ids = data.roles ? [...data.roles] : [];
|
|
@@ -4790,7 +5017,7 @@ var GuildMember = class _GuildMember extends Base {
|
|
|
4790
5017
|
*/
|
|
4791
5018
|
async edit(options) {
|
|
4792
5019
|
const isMe = this.client.user?.id === this.id;
|
|
4793
|
-
const route = isMe ?
|
|
5020
|
+
const route = isMe ? Routes21.guildMemberMe(this.guild.id) : Routes21.guildMember(this.guild.id, this.id);
|
|
4794
5021
|
const data = await this.client.rest.patch(route, {
|
|
4795
5022
|
body: toMemberEditBody(options),
|
|
4796
5023
|
auth: true,
|
|
@@ -4903,8 +5130,8 @@ var GuildMember = class _GuildMember extends Base {
|
|
|
4903
5130
|
};
|
|
4904
5131
|
|
|
4905
5132
|
// src/Domain/Guild/GuildSticker.ts
|
|
4906
|
-
import { Routes as
|
|
4907
|
-
import { SnowflakeUtil as
|
|
5133
|
+
import { Routes as Routes22 } from "@fluxerjs/types";
|
|
5134
|
+
import { SnowflakeUtil as SnowflakeUtil8 } from "@fluxerjs/util";
|
|
4908
5135
|
var GuildSticker = class extends Base {
|
|
4909
5136
|
client;
|
|
4910
5137
|
id;
|
|
@@ -4946,15 +5173,15 @@ var GuildSticker = class extends Base {
|
|
|
4946
5173
|
}
|
|
4947
5174
|
/** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
|
|
4948
5175
|
get createdTimestamp() {
|
|
4949
|
-
return
|
|
5176
|
+
return SnowflakeUtil8.timestampFromSnowflake(this.id);
|
|
4950
5177
|
}
|
|
4951
5178
|
/** Date when this sticker was created, derived from its snowflake ID. */
|
|
4952
5179
|
get createdAt() {
|
|
4953
|
-
return
|
|
5180
|
+
return SnowflakeUtil8.dateFromSnowflake(this.id);
|
|
4954
5181
|
}
|
|
4955
5182
|
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
4956
5183
|
async delete(reason) {
|
|
4957
|
-
await this.client.rest.delete(
|
|
5184
|
+
await this.client.rest.delete(Routes22.guildSticker(this.guildId, this.id), {
|
|
4958
5185
|
auth: true,
|
|
4959
5186
|
...auditReasonHeaders(reason)
|
|
4960
5187
|
});
|
|
@@ -4967,7 +5194,7 @@ var GuildSticker = class extends Base {
|
|
|
4967
5194
|
*/
|
|
4968
5195
|
async edit(options) {
|
|
4969
5196
|
const { reason, ...body } = options;
|
|
4970
|
-
const data = await this.client.rest.patch(
|
|
5197
|
+
const data = await this.client.rest.patch(Routes22.guildSticker(this.guildId, this.id), {
|
|
4971
5198
|
body,
|
|
4972
5199
|
auth: true,
|
|
4973
5200
|
...auditReasonHeaders(reason)
|
|
@@ -4980,12 +5207,12 @@ var GuildSticker = class extends Base {
|
|
|
4980
5207
|
};
|
|
4981
5208
|
|
|
4982
5209
|
// src/Domain/Guild/Role.ts
|
|
4983
|
-
import { Routes as
|
|
5210
|
+
import { Routes as Routes23 } from "@fluxerjs/types";
|
|
4984
5211
|
import {
|
|
4985
5212
|
ALL_PERMISSIONS_BIGINT as ALL_PERMISSIONS_BIGINT2,
|
|
4986
5213
|
PermissionFlags as PermissionFlags4,
|
|
4987
5214
|
PermissionsBitField as PermissionsBitField3,
|
|
4988
|
-
SnowflakeUtil as
|
|
5215
|
+
SnowflakeUtil as SnowflakeUtil9
|
|
4989
5216
|
} from "@fluxerjs/util";
|
|
4990
5217
|
var Role = class _Role extends Base {
|
|
4991
5218
|
/** Parent client instance. */
|
|
@@ -5055,11 +5282,11 @@ var Role = class _Role extends Base {
|
|
|
5055
5282
|
*/
|
|
5056
5283
|
/** Unix timestamp (ms) when this role was created, derived from its snowflake ID. */
|
|
5057
5284
|
get createdTimestamp() {
|
|
5058
|
-
return
|
|
5285
|
+
return SnowflakeUtil9.timestampFromSnowflake(this.id);
|
|
5059
5286
|
}
|
|
5060
5287
|
/** Date when this role was created, derived from its snowflake ID. */
|
|
5061
5288
|
get createdAt() {
|
|
5062
|
-
return
|
|
5289
|
+
return SnowflakeUtil9.dateFromSnowflake(this.id);
|
|
5063
5290
|
}
|
|
5064
5291
|
toString() {
|
|
5065
5292
|
return `<@&${this.id}>`;
|
|
@@ -5105,7 +5332,7 @@ var Role = class _Role extends Base {
|
|
|
5105
5332
|
*/
|
|
5106
5333
|
async edit(options) {
|
|
5107
5334
|
const body = toRoleEditBody(options);
|
|
5108
|
-
const data = await this.client.rest.patch(
|
|
5335
|
+
const data = await this.client.rest.patch(Routes23.guildRole(this.guildId, this.id), {
|
|
5109
5336
|
body: Object.keys(body).length ? body : void 0,
|
|
5110
5337
|
auth: true,
|
|
5111
5338
|
...auditReasonHeaders(options.reason)
|
|
@@ -5118,7 +5345,7 @@ var Role = class _Role extends Base {
|
|
|
5118
5345
|
* @param reason - Audit log reason (`X-Audit-Log-Reason`)
|
|
5119
5346
|
*/
|
|
5120
5347
|
async delete(reason) {
|
|
5121
|
-
await this.client.rest.delete(
|
|
5348
|
+
await this.client.rest.delete(Routes23.guildRole(this.guildId, this.id), {
|
|
5122
5349
|
auth: true,
|
|
5123
5350
|
...auditReasonHeaders(reason)
|
|
5124
5351
|
});
|
|
@@ -5308,7 +5535,7 @@ var ChannelManager = class extends LimitedCollection {
|
|
|
5308
5535
|
async fetchFresh(channelId) {
|
|
5309
5536
|
try {
|
|
5310
5537
|
const data = assertApiObjectWithId(
|
|
5311
|
-
await this.client.rest.get(
|
|
5538
|
+
await this.client.rest.get(Routes24.channel(channelId)),
|
|
5312
5539
|
"channels.fetch()"
|
|
5313
5540
|
);
|
|
5314
5541
|
const existing = this.get(channelId);
|
|
@@ -5361,7 +5588,7 @@ var ChannelManager = class extends LimitedCollection {
|
|
|
5361
5588
|
defaultAllowedMentions: this.client.options.defaultAllowedMentions
|
|
5362
5589
|
});
|
|
5363
5590
|
const data = await this.client.rest.post(
|
|
5364
|
-
|
|
5591
|
+
Routes24.channelMessages(channelId),
|
|
5365
5592
|
postPayload
|
|
5366
5593
|
);
|
|
5367
5594
|
this.client._addMessageToCache(channelId, data);
|
|
@@ -5371,7 +5598,7 @@ var ChannelManager = class extends LimitedCollection {
|
|
|
5371
5598
|
|
|
5372
5599
|
// src/ClientCore/ClientEmoji.ts
|
|
5373
5600
|
import { Collection as Collection8 } from "@fluxerjs/collection";
|
|
5374
|
-
import { Routes as
|
|
5601
|
+
import { Routes as Routes25 } from "@fluxerjs/types";
|
|
5375
5602
|
import { formatEmoji, getUnicodeFromShortcode, parseEmoji } from "@fluxerjs/util";
|
|
5376
5603
|
async function resolveClientEmoji(client, emoji, guildId) {
|
|
5377
5604
|
if (typeof emoji === "object" && emoji.id) {
|
|
@@ -5390,7 +5617,7 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
5390
5617
|
const unicodeFromShortcode = getUnicodeFromShortcode(parsed.name);
|
|
5391
5618
|
if (unicodeFromShortcode) return unicodeFromShortcode;
|
|
5392
5619
|
if (guildId) {
|
|
5393
|
-
const emojis = await client.rest.get(
|
|
5620
|
+
const emojis = await client.rest.get(Routes25.guildEmojis(guildId));
|
|
5394
5621
|
const found = emojis.find((e) => e.name && e.name.toLowerCase() === parsed.name.toLowerCase());
|
|
5395
5622
|
if (found) return formatEmoji({ ...parsed, id: found.id, animated: found.animated });
|
|
5396
5623
|
throw new FluxerError(
|
|
@@ -5407,26 +5634,26 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
5407
5634
|
return parsed.name;
|
|
5408
5635
|
}
|
|
5409
5636
|
async function fetchInstance(client) {
|
|
5410
|
-
const raw = await client.rest.get(
|
|
5637
|
+
const raw = await client.rest.get(Routes25.instanceDiscovery(), {
|
|
5411
5638
|
auth: false,
|
|
5412
5639
|
unversioned: true
|
|
5413
5640
|
});
|
|
5414
5641
|
return parseInstanceDiscovery(raw);
|
|
5415
5642
|
}
|
|
5416
5643
|
function fetchGatewayInfo(client) {
|
|
5417
|
-
return client.rest.get(
|
|
5644
|
+
return client.rest.get(Routes25.gatewayBot());
|
|
5418
5645
|
}
|
|
5419
5646
|
function fetchEmojiMetadata(client, emojiId) {
|
|
5420
|
-
return client.rest.get(
|
|
5647
|
+
return client.rest.get(Routes25.emojiMetadata(emojiId), { auth: true });
|
|
5421
5648
|
}
|
|
5422
5649
|
function fetchStickerMetadata(client, stickerId) {
|
|
5423
|
-
return client.rest.get(
|
|
5650
|
+
return client.rest.get(Routes25.stickerMetadata(stickerId), { auth: true });
|
|
5424
5651
|
}
|
|
5425
5652
|
function fetchApplication(client) {
|
|
5426
|
-
return client.rest.get(
|
|
5653
|
+
return client.rest.get(Routes25.applicationsMe(), { auth: true });
|
|
5427
5654
|
}
|
|
5428
5655
|
async function fetchOAuthApplications(client) {
|
|
5429
|
-
const data = await client.rest.get(
|
|
5656
|
+
const data = await client.rest.get(Routes25.oauth2ApplicationsMe(), { auth: true });
|
|
5430
5657
|
if (Array.isArray(data)) return data;
|
|
5431
5658
|
if (data && typeof data === "object" && "applications" in data && Array.isArray(data.applications)) {
|
|
5432
5659
|
return data.applications;
|
|
@@ -5445,14 +5672,14 @@ function assertChannelIdBatch(name, channelIds) {
|
|
|
5445
5672
|
}
|
|
5446
5673
|
function preloadMessages(client, channelIds) {
|
|
5447
5674
|
assertChannelIdBatch("preloadMessages", channelIds);
|
|
5448
|
-
return client.rest.post(
|
|
5675
|
+
return client.rest.post(Routes25.preloadMessages(), {
|
|
5449
5676
|
body: { channels: channelIds },
|
|
5450
5677
|
auth: true
|
|
5451
5678
|
});
|
|
5452
5679
|
}
|
|
5453
5680
|
function preloadMessagesAlt(client, channelIds) {
|
|
5454
5681
|
assertChannelIdBatch("preloadMessagesAlt", channelIds);
|
|
5455
|
-
return client.rest.post(
|
|
5682
|
+
return client.rest.post(Routes25.preloadMessagesAlt(), {
|
|
5456
5683
|
body: { channels: channelIds },
|
|
5457
5684
|
auth: true
|
|
5458
5685
|
});
|
|
@@ -5460,7 +5687,7 @@ function preloadMessagesAlt(client, channelIds) {
|
|
|
5460
5687
|
async function bulkFetchMessages(client, requests, options = {}) {
|
|
5461
5688
|
validateBulkMessageFetchRequests(requests);
|
|
5462
5689
|
const wire = toBulkFetchWire(requests);
|
|
5463
|
-
const data = await client.rest.post(
|
|
5690
|
+
const data = await client.rest.post(Routes25.channelsMessagesBulk(), {
|
|
5464
5691
|
body: { requests: wire },
|
|
5465
5692
|
auth: true
|
|
5466
5693
|
});
|
|
@@ -5477,7 +5704,7 @@ async function bulkFetchMessages(client, requests, options = {}) {
|
|
|
5477
5704
|
};
|
|
5478
5705
|
}
|
|
5479
5706
|
async function searchMessages(client, options = {}) {
|
|
5480
|
-
const data = await client.rest.post(
|
|
5707
|
+
const data = await client.rest.post(Routes25.searchMessages(), {
|
|
5481
5708
|
body: toMessageSearchBody(options),
|
|
5482
5709
|
auth: true
|
|
5483
5710
|
});
|
|
@@ -5485,19 +5712,19 @@ async function searchMessages(client, options = {}) {
|
|
|
5485
5712
|
}
|
|
5486
5713
|
function fetchEmojiSource(client, emojiId) {
|
|
5487
5714
|
return client.rest.get(
|
|
5488
|
-
|
|
5715
|
+
Routes25.emojiSource(emojiId),
|
|
5489
5716
|
{ auth: true }
|
|
5490
5717
|
);
|
|
5491
5718
|
}
|
|
5492
5719
|
function fetchStickerSource(client, stickerId) {
|
|
5493
5720
|
return client.rest.get(
|
|
5494
|
-
|
|
5721
|
+
Routes25.stickerSource(stickerId),
|
|
5495
5722
|
{ auth: true }
|
|
5496
5723
|
);
|
|
5497
5724
|
}
|
|
5498
5725
|
function fetchDiscoveryCategories(client) {
|
|
5499
5726
|
return client.rest.get(
|
|
5500
|
-
|
|
5727
|
+
Routes25.discoveryCategories(),
|
|
5501
5728
|
{ auth: true }
|
|
5502
5729
|
);
|
|
5503
5730
|
}
|
|
@@ -5512,18 +5739,18 @@ function searchDiscoveryGuilds(client, options = {}) {
|
|
|
5512
5739
|
if (options.offset !== void 0) params.set("offset", String(options.offset));
|
|
5513
5740
|
const qs2 = params.toString();
|
|
5514
5741
|
return client.rest.get(
|
|
5515
|
-
qs2 ? `${
|
|
5742
|
+
qs2 ? `${Routes25.discoveryGuilds()}?${qs2}` : Routes25.discoveryGuilds(),
|
|
5516
5743
|
{ auth: true }
|
|
5517
5744
|
);
|
|
5518
5745
|
}
|
|
5519
5746
|
function fetchExperiments(client) {
|
|
5520
|
-
return client.rest.get(
|
|
5747
|
+
return client.rest.get(Routes25.experiments(), {
|
|
5521
5748
|
auth: true
|
|
5522
5749
|
});
|
|
5523
5750
|
}
|
|
5524
5751
|
function refreshAttachmentUrls(client, attachmentUrls) {
|
|
5525
5752
|
return client.rest.post(
|
|
5526
|
-
|
|
5753
|
+
Routes25.attachmentsRefreshUrls(),
|
|
5527
5754
|
{ body: { attachment_urls: attachmentUrls }, auth: true }
|
|
5528
5755
|
);
|
|
5529
5756
|
}
|
|
@@ -5535,13 +5762,13 @@ function fetchInstanceBadges(client, options = {}) {
|
|
|
5535
5762
|
if (options.version !== void 0) params.set("version", options.version);
|
|
5536
5763
|
const qs2 = params.toString();
|
|
5537
5764
|
return client.rest.get(
|
|
5538
|
-
qs2 ? `${
|
|
5765
|
+
qs2 ? `${Routes25.instanceBadges()}?${qs2}` : Routes25.instanceBadges(),
|
|
5539
5766
|
{ auth: false }
|
|
5540
5767
|
);
|
|
5541
5768
|
}
|
|
5542
5769
|
function fetchChannelPostData(client, channelId, threadIds) {
|
|
5543
5770
|
return client.rest.post(
|
|
5544
|
-
|
|
5771
|
+
Routes25.channelPostData(channelId),
|
|
5545
5772
|
{ body: { thread_ids: threadIds }, auth: true }
|
|
5546
5773
|
);
|
|
5547
5774
|
}
|
|
@@ -5563,13 +5790,13 @@ function createEventMethods(client) {
|
|
|
5563
5790
|
import { GatewayCloseCodes, WebSocketManager } from "@fluxerjs/ws";
|
|
5564
5791
|
|
|
5565
5792
|
// src/Domain/Guild/Guild.ts
|
|
5566
|
-
import { LimitedCollection as LimitedCollection4 } from "@fluxerjs/collection";
|
|
5793
|
+
import { Collection as Collection9, LimitedCollection as LimitedCollection4 } from "@fluxerjs/collection";
|
|
5567
5794
|
import { GuildNSFWLevel } from "@fluxerjs/types";
|
|
5568
|
-
import { SnowflakeUtil as
|
|
5795
|
+
import { SnowflakeUtil as SnowflakeUtil10 } from "@fluxerjs/util";
|
|
5569
5796
|
|
|
5570
5797
|
// src/ClientCore/GuildMemberManager.ts
|
|
5571
5798
|
import { LimitedCollection as LimitedCollection2 } from "@fluxerjs/collection";
|
|
5572
|
-
import { Routes as
|
|
5799
|
+
import { Routes as Routes26 } from "@fluxerjs/types";
|
|
5573
5800
|
var GuildMemberManager = class extends LimitedCollection2 {
|
|
5574
5801
|
constructor(guild) {
|
|
5575
5802
|
super({ maxSize: guild.client.cache.limits.members });
|
|
@@ -5630,7 +5857,7 @@ var GuildMemberManager = class extends LimitedCollection2 {
|
|
|
5630
5857
|
if (options?.limit != null) params.set("limit", String(options.limit));
|
|
5631
5858
|
if (options?.after) params.set("after", options.after);
|
|
5632
5859
|
const qs2 = params.toString();
|
|
5633
|
-
const url =
|
|
5860
|
+
const url = Routes26.guildMembers(this.guild.id) + (qs2 ? `?${qs2}` : "");
|
|
5634
5861
|
const data = assertApiArray(
|
|
5635
5862
|
await this.guild.client.rest.get(url, { auth: true }),
|
|
5636
5863
|
"members.fetch()"
|
|
@@ -5657,7 +5884,7 @@ var GuildMemberManager = class extends LimitedCollection2 {
|
|
|
5657
5884
|
*/
|
|
5658
5885
|
async search(options = {}) {
|
|
5659
5886
|
const data = await this.guild.client.rest.post(
|
|
5660
|
-
|
|
5887
|
+
Routes26.guildMembersSearch(this.guild.id),
|
|
5661
5888
|
{ body: toMemberSearchBody(options), auth: true }
|
|
5662
5889
|
);
|
|
5663
5890
|
const offset = options.offset ?? 0;
|
|
@@ -5683,7 +5910,7 @@ var GuildMemberManager = class extends LimitedCollection2 {
|
|
|
5683
5910
|
};
|
|
5684
5911
|
|
|
5685
5912
|
// src/Domain/Guild/Admin.ts
|
|
5686
|
-
import { Routes as
|
|
5913
|
+
import { Routes as Routes27 } from "@fluxerjs/types";
|
|
5687
5914
|
function toAuditLogEntryPayload(entry, guildId) {
|
|
5688
5915
|
return {
|
|
5689
5916
|
id: entry.id,
|
|
@@ -5704,7 +5931,7 @@ function toVanityPayload(data) {
|
|
|
5704
5931
|
return { code: data.code ?? null, uses: data.uses };
|
|
5705
5932
|
}
|
|
5706
5933
|
async function fetchAuditLogs(guild, options) {
|
|
5707
|
-
const url =
|
|
5934
|
+
const url = Routes27.guildAuditLogs(guild.id) + qs({
|
|
5708
5935
|
limit: options?.limit,
|
|
5709
5936
|
before: options?.before,
|
|
5710
5937
|
after: options?.after,
|
|
@@ -5728,7 +5955,7 @@ async function fetchAuditLogs(guild, options) {
|
|
|
5728
5955
|
};
|
|
5729
5956
|
}
|
|
5730
5957
|
async function editGuild(guild, options) {
|
|
5731
|
-
const data = await guild.client.rest.patch(
|
|
5958
|
+
const data = await guild.client.rest.patch(Routes27.guild(guild.id), {
|
|
5732
5959
|
body: toGuildEditBody(options),
|
|
5733
5960
|
auth: true
|
|
5734
5961
|
});
|
|
@@ -5736,13 +5963,13 @@ async function editGuild(guild, options) {
|
|
|
5736
5963
|
return guild;
|
|
5737
5964
|
}
|
|
5738
5965
|
async function fetchVanityURL(guild) {
|
|
5739
|
-
const data = await guild.client.rest.get(
|
|
5966
|
+
const data = await guild.client.rest.get(Routes27.guildVanityUrl(guild.id), {
|
|
5740
5967
|
auth: true
|
|
5741
5968
|
});
|
|
5742
5969
|
return toVanityPayload(data);
|
|
5743
5970
|
}
|
|
5744
5971
|
async function editVanityURL(guild, code) {
|
|
5745
|
-
const data = await guild.client.rest.patch(
|
|
5972
|
+
const data = await guild.client.rest.patch(Routes27.guildVanityUrl(guild.id), {
|
|
5746
5973
|
body: { code },
|
|
5747
5974
|
auth: true
|
|
5748
5975
|
});
|
|
@@ -5750,14 +5977,14 @@ async function editVanityURL(guild, code) {
|
|
|
5750
5977
|
return toVanityPayload(data);
|
|
5751
5978
|
}
|
|
5752
5979
|
async function fetchDiscoveryStatus(guild) {
|
|
5753
|
-
const data = await guild.client.rest.get(
|
|
5980
|
+
const data = await guild.client.rest.get(Routes27.guildDiscovery(guild.id), {
|
|
5754
5981
|
auth: true
|
|
5755
5982
|
});
|
|
5756
5983
|
return toDiscoveryStatusPayload(data);
|
|
5757
5984
|
}
|
|
5758
5985
|
async function applyForDiscovery(guild, options) {
|
|
5759
5986
|
const data = await guild.client.rest.post(
|
|
5760
|
-
|
|
5987
|
+
Routes27.guildDiscovery(guild.id),
|
|
5761
5988
|
{
|
|
5762
5989
|
body: toDiscoveryBody(options),
|
|
5763
5990
|
auth: true
|
|
@@ -5767,7 +5994,7 @@ async function applyForDiscovery(guild, options) {
|
|
|
5767
5994
|
}
|
|
5768
5995
|
async function editDiscoveryApplication(guild, options) {
|
|
5769
5996
|
const data = await guild.client.rest.patch(
|
|
5770
|
-
|
|
5997
|
+
Routes27.guildDiscovery(guild.id),
|
|
5771
5998
|
{
|
|
5772
5999
|
body: toDiscoveryBody(options),
|
|
5773
6000
|
auth: true
|
|
@@ -5776,34 +6003,34 @@ async function editDiscoveryApplication(guild, options) {
|
|
|
5776
6003
|
return toDiscoveryApplicationPayload(data);
|
|
5777
6004
|
}
|
|
5778
6005
|
async function withdrawDiscoveryApplication(guild) {
|
|
5779
|
-
await guild.client.rest.delete(
|
|
6006
|
+
await guild.client.rest.delete(Routes27.guildDiscovery(guild.id), { auth: true });
|
|
5780
6007
|
}
|
|
5781
6008
|
async function deleteGuild(guild, options) {
|
|
5782
6009
|
const body = options ? toSudoBody(options) : {};
|
|
5783
|
-
await guild.client.rest.post(
|
|
6010
|
+
await guild.client.rest.post(Routes27.guildDelete(guild.id), {
|
|
5784
6011
|
body,
|
|
5785
6012
|
auth: true
|
|
5786
6013
|
});
|
|
5787
6014
|
guild.client.guilds.delete(guild.id);
|
|
5788
6015
|
}
|
|
5789
6016
|
async function transferOwnership(guild, newOwnerId, password) {
|
|
5790
|
-
await guild.client.rest.post(
|
|
6017
|
+
await guild.client.rest.post(Routes27.guildTransferOwnership(guild.id), {
|
|
5791
6018
|
body: { new_owner_id: newOwnerId, ...password != null && { password } },
|
|
5792
6019
|
auth: true
|
|
5793
6020
|
});
|
|
5794
6021
|
}
|
|
5795
6022
|
|
|
5796
6023
|
// src/Domain/Guild/Channels.ts
|
|
5797
|
-
import { Routes as
|
|
6024
|
+
import { Routes as Routes28 } from "@fluxerjs/types";
|
|
5798
6025
|
async function createChannel(guild, options) {
|
|
5799
|
-
const created = await guild.client.rest.post(
|
|
6026
|
+
const created = await guild.client.rest.post(Routes28.guildChannels(guild.id), {
|
|
5800
6027
|
body: toChannelCreateBody(options),
|
|
5801
6028
|
auth: true
|
|
5802
6029
|
});
|
|
5803
6030
|
return cacheChannel(guild, created);
|
|
5804
6031
|
}
|
|
5805
6032
|
async function fetchChannels(guild) {
|
|
5806
|
-
const raw = await guild.client.rest.get(
|
|
6033
|
+
const raw = await guild.client.rest.get(Routes28.guildChannels(guild.id));
|
|
5807
6034
|
if (!Array.isArray(raw))
|
|
5808
6035
|
throw new TypeError(
|
|
5809
6036
|
"guild.fetchChannels() received an invalid API payload (expected an array)"
|
|
@@ -5817,17 +6044,17 @@ async function fetchChannels(guild) {
|
|
|
5817
6044
|
return channels;
|
|
5818
6045
|
}
|
|
5819
6046
|
async function setChannelPositions(guild, updates) {
|
|
5820
|
-
await guild.client.rest.patch(
|
|
6047
|
+
await guild.client.rest.patch(Routes28.guildChannels(guild.id), {
|
|
5821
6048
|
body: toChannelPositionBody(updates),
|
|
5822
6049
|
auth: true
|
|
5823
6050
|
});
|
|
5824
6051
|
}
|
|
5825
6052
|
async function fetchWebhooks(guild) {
|
|
5826
|
-
const data = await guild.client.rest.get(
|
|
6053
|
+
const data = await guild.client.rest.get(Routes28.guildWebhooks(guild.id));
|
|
5827
6054
|
return data.map((w) => new Webhook(guild.client, w));
|
|
5828
6055
|
}
|
|
5829
6056
|
async function fetchInvites(guild) {
|
|
5830
|
-
const data = await guild.client.rest.get(
|
|
6057
|
+
const data = await guild.client.rest.get(Routes28.guildInvites(guild.id));
|
|
5831
6058
|
return data.map((invite) => new Invite(guild.client, invite));
|
|
5832
6059
|
}
|
|
5833
6060
|
async function fetchInvite(guild, codeOrUrl) {
|
|
@@ -5847,14 +6074,14 @@ function resolveGuildOnlineCount(data) {
|
|
|
5847
6074
|
}
|
|
5848
6075
|
|
|
5849
6076
|
// src/Domain/Guild/Emojis.ts
|
|
5850
|
-
import { Routes as
|
|
6077
|
+
import { Routes as Routes29 } from "@fluxerjs/types";
|
|
5851
6078
|
async function fetchEmojis(guild) {
|
|
5852
|
-
const data = await guild.client.rest.get(
|
|
6079
|
+
const data = await guild.client.rest.get(Routes29.guildEmojis(guild.id));
|
|
5853
6080
|
return data.map((e) => cacheEmoji(guild, e));
|
|
5854
6081
|
}
|
|
5855
6082
|
async function fetchEmoji(guild, emojiId) {
|
|
5856
6083
|
try {
|
|
5857
|
-
const data = await guild.client.rest.get(
|
|
6084
|
+
const data = await guild.client.rest.get(Routes29.guildEmoji(guild.id, emojiId));
|
|
5858
6085
|
return cacheEmoji(guild, data);
|
|
5859
6086
|
} catch (err) {
|
|
5860
6087
|
rethrowMapped(err, {
|
|
@@ -5865,7 +6092,7 @@ async function fetchEmoji(guild, emojiId) {
|
|
|
5865
6092
|
}
|
|
5866
6093
|
async function createEmoji(guild, options) {
|
|
5867
6094
|
const { reason, ...body } = options;
|
|
5868
|
-
const data = await guild.client.rest.post(
|
|
6095
|
+
const data = await guild.client.rest.post(Routes29.guildEmojis(guild.id), {
|
|
5869
6096
|
body,
|
|
5870
6097
|
auth: true,
|
|
5871
6098
|
...auditReasonHeaders(reason)
|
|
@@ -5873,7 +6100,7 @@ async function createEmoji(guild, options) {
|
|
|
5873
6100
|
return cacheEmoji(guild, data);
|
|
5874
6101
|
}
|
|
5875
6102
|
async function cloneEmoji(guild, sourceEmojiId) {
|
|
5876
|
-
const data = await guild.client.rest.post(
|
|
6103
|
+
const data = await guild.client.rest.post(Routes29.guildEmojisClone(guild.id), {
|
|
5877
6104
|
body: { source_emoji_id: sourceEmojiId },
|
|
5878
6105
|
auth: true
|
|
5879
6106
|
});
|
|
@@ -5881,7 +6108,7 @@ async function cloneEmoji(guild, sourceEmojiId) {
|
|
|
5881
6108
|
}
|
|
5882
6109
|
async function createEmojisBulk(guild, emojis) {
|
|
5883
6110
|
const data = await guild.client.rest.post(
|
|
5884
|
-
|
|
6111
|
+
Routes29.guildEmojisBulk(guild.id),
|
|
5885
6112
|
{ body: { emojis }, auth: true }
|
|
5886
6113
|
);
|
|
5887
6114
|
return { success: data.success.map((e) => cacheEmoji(guild, e)), failed: data.failed };
|
|
@@ -5901,12 +6128,12 @@ var GuildRoleManager = class extends LimitedCollection3 {
|
|
|
5901
6128
|
};
|
|
5902
6129
|
|
|
5903
6130
|
// src/Domain/Guild/MemberHttp.ts
|
|
5904
|
-
import { Routes as
|
|
6131
|
+
import { Routes as Routes30 } from "@fluxerjs/types";
|
|
5905
6132
|
async function fetchMember(guild, userId) {
|
|
5906
6133
|
const id = normalizeSnowflakeId(userId, "members.fetch()");
|
|
5907
6134
|
try {
|
|
5908
6135
|
const data = await guild.client.rest.get(
|
|
5909
|
-
|
|
6136
|
+
Routes30.guildMember(guild.id, id)
|
|
5910
6137
|
);
|
|
5911
6138
|
if (!data?.user?.id) {
|
|
5912
6139
|
throw new TypeError("members.fetch() received an invalid API payload (missing user.id)");
|
|
@@ -5924,7 +6151,7 @@ async function fetchMember(guild, userId) {
|
|
|
5924
6151
|
}
|
|
5925
6152
|
async function fetchMe(guild) {
|
|
5926
6153
|
const data = await guild.client.rest.get(
|
|
5927
|
-
|
|
6154
|
+
Routes30.guildMemberMe(guild.id),
|
|
5928
6155
|
{ auth: true }
|
|
5929
6156
|
);
|
|
5930
6157
|
if (!data?.user?.id) {
|
|
@@ -5934,10 +6161,10 @@ async function fetchMe(guild) {
|
|
|
5934
6161
|
}
|
|
5935
6162
|
|
|
5936
6163
|
// src/Domain/Guild/Moderation.ts
|
|
5937
|
-
import { Routes as
|
|
6164
|
+
import { Routes as Routes32 } from "@fluxerjs/types";
|
|
5938
6165
|
|
|
5939
6166
|
// src/Domain/Guild/GuildBan.ts
|
|
5940
|
-
import { Routes as
|
|
6167
|
+
import { Routes as Routes31 } from "@fluxerjs/types";
|
|
5941
6168
|
function parseOptionalDate2(value) {
|
|
5942
6169
|
if (value == null || value === "") return null;
|
|
5943
6170
|
const date = new Date(value);
|
|
@@ -5964,7 +6191,7 @@ var GuildBan = class extends Base {
|
|
|
5964
6191
|
* Requires Ban Members permission.
|
|
5965
6192
|
*/
|
|
5966
6193
|
async unban(reason) {
|
|
5967
|
-
await this.client.rest.delete(
|
|
6194
|
+
await this.client.rest.delete(Routes31.guildBan(this.guildId, this.user.id), {
|
|
5968
6195
|
auth: true,
|
|
5969
6196
|
...auditReasonHeaders(reason)
|
|
5970
6197
|
});
|
|
@@ -5974,39 +6201,39 @@ var GuildBan = class extends Base {
|
|
|
5974
6201
|
// src/Domain/Guild/Moderation.ts
|
|
5975
6202
|
async function ban(guild, userId, options) {
|
|
5976
6203
|
const body = options ? toGuildBanBody(options) : {};
|
|
5977
|
-
await guild.client.rest.put(
|
|
6204
|
+
await guild.client.rest.put(Routes32.guildBan(guild.id, userId), {
|
|
5978
6205
|
body: Object.keys(body).length ? body : void 0,
|
|
5979
6206
|
auth: true,
|
|
5980
6207
|
...auditReasonHeaders(options?.reason)
|
|
5981
6208
|
});
|
|
5982
6209
|
}
|
|
5983
6210
|
async function fetchBan(guild, userId) {
|
|
5984
|
-
const data = await guild.client.rest.get(
|
|
6211
|
+
const data = await guild.client.rest.get(Routes32.guildBan(guild.id, userId));
|
|
5985
6212
|
return new GuildBan(guild.client, { ...data, guild_id: guild.id }, guild.id);
|
|
5986
6213
|
}
|
|
5987
6214
|
async function fetchBans(guild) {
|
|
5988
|
-
const data = await guild.client.rest.get(
|
|
6215
|
+
const data = await guild.client.rest.get(Routes32.guildBans(guild.id));
|
|
5989
6216
|
return data.map((b) => new GuildBan(guild.client, { ...b, guild_id: guild.id }, guild.id));
|
|
5990
6217
|
}
|
|
5991
6218
|
async function unban(guild, userId, reason) {
|
|
5992
|
-
await guild.client.rest.delete(
|
|
6219
|
+
await guild.client.rest.delete(Routes32.guildBan(guild.id, userId), {
|
|
5993
6220
|
auth: true,
|
|
5994
6221
|
...auditReasonHeaders(reason)
|
|
5995
6222
|
});
|
|
5996
6223
|
}
|
|
5997
6224
|
async function kick(guild, userId, reason) {
|
|
5998
|
-
await guild.client.rest.delete(
|
|
6225
|
+
await guild.client.rest.delete(Routes32.guildMember(guild.id, userId), {
|
|
5999
6226
|
auth: true,
|
|
6000
6227
|
...auditReasonHeaders(reason)
|
|
6001
6228
|
});
|
|
6002
6229
|
}
|
|
6003
6230
|
|
|
6004
6231
|
// src/Domain/Guild/Roles.ts
|
|
6005
|
-
import { Routes as
|
|
6232
|
+
import { Routes as Routes33 } from "@fluxerjs/types";
|
|
6006
6233
|
import { parseRoleMention } from "@fluxerjs/util";
|
|
6007
6234
|
async function createRole(guild, options = {}) {
|
|
6008
6235
|
const body = toRoleCreateBody(options);
|
|
6009
|
-
const data = await guild.client.rest.post(
|
|
6236
|
+
const data = await guild.client.rest.post(Routes33.guildRoles(guild.id), {
|
|
6010
6237
|
body: Object.keys(body).length ? body : void 0,
|
|
6011
6238
|
auth: true,
|
|
6012
6239
|
...auditReasonHeaders(options.reason)
|
|
@@ -6014,14 +6241,14 @@ async function createRole(guild, options = {}) {
|
|
|
6014
6241
|
return cacheRole(guild, data);
|
|
6015
6242
|
}
|
|
6016
6243
|
async function fetchRoles(guild) {
|
|
6017
|
-
const data = await guild.client.rest.get(
|
|
6244
|
+
const data = await guild.client.rest.get(Routes33.guildRoles(guild.id));
|
|
6018
6245
|
if (!Array.isArray(data))
|
|
6019
6246
|
throw new TypeError("guild.fetchRoles() received an invalid API payload (expected an array)");
|
|
6020
6247
|
return data.map((r) => cacheRole(guild, r));
|
|
6021
6248
|
}
|
|
6022
6249
|
async function fetchRole(guild, roleId2) {
|
|
6023
6250
|
try {
|
|
6024
|
-
const data = await guild.client.rest.get(
|
|
6251
|
+
const data = await guild.client.rest.get(Routes33.guildRole(guild.id, roleId2));
|
|
6025
6252
|
return cacheRole(guild, data);
|
|
6026
6253
|
} catch (err) {
|
|
6027
6254
|
rethrowMapped(err, {
|
|
@@ -6038,7 +6265,7 @@ async function resolveRoleId(guild, arg) {
|
|
|
6038
6265
|
const needle = trimmed.toLowerCase();
|
|
6039
6266
|
const cached = guild.roles.find((r) => r.name?.toLowerCase() === needle);
|
|
6040
6267
|
if (cached) return cached.id;
|
|
6041
|
-
const roles = await guild.client.rest.get(
|
|
6268
|
+
const roles = await guild.client.rest.get(Routes33.guildRoles(guild.id));
|
|
6042
6269
|
const role = roles.find((r) => r.name?.toLowerCase() === needle);
|
|
6043
6270
|
if (!role) return null;
|
|
6044
6271
|
cacheRole(guild, role);
|
|
@@ -6047,7 +6274,7 @@ async function resolveRoleId(guild, arg) {
|
|
|
6047
6274
|
async function setRolePositions(guild, updates) {
|
|
6048
6275
|
return replaceRoles(
|
|
6049
6276
|
guild,
|
|
6050
|
-
await guild.client.rest.patch(
|
|
6277
|
+
await guild.client.rest.patch(Routes33.guildRoles(guild.id), {
|
|
6051
6278
|
body: updates,
|
|
6052
6279
|
auth: true
|
|
6053
6280
|
})
|
|
@@ -6056,7 +6283,7 @@ async function setRolePositions(guild, updates) {
|
|
|
6056
6283
|
async function setRoleHoistPositions(guild, updates) {
|
|
6057
6284
|
return replaceRoles(
|
|
6058
6285
|
guild,
|
|
6059
|
-
await guild.client.rest.patch(
|
|
6286
|
+
await guild.client.rest.patch(Routes33.guildRolesHoistPositions(guild.id), {
|
|
6060
6287
|
body: updates.map((u) => ({
|
|
6061
6288
|
id: u.id,
|
|
6062
6289
|
...u.hoistPosition !== void 0 ? { hoist_position: u.hoistPosition } : {}
|
|
@@ -6068,17 +6295,17 @@ async function setRoleHoistPositions(guild, updates) {
|
|
|
6068
6295
|
async function resetRoleHoistPositions(guild) {
|
|
6069
6296
|
return replaceRoles(
|
|
6070
6297
|
guild,
|
|
6071
|
-
await guild.client.rest.delete(
|
|
6298
|
+
await guild.client.rest.delete(Routes33.guildRolesHoistPositions(guild.id), {
|
|
6072
6299
|
auth: true
|
|
6073
6300
|
})
|
|
6074
6301
|
);
|
|
6075
6302
|
}
|
|
6076
6303
|
|
|
6077
6304
|
// src/Domain/Guild/Stickers.ts
|
|
6078
|
-
import { Routes as
|
|
6305
|
+
import { Routes as Routes34 } from "@fluxerjs/types";
|
|
6079
6306
|
async function createSticker(guild, options) {
|
|
6080
6307
|
const { reason, ...body } = options;
|
|
6081
|
-
const data = await guild.client.rest.post(
|
|
6308
|
+
const data = await guild.client.rest.post(Routes34.guildStickers(guild.id), {
|
|
6082
6309
|
body,
|
|
6083
6310
|
auth: true,
|
|
6084
6311
|
...auditReasonHeaders(reason)
|
|
@@ -6086,7 +6313,7 @@ async function createSticker(guild, options) {
|
|
|
6086
6313
|
return cacheSticker(guild, data);
|
|
6087
6314
|
}
|
|
6088
6315
|
async function cloneSticker(guild, sourceStickerId) {
|
|
6089
|
-
const data = await guild.client.rest.post(
|
|
6316
|
+
const data = await guild.client.rest.post(Routes34.guildStickersClone(guild.id), {
|
|
6090
6317
|
body: { source_sticker_id: sourceStickerId },
|
|
6091
6318
|
auth: true
|
|
6092
6319
|
});
|
|
@@ -6094,17 +6321,17 @@ async function cloneSticker(guild, sourceStickerId) {
|
|
|
6094
6321
|
}
|
|
6095
6322
|
async function createStickersBulk(guild, stickers) {
|
|
6096
6323
|
const data = await guild.client.rest.post(
|
|
6097
|
-
|
|
6324
|
+
Routes34.guildStickersBulk(guild.id),
|
|
6098
6325
|
{ body: { stickers }, auth: true }
|
|
6099
6326
|
);
|
|
6100
6327
|
return { success: data.success.map((s) => cacheSticker(guild, s)), failed: data.failed };
|
|
6101
6328
|
}
|
|
6102
6329
|
async function fetchStickers(guild) {
|
|
6103
|
-
const data = await guild.client.rest.get(
|
|
6330
|
+
const data = await guild.client.rest.get(Routes34.guildStickers(guild.id));
|
|
6104
6331
|
return data.map((s) => cacheSticker(guild, s));
|
|
6105
6332
|
}
|
|
6106
6333
|
async function fetchSticker(guild, stickerId) {
|
|
6107
|
-
const data = await guild.client.rest.get(
|
|
6334
|
+
const data = await guild.client.rest.get(Routes34.guildSticker(guild.id, stickerId));
|
|
6108
6335
|
return cacheSticker(guild, data);
|
|
6109
6336
|
}
|
|
6110
6337
|
|
|
@@ -6193,6 +6420,10 @@ var Guild = class extends Base {
|
|
|
6193
6420
|
emojis;
|
|
6194
6421
|
/** Cached stickers in this guild. */
|
|
6195
6422
|
stickers;
|
|
6423
|
+
/** Live stages in this guild's stage channels, keyed by stage instance ID. */
|
|
6424
|
+
stageInstances;
|
|
6425
|
+
/** Most participants a stage can have while speakers use video, or null if unknown. */
|
|
6426
|
+
maxStageVideoChannelUsers;
|
|
6196
6427
|
/**
|
|
6197
6428
|
* Construct a guild from API data.
|
|
6198
6429
|
* @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE
|
|
@@ -6209,6 +6440,7 @@ var Guild = class extends Base {
|
|
|
6209
6440
|
this.roles = new GuildRoleManager(this.id, { maxSize: client.cache.limits.roles });
|
|
6210
6441
|
this.emojis = new LimitedCollection4({ maxSize: client.cache.limits.emojis });
|
|
6211
6442
|
this.stickers = new LimitedCollection4({ maxSize: client.cache.limits.stickers });
|
|
6443
|
+
this.stageInstances = new Collection9();
|
|
6212
6444
|
this.name = data.name ?? "";
|
|
6213
6445
|
this.icon = data.icon ?? null;
|
|
6214
6446
|
this.banner = data.banner ?? null;
|
|
@@ -6238,6 +6470,7 @@ var Guild = class extends Base {
|
|
|
6238
6470
|
this.bannerHeight = data.banner_height ?? null;
|
|
6239
6471
|
this.splashWidth = data.splash_width ?? null;
|
|
6240
6472
|
this.splashHeight = data.splash_height ?? null;
|
|
6473
|
+
this.maxStageVideoChannelUsers = data.max_stage_video_channel_users ?? null;
|
|
6241
6474
|
this.memberCount = resolveGuildMemberCount(data) ?? null;
|
|
6242
6475
|
this.onlineCount = resolveGuildOnlineCount(data) ?? null;
|
|
6243
6476
|
for (const r of data.roles ?? []) {
|
|
@@ -6294,6 +6527,9 @@ var Guild = class extends Base {
|
|
|
6294
6527
|
if (data.banner_height !== void 0) this.bannerHeight = data.banner_height ?? null;
|
|
6295
6528
|
if (data.splash_width !== void 0) this.splashWidth = data.splash_width ?? null;
|
|
6296
6529
|
if (data.splash_height !== void 0) this.splashHeight = data.splash_height ?? null;
|
|
6530
|
+
if (data.max_stage_video_channel_users !== void 0) {
|
|
6531
|
+
this.maxStageVideoChannelUsers = data.max_stage_video_channel_users ?? null;
|
|
6532
|
+
}
|
|
6297
6533
|
const memberCount = resolveGuildMemberCount(data);
|
|
6298
6534
|
if (memberCount !== void 0) this.memberCount = memberCount;
|
|
6299
6535
|
const onlineCount = resolveGuildOnlineCount(data);
|
|
@@ -6309,11 +6545,11 @@ var Guild = class extends Base {
|
|
|
6309
6545
|
}
|
|
6310
6546
|
/** Unix timestamp (ms) when this guild was created, derived from its snowflake ID. */
|
|
6311
6547
|
get createdTimestamp() {
|
|
6312
|
-
return
|
|
6548
|
+
return SnowflakeUtil10.timestampFromSnowflake(this.id);
|
|
6313
6549
|
}
|
|
6314
6550
|
/** Date when this guild was created, derived from its snowflake ID. */
|
|
6315
6551
|
get createdAt() {
|
|
6316
|
-
return
|
|
6552
|
+
return SnowflakeUtil10.dateFromSnowflake(this.id);
|
|
6317
6553
|
}
|
|
6318
6554
|
/** The guild's name. */
|
|
6319
6555
|
toString() {
|
|
@@ -6599,6 +6835,8 @@ function upsertGuildFromSnapshot(client, guildData, resources = {}) {
|
|
|
6599
6835
|
if (resources.members !== void 0) mergeMembers(guild, resources.members);
|
|
6600
6836
|
if (resources.emojis !== void 0) syncEmojis(guild, resources.emojis);
|
|
6601
6837
|
if (resources.stickers !== void 0) syncStickers(guild, resources.stickers);
|
|
6838
|
+
if (resources.stageInstances !== void 0) syncStageInstances(guild, resources.stageInstances);
|
|
6839
|
+
if (resources.stageCounts !== void 0) applyStageCounts(guild, resources.stageCounts);
|
|
6602
6840
|
if (resources.channels !== void 0) guild.partial = false;
|
|
6603
6841
|
return { guild, created, recovered };
|
|
6604
6842
|
}
|
|
@@ -6613,7 +6851,9 @@ function applyGuildSnapshotFromGateway(client, raw) {
|
|
|
6613
6851
|
emojis: g.emojis,
|
|
6614
6852
|
stickers: g.stickers,
|
|
6615
6853
|
// A channel list without `threads` means this session has no viewable threads.
|
|
6616
|
-
threads: g.channels !== void 0 ? g.threads ?? [] : g.threads
|
|
6854
|
+
threads: g.channels !== void 0 ? g.threads ?? [] : g.threads,
|
|
6855
|
+
stageInstances: g.stage_instances,
|
|
6856
|
+
stageCounts: g.stage_counts
|
|
6617
6857
|
});
|
|
6618
6858
|
if (g.voice_states?.length) {
|
|
6619
6859
|
client.emit(Events.VoiceStatesSync, {
|
|
@@ -6625,7 +6865,7 @@ function applyGuildSnapshotFromGateway(client, raw) {
|
|
|
6625
6865
|
}
|
|
6626
6866
|
|
|
6627
6867
|
// src/ClientCore/ClientUser.ts
|
|
6628
|
-
import { GatewayOpcodes, Routes as
|
|
6868
|
+
import { GatewayOpcodes, Routes as Routes35 } from "@fluxerjs/types";
|
|
6629
6869
|
var ClientUser = class extends User {
|
|
6630
6870
|
/** Broadcast presence (gateway opcode 3) on all shards. */
|
|
6631
6871
|
setPresence(presence) {
|
|
@@ -6635,13 +6875,13 @@ var ClientUser = class extends User {
|
|
|
6635
6875
|
}
|
|
6636
6876
|
/** GET /users/@me — refresh the logged-in user from REST and patch this instance. */
|
|
6637
6877
|
async fetch() {
|
|
6638
|
-
const data = await this.client.rest.get(
|
|
6878
|
+
const data = await this.client.rest.get(Routes35.currentUser(), { auth: true });
|
|
6639
6879
|
this._patch(data);
|
|
6640
6880
|
return this;
|
|
6641
6881
|
}
|
|
6642
6882
|
/** GET /users/@me/guilds — returns camelCase partial guilds. */
|
|
6643
6883
|
async fetchGuilds(options) {
|
|
6644
|
-
const path =
|
|
6884
|
+
const path = Routes35.currentUserGuilds() + (options?.withCounts ? "?with_counts=true" : "");
|
|
6645
6885
|
const data = await this.client.rest.get(path, { auth: true });
|
|
6646
6886
|
return data.map((g) => ({
|
|
6647
6887
|
id: g.id,
|
|
@@ -6665,7 +6905,7 @@ var ClientUser = class extends User {
|
|
|
6665
6905
|
*/
|
|
6666
6906
|
async leaveGuild(guildId, options) {
|
|
6667
6907
|
const body = options ? toSudoBody(options) : void 0;
|
|
6668
|
-
await this.client.rest.delete(
|
|
6908
|
+
await this.client.rest.delete(Routes35.leaveGuild(guildId), {
|
|
6669
6909
|
body: body && Object.keys(body).length ? body : void 0,
|
|
6670
6910
|
auth: true
|
|
6671
6911
|
});
|
|
@@ -6673,7 +6913,7 @@ var ClientUser = class extends User {
|
|
|
6673
6913
|
/** Delete every message authored by the caller across a guild (sudo). */
|
|
6674
6914
|
async bulkDeleteMyMessagesInGuild(guildId, options) {
|
|
6675
6915
|
const body = options ? toSudoBody(options) : void 0;
|
|
6676
|
-
await this.client.rest.post(
|
|
6916
|
+
await this.client.rest.post(Routes35.guildBulkDeleteMine(guildId), {
|
|
6677
6917
|
body: body && Object.keys(body).length ? body : void 0,
|
|
6678
6918
|
auth: true
|
|
6679
6919
|
});
|
|
@@ -7145,7 +7385,7 @@ var memberHandlers = {
|
|
|
7145
7385
|
};
|
|
7146
7386
|
|
|
7147
7387
|
// src/ClientCore/EventHandlers/Messages.ts
|
|
7148
|
-
import { SnowflakeUtil as
|
|
7388
|
+
import { SnowflakeUtil as SnowflakeUtil11 } from "@fluxerjs/util";
|
|
7149
7389
|
function cachedTextChannel(client, channelId) {
|
|
7150
7390
|
const channel = client.channels.get(channelId);
|
|
7151
7391
|
return channel?.isTextBased() ? channel : null;
|
|
@@ -7161,7 +7401,7 @@ function toPartialMessage(client, args) {
|
|
|
7161
7401
|
const cached = args.cached;
|
|
7162
7402
|
const authorId = args.authorId ?? cached?.author?.id ?? null;
|
|
7163
7403
|
const author = cached?.author ? client.getOrCreateUser(cached.author) : authorId ? client.users.get(authorId) ?? null : null;
|
|
7164
|
-
const createdAt = cached?.timestamp ? new Date(cached.timestamp) :
|
|
7404
|
+
const createdAt = cached?.timestamp ? new Date(cached.timestamp) : SnowflakeUtil11.isValid(args.id) ? SnowflakeUtil11.dateFromSnowflake(args.id) : null;
|
|
7165
7405
|
return new PartialMessage(client, {
|
|
7166
7406
|
id: args.id,
|
|
7167
7407
|
channelId: args.channelId,
|
|
@@ -7425,6 +7665,46 @@ var passthroughHandlers = {
|
|
|
7425
7665
|
WEBAUTHN_CREDENTIALS_UPDATE: pass(Events.WebAuthnCredentialsUpdate)
|
|
7426
7666
|
};
|
|
7427
7667
|
|
|
7668
|
+
// src/ClientCore/EventHandlers/Stages.ts
|
|
7669
|
+
var stageHandlers = {
|
|
7670
|
+
STAGE_INSTANCE_CREATE(client, d) {
|
|
7671
|
+
const instance = cacheStageInstance(client, d);
|
|
7672
|
+
client.emit(Events.StageInstanceCreate, instance);
|
|
7673
|
+
},
|
|
7674
|
+
STAGE_INSTANCE_UPDATE(client, d) {
|
|
7675
|
+
const data = d;
|
|
7676
|
+
const cached = client.guilds.get(data.guild_id)?.stageInstances.get(data.id);
|
|
7677
|
+
const old = cached ? new StageInstance(client, cached.toJSON()) : null;
|
|
7678
|
+
const instance = cacheStageInstance(client, data);
|
|
7679
|
+
client.emit(Events.StageInstanceUpdate, old, instance);
|
|
7680
|
+
},
|
|
7681
|
+
STAGE_INSTANCE_DELETE(client, d) {
|
|
7682
|
+
const data = d;
|
|
7683
|
+
const guild = client.guilds.get(data.guild_id);
|
|
7684
|
+
const instance = guild?.stageInstances.get(data.id) ?? new StageInstance(client, data);
|
|
7685
|
+
instance._patch(data);
|
|
7686
|
+
guild?.stageInstances.delete(data.id);
|
|
7687
|
+
client.emit(Events.StageInstanceDelete, instance);
|
|
7688
|
+
},
|
|
7689
|
+
STAGE_COUNTS_UPDATE(client, d) {
|
|
7690
|
+
const data = d;
|
|
7691
|
+
const channel = client.channels.get(data.channel_id);
|
|
7692
|
+
if (channel?.isStage()) channel._patchCounts(data);
|
|
7693
|
+
const payload = {
|
|
7694
|
+
guildId: data.guild_id,
|
|
7695
|
+
channelId: data.channel_id,
|
|
7696
|
+
listenerCount: data.listener_count,
|
|
7697
|
+
speakerCount: data.speaker_count,
|
|
7698
|
+
requestCount: data.request_count,
|
|
7699
|
+
videoEnabled: data.video_enabled ?? null
|
|
7700
|
+
};
|
|
7701
|
+
client.emit(Events.StageCountsUpdate, payload);
|
|
7702
|
+
},
|
|
7703
|
+
STAGE_VOICE_STATES_SYNC: pass(Events.StageVoiceStatesSync),
|
|
7704
|
+
STAGE_AUDIENCE_LIST_UPDATE: pass(Events.StageAudienceListUpdate),
|
|
7705
|
+
VOICE_JOIN_QUEUED: pass(Events.VoiceJoinQueued)
|
|
7706
|
+
};
|
|
7707
|
+
|
|
7428
7708
|
// src/ClientCore/EventHandlers/Threads.ts
|
|
7429
7709
|
function cachedChannel(client, id) {
|
|
7430
7710
|
const direct = client.channels.get(id);
|
|
@@ -7535,7 +7815,8 @@ var eventHandlers = buildRegistry(
|
|
|
7535
7815
|
inviteHandlers,
|
|
7536
7816
|
guildResourceHandlers,
|
|
7537
7817
|
passthroughHandlers,
|
|
7538
|
-
threadHandlers
|
|
7818
|
+
threadHandlers,
|
|
7819
|
+
stageHandlers
|
|
7539
7820
|
);
|
|
7540
7821
|
|
|
7541
7822
|
// src/ClientCore/GatewayDispatch.ts
|
|
@@ -7795,7 +8076,7 @@ async function connectClientGateway(client, token, signal) {
|
|
|
7795
8076
|
|
|
7796
8077
|
// src/ClientCore/GuildManager.ts
|
|
7797
8078
|
import { LimitedCollection as LimitedCollection5 } from "@fluxerjs/collection";
|
|
7798
|
-
import { Routes as
|
|
8079
|
+
import { Routes as Routes36 } from "@fluxerjs/types";
|
|
7799
8080
|
var GuildManager = class extends LimitedCollection5 {
|
|
7800
8081
|
constructor(client) {
|
|
7801
8082
|
super({
|
|
@@ -7855,7 +8136,7 @@ var GuildManager = class extends LimitedCollection5 {
|
|
|
7855
8136
|
return dedupeFetch(this.pendingFetches, id, async () => {
|
|
7856
8137
|
try {
|
|
7857
8138
|
const data = assertApiObjectWithId(
|
|
7858
|
-
await this.client.rest.get(
|
|
8139
|
+
await this.client.rest.get(Routes36.guild(id)),
|
|
7859
8140
|
"guilds.fetch()"
|
|
7860
8141
|
);
|
|
7861
8142
|
let guild;
|
|
@@ -7965,7 +8246,7 @@ var MessageCache = class {
|
|
|
7965
8246
|
// src/ClientCore/UserManager.ts
|
|
7966
8247
|
import { LimitedCollection as LimitedCollection6 } from "@fluxerjs/collection";
|
|
7967
8248
|
import {
|
|
7968
|
-
Routes as
|
|
8249
|
+
Routes as Routes37
|
|
7969
8250
|
} from "@fluxerjs/types";
|
|
7970
8251
|
var soft = (p) => p.catch(() => null);
|
|
7971
8252
|
var UserManager = class extends LimitedCollection6 {
|
|
@@ -8000,7 +8281,7 @@ var UserManager = class extends LimitedCollection6 {
|
|
|
8000
8281
|
id,
|
|
8001
8282
|
async () => this.client.getOrCreateUser(
|
|
8002
8283
|
assertApiObjectWithId(
|
|
8003
|
-
await this.client.rest.get(
|
|
8284
|
+
await this.client.rest.get(Routes37.user(id)),
|
|
8004
8285
|
"users.fetch()"
|
|
8005
8286
|
)
|
|
8006
8287
|
)
|
|
@@ -8023,10 +8304,10 @@ var UserManager = class extends LimitedCollection6 {
|
|
|
8023
8304
|
async fetchWithProfile(userId, options) {
|
|
8024
8305
|
const guildId = options?.guildId ?? void 0;
|
|
8025
8306
|
const [userData, globalProfileRaw, serverProfileRaw, memberData] = await Promise.all([
|
|
8026
|
-
this.client.rest.get(
|
|
8027
|
-
soft(this.client.rest.get(
|
|
8028
|
-
guildId ? soft(this.client.rest.get(
|
|
8029
|
-
guildId ? soft(this.client.rest.get(
|
|
8307
|
+
this.client.rest.get(Routes37.user(userId)),
|
|
8308
|
+
soft(this.client.rest.get(Routes37.userProfile(userId))),
|
|
8309
|
+
guildId ? soft(this.client.rest.get(Routes37.userProfile(userId, guildId))) : null,
|
|
8310
|
+
guildId ? soft(this.client.rest.get(Routes37.guildMember(guildId, userId))) : null
|
|
8030
8311
|
]);
|
|
8031
8312
|
const user = this.client.getOrCreateUser(userData);
|
|
8032
8313
|
let member = null;
|
|
@@ -8609,7 +8890,7 @@ var Client = class _Client extends EventEmitter3 {
|
|
|
8609
8890
|
* @see {@link Routes}
|
|
8610
8891
|
*/
|
|
8611
8892
|
static get Routes() {
|
|
8612
|
-
return
|
|
8893
|
+
return Routes38;
|
|
8613
8894
|
}
|
|
8614
8895
|
};
|
|
8615
8896
|
export {
|