@fluxerjs/core 2.0.3 → 2.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/client.js +53 -34
- package/dist/client.mjs +53 -34
- package/dist/cluster.js +53 -34
- package/dist/cluster.mjs +53 -34
- package/dist/index.js +53 -34
- package/dist/index.mjs +53 -34
- package/package.json +8 -8
package/dist/client.js
CHANGED
|
@@ -4050,17 +4050,8 @@ function createEventMethods(client) {
|
|
|
4050
4050
|
var import_collection11 = require("@fluxerjs/collection");
|
|
4051
4051
|
var import_types41 = require("@fluxerjs/types");
|
|
4052
4052
|
var import_util9 = require("@fluxerjs/util");
|
|
4053
|
-
async function assertEmojiInGuild(client, emojiId, guildId) {
|
|
4054
|
-
const emojis = await client.rest.get(import_types41.Routes.guildEmojis(guildId));
|
|
4055
|
-
if (!emojis.some((e) => e.id === emojiId)) {
|
|
4056
|
-
throw new import_util.FluxerError("Custom emoji is from another server. Use an emoji from this server.", {
|
|
4057
|
-
code: import_util2.ErrorCodes.EmojiNotInGuild
|
|
4058
|
-
});
|
|
4059
|
-
}
|
|
4060
|
-
}
|
|
4061
4053
|
async function resolveClientEmoji(client, emoji, guildId) {
|
|
4062
4054
|
if (typeof emoji === "object" && emoji.id) {
|
|
4063
|
-
if (guildId) await assertEmojiInGuild(client, emoji.id, guildId);
|
|
4064
4055
|
return (0, import_util9.formatEmoji)({ name: emoji.name, id: emoji.id, animated: emoji.animated });
|
|
4065
4056
|
}
|
|
4066
4057
|
const parsed = (0, import_util9.parseEmoji)(
|
|
@@ -4070,7 +4061,6 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
4070
4061
|
throw new import_util.FluxerError("Invalid emoji", { code: import_util2.ErrorCodes.InvalidEmoji });
|
|
4071
4062
|
}
|
|
4072
4063
|
if (parsed.id) {
|
|
4073
|
-
if (guildId) await assertEmojiInGuild(client, parsed.id, guildId);
|
|
4074
4064
|
return (0, import_util9.formatEmoji)(parsed);
|
|
4075
4065
|
}
|
|
4076
4066
|
if (!/^\w+$/.test(parsed.name)) return parsed.name;
|
|
@@ -4265,7 +4255,9 @@ function emitReaction(event) {
|
|
|
4265
4255
|
return (client, d) => {
|
|
4266
4256
|
const data = d;
|
|
4267
4257
|
const reaction = new MessageReaction(client, data);
|
|
4268
|
-
const
|
|
4258
|
+
const guild = data.guild_id ? client.guilds.get(data.guild_id) : void 0;
|
|
4259
|
+
const member = guild && data.member ? cacheMember2(client, guild, { ...data.member, guild_id: data.guild_id }) : null;
|
|
4260
|
+
const user = member?.user ?? client.users.get(data.user_id) ?? client.getOrCreateUser(unknownUser(data.user_id));
|
|
4269
4261
|
const payload = {
|
|
4270
4262
|
reaction,
|
|
4271
4263
|
user,
|
|
@@ -4375,14 +4367,15 @@ var messageHandlers = {
|
|
|
4375
4367
|
};
|
|
4376
4368
|
|
|
4377
4369
|
// src/util/guildUtils.ts
|
|
4378
|
-
function
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
if ("
|
|
4383
|
-
if ("
|
|
4384
|
-
if ("
|
|
4385
|
-
if ("
|
|
4370
|
+
function isRecord2(value) {
|
|
4371
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4372
|
+
}
|
|
4373
|
+
function isValidGuildPayload(o) {
|
|
4374
|
+
if (!Object.hasOwn(o, "id") || typeof o.id !== "string" || o.id.length === 0) return false;
|
|
4375
|
+
if ("name" in o && typeof o.name !== "string") return false;
|
|
4376
|
+
if ("owner_id" in o && typeof o.owner_id !== "string") return false;
|
|
4377
|
+
if ("features" in o && !Array.isArray(o.features)) return false;
|
|
4378
|
+
if ("afk_timeout" in o && typeof o.afk_timeout !== "number") return false;
|
|
4386
4379
|
for (const key of [
|
|
4387
4380
|
"verification_level",
|
|
4388
4381
|
"mfa_level",
|
|
@@ -4390,10 +4383,32 @@ function normalizeGuildPayload(raw) {
|
|
|
4390
4383
|
"explicit_content_filter",
|
|
4391
4384
|
"default_message_notifications"
|
|
4392
4385
|
]) {
|
|
4393
|
-
if (key in o && typeof o[key] !== "number") return
|
|
4386
|
+
if (key in o && typeof o[key] !== "number") return false;
|
|
4394
4387
|
}
|
|
4395
|
-
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return
|
|
4396
|
-
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return
|
|
4388
|
+
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return false;
|
|
4389
|
+
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return false;
|
|
4390
|
+
return true;
|
|
4391
|
+
}
|
|
4392
|
+
function isHydratableGuildPayload(o) {
|
|
4393
|
+
return isValidGuildPayload(o) && Object.hasOwn(o, "name") && typeof o.name === "string" && Object.hasOwn(o, "owner_id") && typeof o.owner_id === "string";
|
|
4394
|
+
}
|
|
4395
|
+
function normalizeGuildSnapshotPayload(raw) {
|
|
4396
|
+
if (!isRecord2(raw)) return null;
|
|
4397
|
+
const flatPayload = isHydratableGuildPayload(raw) && (raw.roles === void 0 || Array.isArray(raw.roles)) ? raw : null;
|
|
4398
|
+
let nestedPayload = null;
|
|
4399
|
+
if (Object.hasOwn(raw, "properties") && isRecord2(raw.properties)) {
|
|
4400
|
+
const properties = raw.properties;
|
|
4401
|
+
const rolesValid = raw.roles === void 0 || Array.isArray(raw.roles);
|
|
4402
|
+
if (rolesValid && isHydratableGuildPayload(properties) && raw.id === properties.id) {
|
|
4403
|
+
nestedPayload = { ...properties };
|
|
4404
|
+
if (raw.roles !== void 0) nestedPayload.roles = raw.roles;
|
|
4405
|
+
}
|
|
4406
|
+
}
|
|
4407
|
+
if (flatPayload === null === (nestedPayload === null)) return null;
|
|
4408
|
+
return flatPayload ?? nestedPayload;
|
|
4409
|
+
}
|
|
4410
|
+
function normalizeGuildUpdatePayload(raw) {
|
|
4411
|
+
if (!isRecord2(raw) || !isValidGuildPayload(raw)) return null;
|
|
4397
4412
|
return raw;
|
|
4398
4413
|
}
|
|
4399
4414
|
|
|
@@ -4405,7 +4420,6 @@ function markGuildUnavailable(client, id) {
|
|
|
4405
4420
|
client.emit(Events.GuildUnavailable, guild);
|
|
4406
4421
|
}
|
|
4407
4422
|
function refreshRecoveredGuild(guild, data) {
|
|
4408
|
-
guild._patch(data);
|
|
4409
4423
|
if (data.roles !== void 0) {
|
|
4410
4424
|
guild.roles.clear();
|
|
4411
4425
|
for (const role of data.roles) {
|
|
@@ -4434,13 +4448,16 @@ var guildHandlers = {
|
|
|
4434
4448
|
}
|
|
4435
4449
|
return;
|
|
4436
4450
|
}
|
|
4437
|
-
const guildData =
|
|
4451
|
+
const guildData = normalizeGuildSnapshotPayload(d);
|
|
4438
4452
|
if (!guildData) return;
|
|
4439
4453
|
const g = d;
|
|
4440
4454
|
const existing = client.guilds.get(guildData.id);
|
|
4441
4455
|
const recovered = existing?.available === false;
|
|
4442
4456
|
const guild = recovered && existing ? existing : new Guild(client, guildData);
|
|
4443
|
-
if (recovered)
|
|
4457
|
+
if (recovered) {
|
|
4458
|
+
guild._patch(guildData);
|
|
4459
|
+
refreshRecoveredGuild(guild, g);
|
|
4460
|
+
}
|
|
4444
4461
|
client.guilds.set(guild.id, guild);
|
|
4445
4462
|
for (const ch of g.channels ?? []) {
|
|
4446
4463
|
const channel = Channel.from(client, ch);
|
|
@@ -4458,7 +4475,7 @@ var guildHandlers = {
|
|
|
4458
4475
|
client._onGuildReceived(guild.id);
|
|
4459
4476
|
},
|
|
4460
4477
|
GUILD_UPDATE(client, d) {
|
|
4461
|
-
const guildData =
|
|
4478
|
+
const guildData = normalizeGuildUpdatePayload(d);
|
|
4462
4479
|
if (!guildData) return;
|
|
4463
4480
|
const existing = client.guilds.get(guildData.id);
|
|
4464
4481
|
if (existing) {
|
|
@@ -5002,22 +5019,21 @@ function hydrateReadyGuilds(client, guilds, waitForGuilds) {
|
|
|
5002
5019
|
if (pending !== null && g.id) pending.add(g.id);
|
|
5003
5020
|
continue;
|
|
5004
5021
|
}
|
|
5005
|
-
const guildData =
|
|
5022
|
+
const guildData = normalizeGuildSnapshotPayload(g);
|
|
5006
5023
|
if (!guildData) continue;
|
|
5007
5024
|
const guild = new Guild(client, guildData);
|
|
5008
5025
|
client.guilds.set(guild.id, guild);
|
|
5009
|
-
const
|
|
5010
|
-
for (const ch of withCh.channels ?? []) {
|
|
5026
|
+
for (const ch of g.channels ?? []) {
|
|
5011
5027
|
const channel = Channel.from(client, ch);
|
|
5012
5028
|
if (channel) {
|
|
5013
5029
|
client.channels.set(channel.id, channel);
|
|
5014
5030
|
guild.channels.set(channel.id, channel);
|
|
5015
5031
|
}
|
|
5016
5032
|
}
|
|
5017
|
-
if (
|
|
5033
|
+
if (g.voice_states?.length) {
|
|
5018
5034
|
client.emit(Events.VoiceStatesSync, {
|
|
5019
5035
|
guildId: guild.id,
|
|
5020
|
-
voiceStates:
|
|
5036
|
+
voiceStates: g.voice_states
|
|
5021
5037
|
});
|
|
5022
5038
|
}
|
|
5023
5039
|
}
|
|
@@ -5133,11 +5149,11 @@ var Client = class _Client extends import_events3.EventEmitter {
|
|
|
5133
5149
|
*/
|
|
5134
5150
|
instance;
|
|
5135
5151
|
/** Guild cache and manager. */
|
|
5136
|
-
guilds
|
|
5152
|
+
guilds;
|
|
5137
5153
|
/** Channel cache and manager. */
|
|
5138
|
-
channels
|
|
5154
|
+
channels;
|
|
5139
5155
|
/** User cache and manager. */
|
|
5140
|
-
users
|
|
5156
|
+
users;
|
|
5141
5157
|
/** Emoji/sticker pack REST wrappers (`/packs/*`). */
|
|
5142
5158
|
packs = new PackManager(this);
|
|
5143
5159
|
/** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
|
|
@@ -5164,6 +5180,9 @@ var Client = class _Client extends import_events3.EventEmitter {
|
|
|
5164
5180
|
cache: { ...DEFAULT_CACHE_LIMITS, ...options.cache },
|
|
5165
5181
|
defaultReplyPing: options.defaultReplyPing ?? true
|
|
5166
5182
|
};
|
|
5183
|
+
this.guilds = new GuildManager(this);
|
|
5184
|
+
this.channels = new ChannelManager(this);
|
|
5185
|
+
this.users = new UserManager(this);
|
|
5167
5186
|
const restApi = options.rest?.api;
|
|
5168
5187
|
if (options.instance !== void 0) {
|
|
5169
5188
|
this.instance = resolveInstanceEndpoints(options.instance);
|
package/dist/client.mjs
CHANGED
|
@@ -4038,17 +4038,8 @@ function createEventMethods(client) {
|
|
|
4038
4038
|
import { Collection as Collection11 } from "@fluxerjs/collection";
|
|
4039
4039
|
import { Routes as Routes32 } from "@fluxerjs/types";
|
|
4040
4040
|
import { formatEmoji, getUnicodeFromShortcode, parseEmoji } from "@fluxerjs/util";
|
|
4041
|
-
async function assertEmojiInGuild(client, emojiId, guildId) {
|
|
4042
|
-
const emojis = await client.rest.get(Routes32.guildEmojis(guildId));
|
|
4043
|
-
if (!emojis.some((e) => e.id === emojiId)) {
|
|
4044
|
-
throw new FluxerError("Custom emoji is from another server. Use an emoji from this server.", {
|
|
4045
|
-
code: ErrorCodes.EmojiNotInGuild
|
|
4046
|
-
});
|
|
4047
|
-
}
|
|
4048
|
-
}
|
|
4049
4041
|
async function resolveClientEmoji(client, emoji, guildId) {
|
|
4050
4042
|
if (typeof emoji === "object" && emoji.id) {
|
|
4051
|
-
if (guildId) await assertEmojiInGuild(client, emoji.id, guildId);
|
|
4052
4043
|
return formatEmoji({ name: emoji.name, id: emoji.id, animated: emoji.animated });
|
|
4053
4044
|
}
|
|
4054
4045
|
const parsed = parseEmoji(
|
|
@@ -4058,7 +4049,6 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
4058
4049
|
throw new FluxerError("Invalid emoji", { code: ErrorCodes.InvalidEmoji });
|
|
4059
4050
|
}
|
|
4060
4051
|
if (parsed.id) {
|
|
4061
|
-
if (guildId) await assertEmojiInGuild(client, parsed.id, guildId);
|
|
4062
4052
|
return formatEmoji(parsed);
|
|
4063
4053
|
}
|
|
4064
4054
|
if (!/^\w+$/.test(parsed.name)) return parsed.name;
|
|
@@ -4253,7 +4243,9 @@ function emitReaction(event) {
|
|
|
4253
4243
|
return (client, d) => {
|
|
4254
4244
|
const data = d;
|
|
4255
4245
|
const reaction = new MessageReaction(client, data);
|
|
4256
|
-
const
|
|
4246
|
+
const guild = data.guild_id ? client.guilds.get(data.guild_id) : void 0;
|
|
4247
|
+
const member = guild && data.member ? cacheMember2(client, guild, { ...data.member, guild_id: data.guild_id }) : null;
|
|
4248
|
+
const user = member?.user ?? client.users.get(data.user_id) ?? client.getOrCreateUser(unknownUser(data.user_id));
|
|
4257
4249
|
const payload = {
|
|
4258
4250
|
reaction,
|
|
4259
4251
|
user,
|
|
@@ -4363,14 +4355,15 @@ var messageHandlers = {
|
|
|
4363
4355
|
};
|
|
4364
4356
|
|
|
4365
4357
|
// src/util/guildUtils.ts
|
|
4366
|
-
function
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
if ("
|
|
4371
|
-
if ("
|
|
4372
|
-
if ("
|
|
4373
|
-
if ("
|
|
4358
|
+
function isRecord2(value) {
|
|
4359
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4360
|
+
}
|
|
4361
|
+
function isValidGuildPayload(o) {
|
|
4362
|
+
if (!Object.hasOwn(o, "id") || typeof o.id !== "string" || o.id.length === 0) return false;
|
|
4363
|
+
if ("name" in o && typeof o.name !== "string") return false;
|
|
4364
|
+
if ("owner_id" in o && typeof o.owner_id !== "string") return false;
|
|
4365
|
+
if ("features" in o && !Array.isArray(o.features)) return false;
|
|
4366
|
+
if ("afk_timeout" in o && typeof o.afk_timeout !== "number") return false;
|
|
4374
4367
|
for (const key of [
|
|
4375
4368
|
"verification_level",
|
|
4376
4369
|
"mfa_level",
|
|
@@ -4378,10 +4371,32 @@ function normalizeGuildPayload(raw) {
|
|
|
4378
4371
|
"explicit_content_filter",
|
|
4379
4372
|
"default_message_notifications"
|
|
4380
4373
|
]) {
|
|
4381
|
-
if (key in o && typeof o[key] !== "number") return
|
|
4374
|
+
if (key in o && typeof o[key] !== "number") return false;
|
|
4382
4375
|
}
|
|
4383
|
-
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return
|
|
4384
|
-
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return
|
|
4376
|
+
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return false;
|
|
4377
|
+
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return false;
|
|
4378
|
+
return true;
|
|
4379
|
+
}
|
|
4380
|
+
function isHydratableGuildPayload(o) {
|
|
4381
|
+
return isValidGuildPayload(o) && Object.hasOwn(o, "name") && typeof o.name === "string" && Object.hasOwn(o, "owner_id") && typeof o.owner_id === "string";
|
|
4382
|
+
}
|
|
4383
|
+
function normalizeGuildSnapshotPayload(raw) {
|
|
4384
|
+
if (!isRecord2(raw)) return null;
|
|
4385
|
+
const flatPayload = isHydratableGuildPayload(raw) && (raw.roles === void 0 || Array.isArray(raw.roles)) ? raw : null;
|
|
4386
|
+
let nestedPayload = null;
|
|
4387
|
+
if (Object.hasOwn(raw, "properties") && isRecord2(raw.properties)) {
|
|
4388
|
+
const properties = raw.properties;
|
|
4389
|
+
const rolesValid = raw.roles === void 0 || Array.isArray(raw.roles);
|
|
4390
|
+
if (rolesValid && isHydratableGuildPayload(properties) && raw.id === properties.id) {
|
|
4391
|
+
nestedPayload = { ...properties };
|
|
4392
|
+
if (raw.roles !== void 0) nestedPayload.roles = raw.roles;
|
|
4393
|
+
}
|
|
4394
|
+
}
|
|
4395
|
+
if (flatPayload === null === (nestedPayload === null)) return null;
|
|
4396
|
+
return flatPayload ?? nestedPayload;
|
|
4397
|
+
}
|
|
4398
|
+
function normalizeGuildUpdatePayload(raw) {
|
|
4399
|
+
if (!isRecord2(raw) || !isValidGuildPayload(raw)) return null;
|
|
4385
4400
|
return raw;
|
|
4386
4401
|
}
|
|
4387
4402
|
|
|
@@ -4393,7 +4408,6 @@ function markGuildUnavailable(client, id) {
|
|
|
4393
4408
|
client.emit(Events.GuildUnavailable, guild);
|
|
4394
4409
|
}
|
|
4395
4410
|
function refreshRecoveredGuild(guild, data) {
|
|
4396
|
-
guild._patch(data);
|
|
4397
4411
|
if (data.roles !== void 0) {
|
|
4398
4412
|
guild.roles.clear();
|
|
4399
4413
|
for (const role of data.roles) {
|
|
@@ -4422,13 +4436,16 @@ var guildHandlers = {
|
|
|
4422
4436
|
}
|
|
4423
4437
|
return;
|
|
4424
4438
|
}
|
|
4425
|
-
const guildData =
|
|
4439
|
+
const guildData = normalizeGuildSnapshotPayload(d);
|
|
4426
4440
|
if (!guildData) return;
|
|
4427
4441
|
const g = d;
|
|
4428
4442
|
const existing = client.guilds.get(guildData.id);
|
|
4429
4443
|
const recovered = existing?.available === false;
|
|
4430
4444
|
const guild = recovered && existing ? existing : new Guild(client, guildData);
|
|
4431
|
-
if (recovered)
|
|
4445
|
+
if (recovered) {
|
|
4446
|
+
guild._patch(guildData);
|
|
4447
|
+
refreshRecoveredGuild(guild, g);
|
|
4448
|
+
}
|
|
4432
4449
|
client.guilds.set(guild.id, guild);
|
|
4433
4450
|
for (const ch of g.channels ?? []) {
|
|
4434
4451
|
const channel = Channel.from(client, ch);
|
|
@@ -4446,7 +4463,7 @@ var guildHandlers = {
|
|
|
4446
4463
|
client._onGuildReceived(guild.id);
|
|
4447
4464
|
},
|
|
4448
4465
|
GUILD_UPDATE(client, d) {
|
|
4449
|
-
const guildData =
|
|
4466
|
+
const guildData = normalizeGuildUpdatePayload(d);
|
|
4450
4467
|
if (!guildData) return;
|
|
4451
4468
|
const existing = client.guilds.get(guildData.id);
|
|
4452
4469
|
if (existing) {
|
|
@@ -4993,22 +5010,21 @@ function hydrateReadyGuilds(client, guilds, waitForGuilds) {
|
|
|
4993
5010
|
if (pending !== null && g.id) pending.add(g.id);
|
|
4994
5011
|
continue;
|
|
4995
5012
|
}
|
|
4996
|
-
const guildData =
|
|
5013
|
+
const guildData = normalizeGuildSnapshotPayload(g);
|
|
4997
5014
|
if (!guildData) continue;
|
|
4998
5015
|
const guild = new Guild(client, guildData);
|
|
4999
5016
|
client.guilds.set(guild.id, guild);
|
|
5000
|
-
const
|
|
5001
|
-
for (const ch of withCh.channels ?? []) {
|
|
5017
|
+
for (const ch of g.channels ?? []) {
|
|
5002
5018
|
const channel = Channel.from(client, ch);
|
|
5003
5019
|
if (channel) {
|
|
5004
5020
|
client.channels.set(channel.id, channel);
|
|
5005
5021
|
guild.channels.set(channel.id, channel);
|
|
5006
5022
|
}
|
|
5007
5023
|
}
|
|
5008
|
-
if (
|
|
5024
|
+
if (g.voice_states?.length) {
|
|
5009
5025
|
client.emit(Events.VoiceStatesSync, {
|
|
5010
5026
|
guildId: guild.id,
|
|
5011
|
-
voiceStates:
|
|
5027
|
+
voiceStates: g.voice_states
|
|
5012
5028
|
});
|
|
5013
5029
|
}
|
|
5014
5030
|
}
|
|
@@ -5124,11 +5140,11 @@ var Client = class _Client extends EventEmitter3 {
|
|
|
5124
5140
|
*/
|
|
5125
5141
|
instance;
|
|
5126
5142
|
/** Guild cache and manager. */
|
|
5127
|
-
guilds
|
|
5143
|
+
guilds;
|
|
5128
5144
|
/** Channel cache and manager. */
|
|
5129
|
-
channels
|
|
5145
|
+
channels;
|
|
5130
5146
|
/** User cache and manager. */
|
|
5131
|
-
users
|
|
5147
|
+
users;
|
|
5132
5148
|
/** Emoji/sticker pack REST wrappers (`/packs/*`). */
|
|
5133
5149
|
packs = new PackManager(this);
|
|
5134
5150
|
/** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
|
|
@@ -5155,6 +5171,9 @@ var Client = class _Client extends EventEmitter3 {
|
|
|
5155
5171
|
cache: { ...DEFAULT_CACHE_LIMITS, ...options.cache },
|
|
5156
5172
|
defaultReplyPing: options.defaultReplyPing ?? true
|
|
5157
5173
|
};
|
|
5174
|
+
this.guilds = new GuildManager(this);
|
|
5175
|
+
this.channels = new ChannelManager(this);
|
|
5176
|
+
this.users = new UserManager(this);
|
|
5158
5177
|
const restApi = options.rest?.api;
|
|
5159
5178
|
if (options.instance !== void 0) {
|
|
5160
5179
|
this.instance = resolveInstanceEndpoints(options.instance);
|
package/dist/cluster.js
CHANGED
|
@@ -4055,17 +4055,8 @@ function createEventMethods(client) {
|
|
|
4055
4055
|
var import_collection11 = require("@fluxerjs/collection");
|
|
4056
4056
|
var import_types41 = require("@fluxerjs/types");
|
|
4057
4057
|
var import_util9 = require("@fluxerjs/util");
|
|
4058
|
-
async function assertEmojiInGuild(client, emojiId, guildId) {
|
|
4059
|
-
const emojis = await client.rest.get(import_types41.Routes.guildEmojis(guildId));
|
|
4060
|
-
if (!emojis.some((e) => e.id === emojiId)) {
|
|
4061
|
-
throw new import_util2.FluxerError("Custom emoji is from another server. Use an emoji from this server.", {
|
|
4062
|
-
code: import_util.ErrorCodes.EmojiNotInGuild
|
|
4063
|
-
});
|
|
4064
|
-
}
|
|
4065
|
-
}
|
|
4066
4058
|
async function resolveClientEmoji(client, emoji, guildId) {
|
|
4067
4059
|
if (typeof emoji === "object" && emoji.id) {
|
|
4068
|
-
if (guildId) await assertEmojiInGuild(client, emoji.id, guildId);
|
|
4069
4060
|
return (0, import_util9.formatEmoji)({ name: emoji.name, id: emoji.id, animated: emoji.animated });
|
|
4070
4061
|
}
|
|
4071
4062
|
const parsed = (0, import_util9.parseEmoji)(
|
|
@@ -4075,7 +4066,6 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
4075
4066
|
throw new import_util2.FluxerError("Invalid emoji", { code: import_util.ErrorCodes.InvalidEmoji });
|
|
4076
4067
|
}
|
|
4077
4068
|
if (parsed.id) {
|
|
4078
|
-
if (guildId) await assertEmojiInGuild(client, parsed.id, guildId);
|
|
4079
4069
|
return (0, import_util9.formatEmoji)(parsed);
|
|
4080
4070
|
}
|
|
4081
4071
|
if (!/^\w+$/.test(parsed.name)) return parsed.name;
|
|
@@ -4270,7 +4260,9 @@ function emitReaction(event) {
|
|
|
4270
4260
|
return (client, d) => {
|
|
4271
4261
|
const data = d;
|
|
4272
4262
|
const reaction = new MessageReaction(client, data);
|
|
4273
|
-
const
|
|
4263
|
+
const guild = data.guild_id ? client.guilds.get(data.guild_id) : void 0;
|
|
4264
|
+
const member = guild && data.member ? cacheMember2(client, guild, { ...data.member, guild_id: data.guild_id }) : null;
|
|
4265
|
+
const user = member?.user ?? client.users.get(data.user_id) ?? client.getOrCreateUser(unknownUser(data.user_id));
|
|
4274
4266
|
const payload = {
|
|
4275
4267
|
reaction,
|
|
4276
4268
|
user,
|
|
@@ -4380,14 +4372,15 @@ var messageHandlers = {
|
|
|
4380
4372
|
};
|
|
4381
4373
|
|
|
4382
4374
|
// src/util/guildUtils.ts
|
|
4383
|
-
function
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
if ("
|
|
4388
|
-
if ("
|
|
4389
|
-
if ("
|
|
4390
|
-
if ("
|
|
4375
|
+
function isRecord2(value) {
|
|
4376
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4377
|
+
}
|
|
4378
|
+
function isValidGuildPayload(o) {
|
|
4379
|
+
if (!Object.hasOwn(o, "id") || typeof o.id !== "string" || o.id.length === 0) return false;
|
|
4380
|
+
if ("name" in o && typeof o.name !== "string") return false;
|
|
4381
|
+
if ("owner_id" in o && typeof o.owner_id !== "string") return false;
|
|
4382
|
+
if ("features" in o && !Array.isArray(o.features)) return false;
|
|
4383
|
+
if ("afk_timeout" in o && typeof o.afk_timeout !== "number") return false;
|
|
4391
4384
|
for (const key of [
|
|
4392
4385
|
"verification_level",
|
|
4393
4386
|
"mfa_level",
|
|
@@ -4395,10 +4388,32 @@ function normalizeGuildPayload(raw) {
|
|
|
4395
4388
|
"explicit_content_filter",
|
|
4396
4389
|
"default_message_notifications"
|
|
4397
4390
|
]) {
|
|
4398
|
-
if (key in o && typeof o[key] !== "number") return
|
|
4391
|
+
if (key in o && typeof o[key] !== "number") return false;
|
|
4399
4392
|
}
|
|
4400
|
-
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return
|
|
4401
|
-
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return
|
|
4393
|
+
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return false;
|
|
4394
|
+
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return false;
|
|
4395
|
+
return true;
|
|
4396
|
+
}
|
|
4397
|
+
function isHydratableGuildPayload(o) {
|
|
4398
|
+
return isValidGuildPayload(o) && Object.hasOwn(o, "name") && typeof o.name === "string" && Object.hasOwn(o, "owner_id") && typeof o.owner_id === "string";
|
|
4399
|
+
}
|
|
4400
|
+
function normalizeGuildSnapshotPayload(raw) {
|
|
4401
|
+
if (!isRecord2(raw)) return null;
|
|
4402
|
+
const flatPayload = isHydratableGuildPayload(raw) && (raw.roles === void 0 || Array.isArray(raw.roles)) ? raw : null;
|
|
4403
|
+
let nestedPayload = null;
|
|
4404
|
+
if (Object.hasOwn(raw, "properties") && isRecord2(raw.properties)) {
|
|
4405
|
+
const properties = raw.properties;
|
|
4406
|
+
const rolesValid = raw.roles === void 0 || Array.isArray(raw.roles);
|
|
4407
|
+
if (rolesValid && isHydratableGuildPayload(properties) && raw.id === properties.id) {
|
|
4408
|
+
nestedPayload = { ...properties };
|
|
4409
|
+
if (raw.roles !== void 0) nestedPayload.roles = raw.roles;
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
if (flatPayload === null === (nestedPayload === null)) return null;
|
|
4413
|
+
return flatPayload ?? nestedPayload;
|
|
4414
|
+
}
|
|
4415
|
+
function normalizeGuildUpdatePayload(raw) {
|
|
4416
|
+
if (!isRecord2(raw) || !isValidGuildPayload(raw)) return null;
|
|
4402
4417
|
return raw;
|
|
4403
4418
|
}
|
|
4404
4419
|
|
|
@@ -4410,7 +4425,6 @@ function markGuildUnavailable(client, id) {
|
|
|
4410
4425
|
client.emit(Events.GuildUnavailable, guild);
|
|
4411
4426
|
}
|
|
4412
4427
|
function refreshRecoveredGuild(guild, data) {
|
|
4413
|
-
guild._patch(data);
|
|
4414
4428
|
if (data.roles !== void 0) {
|
|
4415
4429
|
guild.roles.clear();
|
|
4416
4430
|
for (const role of data.roles) {
|
|
@@ -4439,13 +4453,16 @@ var guildHandlers = {
|
|
|
4439
4453
|
}
|
|
4440
4454
|
return;
|
|
4441
4455
|
}
|
|
4442
|
-
const guildData =
|
|
4456
|
+
const guildData = normalizeGuildSnapshotPayload(d);
|
|
4443
4457
|
if (!guildData) return;
|
|
4444
4458
|
const g = d;
|
|
4445
4459
|
const existing = client.guilds.get(guildData.id);
|
|
4446
4460
|
const recovered = existing?.available === false;
|
|
4447
4461
|
const guild = recovered && existing ? existing : new Guild(client, guildData);
|
|
4448
|
-
if (recovered)
|
|
4462
|
+
if (recovered) {
|
|
4463
|
+
guild._patch(guildData);
|
|
4464
|
+
refreshRecoveredGuild(guild, g);
|
|
4465
|
+
}
|
|
4449
4466
|
client.guilds.set(guild.id, guild);
|
|
4450
4467
|
for (const ch of g.channels ?? []) {
|
|
4451
4468
|
const channel = Channel.from(client, ch);
|
|
@@ -4463,7 +4480,7 @@ var guildHandlers = {
|
|
|
4463
4480
|
client._onGuildReceived(guild.id);
|
|
4464
4481
|
},
|
|
4465
4482
|
GUILD_UPDATE(client, d) {
|
|
4466
|
-
const guildData =
|
|
4483
|
+
const guildData = normalizeGuildUpdatePayload(d);
|
|
4467
4484
|
if (!guildData) return;
|
|
4468
4485
|
const existing = client.guilds.get(guildData.id);
|
|
4469
4486
|
if (existing) {
|
|
@@ -5007,22 +5024,21 @@ function hydrateReadyGuilds(client, guilds, waitForGuilds) {
|
|
|
5007
5024
|
if (pending !== null && g.id) pending.add(g.id);
|
|
5008
5025
|
continue;
|
|
5009
5026
|
}
|
|
5010
|
-
const guildData =
|
|
5027
|
+
const guildData = normalizeGuildSnapshotPayload(g);
|
|
5011
5028
|
if (!guildData) continue;
|
|
5012
5029
|
const guild = new Guild(client, guildData);
|
|
5013
5030
|
client.guilds.set(guild.id, guild);
|
|
5014
|
-
const
|
|
5015
|
-
for (const ch of withCh.channels ?? []) {
|
|
5031
|
+
for (const ch of g.channels ?? []) {
|
|
5016
5032
|
const channel = Channel.from(client, ch);
|
|
5017
5033
|
if (channel) {
|
|
5018
5034
|
client.channels.set(channel.id, channel);
|
|
5019
5035
|
guild.channels.set(channel.id, channel);
|
|
5020
5036
|
}
|
|
5021
5037
|
}
|
|
5022
|
-
if (
|
|
5038
|
+
if (g.voice_states?.length) {
|
|
5023
5039
|
client.emit(Events.VoiceStatesSync, {
|
|
5024
5040
|
guildId: guild.id,
|
|
5025
|
-
voiceStates:
|
|
5041
|
+
voiceStates: g.voice_states
|
|
5026
5042
|
});
|
|
5027
5043
|
}
|
|
5028
5044
|
}
|
|
@@ -5138,11 +5154,11 @@ var Client = class _Client extends import_events3.EventEmitter {
|
|
|
5138
5154
|
*/
|
|
5139
5155
|
instance;
|
|
5140
5156
|
/** Guild cache and manager. */
|
|
5141
|
-
guilds
|
|
5157
|
+
guilds;
|
|
5142
5158
|
/** Channel cache and manager. */
|
|
5143
|
-
channels
|
|
5159
|
+
channels;
|
|
5144
5160
|
/** User cache and manager. */
|
|
5145
|
-
users
|
|
5161
|
+
users;
|
|
5146
5162
|
/** Emoji/sticker pack REST wrappers (`/packs/*`). */
|
|
5147
5163
|
packs = new PackManager(this);
|
|
5148
5164
|
/** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
|
|
@@ -5169,6 +5185,9 @@ var Client = class _Client extends import_events3.EventEmitter {
|
|
|
5169
5185
|
cache: { ...DEFAULT_CACHE_LIMITS, ...options.cache },
|
|
5170
5186
|
defaultReplyPing: options.defaultReplyPing ?? true
|
|
5171
5187
|
};
|
|
5188
|
+
this.guilds = new GuildManager(this);
|
|
5189
|
+
this.channels = new ChannelManager(this);
|
|
5190
|
+
this.users = new UserManager(this);
|
|
5172
5191
|
const restApi = options.rest?.api;
|
|
5173
5192
|
if (options.instance !== void 0) {
|
|
5174
5193
|
this.instance = resolveInstanceEndpoints(options.instance);
|
package/dist/cluster.mjs
CHANGED
|
@@ -4041,17 +4041,8 @@ function createEventMethods(client) {
|
|
|
4041
4041
|
import { Collection as Collection11 } from "@fluxerjs/collection";
|
|
4042
4042
|
import { Routes as Routes32 } from "@fluxerjs/types";
|
|
4043
4043
|
import { formatEmoji, getUnicodeFromShortcode, parseEmoji } from "@fluxerjs/util";
|
|
4044
|
-
async function assertEmojiInGuild(client, emojiId, guildId) {
|
|
4045
|
-
const emojis = await client.rest.get(Routes32.guildEmojis(guildId));
|
|
4046
|
-
if (!emojis.some((e) => e.id === emojiId)) {
|
|
4047
|
-
throw new FluxerError("Custom emoji is from another server. Use an emoji from this server.", {
|
|
4048
|
-
code: ErrorCodes.EmojiNotInGuild
|
|
4049
|
-
});
|
|
4050
|
-
}
|
|
4051
|
-
}
|
|
4052
4044
|
async function resolveClientEmoji(client, emoji, guildId) {
|
|
4053
4045
|
if (typeof emoji === "object" && emoji.id) {
|
|
4054
|
-
if (guildId) await assertEmojiInGuild(client, emoji.id, guildId);
|
|
4055
4046
|
return formatEmoji({ name: emoji.name, id: emoji.id, animated: emoji.animated });
|
|
4056
4047
|
}
|
|
4057
4048
|
const parsed = parseEmoji(
|
|
@@ -4061,7 +4052,6 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
4061
4052
|
throw new FluxerError("Invalid emoji", { code: ErrorCodes.InvalidEmoji });
|
|
4062
4053
|
}
|
|
4063
4054
|
if (parsed.id) {
|
|
4064
|
-
if (guildId) await assertEmojiInGuild(client, parsed.id, guildId);
|
|
4065
4055
|
return formatEmoji(parsed);
|
|
4066
4056
|
}
|
|
4067
4057
|
if (!/^\w+$/.test(parsed.name)) return parsed.name;
|
|
@@ -4256,7 +4246,9 @@ function emitReaction(event) {
|
|
|
4256
4246
|
return (client, d) => {
|
|
4257
4247
|
const data = d;
|
|
4258
4248
|
const reaction = new MessageReaction(client, data);
|
|
4259
|
-
const
|
|
4249
|
+
const guild = data.guild_id ? client.guilds.get(data.guild_id) : void 0;
|
|
4250
|
+
const member = guild && data.member ? cacheMember2(client, guild, { ...data.member, guild_id: data.guild_id }) : null;
|
|
4251
|
+
const user = member?.user ?? client.users.get(data.user_id) ?? client.getOrCreateUser(unknownUser(data.user_id));
|
|
4260
4252
|
const payload = {
|
|
4261
4253
|
reaction,
|
|
4262
4254
|
user,
|
|
@@ -4366,14 +4358,15 @@ var messageHandlers = {
|
|
|
4366
4358
|
};
|
|
4367
4359
|
|
|
4368
4360
|
// src/util/guildUtils.ts
|
|
4369
|
-
function
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
if ("
|
|
4374
|
-
if ("
|
|
4375
|
-
if ("
|
|
4376
|
-
if ("
|
|
4361
|
+
function isRecord2(value) {
|
|
4362
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4363
|
+
}
|
|
4364
|
+
function isValidGuildPayload(o) {
|
|
4365
|
+
if (!Object.hasOwn(o, "id") || typeof o.id !== "string" || o.id.length === 0) return false;
|
|
4366
|
+
if ("name" in o && typeof o.name !== "string") return false;
|
|
4367
|
+
if ("owner_id" in o && typeof o.owner_id !== "string") return false;
|
|
4368
|
+
if ("features" in o && !Array.isArray(o.features)) return false;
|
|
4369
|
+
if ("afk_timeout" in o && typeof o.afk_timeout !== "number") return false;
|
|
4377
4370
|
for (const key of [
|
|
4378
4371
|
"verification_level",
|
|
4379
4372
|
"mfa_level",
|
|
@@ -4381,10 +4374,32 @@ function normalizeGuildPayload(raw) {
|
|
|
4381
4374
|
"explicit_content_filter",
|
|
4382
4375
|
"default_message_notifications"
|
|
4383
4376
|
]) {
|
|
4384
|
-
if (key in o && typeof o[key] !== "number") return
|
|
4377
|
+
if (key in o && typeof o[key] !== "number") return false;
|
|
4385
4378
|
}
|
|
4386
|
-
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return
|
|
4387
|
-
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return
|
|
4379
|
+
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return false;
|
|
4380
|
+
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return false;
|
|
4381
|
+
return true;
|
|
4382
|
+
}
|
|
4383
|
+
function isHydratableGuildPayload(o) {
|
|
4384
|
+
return isValidGuildPayload(o) && Object.hasOwn(o, "name") && typeof o.name === "string" && Object.hasOwn(o, "owner_id") && typeof o.owner_id === "string";
|
|
4385
|
+
}
|
|
4386
|
+
function normalizeGuildSnapshotPayload(raw) {
|
|
4387
|
+
if (!isRecord2(raw)) return null;
|
|
4388
|
+
const flatPayload = isHydratableGuildPayload(raw) && (raw.roles === void 0 || Array.isArray(raw.roles)) ? raw : null;
|
|
4389
|
+
let nestedPayload = null;
|
|
4390
|
+
if (Object.hasOwn(raw, "properties") && isRecord2(raw.properties)) {
|
|
4391
|
+
const properties = raw.properties;
|
|
4392
|
+
const rolesValid = raw.roles === void 0 || Array.isArray(raw.roles);
|
|
4393
|
+
if (rolesValid && isHydratableGuildPayload(properties) && raw.id === properties.id) {
|
|
4394
|
+
nestedPayload = { ...properties };
|
|
4395
|
+
if (raw.roles !== void 0) nestedPayload.roles = raw.roles;
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
if (flatPayload === null === (nestedPayload === null)) return null;
|
|
4399
|
+
return flatPayload ?? nestedPayload;
|
|
4400
|
+
}
|
|
4401
|
+
function normalizeGuildUpdatePayload(raw) {
|
|
4402
|
+
if (!isRecord2(raw) || !isValidGuildPayload(raw)) return null;
|
|
4388
4403
|
return raw;
|
|
4389
4404
|
}
|
|
4390
4405
|
|
|
@@ -4396,7 +4411,6 @@ function markGuildUnavailable(client, id) {
|
|
|
4396
4411
|
client.emit(Events.GuildUnavailable, guild);
|
|
4397
4412
|
}
|
|
4398
4413
|
function refreshRecoveredGuild(guild, data) {
|
|
4399
|
-
guild._patch(data);
|
|
4400
4414
|
if (data.roles !== void 0) {
|
|
4401
4415
|
guild.roles.clear();
|
|
4402
4416
|
for (const role of data.roles) {
|
|
@@ -4425,13 +4439,16 @@ var guildHandlers = {
|
|
|
4425
4439
|
}
|
|
4426
4440
|
return;
|
|
4427
4441
|
}
|
|
4428
|
-
const guildData =
|
|
4442
|
+
const guildData = normalizeGuildSnapshotPayload(d);
|
|
4429
4443
|
if (!guildData) return;
|
|
4430
4444
|
const g = d;
|
|
4431
4445
|
const existing = client.guilds.get(guildData.id);
|
|
4432
4446
|
const recovered = existing?.available === false;
|
|
4433
4447
|
const guild = recovered && existing ? existing : new Guild(client, guildData);
|
|
4434
|
-
if (recovered)
|
|
4448
|
+
if (recovered) {
|
|
4449
|
+
guild._patch(guildData);
|
|
4450
|
+
refreshRecoveredGuild(guild, g);
|
|
4451
|
+
}
|
|
4435
4452
|
client.guilds.set(guild.id, guild);
|
|
4436
4453
|
for (const ch of g.channels ?? []) {
|
|
4437
4454
|
const channel = Channel.from(client, ch);
|
|
@@ -4449,7 +4466,7 @@ var guildHandlers = {
|
|
|
4449
4466
|
client._onGuildReceived(guild.id);
|
|
4450
4467
|
},
|
|
4451
4468
|
GUILD_UPDATE(client, d) {
|
|
4452
|
-
const guildData =
|
|
4469
|
+
const guildData = normalizeGuildUpdatePayload(d);
|
|
4453
4470
|
if (!guildData) return;
|
|
4454
4471
|
const existing = client.guilds.get(guildData.id);
|
|
4455
4472
|
if (existing) {
|
|
@@ -4996,22 +5013,21 @@ function hydrateReadyGuilds(client, guilds, waitForGuilds) {
|
|
|
4996
5013
|
if (pending !== null && g.id) pending.add(g.id);
|
|
4997
5014
|
continue;
|
|
4998
5015
|
}
|
|
4999
|
-
const guildData =
|
|
5016
|
+
const guildData = normalizeGuildSnapshotPayload(g);
|
|
5000
5017
|
if (!guildData) continue;
|
|
5001
5018
|
const guild = new Guild(client, guildData);
|
|
5002
5019
|
client.guilds.set(guild.id, guild);
|
|
5003
|
-
const
|
|
5004
|
-
for (const ch of withCh.channels ?? []) {
|
|
5020
|
+
for (const ch of g.channels ?? []) {
|
|
5005
5021
|
const channel = Channel.from(client, ch);
|
|
5006
5022
|
if (channel) {
|
|
5007
5023
|
client.channels.set(channel.id, channel);
|
|
5008
5024
|
guild.channels.set(channel.id, channel);
|
|
5009
5025
|
}
|
|
5010
5026
|
}
|
|
5011
|
-
if (
|
|
5027
|
+
if (g.voice_states?.length) {
|
|
5012
5028
|
client.emit(Events.VoiceStatesSync, {
|
|
5013
5029
|
guildId: guild.id,
|
|
5014
|
-
voiceStates:
|
|
5030
|
+
voiceStates: g.voice_states
|
|
5015
5031
|
});
|
|
5016
5032
|
}
|
|
5017
5033
|
}
|
|
@@ -5127,11 +5143,11 @@ var Client = class _Client extends EventEmitter3 {
|
|
|
5127
5143
|
*/
|
|
5128
5144
|
instance;
|
|
5129
5145
|
/** Guild cache and manager. */
|
|
5130
|
-
guilds
|
|
5146
|
+
guilds;
|
|
5131
5147
|
/** Channel cache and manager. */
|
|
5132
|
-
channels
|
|
5148
|
+
channels;
|
|
5133
5149
|
/** User cache and manager. */
|
|
5134
|
-
users
|
|
5150
|
+
users;
|
|
5135
5151
|
/** Emoji/sticker pack REST wrappers (`/packs/*`). */
|
|
5136
5152
|
packs = new PackManager(this);
|
|
5137
5153
|
/** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
|
|
@@ -5158,6 +5174,9 @@ var Client = class _Client extends EventEmitter3 {
|
|
|
5158
5174
|
cache: { ...DEFAULT_CACHE_LIMITS, ...options.cache },
|
|
5159
5175
|
defaultReplyPing: options.defaultReplyPing ?? true
|
|
5160
5176
|
};
|
|
5177
|
+
this.guilds = new GuildManager(this);
|
|
5178
|
+
this.channels = new ChannelManager(this);
|
|
5179
|
+
this.users = new UserManager(this);
|
|
5161
5180
|
const restApi = options.rest?.api;
|
|
5162
5181
|
if (options.instance !== void 0) {
|
|
5163
5182
|
this.instance = resolveInstanceEndpoints(options.instance);
|
package/dist/index.js
CHANGED
|
@@ -4167,17 +4167,8 @@ function createEventMethods(client) {
|
|
|
4167
4167
|
var import_collection11 = require("@fluxerjs/collection");
|
|
4168
4168
|
var import_types41 = require("@fluxerjs/types");
|
|
4169
4169
|
var import_util9 = require("@fluxerjs/util");
|
|
4170
|
-
async function assertEmojiInGuild(client, emojiId, guildId) {
|
|
4171
|
-
const emojis = await client.rest.get(import_types41.Routes.guildEmojis(guildId));
|
|
4172
|
-
if (!emojis.some((e) => e.id === emojiId)) {
|
|
4173
|
-
throw new import_util.FluxerError("Custom emoji is from another server. Use an emoji from this server.", {
|
|
4174
|
-
code: import_util2.ErrorCodes.EmojiNotInGuild
|
|
4175
|
-
});
|
|
4176
|
-
}
|
|
4177
|
-
}
|
|
4178
4170
|
async function resolveClientEmoji(client, emoji, guildId) {
|
|
4179
4171
|
if (typeof emoji === "object" && emoji.id) {
|
|
4180
|
-
if (guildId) await assertEmojiInGuild(client, emoji.id, guildId);
|
|
4181
4172
|
return (0, import_util9.formatEmoji)({ name: emoji.name, id: emoji.id, animated: emoji.animated });
|
|
4182
4173
|
}
|
|
4183
4174
|
const parsed = (0, import_util9.parseEmoji)(
|
|
@@ -4187,7 +4178,6 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
4187
4178
|
throw new import_util.FluxerError("Invalid emoji", { code: import_util2.ErrorCodes.InvalidEmoji });
|
|
4188
4179
|
}
|
|
4189
4180
|
if (parsed.id) {
|
|
4190
|
-
if (guildId) await assertEmojiInGuild(client, parsed.id, guildId);
|
|
4191
4181
|
return (0, import_util9.formatEmoji)(parsed);
|
|
4192
4182
|
}
|
|
4193
4183
|
if (!/^\w+$/.test(parsed.name)) return parsed.name;
|
|
@@ -4382,7 +4372,9 @@ function emitReaction(event) {
|
|
|
4382
4372
|
return (client, d) => {
|
|
4383
4373
|
const data = d;
|
|
4384
4374
|
const reaction = new MessageReaction(client, data);
|
|
4385
|
-
const
|
|
4375
|
+
const guild = data.guild_id ? client.guilds.get(data.guild_id) : void 0;
|
|
4376
|
+
const member = guild && data.member ? cacheMember2(client, guild, { ...data.member, guild_id: data.guild_id }) : null;
|
|
4377
|
+
const user = member?.user ?? client.users.get(data.user_id) ?? client.getOrCreateUser(unknownUser(data.user_id));
|
|
4386
4378
|
const payload = {
|
|
4387
4379
|
reaction,
|
|
4388
4380
|
user,
|
|
@@ -4492,14 +4484,15 @@ var messageHandlers = {
|
|
|
4492
4484
|
};
|
|
4493
4485
|
|
|
4494
4486
|
// src/util/guildUtils.ts
|
|
4495
|
-
function
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
if ("
|
|
4500
|
-
if ("
|
|
4501
|
-
if ("
|
|
4502
|
-
if ("
|
|
4487
|
+
function isRecord2(value) {
|
|
4488
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4489
|
+
}
|
|
4490
|
+
function isValidGuildPayload(o) {
|
|
4491
|
+
if (!Object.hasOwn(o, "id") || typeof o.id !== "string" || o.id.length === 0) return false;
|
|
4492
|
+
if ("name" in o && typeof o.name !== "string") return false;
|
|
4493
|
+
if ("owner_id" in o && typeof o.owner_id !== "string") return false;
|
|
4494
|
+
if ("features" in o && !Array.isArray(o.features)) return false;
|
|
4495
|
+
if ("afk_timeout" in o && typeof o.afk_timeout !== "number") return false;
|
|
4503
4496
|
for (const key of [
|
|
4504
4497
|
"verification_level",
|
|
4505
4498
|
"mfa_level",
|
|
@@ -4507,10 +4500,32 @@ function normalizeGuildPayload(raw) {
|
|
|
4507
4500
|
"explicit_content_filter",
|
|
4508
4501
|
"default_message_notifications"
|
|
4509
4502
|
]) {
|
|
4510
|
-
if (key in o && typeof o[key] !== "number") return
|
|
4503
|
+
if (key in o && typeof o[key] !== "number") return false;
|
|
4511
4504
|
}
|
|
4512
|
-
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return
|
|
4513
|
-
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return
|
|
4505
|
+
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return false;
|
|
4506
|
+
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return false;
|
|
4507
|
+
return true;
|
|
4508
|
+
}
|
|
4509
|
+
function isHydratableGuildPayload(o) {
|
|
4510
|
+
return isValidGuildPayload(o) && Object.hasOwn(o, "name") && typeof o.name === "string" && Object.hasOwn(o, "owner_id") && typeof o.owner_id === "string";
|
|
4511
|
+
}
|
|
4512
|
+
function normalizeGuildSnapshotPayload(raw) {
|
|
4513
|
+
if (!isRecord2(raw)) return null;
|
|
4514
|
+
const flatPayload = isHydratableGuildPayload(raw) && (raw.roles === void 0 || Array.isArray(raw.roles)) ? raw : null;
|
|
4515
|
+
let nestedPayload = null;
|
|
4516
|
+
if (Object.hasOwn(raw, "properties") && isRecord2(raw.properties)) {
|
|
4517
|
+
const properties = raw.properties;
|
|
4518
|
+
const rolesValid = raw.roles === void 0 || Array.isArray(raw.roles);
|
|
4519
|
+
if (rolesValid && isHydratableGuildPayload(properties) && raw.id === properties.id) {
|
|
4520
|
+
nestedPayload = { ...properties };
|
|
4521
|
+
if (raw.roles !== void 0) nestedPayload.roles = raw.roles;
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4524
|
+
if (flatPayload === null === (nestedPayload === null)) return null;
|
|
4525
|
+
return flatPayload ?? nestedPayload;
|
|
4526
|
+
}
|
|
4527
|
+
function normalizeGuildUpdatePayload(raw) {
|
|
4528
|
+
if (!isRecord2(raw) || !isValidGuildPayload(raw)) return null;
|
|
4514
4529
|
return raw;
|
|
4515
4530
|
}
|
|
4516
4531
|
|
|
@@ -4522,7 +4537,6 @@ function markGuildUnavailable(client, id) {
|
|
|
4522
4537
|
client.emit(Events.GuildUnavailable, guild);
|
|
4523
4538
|
}
|
|
4524
4539
|
function refreshRecoveredGuild(guild, data) {
|
|
4525
|
-
guild._patch(data);
|
|
4526
4540
|
if (data.roles !== void 0) {
|
|
4527
4541
|
guild.roles.clear();
|
|
4528
4542
|
for (const role of data.roles) {
|
|
@@ -4551,13 +4565,16 @@ var guildHandlers = {
|
|
|
4551
4565
|
}
|
|
4552
4566
|
return;
|
|
4553
4567
|
}
|
|
4554
|
-
const guildData =
|
|
4568
|
+
const guildData = normalizeGuildSnapshotPayload(d);
|
|
4555
4569
|
if (!guildData) return;
|
|
4556
4570
|
const g = d;
|
|
4557
4571
|
const existing = client.guilds.get(guildData.id);
|
|
4558
4572
|
const recovered = existing?.available === false;
|
|
4559
4573
|
const guild = recovered && existing ? existing : new Guild(client, guildData);
|
|
4560
|
-
if (recovered)
|
|
4574
|
+
if (recovered) {
|
|
4575
|
+
guild._patch(guildData);
|
|
4576
|
+
refreshRecoveredGuild(guild, g);
|
|
4577
|
+
}
|
|
4561
4578
|
client.guilds.set(guild.id, guild);
|
|
4562
4579
|
for (const ch of g.channels ?? []) {
|
|
4563
4580
|
const channel = Channel.from(client, ch);
|
|
@@ -4575,7 +4592,7 @@ var guildHandlers = {
|
|
|
4575
4592
|
client._onGuildReceived(guild.id);
|
|
4576
4593
|
},
|
|
4577
4594
|
GUILD_UPDATE(client, d) {
|
|
4578
|
-
const guildData =
|
|
4595
|
+
const guildData = normalizeGuildUpdatePayload(d);
|
|
4579
4596
|
if (!guildData) return;
|
|
4580
4597
|
const existing = client.guilds.get(guildData.id);
|
|
4581
4598
|
if (existing) {
|
|
@@ -5119,22 +5136,21 @@ function hydrateReadyGuilds(client, guilds, waitForGuilds) {
|
|
|
5119
5136
|
if (pending !== null && g.id) pending.add(g.id);
|
|
5120
5137
|
continue;
|
|
5121
5138
|
}
|
|
5122
|
-
const guildData =
|
|
5139
|
+
const guildData = normalizeGuildSnapshotPayload(g);
|
|
5123
5140
|
if (!guildData) continue;
|
|
5124
5141
|
const guild = new Guild(client, guildData);
|
|
5125
5142
|
client.guilds.set(guild.id, guild);
|
|
5126
|
-
const
|
|
5127
|
-
for (const ch of withCh.channels ?? []) {
|
|
5143
|
+
for (const ch of g.channels ?? []) {
|
|
5128
5144
|
const channel = Channel.from(client, ch);
|
|
5129
5145
|
if (channel) {
|
|
5130
5146
|
client.channels.set(channel.id, channel);
|
|
5131
5147
|
guild.channels.set(channel.id, channel);
|
|
5132
5148
|
}
|
|
5133
5149
|
}
|
|
5134
|
-
if (
|
|
5150
|
+
if (g.voice_states?.length) {
|
|
5135
5151
|
client.emit(Events.VoiceStatesSync, {
|
|
5136
5152
|
guildId: guild.id,
|
|
5137
|
-
voiceStates:
|
|
5153
|
+
voiceStates: g.voice_states
|
|
5138
5154
|
});
|
|
5139
5155
|
}
|
|
5140
5156
|
}
|
|
@@ -5250,11 +5266,11 @@ var Client = class _Client extends import_events3.EventEmitter {
|
|
|
5250
5266
|
*/
|
|
5251
5267
|
instance;
|
|
5252
5268
|
/** Guild cache and manager. */
|
|
5253
|
-
guilds
|
|
5269
|
+
guilds;
|
|
5254
5270
|
/** Channel cache and manager. */
|
|
5255
|
-
channels
|
|
5271
|
+
channels;
|
|
5256
5272
|
/** User cache and manager. */
|
|
5257
|
-
users
|
|
5273
|
+
users;
|
|
5258
5274
|
/** Emoji/sticker pack REST wrappers (`/packs/*`). */
|
|
5259
5275
|
packs = new PackManager(this);
|
|
5260
5276
|
/** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
|
|
@@ -5281,6 +5297,9 @@ var Client = class _Client extends import_events3.EventEmitter {
|
|
|
5281
5297
|
cache: { ...DEFAULT_CACHE_LIMITS, ...options.cache },
|
|
5282
5298
|
defaultReplyPing: options.defaultReplyPing ?? true
|
|
5283
5299
|
};
|
|
5300
|
+
this.guilds = new GuildManager(this);
|
|
5301
|
+
this.channels = new ChannelManager(this);
|
|
5302
|
+
this.users = new UserManager(this);
|
|
5284
5303
|
const restApi = options.rest?.api;
|
|
5285
5304
|
if (options.instance !== void 0) {
|
|
5286
5305
|
this.instance = resolveInstanceEndpoints(options.instance);
|
package/dist/index.mjs
CHANGED
|
@@ -4053,17 +4053,8 @@ function createEventMethods(client) {
|
|
|
4053
4053
|
import { Collection as Collection11 } from "@fluxerjs/collection";
|
|
4054
4054
|
import { Routes as Routes32 } from "@fluxerjs/types";
|
|
4055
4055
|
import { formatEmoji, getUnicodeFromShortcode, parseEmoji } from "@fluxerjs/util";
|
|
4056
|
-
async function assertEmojiInGuild(client, emojiId, guildId) {
|
|
4057
|
-
const emojis = await client.rest.get(Routes32.guildEmojis(guildId));
|
|
4058
|
-
if (!emojis.some((e) => e.id === emojiId)) {
|
|
4059
|
-
throw new FluxerError("Custom emoji is from another server. Use an emoji from this server.", {
|
|
4060
|
-
code: ErrorCodes.EmojiNotInGuild
|
|
4061
|
-
});
|
|
4062
|
-
}
|
|
4063
|
-
}
|
|
4064
4056
|
async function resolveClientEmoji(client, emoji, guildId) {
|
|
4065
4057
|
if (typeof emoji === "object" && emoji.id) {
|
|
4066
|
-
if (guildId) await assertEmojiInGuild(client, emoji.id, guildId);
|
|
4067
4058
|
return formatEmoji({ name: emoji.name, id: emoji.id, animated: emoji.animated });
|
|
4068
4059
|
}
|
|
4069
4060
|
const parsed = parseEmoji(
|
|
@@ -4073,7 +4064,6 @@ async function resolveClientEmoji(client, emoji, guildId) {
|
|
|
4073
4064
|
throw new FluxerError("Invalid emoji", { code: ErrorCodes.InvalidEmoji });
|
|
4074
4065
|
}
|
|
4075
4066
|
if (parsed.id) {
|
|
4076
|
-
if (guildId) await assertEmojiInGuild(client, parsed.id, guildId);
|
|
4077
4067
|
return formatEmoji(parsed);
|
|
4078
4068
|
}
|
|
4079
4069
|
if (!/^\w+$/.test(parsed.name)) return parsed.name;
|
|
@@ -4268,7 +4258,9 @@ function emitReaction(event) {
|
|
|
4268
4258
|
return (client, d) => {
|
|
4269
4259
|
const data = d;
|
|
4270
4260
|
const reaction = new MessageReaction(client, data);
|
|
4271
|
-
const
|
|
4261
|
+
const guild = data.guild_id ? client.guilds.get(data.guild_id) : void 0;
|
|
4262
|
+
const member = guild && data.member ? cacheMember2(client, guild, { ...data.member, guild_id: data.guild_id }) : null;
|
|
4263
|
+
const user = member?.user ?? client.users.get(data.user_id) ?? client.getOrCreateUser(unknownUser(data.user_id));
|
|
4272
4264
|
const payload = {
|
|
4273
4265
|
reaction,
|
|
4274
4266
|
user,
|
|
@@ -4378,14 +4370,15 @@ var messageHandlers = {
|
|
|
4378
4370
|
};
|
|
4379
4371
|
|
|
4380
4372
|
// src/util/guildUtils.ts
|
|
4381
|
-
function
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
if ("
|
|
4386
|
-
if ("
|
|
4387
|
-
if ("
|
|
4388
|
-
if ("
|
|
4373
|
+
function isRecord2(value) {
|
|
4374
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4375
|
+
}
|
|
4376
|
+
function isValidGuildPayload(o) {
|
|
4377
|
+
if (!Object.hasOwn(o, "id") || typeof o.id !== "string" || o.id.length === 0) return false;
|
|
4378
|
+
if ("name" in o && typeof o.name !== "string") return false;
|
|
4379
|
+
if ("owner_id" in o && typeof o.owner_id !== "string") return false;
|
|
4380
|
+
if ("features" in o && !Array.isArray(o.features)) return false;
|
|
4381
|
+
if ("afk_timeout" in o && typeof o.afk_timeout !== "number") return false;
|
|
4389
4382
|
for (const key of [
|
|
4390
4383
|
"verification_level",
|
|
4391
4384
|
"mfa_level",
|
|
@@ -4393,10 +4386,32 @@ function normalizeGuildPayload(raw) {
|
|
|
4393
4386
|
"explicit_content_filter",
|
|
4394
4387
|
"default_message_notifications"
|
|
4395
4388
|
]) {
|
|
4396
|
-
if (key in o && typeof o[key] !== "number") return
|
|
4389
|
+
if (key in o && typeof o[key] !== "number") return false;
|
|
4397
4390
|
}
|
|
4398
|
-
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return
|
|
4399
|
-
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return
|
|
4391
|
+
if ("icon" in o && o.icon !== null && typeof o.icon !== "string") return false;
|
|
4392
|
+
if ("banner" in o && o.banner !== null && typeof o.banner !== "string") return false;
|
|
4393
|
+
return true;
|
|
4394
|
+
}
|
|
4395
|
+
function isHydratableGuildPayload(o) {
|
|
4396
|
+
return isValidGuildPayload(o) && Object.hasOwn(o, "name") && typeof o.name === "string" && Object.hasOwn(o, "owner_id") && typeof o.owner_id === "string";
|
|
4397
|
+
}
|
|
4398
|
+
function normalizeGuildSnapshotPayload(raw) {
|
|
4399
|
+
if (!isRecord2(raw)) return null;
|
|
4400
|
+
const flatPayload = isHydratableGuildPayload(raw) && (raw.roles === void 0 || Array.isArray(raw.roles)) ? raw : null;
|
|
4401
|
+
let nestedPayload = null;
|
|
4402
|
+
if (Object.hasOwn(raw, "properties") && isRecord2(raw.properties)) {
|
|
4403
|
+
const properties = raw.properties;
|
|
4404
|
+
const rolesValid = raw.roles === void 0 || Array.isArray(raw.roles);
|
|
4405
|
+
if (rolesValid && isHydratableGuildPayload(properties) && raw.id === properties.id) {
|
|
4406
|
+
nestedPayload = { ...properties };
|
|
4407
|
+
if (raw.roles !== void 0) nestedPayload.roles = raw.roles;
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4410
|
+
if (flatPayload === null === (nestedPayload === null)) return null;
|
|
4411
|
+
return flatPayload ?? nestedPayload;
|
|
4412
|
+
}
|
|
4413
|
+
function normalizeGuildUpdatePayload(raw) {
|
|
4414
|
+
if (!isRecord2(raw) || !isValidGuildPayload(raw)) return null;
|
|
4400
4415
|
return raw;
|
|
4401
4416
|
}
|
|
4402
4417
|
|
|
@@ -4408,7 +4423,6 @@ function markGuildUnavailable(client, id) {
|
|
|
4408
4423
|
client.emit(Events.GuildUnavailable, guild);
|
|
4409
4424
|
}
|
|
4410
4425
|
function refreshRecoveredGuild(guild, data) {
|
|
4411
|
-
guild._patch(data);
|
|
4412
4426
|
if (data.roles !== void 0) {
|
|
4413
4427
|
guild.roles.clear();
|
|
4414
4428
|
for (const role of data.roles) {
|
|
@@ -4437,13 +4451,16 @@ var guildHandlers = {
|
|
|
4437
4451
|
}
|
|
4438
4452
|
return;
|
|
4439
4453
|
}
|
|
4440
|
-
const guildData =
|
|
4454
|
+
const guildData = normalizeGuildSnapshotPayload(d);
|
|
4441
4455
|
if (!guildData) return;
|
|
4442
4456
|
const g = d;
|
|
4443
4457
|
const existing = client.guilds.get(guildData.id);
|
|
4444
4458
|
const recovered = existing?.available === false;
|
|
4445
4459
|
const guild = recovered && existing ? existing : new Guild(client, guildData);
|
|
4446
|
-
if (recovered)
|
|
4460
|
+
if (recovered) {
|
|
4461
|
+
guild._patch(guildData);
|
|
4462
|
+
refreshRecoveredGuild(guild, g);
|
|
4463
|
+
}
|
|
4447
4464
|
client.guilds.set(guild.id, guild);
|
|
4448
4465
|
for (const ch of g.channels ?? []) {
|
|
4449
4466
|
const channel = Channel.from(client, ch);
|
|
@@ -4461,7 +4478,7 @@ var guildHandlers = {
|
|
|
4461
4478
|
client._onGuildReceived(guild.id);
|
|
4462
4479
|
},
|
|
4463
4480
|
GUILD_UPDATE(client, d) {
|
|
4464
|
-
const guildData =
|
|
4481
|
+
const guildData = normalizeGuildUpdatePayload(d);
|
|
4465
4482
|
if (!guildData) return;
|
|
4466
4483
|
const existing = client.guilds.get(guildData.id);
|
|
4467
4484
|
if (existing) {
|
|
@@ -5008,22 +5025,21 @@ function hydrateReadyGuilds(client, guilds, waitForGuilds) {
|
|
|
5008
5025
|
if (pending !== null && g.id) pending.add(g.id);
|
|
5009
5026
|
continue;
|
|
5010
5027
|
}
|
|
5011
|
-
const guildData =
|
|
5028
|
+
const guildData = normalizeGuildSnapshotPayload(g);
|
|
5012
5029
|
if (!guildData) continue;
|
|
5013
5030
|
const guild = new Guild(client, guildData);
|
|
5014
5031
|
client.guilds.set(guild.id, guild);
|
|
5015
|
-
const
|
|
5016
|
-
for (const ch of withCh.channels ?? []) {
|
|
5032
|
+
for (const ch of g.channels ?? []) {
|
|
5017
5033
|
const channel = Channel.from(client, ch);
|
|
5018
5034
|
if (channel) {
|
|
5019
5035
|
client.channels.set(channel.id, channel);
|
|
5020
5036
|
guild.channels.set(channel.id, channel);
|
|
5021
5037
|
}
|
|
5022
5038
|
}
|
|
5023
|
-
if (
|
|
5039
|
+
if (g.voice_states?.length) {
|
|
5024
5040
|
client.emit(Events.VoiceStatesSync, {
|
|
5025
5041
|
guildId: guild.id,
|
|
5026
|
-
voiceStates:
|
|
5042
|
+
voiceStates: g.voice_states
|
|
5027
5043
|
});
|
|
5028
5044
|
}
|
|
5029
5045
|
}
|
|
@@ -5139,11 +5155,11 @@ var Client = class _Client extends EventEmitter3 {
|
|
|
5139
5155
|
*/
|
|
5140
5156
|
instance;
|
|
5141
5157
|
/** Guild cache and manager. */
|
|
5142
|
-
guilds
|
|
5158
|
+
guilds;
|
|
5143
5159
|
/** Channel cache and manager. */
|
|
5144
|
-
channels
|
|
5160
|
+
channels;
|
|
5145
5161
|
/** User cache and manager. */
|
|
5146
|
-
users
|
|
5162
|
+
users;
|
|
5147
5163
|
/** Emoji/sticker pack REST wrappers (`/packs/*`). */
|
|
5148
5164
|
packs = new PackManager(this);
|
|
5149
5165
|
/** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
|
|
@@ -5170,6 +5186,9 @@ var Client = class _Client extends EventEmitter3 {
|
|
|
5170
5186
|
cache: { ...DEFAULT_CACHE_LIMITS, ...options.cache },
|
|
5171
5187
|
defaultReplyPing: options.defaultReplyPing ?? true
|
|
5172
5188
|
};
|
|
5189
|
+
this.guilds = new GuildManager(this);
|
|
5190
|
+
this.channels = new ChannelManager(this);
|
|
5191
|
+
this.users = new UserManager(this);
|
|
5173
5192
|
const restApi = options.rest?.api;
|
|
5174
5193
|
if (options.instance !== void 0) {
|
|
5175
5194
|
this.instance = resolveInstanceEndpoints(options.instance);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "2.0
|
|
6
|
+
"version": "2.1.0",
|
|
7
7
|
"description": "A fully-featured SDK for Fluxer bots",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"dist"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@fluxerjs/
|
|
58
|
-
"@fluxerjs/
|
|
59
|
-
"@fluxerjs/collection": "2.
|
|
60
|
-
"@fluxerjs/
|
|
61
|
-
"@fluxerjs/builders": "2.
|
|
62
|
-
"@fluxerjs/
|
|
57
|
+
"@fluxerjs/ws": "2.1.0",
|
|
58
|
+
"@fluxerjs/rest": "2.1.0",
|
|
59
|
+
"@fluxerjs/collection": "2.1.0",
|
|
60
|
+
"@fluxerjs/util": "2.1.0",
|
|
61
|
+
"@fluxerjs/builders": "2.1.0",
|
|
62
|
+
"@fluxerjs/types": "2.1.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/node": "^20.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"typescript": "^5.6.0"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|
|
70
|
-
"node": ">=
|
|
70
|
+
"node": ">=22.13.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "tsup",
|