@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/client.js
CHANGED
|
@@ -448,6 +448,13 @@ function toSudoBody(options) {
|
|
|
448
448
|
return body;
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
+
// src/Helpers/AuditReason.ts
|
|
452
|
+
var AUDIT_LOG_REASON_HEADER = "X-Audit-Log-Reason";
|
|
453
|
+
function auditReasonHeaders(reason) {
|
|
454
|
+
if (reason == null || reason === "") return {};
|
|
455
|
+
return { headers: { [AUDIT_LOG_REASON_HEADER]: encodeURIComponent(reason) } };
|
|
456
|
+
}
|
|
457
|
+
|
|
451
458
|
// src/Helpers/MessageUtils/Body.ts
|
|
452
459
|
var import_builders = require("@fluxerjs/builders");
|
|
453
460
|
var import_types = require("@fluxerjs/types");
|
|
@@ -1095,6 +1102,67 @@ var CDN_URL = "https://fluxerusercontent.com";
|
|
|
1095
1102
|
var STATIC_CDN_URL = "https://fluxerstatic.com";
|
|
1096
1103
|
|
|
1097
1104
|
// src/Helpers/Cdn.ts
|
|
1105
|
+
var CDN_SIZE_LADDER = [
|
|
1106
|
+
16,
|
|
1107
|
+
20,
|
|
1108
|
+
22,
|
|
1109
|
+
24,
|
|
1110
|
+
28,
|
|
1111
|
+
32,
|
|
1112
|
+
40,
|
|
1113
|
+
44,
|
|
1114
|
+
48,
|
|
1115
|
+
56,
|
|
1116
|
+
60,
|
|
1117
|
+
64,
|
|
1118
|
+
80,
|
|
1119
|
+
96,
|
|
1120
|
+
100,
|
|
1121
|
+
128,
|
|
1122
|
+
160,
|
|
1123
|
+
240,
|
|
1124
|
+
256,
|
|
1125
|
+
300,
|
|
1126
|
+
320,
|
|
1127
|
+
480,
|
|
1128
|
+
512,
|
|
1129
|
+
600,
|
|
1130
|
+
640,
|
|
1131
|
+
1024,
|
|
1132
|
+
1280,
|
|
1133
|
+
1536,
|
|
1134
|
+
2048,
|
|
1135
|
+
3072,
|
|
1136
|
+
4096,
|
|
1137
|
+
8192,
|
|
1138
|
+
16384
|
|
1139
|
+
];
|
|
1140
|
+
var CDN_ASSET_CLASS_RANGE = {
|
|
1141
|
+
icon: { min: 128, max: 1024 },
|
|
1142
|
+
banner: { min: 480, max: 2400 },
|
|
1143
|
+
emoji: { min: 32, max: 512 },
|
|
1144
|
+
sticker: { min: 128, max: 512 }
|
|
1145
|
+
};
|
|
1146
|
+
function nearestSize(requested, candidates) {
|
|
1147
|
+
let best = candidates[0];
|
|
1148
|
+
let bestDist = Math.abs(requested - best);
|
|
1149
|
+
for (let i = 1; i < candidates.length; i++) {
|
|
1150
|
+
const step = candidates[i];
|
|
1151
|
+
const dist = Math.abs(requested - step);
|
|
1152
|
+
if (dist < bestDist || dist === bestDist && step > best) {
|
|
1153
|
+
best = step;
|
|
1154
|
+
bestDist = dist;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
return best;
|
|
1158
|
+
}
|
|
1159
|
+
function snapCdnSize(requested, assetClass) {
|
|
1160
|
+
const { min, max } = CDN_ASSET_CLASS_RANGE[assetClass];
|
|
1161
|
+
const snapped = nearestSize(requested, CDN_SIZE_LADDER);
|
|
1162
|
+
const clamped = Math.min(max, Math.max(min, snapped));
|
|
1163
|
+
const allowed = CDN_SIZE_LADDER.filter((step) => step >= min && step <= max);
|
|
1164
|
+
return nearestSize(clamped, allowed);
|
|
1165
|
+
}
|
|
1098
1166
|
function mediaBase(options) {
|
|
1099
1167
|
return (options?.mediaBase ?? CDN_URL).replace(/\/+$/, "");
|
|
1100
1168
|
}
|
|
@@ -1106,31 +1174,33 @@ function getExtension(hash, options) {
|
|
|
1106
1174
|
if (hash?.startsWith("a_")) return "gif";
|
|
1107
1175
|
return ext;
|
|
1108
1176
|
}
|
|
1109
|
-
function appendSize(options) {
|
|
1110
|
-
|
|
1177
|
+
function appendSize(options, assetClass) {
|
|
1178
|
+
const size = options?.size;
|
|
1179
|
+
if (size == null || !Number.isFinite(size) || size <= 0) return "";
|
|
1180
|
+
return `?size=${snapCdnSize(size, assetClass)}`;
|
|
1111
1181
|
}
|
|
1112
1182
|
function cdnAvatarURL(userId, avatarHash, options) {
|
|
1113
1183
|
if (!avatarHash) return null;
|
|
1114
1184
|
const ext = getExtension(avatarHash, options);
|
|
1115
|
-
const size = appendSize(options);
|
|
1185
|
+
const size = appendSize(options, "icon");
|
|
1116
1186
|
return `${mediaBase(options)}/avatars/${userId}/${avatarHash}.${ext}${size}`;
|
|
1117
1187
|
}
|
|
1118
1188
|
function cdnBannerURL(resourceId, bannerHash, options) {
|
|
1119
1189
|
if (!bannerHash) return null;
|
|
1120
1190
|
const ext = getExtension(bannerHash, options);
|
|
1121
|
-
const size = appendSize(options);
|
|
1191
|
+
const size = appendSize(options, "banner");
|
|
1122
1192
|
return `${mediaBase(options)}/banners/${resourceId}/${bannerHash}.${ext}${size}`;
|
|
1123
1193
|
}
|
|
1124
1194
|
function cdnMemberAvatarURL(guildId, userId, avatarHash, options) {
|
|
1125
1195
|
if (!avatarHash) return null;
|
|
1126
1196
|
const ext = getExtension(avatarHash, options);
|
|
1127
|
-
const size = appendSize(options);
|
|
1197
|
+
const size = appendSize(options, "icon");
|
|
1128
1198
|
return `${mediaBase(options)}/guilds/${guildId}/users/${userId}/avatars/${avatarHash}.${ext}${size}`;
|
|
1129
1199
|
}
|
|
1130
1200
|
function cdnMemberBannerURL(guildId, userId, bannerHash, options) {
|
|
1131
1201
|
if (!bannerHash) return null;
|
|
1132
1202
|
const ext = getExtension(bannerHash, options);
|
|
1133
|
-
const size = appendSize(options);
|
|
1203
|
+
const size = appendSize(options, "banner");
|
|
1134
1204
|
return `${mediaBase(options)}/guilds/${guildId}/users/${userId}/banners/${bannerHash}.${ext}${size}`;
|
|
1135
1205
|
}
|
|
1136
1206
|
function cdnDefaultAvatarURL(userIdOrIndex, options) {
|
|
@@ -1139,16 +1209,19 @@ function cdnDefaultAvatarURL(userIdOrIndex, options) {
|
|
|
1139
1209
|
}
|
|
1140
1210
|
function cdnGuildAssetURL(kind, id, hash, options) {
|
|
1141
1211
|
if (!hash) return null;
|
|
1142
|
-
const
|
|
1212
|
+
const assetClass = kind === "icons" ? "icon" : "banner";
|
|
1213
|
+
const size = appendSize(options, assetClass);
|
|
1143
1214
|
return `${mediaBase(options)}/${kind}/${id}/${hash}.png${size}`;
|
|
1144
1215
|
}
|
|
1145
1216
|
function cdnEmojiURL(emojiId, animated, options) {
|
|
1146
1217
|
const ext = animated ? "gif" : "png";
|
|
1147
|
-
|
|
1218
|
+
const size = appendSize(options, "emoji");
|
|
1219
|
+
return `${mediaBase(options)}/emojis/${emojiId}.${ext}${size}`;
|
|
1148
1220
|
}
|
|
1149
1221
|
function cdnStickerURL(stickerId, animated, options) {
|
|
1150
1222
|
const ext = animated ? "gif" : "png";
|
|
1151
|
-
|
|
1223
|
+
const size = appendSize(options, "sticker");
|
|
1224
|
+
return `${mediaBase(options)}/stickers/${stickerId}.${ext}${size}`;
|
|
1152
1225
|
}
|
|
1153
1226
|
|
|
1154
1227
|
// src/Domain/Message/MessageSticker.ts
|
|
@@ -1376,6 +1449,8 @@ var Message = class _Message extends Base {
|
|
|
1376
1449
|
mentionRoles;
|
|
1377
1450
|
/** Client-side nonce for deduplication. */
|
|
1378
1451
|
nonce;
|
|
1452
|
+
/** IDs of custom emojis in the message classified as explicit. */
|
|
1453
|
+
nsfwEmojis;
|
|
1379
1454
|
/**
|
|
1380
1455
|
* Cached text-capable channel (guild text, guild voice, or DM), or null if uncached / not text-based.
|
|
1381
1456
|
* Narrowed type has {@link Channel.send} and {@link Channel.delete}.
|
|
@@ -1450,6 +1525,7 @@ var Message = class _Message extends Base {
|
|
|
1450
1525
|
this.mentions = (data.mentions ?? []).map((u) => client.getOrCreateUser(u));
|
|
1451
1526
|
this.mentionRoles = data.mention_roles ?? [];
|
|
1452
1527
|
this.nonce = data.nonce ?? null;
|
|
1528
|
+
this.nsfwEmojis = data.nsfw_emojis ?? [];
|
|
1453
1529
|
}
|
|
1454
1530
|
/**
|
|
1455
1531
|
* Apply an API message payload in place (cache identity / MESSAGE_UPDATE).
|
|
@@ -1482,6 +1558,7 @@ var Message = class _Message extends Base {
|
|
|
1482
1558
|
this.mentions = (data.mentions ?? []).map((u) => this.client.getOrCreateUser(u));
|
|
1483
1559
|
this.mentionRoles = data.mention_roles ?? [];
|
|
1484
1560
|
this.nonce = data.nonce ?? null;
|
|
1561
|
+
this.nsfwEmojis = data.nsfw_emojis ?? [];
|
|
1485
1562
|
}
|
|
1486
1563
|
/**
|
|
1487
1564
|
* Send a standalone message in this channel (not a reply).
|
|
@@ -1565,8 +1642,10 @@ var Message = class _Message extends Base {
|
|
|
1565
1642
|
return this.client.channels.fetchMessage(this.channelId, this.id);
|
|
1566
1643
|
}
|
|
1567
1644
|
/** Delete this message. */
|
|
1568
|
-
async delete() {
|
|
1569
|
-
await this.client.rest.delete(import_types5.Routes.channelMessage(this.channelId, this.id)
|
|
1645
|
+
async delete(reason) {
|
|
1646
|
+
await this.client.rest.delete(import_types5.Routes.channelMessage(this.channelId, this.id), {
|
|
1647
|
+
...auditReasonHeaders(reason)
|
|
1648
|
+
});
|
|
1570
1649
|
this.client._removeMessageFromCache(this.channelId, this.id);
|
|
1571
1650
|
}
|
|
1572
1651
|
/** Delete a specific attachment from this message. */
|
|
@@ -1880,6 +1959,29 @@ var MessageCollector = class _MessageCollector extends import_node_events2.Event
|
|
|
1880
1959
|
|
|
1881
1960
|
// src/Domain/Channel/Attachments.ts
|
|
1882
1961
|
var import_types7 = require("@fluxerjs/types");
|
|
1962
|
+
var BOT_ATTACHMENT_MAX_BYTES = 50 * 1024 * 1024;
|
|
1963
|
+
var ATTACHMENT_MULTIPART_THRESHOLD_BYTES = 10 * 1024 * 1024;
|
|
1964
|
+
function instanceLimitOverridesSnapshot(client) {
|
|
1965
|
+
const rules = client.instance.discovery?.limits?.rules;
|
|
1966
|
+
if (!rules?.length) return null;
|
|
1967
|
+
const snapshot = {};
|
|
1968
|
+
for (const rule of rules) {
|
|
1969
|
+
Object.assign(snapshot, rule.overrides);
|
|
1970
|
+
}
|
|
1971
|
+
return Object.keys(snapshot).length ? snapshot : null;
|
|
1972
|
+
}
|
|
1973
|
+
function assertBotAttachmentLimits(client, files) {
|
|
1974
|
+
const snapshot = instanceLimitOverridesSnapshot(client);
|
|
1975
|
+
for (const file of files) {
|
|
1976
|
+
const size = file.data.byteLength;
|
|
1977
|
+
if (size <= BOT_ATTACHMENT_MAX_BYTES) continue;
|
|
1978
|
+
const snapshotNote = snapshot ? ` Instance limit overrides: ${JSON.stringify(snapshot)}.` : "";
|
|
1979
|
+
throw new import_util4.FluxerError(
|
|
1980
|
+
`Bot attachments are limited to 50 MiB (${BOT_ATTACHMENT_MAX_BYTES} bytes); "${file.filename}" is ${size} bytes.${snapshotNote}`,
|
|
1981
|
+
{ code: import_util3.ErrorCodes.AttachmentTooLarge }
|
|
1982
|
+
);
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1883
1985
|
function asBytes(data) {
|
|
1884
1986
|
const src = data instanceof ArrayBuffer ? new Uint8Array(data) : new Uint8Array(data);
|
|
1885
1987
|
const out = new Uint8Array(src.byteLength);
|
|
@@ -1899,6 +2001,7 @@ async function putBlob(url, body, contentType) {
|
|
|
1899
2001
|
}
|
|
1900
2002
|
}
|
|
1901
2003
|
async function uploadAttachmentsForSend(client, channelId, files) {
|
|
2004
|
+
assertBotAttachmentLimits(client, files);
|
|
1902
2005
|
const plan = await client.rest.post(
|
|
1903
2006
|
import_types7.Routes.channelAttachments(channelId),
|
|
1904
2007
|
{
|
|
@@ -2195,11 +2298,12 @@ var Channel = class extends Base {
|
|
|
2195
2298
|
if (options?.silent) params.set("silent", "true");
|
|
2196
2299
|
if (options?.deleteMessages) params.set("delete_messages", "true");
|
|
2197
2300
|
const qs2 = params.toString();
|
|
2198
|
-
const { silent: _s, deleteMessages: _d, ...sudo } = options ?? {};
|
|
2301
|
+
const { silent: _s, deleteMessages: _d, reason: _reason, ...sudo } = options ?? {};
|
|
2199
2302
|
const body = Object.keys(sudo).length ? toSudoBody(sudo) : void 0;
|
|
2200
2303
|
await this.client.rest.delete(import_types8.Routes.channel(this.id) + (qs2 ? `?${qs2}` : ""), {
|
|
2201
2304
|
body,
|
|
2202
|
-
auth: true
|
|
2305
|
+
auth: true,
|
|
2306
|
+
...auditReasonHeaders(_reason)
|
|
2203
2307
|
});
|
|
2204
2308
|
this.client.channels.delete(this.id);
|
|
2205
2309
|
this.client._clearMessageCache(this.id);
|
|
@@ -2359,7 +2463,7 @@ var import_types11 = require("@fluxerjs/types");
|
|
|
2359
2463
|
// src/Helpers/Instance.ts
|
|
2360
2464
|
var import_util9 = require("@fluxerjs/util");
|
|
2361
2465
|
var DEFAULT_INSTANCE_ENDPOINTS = Object.freeze({
|
|
2362
|
-
api: "https://
|
|
2466
|
+
api: "https://web.fluxer.app/api",
|
|
2363
2467
|
api_client: "https://web.fluxer.app/api",
|
|
2364
2468
|
api_public: "https://api.fluxer.app",
|
|
2365
2469
|
gateway: "wss://gateway.fluxer.app",
|
|
@@ -2393,6 +2497,10 @@ function requireString(obj, key, path) {
|
|
|
2393
2497
|
}
|
|
2394
2498
|
return value;
|
|
2395
2499
|
}
|
|
2500
|
+
var INSTANCE_DISCOVERY_PATH = "/.well-known/fluxer";
|
|
2501
|
+
function instanceDiscoveryUrl(origin) {
|
|
2502
|
+
return `${normalizeApiOrigin(origin)}${INSTANCE_DISCOVERY_PATH}`;
|
|
2503
|
+
}
|
|
2396
2504
|
function normalizeApiOrigin(api) {
|
|
2397
2505
|
const trimmed = api.trim().replace(/\/+$/, "");
|
|
2398
2506
|
return trimmed.replace(/\/v\d+$/i, "");
|
|
@@ -2421,6 +2529,8 @@ function parseInstanceDiscovery(raw) {
|
|
|
2421
2529
|
endpoints[key] = requireString(raw.endpoints, key, "endpoints");
|
|
2422
2530
|
}
|
|
2423
2531
|
endpoints.api = normalizeApiOrigin(endpoints.api);
|
|
2532
|
+
endpoints.api_client = normalizeApiOrigin(endpoints.api_client);
|
|
2533
|
+
endpoints.api_public = normalizeApiOrigin(endpoints.api_public);
|
|
2424
2534
|
endpoints.invite = normalizeInviteBase(endpoints.invite);
|
|
2425
2535
|
endpoints.media = endpoints.media.replace(/\/+$/, "");
|
|
2426
2536
|
endpoints.static_cdn = endpoints.static_cdn.replace(/\/+$/, "");
|
|
@@ -2498,6 +2608,11 @@ function resolveInstanceEndpoints(input) {
|
|
|
2498
2608
|
}
|
|
2499
2609
|
}
|
|
2500
2610
|
merged.api = normalizeApiOrigin(merged.api);
|
|
2611
|
+
merged.api_client = normalizeApiOrigin(merged.api_client);
|
|
2612
|
+
merged.api_public = normalizeApiOrigin(merged.api_public);
|
|
2613
|
+
if (typeof partial.api === "string" && partial.api.length > 0 && (typeof partial.api_public !== "string" || partial.api_public.length === 0)) {
|
|
2614
|
+
merged.api_public = merged.api;
|
|
2615
|
+
}
|
|
2501
2616
|
merged.invite = normalizeInviteBase(merged.invite);
|
|
2502
2617
|
merged.media = merged.media.replace(/\/+$/, "");
|
|
2503
2618
|
merged.static_cdn = merged.static_cdn.replace(/\/+$/, "");
|
|
@@ -2506,13 +2621,13 @@ function resolveInstanceEndpoints(input) {
|
|
|
2506
2621
|
discovery: null
|
|
2507
2622
|
});
|
|
2508
2623
|
}
|
|
2509
|
-
function resolveRestApi(
|
|
2510
|
-
const fromInstance = normalizeApiOrigin(
|
|
2624
|
+
function resolveRestApi(instanceApiPublic, restApi) {
|
|
2625
|
+
const fromInstance = normalizeApiOrigin(instanceApiPublic);
|
|
2511
2626
|
if (restApi === void 0) return fromInstance;
|
|
2512
2627
|
const fromRest = normalizeApiOrigin(restApi);
|
|
2513
2628
|
if (fromRest !== fromInstance) {
|
|
2514
2629
|
throw new import_util4.FluxerError(
|
|
2515
|
-
`Conflicting API hosts: instance.
|
|
2630
|
+
`Conflicting API hosts: instance.api_public (${fromInstance}) vs rest.api (${fromRest}). Prefer ClientOptions.instance.`,
|
|
2516
2631
|
{ code: import_util3.ErrorCodes.ConflictingInstanceConfig }
|
|
2517
2632
|
);
|
|
2518
2633
|
}
|
|
@@ -2992,7 +3107,8 @@ var GuildChannel = class extends Channel {
|
|
|
2992
3107
|
async edit(options) {
|
|
2993
3108
|
const data = await this.client.rest.patch(import_types14.Routes.channel(this.id), {
|
|
2994
3109
|
body: toChannelEditBody(options),
|
|
2995
|
-
auth: true
|
|
3110
|
+
auth: true,
|
|
3111
|
+
...auditReasonHeaders(options.reason)
|
|
2996
3112
|
});
|
|
2997
3113
|
this.name = data.name ?? this.name;
|
|
2998
3114
|
this.parentId = data.parent_id ?? this.parentId;
|
|
@@ -3524,9 +3640,10 @@ var GuildEmoji = class extends Base {
|
|
|
3524
3640
|
return `<${this.animated ? "a" : ""}:${this.name}:${this.id}>`;
|
|
3525
3641
|
}
|
|
3526
3642
|
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
3527
|
-
async delete() {
|
|
3643
|
+
async delete(reason) {
|
|
3528
3644
|
await this.client.rest.delete(import_types17.Routes.guildEmoji(this.guildId, this.id), {
|
|
3529
|
-
auth: true
|
|
3645
|
+
auth: true,
|
|
3646
|
+
...auditReasonHeaders(reason)
|
|
3530
3647
|
});
|
|
3531
3648
|
const guild = this.client.guilds.get(this.guildId);
|
|
3532
3649
|
if (guild) guild.emojis.delete(this.id);
|
|
@@ -3536,9 +3653,11 @@ var GuildEmoji = class extends Base {
|
|
|
3536
3653
|
* Requires Manage Emojis and Stickers permission.
|
|
3537
3654
|
*/
|
|
3538
3655
|
async edit(options) {
|
|
3656
|
+
const { reason, name } = options;
|
|
3539
3657
|
const data = await this.client.rest.patch(import_types17.Routes.guildEmoji(this.guildId, this.id), {
|
|
3540
|
-
body:
|
|
3541
|
-
auth: true
|
|
3658
|
+
body: { name },
|
|
3659
|
+
auth: true,
|
|
3660
|
+
...auditReasonHeaders(reason)
|
|
3542
3661
|
});
|
|
3543
3662
|
this.name = data.name;
|
|
3544
3663
|
return this;
|
|
@@ -3554,6 +3673,9 @@ var import_types18 = require("@fluxerjs/types");
|
|
|
3554
3673
|
var import_util16 = require("@fluxerjs/util");
|
|
3555
3674
|
function computePermissions(basePermissions, overwrites, memberRoles, memberId, isOwner) {
|
|
3556
3675
|
if (isOwner) return import_util16.ALL_PERMISSIONS_BIGINT;
|
|
3676
|
+
if ((basePermissions & import_util16.PermissionFlags.Administrator) !== 0n) {
|
|
3677
|
+
return import_util16.ALL_PERMISSIONS_BIGINT;
|
|
3678
|
+
}
|
|
3557
3679
|
let perms = basePermissions;
|
|
3558
3680
|
for (const overwrite of overwrites ?? []) {
|
|
3559
3681
|
const applies = overwrite.type === import_types18.OverwriteType.Role && memberRoles.includes(overwrite.id) || overwrite.type === import_types18.OverwriteType.Member && overwrite.id === memberId;
|
|
@@ -3562,7 +3684,7 @@ function computePermissions(basePermissions, overwrites, memberRoles, memberId,
|
|
|
3562
3684
|
const deny = BigInt(overwrite.deny || "0");
|
|
3563
3685
|
perms = perms & ~deny | allow;
|
|
3564
3686
|
}
|
|
3565
|
-
return
|
|
3687
|
+
return perms;
|
|
3566
3688
|
}
|
|
3567
3689
|
|
|
3568
3690
|
// src/Domain/Guild/GuildMemberRoleManager.ts
|
|
@@ -3768,7 +3890,8 @@ var GuildMember = class _GuildMember extends Base {
|
|
|
3768
3890
|
const route = isMe ? import_types20.Routes.guildMemberMe(this.guild.id) : import_types20.Routes.guildMember(this.guild.id, this.id);
|
|
3769
3891
|
const data = await this.client.rest.patch(route, {
|
|
3770
3892
|
body: toMemberEditBody(options),
|
|
3771
|
-
auth: true
|
|
3893
|
+
auth: true,
|
|
3894
|
+
...auditReasonHeaders(options.reason ?? options.timeoutReason)
|
|
3772
3895
|
});
|
|
3773
3896
|
this._patch(data);
|
|
3774
3897
|
if (options.bio !== void 0) this.bio = options.bio;
|
|
@@ -3802,8 +3925,8 @@ var GuildMember = class _GuildMember extends Base {
|
|
|
3802
3925
|
await this.edit({ channelId, connectionId });
|
|
3803
3926
|
}
|
|
3804
3927
|
/** Kick this member. Requires Kick Members. */
|
|
3805
|
-
async kick() {
|
|
3806
|
-
await this.guild.kick(this.id);
|
|
3928
|
+
async kick(reason) {
|
|
3929
|
+
await this.guild.kick(this.id, reason);
|
|
3807
3930
|
}
|
|
3808
3931
|
/** Ban this member. Requires Ban Members. */
|
|
3809
3932
|
async ban(options) {
|
|
@@ -3927,9 +4050,10 @@ var GuildSticker = class extends Base {
|
|
|
3927
4050
|
return import_util18.SnowflakeUtil.dateFromSnowflake(this.id);
|
|
3928
4051
|
}
|
|
3929
4052
|
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
3930
|
-
async delete() {
|
|
4053
|
+
async delete(reason) {
|
|
3931
4054
|
await this.client.rest.delete(import_types21.Routes.guildSticker(this.guildId, this.id), {
|
|
3932
|
-
auth: true
|
|
4055
|
+
auth: true,
|
|
4056
|
+
...auditReasonHeaders(reason)
|
|
3933
4057
|
});
|
|
3934
4058
|
const guild = this.client.guilds.get(this.guildId);
|
|
3935
4059
|
if (guild) guild.stickers.delete(this.id);
|
|
@@ -3939,9 +4063,11 @@ var GuildSticker = class extends Base {
|
|
|
3939
4063
|
* Requires Manage Emojis and Stickers permission.
|
|
3940
4064
|
*/
|
|
3941
4065
|
async edit(options) {
|
|
4066
|
+
const { reason, ...body } = options;
|
|
3942
4067
|
const data = await this.client.rest.patch(import_types21.Routes.guildSticker(this.guildId, this.id), {
|
|
3943
|
-
body
|
|
3944
|
-
auth: true
|
|
4068
|
+
body,
|
|
4069
|
+
auth: true,
|
|
4070
|
+
...auditReasonHeaders(reason)
|
|
3945
4071
|
});
|
|
3946
4072
|
const s = data;
|
|
3947
4073
|
this.name = s.name;
|
|
@@ -4063,16 +4189,21 @@ var Role = class _Role extends Base {
|
|
|
4063
4189
|
const body = toRoleEditBody(options);
|
|
4064
4190
|
const data = await this.client.rest.patch(import_types22.Routes.guildRole(this.guildId, this.id), {
|
|
4065
4191
|
body: Object.keys(body).length ? body : void 0,
|
|
4066
|
-
auth: true
|
|
4192
|
+
auth: true,
|
|
4193
|
+
...auditReasonHeaders(options.reason)
|
|
4067
4194
|
});
|
|
4068
4195
|
this._patch(data);
|
|
4069
4196
|
return this;
|
|
4070
4197
|
}
|
|
4071
4198
|
/**
|
|
4072
4199
|
* DELETE role. Requires Manage Roles.
|
|
4200
|
+
* @param reason - Audit log reason (`X-Audit-Log-Reason`)
|
|
4073
4201
|
*/
|
|
4074
|
-
async delete() {
|
|
4075
|
-
await this.client.rest.delete(import_types22.Routes.guildRole(this.guildId, this.id), {
|
|
4202
|
+
async delete(reason) {
|
|
4203
|
+
await this.client.rest.delete(import_types22.Routes.guildRole(this.guildId, this.id), {
|
|
4204
|
+
auth: true,
|
|
4205
|
+
...auditReasonHeaders(reason)
|
|
4206
|
+
});
|
|
4076
4207
|
this.client.guilds.get(this.guildId)?.roles.delete(this.id);
|
|
4077
4208
|
}
|
|
4078
4209
|
};
|
|
@@ -4323,7 +4454,10 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
4323
4454
|
return parsed.name;
|
|
4324
4455
|
}
|
|
4325
4456
|
async function fetchInstance(client) {
|
|
4326
|
-
const raw = await client.rest.get(import_types24.Routes.instanceDiscovery(), {
|
|
4457
|
+
const raw = await client.rest.get(import_types24.Routes.instanceDiscovery(), {
|
|
4458
|
+
auth: false,
|
|
4459
|
+
unversioned: true
|
|
4460
|
+
});
|
|
4327
4461
|
return parseInstanceDiscovery(raw);
|
|
4328
4462
|
}
|
|
4329
4463
|
function fetchGatewayInfo(client) {
|
|
@@ -4702,9 +4836,11 @@ async function fetchEmoji(guild, emojiId) {
|
|
|
4702
4836
|
}
|
|
4703
4837
|
}
|
|
4704
4838
|
async function createEmoji(guild, options) {
|
|
4839
|
+
const { reason, ...body } = options;
|
|
4705
4840
|
const data = await guild.client.rest.post(import_types28.Routes.guildEmojis(guild.id), {
|
|
4706
|
-
body
|
|
4707
|
-
auth: true
|
|
4841
|
+
body,
|
|
4842
|
+
auth: true,
|
|
4843
|
+
...auditReasonHeaders(reason)
|
|
4708
4844
|
});
|
|
4709
4845
|
return cacheEmoji(guild, data);
|
|
4710
4846
|
}
|
|
@@ -4723,6 +4859,19 @@ async function createEmojisBulk(guild, emojis) {
|
|
|
4723
4859
|
return { success: data.success.map((e) => cacheEmoji(guild, e)), failed: data.failed };
|
|
4724
4860
|
}
|
|
4725
4861
|
|
|
4862
|
+
// src/Domain/Guild/GuildRoleManager.ts
|
|
4863
|
+
var import_collection11 = require("@fluxerjs/collection");
|
|
4864
|
+
var GuildRoleManager = class extends import_collection11.LimitedCollection {
|
|
4865
|
+
constructor(guildId, options) {
|
|
4866
|
+
super(options);
|
|
4867
|
+
this.guildId = guildId;
|
|
4868
|
+
}
|
|
4869
|
+
/** The @everyone role (`id === guild.id`), or undefined if uncached. */
|
|
4870
|
+
get everyone() {
|
|
4871
|
+
return this.get(this.guildId);
|
|
4872
|
+
}
|
|
4873
|
+
};
|
|
4874
|
+
|
|
4726
4875
|
// src/Domain/Guild/MemberHttp.ts
|
|
4727
4876
|
var import_types29 = require("@fluxerjs/types");
|
|
4728
4877
|
async function fetchMember(guild, userId) {
|
|
@@ -4779,9 +4928,10 @@ var GuildBan = class extends Base {
|
|
|
4779
4928
|
* Remove this ban (unban the user).
|
|
4780
4929
|
* Requires Ban Members permission.
|
|
4781
4930
|
*/
|
|
4782
|
-
async unban() {
|
|
4931
|
+
async unban(reason) {
|
|
4783
4932
|
await this.client.rest.delete(import_types30.Routes.guildBan(this.guildId, this.user.id), {
|
|
4784
|
-
auth: true
|
|
4933
|
+
auth: true,
|
|
4934
|
+
...auditReasonHeaders(reason)
|
|
4785
4935
|
});
|
|
4786
4936
|
}
|
|
4787
4937
|
};
|
|
@@ -4791,33 +4941,27 @@ async function ban(guild, userId, options) {
|
|
|
4791
4941
|
const body = options ? toGuildBanBody(options) : {};
|
|
4792
4942
|
await guild.client.rest.put(import_types31.Routes.guildBan(guild.id, userId), {
|
|
4793
4943
|
body: Object.keys(body).length ? body : void 0,
|
|
4794
|
-
auth: true
|
|
4944
|
+
auth: true,
|
|
4945
|
+
...auditReasonHeaders(options?.reason)
|
|
4795
4946
|
});
|
|
4796
4947
|
}
|
|
4797
4948
|
async function fetchBans(guild) {
|
|
4798
4949
|
const data = await guild.client.rest.get(import_types31.Routes.guildBans(guild.id));
|
|
4799
4950
|
return data.map((b) => new GuildBan(guild.client, { ...b, guild_id: guild.id }, guild.id));
|
|
4800
4951
|
}
|
|
4801
|
-
async function unban(guild, userId) {
|
|
4802
|
-
await guild.client.rest.delete(import_types31.Routes.guildBan(guild.id, userId), {
|
|
4952
|
+
async function unban(guild, userId, reason) {
|
|
4953
|
+
await guild.client.rest.delete(import_types31.Routes.guildBan(guild.id, userId), {
|
|
4954
|
+
auth: true,
|
|
4955
|
+
...auditReasonHeaders(reason)
|
|
4956
|
+
});
|
|
4803
4957
|
}
|
|
4804
|
-
async function kick(guild, userId) {
|
|
4805
|
-
await guild.client.rest.delete(import_types31.Routes.guildMember(guild.id, userId), {
|
|
4958
|
+
async function kick(guild, userId, reason) {
|
|
4959
|
+
await guild.client.rest.delete(import_types31.Routes.guildMember(guild.id, userId), {
|
|
4960
|
+
auth: true,
|
|
4961
|
+
...auditReasonHeaders(reason)
|
|
4962
|
+
});
|
|
4806
4963
|
}
|
|
4807
4964
|
|
|
4808
|
-
// src/Domain/Guild/GuildRoleManager.ts
|
|
4809
|
-
var import_collection11 = require("@fluxerjs/collection");
|
|
4810
|
-
var GuildRoleManager = class extends import_collection11.LimitedCollection {
|
|
4811
|
-
constructor(guildId, options) {
|
|
4812
|
-
super(options);
|
|
4813
|
-
this.guildId = guildId;
|
|
4814
|
-
}
|
|
4815
|
-
/** The @everyone role (`id === guild.id`), or undefined if uncached. */
|
|
4816
|
-
get everyone() {
|
|
4817
|
-
return this.get(this.guildId);
|
|
4818
|
-
}
|
|
4819
|
-
};
|
|
4820
|
-
|
|
4821
4965
|
// src/Domain/Guild/Roles.ts
|
|
4822
4966
|
var import_types32 = require("@fluxerjs/types");
|
|
4823
4967
|
var import_util21 = require("@fluxerjs/util");
|
|
@@ -4825,7 +4969,8 @@ async function createRole(guild, options = {}) {
|
|
|
4825
4969
|
const body = toRoleCreateBody(options);
|
|
4826
4970
|
const data = await guild.client.rest.post(import_types32.Routes.guildRoles(guild.id), {
|
|
4827
4971
|
body: Object.keys(body).length ? body : void 0,
|
|
4828
|
-
auth: true
|
|
4972
|
+
auth: true,
|
|
4973
|
+
...auditReasonHeaders(options.reason)
|
|
4829
4974
|
});
|
|
4830
4975
|
return cacheRole(guild, data);
|
|
4831
4976
|
}
|
|
@@ -4891,9 +5036,11 @@ async function resetRoleHoistPositions(guild) {
|
|
|
4891
5036
|
// src/Domain/Guild/Stickers.ts
|
|
4892
5037
|
var import_types33 = require("@fluxerjs/types");
|
|
4893
5038
|
async function createSticker(guild, options) {
|
|
5039
|
+
const { reason, ...body } = options;
|
|
4894
5040
|
const data = await guild.client.rest.post(import_types33.Routes.guildStickers(guild.id), {
|
|
4895
|
-
body
|
|
4896
|
-
auth: true
|
|
5041
|
+
body,
|
|
5042
|
+
auth: true,
|
|
5043
|
+
...auditReasonHeaders(reason)
|
|
4897
5044
|
});
|
|
4898
5045
|
return cacheSticker(guild, data);
|
|
4899
5046
|
}
|
|
@@ -5223,12 +5370,12 @@ var Guild = class extends Base {
|
|
|
5223
5370
|
return fetchBans(this);
|
|
5224
5371
|
}
|
|
5225
5372
|
/** Unban a user from the guild. Requires Ban Members. */
|
|
5226
|
-
unban(userId) {
|
|
5227
|
-
return unban(this, userId);
|
|
5373
|
+
unban(userId, reason) {
|
|
5374
|
+
return unban(this, userId, reason);
|
|
5228
5375
|
}
|
|
5229
5376
|
/** Kick a user from the guild. Requires Kick Members. */
|
|
5230
|
-
kick(userId) {
|
|
5231
|
-
return kick(this, userId);
|
|
5377
|
+
kick(userId, reason) {
|
|
5378
|
+
return kick(this, userId, reason);
|
|
5232
5379
|
}
|
|
5233
5380
|
/** Fetch all emojis in this guild from the API. */
|
|
5234
5381
|
fetchEmojis() {
|
|
@@ -5678,7 +5825,14 @@ function markGuildUnavailable(client, id) {
|
|
|
5678
5825
|
guild.available = false;
|
|
5679
5826
|
client.emit(Events.GuildUnavailable, guild);
|
|
5680
5827
|
}
|
|
5828
|
+
function isStartupGuildHydration(client) {
|
|
5829
|
+
return client._guildStreamSettleTimeout !== null;
|
|
5830
|
+
}
|
|
5681
5831
|
var guildHandlers = {
|
|
5832
|
+
/**
|
|
5833
|
+
* Available snapshots: {@link Events.GuildAvailable} for READY stubs / outage recovery,
|
|
5834
|
+
* {@link Events.GuildCreate} for real joins (unless {@link ClientOptions.emitGuildCreateOnStartup}).
|
|
5835
|
+
*/
|
|
5682
5836
|
GUILD_CREATE(client, d) {
|
|
5683
5837
|
const raw = d;
|
|
5684
5838
|
if (raw.unavailable === true) {
|
|
@@ -5691,11 +5845,32 @@ var guildHandlers = {
|
|
|
5691
5845
|
}
|
|
5692
5846
|
return;
|
|
5693
5847
|
}
|
|
5848
|
+
const startupHydration = isStartupGuildHydration(client);
|
|
5849
|
+
if (startupHydration) {
|
|
5850
|
+
resetGuildStreamSettle(client);
|
|
5851
|
+
}
|
|
5694
5852
|
const result = applyGuildSnapshotFromGateway(client, d);
|
|
5695
5853
|
if (!result) return;
|
|
5696
5854
|
const { guild, recovered } = result;
|
|
5697
|
-
|
|
5698
|
-
|
|
5855
|
+
const legacyStartup = client.options.emitGuildCreateOnStartup === true;
|
|
5856
|
+
const wasReadyStub = client._readyStubGuildIds.delete(guild.id);
|
|
5857
|
+
const isStartupBackfill = wasReadyStub || startupHydration;
|
|
5858
|
+
if (recovered) {
|
|
5859
|
+
guild.available = true;
|
|
5860
|
+
if (legacyStartup && isStartupBackfill) {
|
|
5861
|
+
client.emit(Events.GuildCreate, guild);
|
|
5862
|
+
} else {
|
|
5863
|
+
client.emit(Events.GuildAvailable, guild);
|
|
5864
|
+
}
|
|
5865
|
+
} else if (startupHydration) {
|
|
5866
|
+
if (legacyStartup) {
|
|
5867
|
+
client.emit(Events.GuildCreate, guild);
|
|
5868
|
+
} else {
|
|
5869
|
+
client.emit(Events.GuildAvailable, guild);
|
|
5870
|
+
}
|
|
5871
|
+
} else {
|
|
5872
|
+
client.emit(Events.GuildCreate, guild);
|
|
5873
|
+
}
|
|
5699
5874
|
client._onGuildReceived(guild.id);
|
|
5700
5875
|
},
|
|
5701
5876
|
GUILD_UPDATE(client, d) {
|
|
@@ -5734,6 +5909,7 @@ var guildHandlers = {
|
|
|
5734
5909
|
markGuildUnavailable(client, id);
|
|
5735
5910
|
return;
|
|
5736
5911
|
}
|
|
5912
|
+
client._readyStubGuildIds.delete(id);
|
|
5737
5913
|
const guild = client.guilds.get(id);
|
|
5738
5914
|
if (!guild) return;
|
|
5739
5915
|
client.guilds.delete(id);
|
|
@@ -6249,10 +6425,15 @@ function hydrateReadyGuilds(client, guilds, waitForGuilds) {
|
|
|
6249
6425
|
for (const g of guilds ?? []) {
|
|
6250
6426
|
if (g.unavailable === true) {
|
|
6251
6427
|
if (typeof g.id === "string") {
|
|
6252
|
-
|
|
6253
|
-
if (
|
|
6254
|
-
|
|
6428
|
+
let guild = client.guilds.get(g.id);
|
|
6429
|
+
if (!guild) {
|
|
6430
|
+
guild = new Guild(client, { id: g.id });
|
|
6431
|
+
guild.available = false;
|
|
6432
|
+
client.guilds.set(g.id, guild);
|
|
6433
|
+
} else if (guild.available !== false) {
|
|
6434
|
+
guild.available = false;
|
|
6255
6435
|
}
|
|
6436
|
+
client._readyStubGuildIds.add(g.id);
|
|
6256
6437
|
if (pending !== null) pending.add(g.id);
|
|
6257
6438
|
}
|
|
6258
6439
|
continue;
|
|
@@ -6280,6 +6461,13 @@ function clearGuildStreamSettle(client) {
|
|
|
6280
6461
|
clearTimeout(client._guildStreamSettleTimeout);
|
|
6281
6462
|
client._guildStreamSettleTimeout = null;
|
|
6282
6463
|
}
|
|
6464
|
+
function resetGuildStreamSettle(client) {
|
|
6465
|
+
clearGuildStreamSettle(client);
|
|
6466
|
+
client._guildStreamSettleTimeout = setTimeout(() => {
|
|
6467
|
+
client._guildStreamSettleTimeout = null;
|
|
6468
|
+
if (client.readyAt === null) finalizeClientReady(client);
|
|
6469
|
+
}, GUILD_STREAM_SETTLE_MS);
|
|
6470
|
+
}
|
|
6283
6471
|
function handleReadyPayload(client, data) {
|
|
6284
6472
|
client.user = new ClientUser(client, data.user);
|
|
6285
6473
|
const waitForGuilds = client.options.waitForGuilds === true;
|
|
@@ -6299,14 +6487,9 @@ function handleReadyPayload(client, data) {
|
|
|
6299
6487
|
client._pendingGuildIds = existing;
|
|
6300
6488
|
return;
|
|
6301
6489
|
}
|
|
6302
|
-
if (
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
client._guildStreamSettleTimeout = null;
|
|
6306
|
-
if (client.readyAt === null) finalizeClientReady(client);
|
|
6307
|
-
}, GUILD_STREAM_SETTLE_MS);
|
|
6308
|
-
}
|
|
6309
|
-
return;
|
|
6490
|
+
if (guilds.length === 0) {
|
|
6491
|
+
resetGuildStreamSettle(client);
|
|
6492
|
+
if (waitForGuilds) return;
|
|
6310
6493
|
}
|
|
6311
6494
|
finalizeClientReady(client);
|
|
6312
6495
|
}
|
|
@@ -6639,7 +6822,12 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6639
6822
|
_ws = null;
|
|
6640
6823
|
/** When waitForGuilds, guild IDs still expected via GUILD_CREATE. */
|
|
6641
6824
|
_pendingGuildIds = null;
|
|
6642
|
-
/**
|
|
6825
|
+
/** Guild IDs inserted as unavailable stubs from READY (startup / reconnect backfill). */
|
|
6826
|
+
_readyStubGuildIds = /* @__PURE__ */ new Set();
|
|
6827
|
+
/**
|
|
6828
|
+
* @internal Empty-READY guild stream window.
|
|
6829
|
+
* Classifies incoming GUILD_CREATE as startup hydration. Also delays Ready when waitForGuilds.
|
|
6830
|
+
*/
|
|
6643
6831
|
_guildStreamSettleTimeout = null;
|
|
6644
6832
|
/** @internal Dispatches queued until Ready when waitForGuilds delays Ready. */
|
|
6645
6833
|
_deferredGatewayDispatches = [];
|
|
@@ -6670,7 +6858,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6670
6858
|
const restApi = options.rest?.api;
|
|
6671
6859
|
if (options.instance !== void 0) {
|
|
6672
6860
|
this.instance = resolveInstanceEndpoints(options.instance);
|
|
6673
|
-
resolveRestApi(this.instance.endpoints.
|
|
6861
|
+
resolveRestApi(this.instance.endpoints.api_public, restApi);
|
|
6674
6862
|
} else {
|
|
6675
6863
|
this.instance = resolveInstanceEndpoints(
|
|
6676
6864
|
restApi !== void 0 ? { api: restApi } : void 0
|
|
@@ -6683,27 +6871,31 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6683
6871
|
}
|
|
6684
6872
|
this.rest = new import_rest3.REST({
|
|
6685
6873
|
...this.options.rest,
|
|
6686
|
-
api: this.instance.endpoints.
|
|
6687
|
-
version: this.options.rest?.version ?? "1"
|
|
6874
|
+
api: this.instance.endpoints.api_public,
|
|
6875
|
+
version: this.options.rest?.version ?? "1",
|
|
6876
|
+
locale: this.options.locale ?? this.options.rest?.locale
|
|
6688
6877
|
});
|
|
6689
6878
|
}
|
|
6690
6879
|
/**
|
|
6691
6880
|
* Create a client from instance discovery (`GET /.well-known/fluxer`).
|
|
6692
|
-
*
|
|
6881
|
+
* Fetches the unversioned well-known document from the given origin (not `{api}/v1/.well-known/fluxer`).
|
|
6882
|
+
* Wires REST from `endpoints.api_public`. `endpoints.api` / `api_client` stay on the instance for inspection.
|
|
6883
|
+
* Does not log in. Call {@link login} with a token afterward.
|
|
6693
6884
|
*
|
|
6694
|
-
* @param origin -
|
|
6695
|
-
* @param options - Client options (must not conflict with discovered `endpoints.
|
|
6885
|
+
* @param origin - Origin used only to fetch discovery (e.g. `https://fluxer.app` or `https://my.instance`)
|
|
6886
|
+
* @param options - Client options (must not conflict with discovered `endpoints.api_public`)
|
|
6696
6887
|
* @param connectOptions - Optional abort signal for the discovery request
|
|
6697
6888
|
*/
|
|
6698
6889
|
static async fromDiscovery(origin, options = {}, connectOptions) {
|
|
6699
|
-
const
|
|
6890
|
+
const bootstrapOrigin = typeof origin === "string" ? normalizeApiOrigin(origin) : normalizeApiOrigin(origin.api);
|
|
6700
6891
|
const version = typeof origin === "string" ? options.rest?.version ?? "1" : origin.version ?? options.rest?.version ?? "1";
|
|
6701
6892
|
const bootstrap = new import_rest3.REST({
|
|
6702
6893
|
...options.rest ?? {},
|
|
6703
|
-
api:
|
|
6704
|
-
version
|
|
6894
|
+
api: bootstrapOrigin,
|
|
6895
|
+
version,
|
|
6896
|
+
locale: options.locale ?? options.rest?.locale
|
|
6705
6897
|
});
|
|
6706
|
-
const raw = await bootstrap.get(
|
|
6898
|
+
const raw = await bootstrap.get(instanceDiscoveryUrl(bootstrapOrigin), {
|
|
6707
6899
|
auth: false,
|
|
6708
6900
|
...connectOptions?.signal ? { signal: connectOptions.signal } : {}
|
|
6709
6901
|
});
|
|
@@ -6711,7 +6903,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6711
6903
|
const { rest, ...restOptions } = options;
|
|
6712
6904
|
return new _Client({
|
|
6713
6905
|
...restOptions,
|
|
6714
|
-
// Drop rest.api so discovered endpoints.
|
|
6906
|
+
// Drop rest.api so discovered endpoints.api_public owns the REST host; keep other REST opts.
|
|
6715
6907
|
...rest ? { rest: { ...rest, api: void 0 } } : {},
|
|
6716
6908
|
instance: discovery
|
|
6717
6909
|
});
|
|
@@ -6738,7 +6930,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
6738
6930
|
return resolveClientEmoji(this, emoji, guildId);
|
|
6739
6931
|
}
|
|
6740
6932
|
/**
|
|
6741
|
-
* Fetch instance discovery document (
|
|
6933
|
+
* Fetch instance discovery document (unversioned `GET /.well-known/fluxer` on the REST host).
|
|
6742
6934
|
* @returns Instance configuration (endpoints, features, metadata)
|
|
6743
6935
|
*/
|
|
6744
6936
|
fetchInstance() {
|
|
@@ -7007,6 +7199,7 @@ var Client = class _Client extends import_node_events3.EventEmitter {
|
|
|
7007
7199
|
this.user = null;
|
|
7008
7200
|
this.readyAt = null;
|
|
7009
7201
|
this._pendingGuildIds = null;
|
|
7202
|
+
this._readyStubGuildIds.clear();
|
|
7010
7203
|
this.guilds.clear();
|
|
7011
7204
|
this.channels.clear();
|
|
7012
7205
|
this.users.clear();
|