@fluxerjs/core 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SubpathMessage-CjQBbVmb.d.mts → SubpathMessage-Cj_U0V19.d.mts} +64 -21
- package/dist/{SubpathMessage-DNlKq2Nj.d.ts → SubpathMessage-DaimQAd9.d.ts} +64 -21
- package/dist/{Sudo-CFfbmis3.d.mts → Sudo-fOKSPbxN.d.mts} +8 -0
- package/dist/{Sudo-CFfbmis3.d.ts → Sudo-fOKSPbxN.d.ts} +8 -0
- package/dist/client.d.mts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +282 -89
- package/dist/client.mjs +282 -89
- package/dist/cluster.d.mts +3 -3
- package/dist/cluster.d.ts +3 -3
- package/dist/cluster.js +282 -89
- package/dist/cluster.mjs +282 -89
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +286 -89
- package/dist/index.mjs +284 -89
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/message.d.mts +2 -2
- package/dist/message.d.ts +2 -2
- package/dist/message.js +83 -3
- package/dist/message.mjs +83 -3
- package/package.json +5 -5
package/dist/cluster.js
CHANGED
|
@@ -521,6 +521,13 @@ function toSudoBody(options) {
|
|
|
521
521
|
return body;
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
+
// src/Helpers/AuditReason.ts
|
|
525
|
+
var AUDIT_LOG_REASON_HEADER = "X-Audit-Log-Reason";
|
|
526
|
+
function auditReasonHeaders(reason) {
|
|
527
|
+
if (reason == null || reason === "") return {};
|
|
528
|
+
return { headers: { [AUDIT_LOG_REASON_HEADER]: encodeURIComponent(reason) } };
|
|
529
|
+
}
|
|
530
|
+
|
|
524
531
|
// src/Helpers/MessageUtils/Body.ts
|
|
525
532
|
var import_builders = require("@fluxerjs/builders");
|
|
526
533
|
var import_types = require("@fluxerjs/types");
|
|
@@ -1100,6 +1107,67 @@ var CDN_URL = "https://fluxerusercontent.com";
|
|
|
1100
1107
|
var STATIC_CDN_URL = "https://fluxerstatic.com";
|
|
1101
1108
|
|
|
1102
1109
|
// src/Helpers/Cdn.ts
|
|
1110
|
+
var CDN_SIZE_LADDER = [
|
|
1111
|
+
16,
|
|
1112
|
+
20,
|
|
1113
|
+
22,
|
|
1114
|
+
24,
|
|
1115
|
+
28,
|
|
1116
|
+
32,
|
|
1117
|
+
40,
|
|
1118
|
+
44,
|
|
1119
|
+
48,
|
|
1120
|
+
56,
|
|
1121
|
+
60,
|
|
1122
|
+
64,
|
|
1123
|
+
80,
|
|
1124
|
+
96,
|
|
1125
|
+
100,
|
|
1126
|
+
128,
|
|
1127
|
+
160,
|
|
1128
|
+
240,
|
|
1129
|
+
256,
|
|
1130
|
+
300,
|
|
1131
|
+
320,
|
|
1132
|
+
480,
|
|
1133
|
+
512,
|
|
1134
|
+
600,
|
|
1135
|
+
640,
|
|
1136
|
+
1024,
|
|
1137
|
+
1280,
|
|
1138
|
+
1536,
|
|
1139
|
+
2048,
|
|
1140
|
+
3072,
|
|
1141
|
+
4096,
|
|
1142
|
+
8192,
|
|
1143
|
+
16384
|
|
1144
|
+
];
|
|
1145
|
+
var CDN_ASSET_CLASS_RANGE = {
|
|
1146
|
+
icon: { min: 128, max: 1024 },
|
|
1147
|
+
banner: { min: 480, max: 2400 },
|
|
1148
|
+
emoji: { min: 32, max: 512 },
|
|
1149
|
+
sticker: { min: 128, max: 512 }
|
|
1150
|
+
};
|
|
1151
|
+
function nearestSize(requested, candidates) {
|
|
1152
|
+
let best = candidates[0];
|
|
1153
|
+
let bestDist = Math.abs(requested - best);
|
|
1154
|
+
for (let i = 1; i < candidates.length; i++) {
|
|
1155
|
+
const step = candidates[i];
|
|
1156
|
+
const dist = Math.abs(requested - step);
|
|
1157
|
+
if (dist < bestDist || dist === bestDist && step > best) {
|
|
1158
|
+
best = step;
|
|
1159
|
+
bestDist = dist;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return best;
|
|
1163
|
+
}
|
|
1164
|
+
function snapCdnSize(requested, assetClass) {
|
|
1165
|
+
const { min, max } = CDN_ASSET_CLASS_RANGE[assetClass];
|
|
1166
|
+
const snapped = nearestSize(requested, CDN_SIZE_LADDER);
|
|
1167
|
+
const clamped = Math.min(max, Math.max(min, snapped));
|
|
1168
|
+
const allowed = CDN_SIZE_LADDER.filter((step) => step >= min && step <= max);
|
|
1169
|
+
return nearestSize(clamped, allowed);
|
|
1170
|
+
}
|
|
1103
1171
|
function mediaBase(options) {
|
|
1104
1172
|
return (options?.mediaBase ?? CDN_URL).replace(/\/+$/, "");
|
|
1105
1173
|
}
|
|
@@ -1111,31 +1179,33 @@ function getExtension(hash, options) {
|
|
|
1111
1179
|
if (hash?.startsWith("a_")) return "gif";
|
|
1112
1180
|
return ext;
|
|
1113
1181
|
}
|
|
1114
|
-
function appendSize(options) {
|
|
1115
|
-
|
|
1182
|
+
function appendSize(options, assetClass) {
|
|
1183
|
+
const size = options?.size;
|
|
1184
|
+
if (size == null || !Number.isFinite(size) || size <= 0) return "";
|
|
1185
|
+
return `?size=${snapCdnSize(size, assetClass)}`;
|
|
1116
1186
|
}
|
|
1117
1187
|
function cdnAvatarURL(userId, avatarHash, options) {
|
|
1118
1188
|
if (!avatarHash) return null;
|
|
1119
1189
|
const ext = getExtension(avatarHash, options);
|
|
1120
|
-
const size = appendSize(options);
|
|
1190
|
+
const size = appendSize(options, "icon");
|
|
1121
1191
|
return `${mediaBase(options)}/avatars/${userId}/${avatarHash}.${ext}${size}`;
|
|
1122
1192
|
}
|
|
1123
1193
|
function cdnBannerURL(resourceId, bannerHash, options) {
|
|
1124
1194
|
if (!bannerHash) return null;
|
|
1125
1195
|
const ext = getExtension(bannerHash, options);
|
|
1126
|
-
const size = appendSize(options);
|
|
1196
|
+
const size = appendSize(options, "banner");
|
|
1127
1197
|
return `${mediaBase(options)}/banners/${resourceId}/${bannerHash}.${ext}${size}`;
|
|
1128
1198
|
}
|
|
1129
1199
|
function cdnMemberAvatarURL(guildId, userId, avatarHash, options) {
|
|
1130
1200
|
if (!avatarHash) return null;
|
|
1131
1201
|
const ext = getExtension(avatarHash, options);
|
|
1132
|
-
const size = appendSize(options);
|
|
1202
|
+
const size = appendSize(options, "icon");
|
|
1133
1203
|
return `${mediaBase(options)}/guilds/${guildId}/users/${userId}/avatars/${avatarHash}.${ext}${size}`;
|
|
1134
1204
|
}
|
|
1135
1205
|
function cdnMemberBannerURL(guildId, userId, bannerHash, options) {
|
|
1136
1206
|
if (!bannerHash) return null;
|
|
1137
1207
|
const ext = getExtension(bannerHash, options);
|
|
1138
|
-
const size = appendSize(options);
|
|
1208
|
+
const size = appendSize(options, "banner");
|
|
1139
1209
|
return `${mediaBase(options)}/guilds/${guildId}/users/${userId}/banners/${bannerHash}.${ext}${size}`;
|
|
1140
1210
|
}
|
|
1141
1211
|
function cdnDefaultAvatarURL(userIdOrIndex, options) {
|
|
@@ -1144,16 +1214,19 @@ function cdnDefaultAvatarURL(userIdOrIndex, options) {
|
|
|
1144
1214
|
}
|
|
1145
1215
|
function cdnGuildAssetURL(kind, id, hash, options) {
|
|
1146
1216
|
if (!hash) return null;
|
|
1147
|
-
const
|
|
1217
|
+
const assetClass = kind === "icons" ? "icon" : "banner";
|
|
1218
|
+
const size = appendSize(options, assetClass);
|
|
1148
1219
|
return `${mediaBase(options)}/${kind}/${id}/${hash}.png${size}`;
|
|
1149
1220
|
}
|
|
1150
1221
|
function cdnEmojiURL(emojiId, animated, options) {
|
|
1151
1222
|
const ext = animated ? "gif" : "png";
|
|
1152
|
-
|
|
1223
|
+
const size = appendSize(options, "emoji");
|
|
1224
|
+
return `${mediaBase(options)}/emojis/${emojiId}.${ext}${size}`;
|
|
1153
1225
|
}
|
|
1154
1226
|
function cdnStickerURL(stickerId, animated, options) {
|
|
1155
1227
|
const ext = animated ? "gif" : "png";
|
|
1156
|
-
|
|
1228
|
+
const size = appendSize(options, "sticker");
|
|
1229
|
+
return `${mediaBase(options)}/stickers/${stickerId}.${ext}${size}`;
|
|
1157
1230
|
}
|
|
1158
1231
|
|
|
1159
1232
|
// src/Domain/Message/MessageSticker.ts
|
|
@@ -1381,6 +1454,8 @@ var Message = class _Message extends Base {
|
|
|
1381
1454
|
mentionRoles;
|
|
1382
1455
|
/** Client-side nonce for deduplication. */
|
|
1383
1456
|
nonce;
|
|
1457
|
+
/** IDs of custom emojis in the message classified as explicit. */
|
|
1458
|
+
nsfwEmojis;
|
|
1384
1459
|
/**
|
|
1385
1460
|
* Cached text-capable channel (guild text, guild voice, or DM), or null if uncached / not text-based.
|
|
1386
1461
|
* Narrowed type has {@link Channel.send} and {@link Channel.delete}.
|
|
@@ -1455,6 +1530,7 @@ var Message = class _Message extends Base {
|
|
|
1455
1530
|
this.mentions = (data.mentions ?? []).map((u) => client.getOrCreateUser(u));
|
|
1456
1531
|
this.mentionRoles = data.mention_roles ?? [];
|
|
1457
1532
|
this.nonce = data.nonce ?? null;
|
|
1533
|
+
this.nsfwEmojis = data.nsfw_emojis ?? [];
|
|
1458
1534
|
}
|
|
1459
1535
|
/**
|
|
1460
1536
|
* Apply an API message payload in place (cache identity / MESSAGE_UPDATE).
|
|
@@ -1487,6 +1563,7 @@ var Message = class _Message extends Base {
|
|
|
1487
1563
|
this.mentions = (data.mentions ?? []).map((u) => this.client.getOrCreateUser(u));
|
|
1488
1564
|
this.mentionRoles = data.mention_roles ?? [];
|
|
1489
1565
|
this.nonce = data.nonce ?? null;
|
|
1566
|
+
this.nsfwEmojis = data.nsfw_emojis ?? [];
|
|
1490
1567
|
}
|
|
1491
1568
|
/**
|
|
1492
1569
|
* Send a standalone message in this channel (not a reply).
|
|
@@ -1570,8 +1647,10 @@ var Message = class _Message extends Base {
|
|
|
1570
1647
|
return this.client.channels.fetchMessage(this.channelId, this.id);
|
|
1571
1648
|
}
|
|
1572
1649
|
/** Delete this message. */
|
|
1573
|
-
async delete() {
|
|
1574
|
-
await this.client.rest.delete(import_types5.Routes.channelMessage(this.channelId, this.id)
|
|
1650
|
+
async delete(reason) {
|
|
1651
|
+
await this.client.rest.delete(import_types5.Routes.channelMessage(this.channelId, this.id), {
|
|
1652
|
+
...auditReasonHeaders(reason)
|
|
1653
|
+
});
|
|
1575
1654
|
this.client._removeMessageFromCache(this.channelId, this.id);
|
|
1576
1655
|
}
|
|
1577
1656
|
/** Delete a specific attachment from this message. */
|
|
@@ -1885,6 +1964,29 @@ var MessageCollector = class _MessageCollector extends import_node_events2.Event
|
|
|
1885
1964
|
|
|
1886
1965
|
// src/Domain/Channel/Attachments.ts
|
|
1887
1966
|
var import_types7 = require("@fluxerjs/types");
|
|
1967
|
+
var BOT_ATTACHMENT_MAX_BYTES = 50 * 1024 * 1024;
|
|
1968
|
+
var ATTACHMENT_MULTIPART_THRESHOLD_BYTES = 10 * 1024 * 1024;
|
|
1969
|
+
function instanceLimitOverridesSnapshot(client) {
|
|
1970
|
+
const rules = client.instance.discovery?.limits?.rules;
|
|
1971
|
+
if (!rules?.length) return null;
|
|
1972
|
+
const snapshot = {};
|
|
1973
|
+
for (const rule of rules) {
|
|
1974
|
+
Object.assign(snapshot, rule.overrides);
|
|
1975
|
+
}
|
|
1976
|
+
return Object.keys(snapshot).length ? snapshot : null;
|
|
1977
|
+
}
|
|
1978
|
+
function assertBotAttachmentLimits(client, files) {
|
|
1979
|
+
const snapshot = instanceLimitOverridesSnapshot(client);
|
|
1980
|
+
for (const file of files) {
|
|
1981
|
+
const size = file.data.byteLength;
|
|
1982
|
+
if (size <= BOT_ATTACHMENT_MAX_BYTES) continue;
|
|
1983
|
+
const snapshotNote = snapshot ? ` Instance limit overrides: ${JSON.stringify(snapshot)}.` : "";
|
|
1984
|
+
throw new import_util2.FluxerError(
|
|
1985
|
+
`Bot attachments are limited to 50 MiB (${BOT_ATTACHMENT_MAX_BYTES} bytes); "${file.filename}" is ${size} bytes.${snapshotNote}`,
|
|
1986
|
+
{ code: import_util.ErrorCodes.AttachmentTooLarge }
|
|
1987
|
+
);
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1888
1990
|
function asBytes(data) {
|
|
1889
1991
|
const src = data instanceof ArrayBuffer ? new Uint8Array(data) : new Uint8Array(data);
|
|
1890
1992
|
const out = new Uint8Array(src.byteLength);
|
|
@@ -1904,6 +2006,7 @@ async function putBlob(url, body, contentType) {
|
|
|
1904
2006
|
}
|
|
1905
2007
|
}
|
|
1906
2008
|
async function uploadAttachmentsForSend(client, channelId, files) {
|
|
2009
|
+
assertBotAttachmentLimits(client, files);
|
|
1907
2010
|
const plan = await client.rest.post(
|
|
1908
2011
|
import_types7.Routes.channelAttachments(channelId),
|
|
1909
2012
|
{
|
|
@@ -2200,11 +2303,12 @@ var Channel = class extends Base {
|
|
|
2200
2303
|
if (options?.silent) params.set("silent", "true");
|
|
2201
2304
|
if (options?.deleteMessages) params.set("delete_messages", "true");
|
|
2202
2305
|
const qs2 = params.toString();
|
|
2203
|
-
const { silent: _s, deleteMessages: _d, ...sudo } = options ?? {};
|
|
2306
|
+
const { silent: _s, deleteMessages: _d, reason: _reason, ...sudo } = options ?? {};
|
|
2204
2307
|
const body = Object.keys(sudo).length ? toSudoBody(sudo) : void 0;
|
|
2205
2308
|
await this.client.rest.delete(import_types8.Routes.channel(this.id) + (qs2 ? `?${qs2}` : ""), {
|
|
2206
2309
|
body,
|
|
2207
|
-
auth: true
|
|
2310
|
+
auth: true,
|
|
2311
|
+
...auditReasonHeaders(_reason)
|
|
2208
2312
|
});
|
|
2209
2313
|
this.client.channels.delete(this.id);
|
|
2210
2314
|
this.client._clearMessageCache(this.id);
|
|
@@ -2364,7 +2468,7 @@ var import_types11 = require("@fluxerjs/types");
|
|
|
2364
2468
|
// src/Helpers/Instance.ts
|
|
2365
2469
|
var import_util9 = require("@fluxerjs/util");
|
|
2366
2470
|
var DEFAULT_INSTANCE_ENDPOINTS = Object.freeze({
|
|
2367
|
-
api: "https://
|
|
2471
|
+
api: "https://web.fluxer.app/api",
|
|
2368
2472
|
api_client: "https://web.fluxer.app/api",
|
|
2369
2473
|
api_public: "https://api.fluxer.app",
|
|
2370
2474
|
gateway: "wss://gateway.fluxer.app",
|
|
@@ -2398,6 +2502,10 @@ function requireString(obj, key, path) {
|
|
|
2398
2502
|
}
|
|
2399
2503
|
return value;
|
|
2400
2504
|
}
|
|
2505
|
+
var INSTANCE_DISCOVERY_PATH = "/.well-known/fluxer";
|
|
2506
|
+
function instanceDiscoveryUrl(origin) {
|
|
2507
|
+
return `${normalizeApiOrigin(origin)}${INSTANCE_DISCOVERY_PATH}`;
|
|
2508
|
+
}
|
|
2401
2509
|
function normalizeApiOrigin(api) {
|
|
2402
2510
|
const trimmed = api.trim().replace(/\/+$/, "");
|
|
2403
2511
|
return trimmed.replace(/\/v\d+$/i, "");
|
|
@@ -2426,6 +2534,8 @@ function parseInstanceDiscovery(raw) {
|
|
|
2426
2534
|
endpoints[key] = requireString(raw.endpoints, key, "endpoints");
|
|
2427
2535
|
}
|
|
2428
2536
|
endpoints.api = normalizeApiOrigin(endpoints.api);
|
|
2537
|
+
endpoints.api_client = normalizeApiOrigin(endpoints.api_client);
|
|
2538
|
+
endpoints.api_public = normalizeApiOrigin(endpoints.api_public);
|
|
2429
2539
|
endpoints.invite = normalizeInviteBase(endpoints.invite);
|
|
2430
2540
|
endpoints.media = endpoints.media.replace(/\/+$/, "");
|
|
2431
2541
|
endpoints.static_cdn = endpoints.static_cdn.replace(/\/+$/, "");
|
|
@@ -2503,6 +2613,11 @@ function resolveInstanceEndpoints(input) {
|
|
|
2503
2613
|
}
|
|
2504
2614
|
}
|
|
2505
2615
|
merged.api = normalizeApiOrigin(merged.api);
|
|
2616
|
+
merged.api_client = normalizeApiOrigin(merged.api_client);
|
|
2617
|
+
merged.api_public = normalizeApiOrigin(merged.api_public);
|
|
2618
|
+
if (typeof partial.api === "string" && partial.api.length > 0 && (typeof partial.api_public !== "string" || partial.api_public.length === 0)) {
|
|
2619
|
+
merged.api_public = merged.api;
|
|
2620
|
+
}
|
|
2506
2621
|
merged.invite = normalizeInviteBase(merged.invite);
|
|
2507
2622
|
merged.media = merged.media.replace(/\/+$/, "");
|
|
2508
2623
|
merged.static_cdn = merged.static_cdn.replace(/\/+$/, "");
|
|
@@ -2511,13 +2626,13 @@ function resolveInstanceEndpoints(input) {
|
|
|
2511
2626
|
discovery: null
|
|
2512
2627
|
});
|
|
2513
2628
|
}
|
|
2514
|
-
function resolveRestApi(
|
|
2515
|
-
const fromInstance = normalizeApiOrigin(
|
|
2629
|
+
function resolveRestApi(instanceApiPublic, restApi) {
|
|
2630
|
+
const fromInstance = normalizeApiOrigin(instanceApiPublic);
|
|
2516
2631
|
if (restApi === void 0) return fromInstance;
|
|
2517
2632
|
const fromRest = normalizeApiOrigin(restApi);
|
|
2518
2633
|
if (fromRest !== fromInstance) {
|
|
2519
2634
|
throw new import_util2.FluxerError(
|
|
2520
|
-
`Conflicting API hosts: instance.
|
|
2635
|
+
`Conflicting API hosts: instance.api_public (${fromInstance}) vs rest.api (${fromRest}). Prefer ClientOptions.instance.`,
|
|
2521
2636
|
{ code: import_util.ErrorCodes.ConflictingInstanceConfig }
|
|
2522
2637
|
);
|
|
2523
2638
|
}
|
|
@@ -2997,7 +3112,8 @@ var GuildChannel = class extends Channel {
|
|
|
2997
3112
|
async edit(options) {
|
|
2998
3113
|
const data = await this.client.rest.patch(import_types14.Routes.channel(this.id), {
|
|
2999
3114
|
body: toChannelEditBody(options),
|
|
3000
|
-
auth: true
|
|
3115
|
+
auth: true,
|
|
3116
|
+
...auditReasonHeaders(options.reason)
|
|
3001
3117
|
});
|
|
3002
3118
|
this.name = data.name ?? this.name;
|
|
3003
3119
|
this.parentId = data.parent_id ?? this.parentId;
|
|
@@ -3529,9 +3645,10 @@ var GuildEmoji = class extends Base {
|
|
|
3529
3645
|
return `<${this.animated ? "a" : ""}:${this.name}:${this.id}>`;
|
|
3530
3646
|
}
|
|
3531
3647
|
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
3532
|
-
async delete() {
|
|
3648
|
+
async delete(reason) {
|
|
3533
3649
|
await this.client.rest.delete(import_types17.Routes.guildEmoji(this.guildId, this.id), {
|
|
3534
|
-
auth: true
|
|
3650
|
+
auth: true,
|
|
3651
|
+
...auditReasonHeaders(reason)
|
|
3535
3652
|
});
|
|
3536
3653
|
const guild = this.client.guilds.get(this.guildId);
|
|
3537
3654
|
if (guild) guild.emojis.delete(this.id);
|
|
@@ -3541,9 +3658,11 @@ var GuildEmoji = class extends Base {
|
|
|
3541
3658
|
* Requires Manage Emojis and Stickers permission.
|
|
3542
3659
|
*/
|
|
3543
3660
|
async edit(options) {
|
|
3661
|
+
const { reason, name } = options;
|
|
3544
3662
|
const data = await this.client.rest.patch(import_types17.Routes.guildEmoji(this.guildId, this.id), {
|
|
3545
|
-
body:
|
|
3546
|
-
auth: true
|
|
3663
|
+
body: { name },
|
|
3664
|
+
auth: true,
|
|
3665
|
+
...auditReasonHeaders(reason)
|
|
3547
3666
|
});
|
|
3548
3667
|
this.name = data.name;
|
|
3549
3668
|
return this;
|
|
@@ -3559,6 +3678,9 @@ var import_types18 = require("@fluxerjs/types");
|
|
|
3559
3678
|
var import_util16 = require("@fluxerjs/util");
|
|
3560
3679
|
function computePermissions(basePermissions, overwrites, memberRoles, memberId, isOwner) {
|
|
3561
3680
|
if (isOwner) return import_util16.ALL_PERMISSIONS_BIGINT;
|
|
3681
|
+
if ((basePermissions & import_util16.PermissionFlags.Administrator) !== 0n) {
|
|
3682
|
+
return import_util16.ALL_PERMISSIONS_BIGINT;
|
|
3683
|
+
}
|
|
3562
3684
|
let perms = basePermissions;
|
|
3563
3685
|
for (const overwrite of overwrites ?? []) {
|
|
3564
3686
|
const applies = overwrite.type === import_types18.OverwriteType.Role && memberRoles.includes(overwrite.id) || overwrite.type === import_types18.OverwriteType.Member && overwrite.id === memberId;
|
|
@@ -3567,7 +3689,7 @@ function computePermissions(basePermissions, overwrites, memberRoles, memberId,
|
|
|
3567
3689
|
const deny = BigInt(overwrite.deny || "0");
|
|
3568
3690
|
perms = perms & ~deny | allow;
|
|
3569
3691
|
}
|
|
3570
|
-
return
|
|
3692
|
+
return perms;
|
|
3571
3693
|
}
|
|
3572
3694
|
|
|
3573
3695
|
// src/Domain/Guild/GuildMemberRoleManager.ts
|
|
@@ -3773,7 +3895,8 @@ var GuildMember = class _GuildMember extends Base {
|
|
|
3773
3895
|
const route = isMe ? import_types20.Routes.guildMemberMe(this.guild.id) : import_types20.Routes.guildMember(this.guild.id, this.id);
|
|
3774
3896
|
const data = await this.client.rest.patch(route, {
|
|
3775
3897
|
body: toMemberEditBody(options),
|
|
3776
|
-
auth: true
|
|
3898
|
+
auth: true,
|
|
3899
|
+
...auditReasonHeaders(options.reason ?? options.timeoutReason)
|
|
3777
3900
|
});
|
|
3778
3901
|
this._patch(data);
|
|
3779
3902
|
if (options.bio !== void 0) this.bio = options.bio;
|
|
@@ -3807,8 +3930,8 @@ var GuildMember = class _GuildMember extends Base {
|
|
|
3807
3930
|
await this.edit({ channelId, connectionId });
|
|
3808
3931
|
}
|
|
3809
3932
|
/** Kick this member. Requires Kick Members. */
|
|
3810
|
-
async kick() {
|
|
3811
|
-
await this.guild.kick(this.id);
|
|
3933
|
+
async kick(reason) {
|
|
3934
|
+
await this.guild.kick(this.id, reason);
|
|
3812
3935
|
}
|
|
3813
3936
|
/** Ban this member. Requires Ban Members. */
|
|
3814
3937
|
async ban(options) {
|
|
@@ -3932,9 +4055,10 @@ var GuildSticker = class extends Base {
|
|
|
3932
4055
|
return import_util18.SnowflakeUtil.dateFromSnowflake(this.id);
|
|
3933
4056
|
}
|
|
3934
4057
|
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
3935
|
-
async delete() {
|
|
4058
|
+
async delete(reason) {
|
|
3936
4059
|
await this.client.rest.delete(import_types21.Routes.guildSticker(this.guildId, this.id), {
|
|
3937
|
-
auth: true
|
|
4060
|
+
auth: true,
|
|
4061
|
+
...auditReasonHeaders(reason)
|
|
3938
4062
|
});
|
|
3939
4063
|
const guild = this.client.guilds.get(this.guildId);
|
|
3940
4064
|
if (guild) guild.stickers.delete(this.id);
|
|
@@ -3944,9 +4068,11 @@ var GuildSticker = class extends Base {
|
|
|
3944
4068
|
* Requires Manage Emojis and Stickers permission.
|
|
3945
4069
|
*/
|
|
3946
4070
|
async edit(options) {
|
|
4071
|
+
const { reason, ...body } = options;
|
|
3947
4072
|
const data = await this.client.rest.patch(import_types21.Routes.guildSticker(this.guildId, this.id), {
|
|
3948
|
-
body
|
|
3949
|
-
auth: true
|
|
4073
|
+
body,
|
|
4074
|
+
auth: true,
|
|
4075
|
+
...auditReasonHeaders(reason)
|
|
3950
4076
|
});
|
|
3951
4077
|
const s = data;
|
|
3952
4078
|
this.name = s.name;
|
|
@@ -4068,16 +4194,21 @@ var Role = class _Role extends Base {
|
|
|
4068
4194
|
const body = toRoleEditBody(options);
|
|
4069
4195
|
const data = await this.client.rest.patch(import_types22.Routes.guildRole(this.guildId, this.id), {
|
|
4070
4196
|
body: Object.keys(body).length ? body : void 0,
|
|
4071
|
-
auth: true
|
|
4197
|
+
auth: true,
|
|
4198
|
+
...auditReasonHeaders(options.reason)
|
|
4072
4199
|
});
|
|
4073
4200
|
this._patch(data);
|
|
4074
4201
|
return this;
|
|
4075
4202
|
}
|
|
4076
4203
|
/**
|
|
4077
4204
|
* DELETE role. Requires Manage Roles.
|
|
4205
|
+
* @param reason - Audit log reason (`X-Audit-Log-Reason`)
|
|
4078
4206
|
*/
|
|
4079
|
-
async delete() {
|
|
4080
|
-
await this.client.rest.delete(import_types22.Routes.guildRole(this.guildId, this.id), {
|
|
4207
|
+
async delete(reason) {
|
|
4208
|
+
await this.client.rest.delete(import_types22.Routes.guildRole(this.guildId, this.id), {
|
|
4209
|
+
auth: true,
|
|
4210
|
+
...auditReasonHeaders(reason)
|
|
4211
|
+
});
|
|
4081
4212
|
this.client.guilds.get(this.guildId)?.roles.delete(this.id);
|
|
4082
4213
|
}
|
|
4083
4214
|
};
|
|
@@ -4328,7 +4459,10 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
4328
4459
|
return parsed.name;
|
|
4329
4460
|
}
|
|
4330
4461
|
async function fetchInstance(client) {
|
|
4331
|
-
const raw = await client.rest.get(import_types24.Routes.instanceDiscovery(), {
|
|
4462
|
+
const raw = await client.rest.get(import_types24.Routes.instanceDiscovery(), {
|
|
4463
|
+
auth: false,
|
|
4464
|
+
unversioned: true
|
|
4465
|
+
});
|
|
4332
4466
|
return parseInstanceDiscovery(raw);
|
|
4333
4467
|
}
|
|
4334
4468
|
function fetchGatewayInfo(client) {
|
|
@@ -4707,9 +4841,11 @@ async function fetchEmoji(guild, emojiId) {
|
|
|
4707
4841
|
}
|
|
4708
4842
|
}
|
|
4709
4843
|
async function createEmoji(guild, options) {
|
|
4844
|
+
const { reason, ...body } = options;
|
|
4710
4845
|
const data = await guild.client.rest.post(import_types28.Routes.guildEmojis(guild.id), {
|
|
4711
|
-
body
|
|
4712
|
-
auth: true
|
|
4846
|
+
body,
|
|
4847
|
+
auth: true,
|
|
4848
|
+
...auditReasonHeaders(reason)
|
|
4713
4849
|
});
|
|
4714
4850
|
return cacheEmoji(guild, data);
|
|
4715
4851
|
}
|
|
@@ -4728,6 +4864,19 @@ async function createEmojisBulk(guild, emojis) {
|
|
|
4728
4864
|
return { success: data.success.map((e) => cacheEmoji(guild, e)), failed: data.failed };
|
|
4729
4865
|
}
|
|
4730
4866
|
|
|
4867
|
+
// src/Domain/Guild/GuildRoleManager.ts
|
|
4868
|
+
var import_collection11 = require("@fluxerjs/collection");
|
|
4869
|
+
var GuildRoleManager = class extends import_collection11.LimitedCollection {
|
|
4870
|
+
constructor(guildId, options) {
|
|
4871
|
+
super(options);
|
|
4872
|
+
this.guildId = guildId;
|
|
4873
|
+
}
|
|
4874
|
+
/** The @everyone role (`id === guild.id`), or undefined if uncached. */
|
|
4875
|
+
get everyone() {
|
|
4876
|
+
return this.get(this.guildId);
|
|
4877
|
+
}
|
|
4878
|
+
};
|
|
4879
|
+
|
|
4731
4880
|
// src/Domain/Guild/MemberHttp.ts
|
|
4732
4881
|
var import_types29 = require("@fluxerjs/types");
|
|
4733
4882
|
async function fetchMember(guild, userId) {
|
|
@@ -4784,9 +4933,10 @@ var GuildBan = class extends Base {
|
|
|
4784
4933
|
* Remove this ban (unban the user).
|
|
4785
4934
|
* Requires Ban Members permission.
|
|
4786
4935
|
*/
|
|
4787
|
-
async unban() {
|
|
4936
|
+
async unban(reason) {
|
|
4788
4937
|
await this.client.rest.delete(import_types30.Routes.guildBan(this.guildId, this.user.id), {
|
|
4789
|
-
auth: true
|
|
4938
|
+
auth: true,
|
|
4939
|
+
...auditReasonHeaders(reason)
|
|
4790
4940
|
});
|
|
4791
4941
|
}
|
|
4792
4942
|
};
|
|
@@ -4796,33 +4946,27 @@ async function ban(guild, userId, options) {
|
|
|
4796
4946
|
const body = options ? toGuildBanBody(options) : {};
|
|
4797
4947
|
await guild.client.rest.put(import_types31.Routes.guildBan(guild.id, userId), {
|
|
4798
4948
|
body: Object.keys(body).length ? body : void 0,
|
|
4799
|
-
auth: true
|
|
4949
|
+
auth: true,
|
|
4950
|
+
...auditReasonHeaders(options?.reason)
|
|
4800
4951
|
});
|
|
4801
4952
|
}
|
|
4802
4953
|
async function fetchBans(guild) {
|
|
4803
4954
|
const data = await guild.client.rest.get(import_types31.Routes.guildBans(guild.id));
|
|
4804
4955
|
return data.map((b) => new GuildBan(guild.client, { ...b, guild_id: guild.id }, guild.id));
|
|
4805
4956
|
}
|
|
4806
|
-
async function unban(guild, userId) {
|
|
4807
|
-
await guild.client.rest.delete(import_types31.Routes.guildBan(guild.id, userId), {
|
|
4957
|
+
async function unban(guild, userId, reason) {
|
|
4958
|
+
await guild.client.rest.delete(import_types31.Routes.guildBan(guild.id, userId), {
|
|
4959
|
+
auth: true,
|
|
4960
|
+
...auditReasonHeaders(reason)
|
|
4961
|
+
});
|
|
4808
4962
|
}
|
|
4809
|
-
async function kick(guild, userId) {
|
|
4810
|
-
await guild.client.rest.delete(import_types31.Routes.guildMember(guild.id, userId), {
|
|
4963
|
+
async function kick(guild, userId, reason) {
|
|
4964
|
+
await guild.client.rest.delete(import_types31.Routes.guildMember(guild.id, userId), {
|
|
4965
|
+
auth: true,
|
|
4966
|
+
...auditReasonHeaders(reason)
|
|
4967
|
+
});
|
|
4811
4968
|
}
|
|
4812
4969
|
|
|
4813
|
-
// src/Domain/Guild/GuildRoleManager.ts
|
|
4814
|
-
var import_collection11 = require("@fluxerjs/collection");
|
|
4815
|
-
var GuildRoleManager = class extends import_collection11.LimitedCollection {
|
|
4816
|
-
constructor(guildId, options) {
|
|
4817
|
-
super(options);
|
|
4818
|
-
this.guildId = guildId;
|
|
4819
|
-
}
|
|
4820
|
-
/** The @everyone role (`id === guild.id`), or undefined if uncached. */
|
|
4821
|
-
get everyone() {
|
|
4822
|
-
return this.get(this.guildId);
|
|
4823
|
-
}
|
|
4824
|
-
};
|
|
4825
|
-
|
|
4826
4970
|
// src/Domain/Guild/Roles.ts
|
|
4827
4971
|
var import_types32 = require("@fluxerjs/types");
|
|
4828
4972
|
var import_util21 = require("@fluxerjs/util");
|
|
@@ -4830,7 +4974,8 @@ async function createRole(guild, options = {}) {
|
|
|
4830
4974
|
const body = toRoleCreateBody(options);
|
|
4831
4975
|
const data = await guild.client.rest.post(import_types32.Routes.guildRoles(guild.id), {
|
|
4832
4976
|
body: Object.keys(body).length ? body : void 0,
|
|
4833
|
-
auth: true
|
|
4977
|
+
auth: true,
|
|
4978
|
+
...auditReasonHeaders(options.reason)
|
|
4834
4979
|
});
|
|
4835
4980
|
return cacheRole(guild, data);
|
|
4836
4981
|
}
|
|
@@ -4896,9 +5041,11 @@ async function resetRoleHoistPositions(guild) {
|
|
|
4896
5041
|
// src/Domain/Guild/Stickers.ts
|
|
4897
5042
|
var import_types33 = require("@fluxerjs/types");
|
|
4898
5043
|
async function createSticker(guild, options) {
|
|
5044
|
+
const { reason, ...body } = options;
|
|
4899
5045
|
const data = await guild.client.rest.post(import_types33.Routes.guildStickers(guild.id), {
|
|
4900
|
-
body
|
|
4901
|
-
auth: true
|
|
5046
|
+
body,
|
|
5047
|
+
auth: true,
|
|
5048
|
+
...auditReasonHeaders(reason)
|
|
4902
5049
|
});
|
|
4903
5050
|
return cacheSticker(guild, data);
|
|
4904
5051
|
}
|
|
@@ -5228,12 +5375,12 @@ var Guild = class extends Base {
|
|
|
5228
5375
|
return fetchBans(this);
|
|
5229
5376
|
}
|
|
5230
5377
|
/** Unban a user from the guild. Requires Ban Members. */
|
|
5231
|
-
unban(userId) {
|
|
5232
|
-
return unban(this, userId);
|
|
5378
|
+
unban(userId, reason) {
|
|
5379
|
+
return unban(this, userId, reason);
|
|
5233
5380
|
}
|
|
5234
5381
|
/** Kick a user from the guild. Requires Kick Members. */
|
|
5235
|
-
kick(userId) {
|
|
5236
|
-
return kick(this, userId);
|
|
5382
|
+
kick(userId, reason) {
|
|
5383
|
+
return kick(this, userId, reason);
|
|
5237
5384
|
}
|
|
5238
5385
|
/** Fetch all emojis in this guild from the API. */
|
|
5239
5386
|
fetchEmojis() {
|
|
@@ -5683,7 +5830,14 @@ function markGuildUnavailable(client, id) {
|
|
|
5683
5830
|
guild.available = false;
|
|
5684
5831
|
client.emit(Events.GuildUnavailable, guild);
|
|
5685
5832
|
}
|
|
5833
|
+
function isStartupGuildHydration(client) {
|
|
5834
|
+
return client._guildStreamSettleTimeout !== null;
|
|
5835
|
+
}
|
|
5686
5836
|
var guildHandlers = {
|
|
5837
|
+
/**
|
|
5838
|
+
* Available snapshots: {@link Events.GuildAvailable} for READY stubs / outage recovery,
|
|
5839
|
+
* {@link Events.GuildCreate} for real joins (unless {@link ClientOptions.emitGuildCreateOnStartup}).
|
|
5840
|
+
*/
|
|
5687
5841
|
GUILD_CREATE(client, d) {
|
|
5688
5842
|
const raw = d;
|
|
5689
5843
|
if (raw.unavailable === true) {
|
|
@@ -5696,11 +5850,32 @@ var guildHandlers = {
|
|
|
5696
5850
|
}
|
|
5697
5851
|
return;
|
|
5698
5852
|
}
|
|
5853
|
+
const startupHydration = isStartupGuildHydration(client);
|
|
5854
|
+
if (startupHydration) {
|
|
5855
|
+
resetGuildStreamSettle(client);
|
|
5856
|
+
}
|
|
5699
5857
|
const result = applyGuildSnapshotFromGateway(client, d);
|
|
5700
5858
|
if (!result) return;
|
|
5701
5859
|
const { guild, recovered } = result;
|
|
5702
|
-
|
|
5703
|
-
|
|
5860
|
+
const legacyStartup = client.options.emitGuildCreateOnStartup === true;
|
|
5861
|
+
const wasReadyStub = client._readyStubGuildIds.delete(guild.id);
|
|
5862
|
+
const isStartupBackfill = wasReadyStub || startupHydration;
|
|
5863
|
+
if (recovered) {
|
|
5864
|
+
guild.available = true;
|
|
5865
|
+
if (legacyStartup && isStartupBackfill) {
|
|
5866
|
+
client.emit(Events.GuildCreate, guild);
|
|
5867
|
+
} else {
|
|
5868
|
+
client.emit(Events.GuildAvailable, guild);
|
|
5869
|
+
}
|
|
5870
|
+
} else if (startupHydration) {
|
|
5871
|
+
if (legacyStartup) {
|
|
5872
|
+
client.emit(Events.GuildCreate, guild);
|
|
5873
|
+
} else {
|
|
5874
|
+
client.emit(Events.GuildAvailable, guild);
|
|
5875
|
+
}
|
|
5876
|
+
} else {
|
|
5877
|
+
client.emit(Events.GuildCreate, guild);
|
|
5878
|
+
}
|
|
5704
5879
|
client._onGuildReceived(guild.id);
|
|
5705
5880
|
},
|
|
5706
5881
|
GUILD_UPDATE(client, d) {
|
|
@@ -5739,6 +5914,7 @@ var guildHandlers = {
|
|
|
5739
5914
|
markGuildUnavailable(client, id);
|
|
5740
5915
|
return;
|
|
5741
5916
|
}
|
|
5917
|
+
client._readyStubGuildIds.delete(id);
|
|
5742
5918
|
const guild = client.guilds.get(id);
|
|
5743
5919
|
if (!guild) return;
|
|
5744
5920
|
client.guilds.delete(id);
|
|
@@ -6254,10 +6430,15 @@ function hydrateReadyGuilds(client, guilds, waitForGuilds) {
|
|
|
6254
6430
|
for (const g of guilds ?? []) {
|
|
6255
6431
|
if (g.unavailable === true) {
|
|
6256
6432
|
if (typeof g.id === "string") {
|
|
6257
|
-
|
|
6258
|
-
if (
|
|
6259
|
-
|
|
6433
|
+
let guild = client.guilds.get(g.id);
|
|
6434
|
+
if (!guild) {
|
|
6435
|
+
guild = new Guild(client, { id: g.id });
|
|
6436
|
+
guild.available = false;
|
|
6437
|
+
client.guilds.set(g.id, guild);
|
|
6438
|
+
} else if (guild.available !== false) {
|
|
6439
|
+
guild.available = false;
|
|
6260
6440
|
}
|
|
6441
|
+
client._readyStubGuildIds.add(g.id);
|
|
6261
6442
|
if (pending !== null) pending.add(g.id);
|
|
6262
6443
|
}
|
|
6263
6444
|
continue;
|
|
@@ -6285,6 +6466,13 @@ function clearGuildStreamSettle(client) {
|
|
|
6285
6466
|
clearTimeout(client._guildStreamSettleTimeout);
|
|
6286
6467
|
client._guildStreamSettleTimeout = null;
|
|
6287
6468
|
}
|
|
6469
|
+
function resetGuildStreamSettle(client) {
|
|
6470
|
+
clearGuildStreamSettle(client);
|
|
6471
|
+
client._guildStreamSettleTimeout = setTimeout(() => {
|
|
6472
|
+
client._guildStreamSettleTimeout = null;
|
|
6473
|
+
if (client.readyAt === null) finalizeClientReady(client);
|
|
6474
|
+
}, GUILD_STREAM_SETTLE_MS);
|
|
6475
|
+
}
|
|
6288
6476
|
function handleReadyPayload(client, data) {
|
|
6289
6477
|
client.user = new ClientUser(client, data.user);
|
|
6290
6478
|
const waitForGuilds = client.options.waitForGuilds === true;
|
|
@@ -6304,14 +6492,9 @@ function handleReadyPayload(client, data) {
|
|
|
6304
6492
|
client._pendingGuildIds = existing;
|
|
6305
6493
|
return;
|
|
6306
6494
|
}
|
|
6307
|
-
if (
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
client._guildStreamSettleTimeout = null;
|
|
6311
|
-
if (client.readyAt === null) finalizeClientReady(client);
|
|
6312
|
-
}, GUILD_STREAM_SETTLE_MS);
|
|
6313
|
-
}
|
|
6314
|
-
return;
|
|
6495
|
+
if (guilds.length === 0) {
|
|
6496
|
+
resetGuildStreamSettle(client);
|
|
6497
|
+
if (waitForGuilds) return;
|
|
6315
6498
|
}
|
|
6316
6499
|
finalizeClientReady(client);
|
|
6317
6500
|
}
|
|
@@ -6644,7 +6827,12 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6644
6827
|
_ws = null;
|
|
6645
6828
|
/** When waitForGuilds, guild IDs still expected via GUILD_CREATE. */
|
|
6646
6829
|
_pendingGuildIds = null;
|
|
6647
|
-
/**
|
|
6830
|
+
/** Guild IDs inserted as unavailable stubs from READY (startup / reconnect backfill). */
|
|
6831
|
+
_readyStubGuildIds = /* @__PURE__ */ new Set();
|
|
6832
|
+
/**
|
|
6833
|
+
* @internal Empty-READY guild stream window.
|
|
6834
|
+
* Classifies incoming GUILD_CREATE as startup hydration. Also delays Ready when waitForGuilds.
|
|
6835
|
+
*/
|
|
6648
6836
|
_guildStreamSettleTimeout = null;
|
|
6649
6837
|
/** @internal Dispatches queued until Ready when waitForGuilds delays Ready. */
|
|
6650
6838
|
_deferredGatewayDispatches = [];
|
|
@@ -6675,7 +6863,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6675
6863
|
const restApi = options.rest?.api;
|
|
6676
6864
|
if (options.instance !== void 0) {
|
|
6677
6865
|
this.instance = resolveInstanceEndpoints(options.instance);
|
|
6678
|
-
resolveRestApi(this.instance.endpoints.
|
|
6866
|
+
resolveRestApi(this.instance.endpoints.api_public, restApi);
|
|
6679
6867
|
} else {
|
|
6680
6868
|
this.instance = resolveInstanceEndpoints(
|
|
6681
6869
|
restApi !== void 0 ? { api: restApi } : void 0
|
|
@@ -6688,27 +6876,31 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6688
6876
|
}
|
|
6689
6877
|
this.rest = new import_rest3.REST({
|
|
6690
6878
|
...this.options.rest,
|
|
6691
|
-
api: this.instance.endpoints.
|
|
6692
|
-
version: this.options.rest?.version ?? "1"
|
|
6879
|
+
api: this.instance.endpoints.api_public,
|
|
6880
|
+
version: this.options.rest?.version ?? "1",
|
|
6881
|
+
locale: this.options.locale ?? this.options.rest?.locale
|
|
6693
6882
|
});
|
|
6694
6883
|
}
|
|
6695
6884
|
/**
|
|
6696
6885
|
* Create a client from instance discovery (`GET /.well-known/fluxer`).
|
|
6697
|
-
*
|
|
6886
|
+
* Fetches the unversioned well-known document from the given origin (not `{api}/v1/.well-known/fluxer`).
|
|
6887
|
+
* Wires REST from `endpoints.api_public`. `endpoints.api` / `api_client` stay on the instance for inspection.
|
|
6888
|
+
* Does not log in. Call {@link login} with a token afterward.
|
|
6698
6889
|
*
|
|
6699
|
-
* @param origin -
|
|
6700
|
-
* @param options - Client options (must not conflict with discovered `endpoints.
|
|
6890
|
+
* @param origin - Origin used only to fetch discovery (e.g. `https://fluxer.app` or `https://my.instance`)
|
|
6891
|
+
* @param options - Client options (must not conflict with discovered `endpoints.api_public`)
|
|
6701
6892
|
* @param connectOptions - Optional abort signal for the discovery request
|
|
6702
6893
|
*/
|
|
6703
6894
|
static async fromDiscovery(origin, options = {}, connectOptions) {
|
|
6704
|
-
const
|
|
6895
|
+
const bootstrapOrigin = typeof origin === "string" ? normalizeApiOrigin(origin) : normalizeApiOrigin(origin.api);
|
|
6705
6896
|
const version = typeof origin === "string" ? options.rest?.version ?? "1" : origin.version ?? options.rest?.version ?? "1";
|
|
6706
6897
|
const bootstrap = new import_rest3.REST({
|
|
6707
6898
|
...options.rest ?? {},
|
|
6708
|
-
api:
|
|
6709
|
-
version
|
|
6899
|
+
api: bootstrapOrigin,
|
|
6900
|
+
version,
|
|
6901
|
+
locale: options.locale ?? options.rest?.locale
|
|
6710
6902
|
});
|
|
6711
|
-
const raw = await bootstrap.get(
|
|
6903
|
+
const raw = await bootstrap.get(instanceDiscoveryUrl(bootstrapOrigin), {
|
|
6712
6904
|
auth: false,
|
|
6713
6905
|
...connectOptions?.signal ? { signal: connectOptions.signal } : {}
|
|
6714
6906
|
});
|
|
@@ -6716,7 +6908,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6716
6908
|
const { rest, ...restOptions } = options;
|
|
6717
6909
|
return new _Client({
|
|
6718
6910
|
...restOptions,
|
|
6719
|
-
// Drop rest.api so discovered endpoints.
|
|
6911
|
+
// Drop rest.api so discovered endpoints.api_public owns the REST host; keep other REST opts.
|
|
6720
6912
|
...rest ? { rest: { ...rest, api: void 0 } } : {},
|
|
6721
6913
|
instance: discovery
|
|
6722
6914
|
});
|
|
@@ -6743,7 +6935,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6743
6935
|
return resolveClientEmoji(this, emoji, guildId);
|
|
6744
6936
|
}
|
|
6745
6937
|
/**
|
|
6746
|
-
* Fetch instance discovery document (
|
|
6938
|
+
* Fetch instance discovery document (unversioned `GET /.well-known/fluxer` on the REST host).
|
|
6747
6939
|
* @returns Instance configuration (endpoints, features, metadata)
|
|
6748
6940
|
*/
|
|
6749
6941
|
fetchInstance() {
|
|
@@ -7012,6 +7204,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
7012
7204
|
this.user = null;
|
|
7013
7205
|
this.readyAt = null;
|
|
7014
7206
|
this._pendingGuildIds = null;
|
|
7207
|
+
this._readyStubGuildIds.clear();
|
|
7015
7208
|
this.guilds.clear();
|
|
7016
7209
|
this.channels.clear();
|
|
7017
7210
|
this.users.clear();
|