@fluxerjs/core 1.1.1 → 1.1.2
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/{Channel-4WVFDOCG.mjs → Channel-YB3LWDHZ.mjs} +2 -2
- package/dist/{ClientUser-PXAAKR2P.mjs → ClientUser-QQXLZ5WP.mjs} +1 -1
- package/dist/{Guild-FMBCTAV4.mjs → Guild-MDW7KF33.mjs} +3 -3
- package/dist/{MessageReaction-AYSOCOMX.mjs → MessageReaction-GYQNJ6GX.mjs} +2 -2
- package/dist/{Role-5MWSGL66.mjs → Role-N2ZEMRUQ.mjs} +1 -1
- package/dist/chunk-5I54OXBG.mjs +111 -0
- package/dist/{chunk-4F765HVV.mjs → chunk-G2YVDCRB.mjs} +2 -2
- package/dist/{chunk-FRVZ7D6D.mjs → chunk-KOTF4TTZ.mjs} +118 -8
- package/dist/{chunk-V6T5VMWD.mjs → chunk-PU73YRKJ.mjs} +2 -1
- package/dist/{chunk-K6NLD6SB.mjs → chunk-YL5S4W6R.mjs} +5 -5
- package/dist/{chunk-RWFKZ3DF.mjs → chunk-ZKKBIQBA.mjs} +1 -1
- package/dist/index.d.mts +134 -6
- package/dist/index.d.ts +134 -6
- package/dist/index.js +312 -59
- package/dist/index.mjs +123 -36
- package/package.json +7 -7
- package/dist/chunk-DQ4TNBPG.mjs +0 -63
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Guild
|
|
3
|
-
|
|
2
|
+
Guild,
|
|
3
|
+
GuildMemberManager
|
|
4
|
+
} from "./chunk-KOTF4TTZ.mjs";
|
|
4
5
|
import {
|
|
5
6
|
MessageReaction
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YL5S4W6R.mjs";
|
|
7
8
|
import {
|
|
8
9
|
ClientUser,
|
|
9
10
|
User
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-G2YVDCRB.mjs";
|
|
11
12
|
import {
|
|
12
13
|
Message,
|
|
13
14
|
ReactionCollector
|
|
@@ -28,11 +29,11 @@ import {
|
|
|
28
29
|
MessageManager,
|
|
29
30
|
TextChannel,
|
|
30
31
|
VoiceChannel
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-ZKKBIQBA.mjs";
|
|
32
33
|
import {
|
|
33
34
|
ErrorCodes,
|
|
34
35
|
FluxerError
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-PU73YRKJ.mjs";
|
|
36
37
|
import {
|
|
37
38
|
Events
|
|
38
39
|
} from "./chunk-AH7KYH2Z.mjs";
|
|
@@ -55,7 +56,7 @@ import {
|
|
|
55
56
|
} from "./chunk-HQMYRYMY.mjs";
|
|
56
57
|
import {
|
|
57
58
|
Role
|
|
58
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-5I54OXBG.mjs";
|
|
59
60
|
import {
|
|
60
61
|
GuildBan
|
|
61
62
|
} from "./chunk-UXIF75BV.mjs";
|
|
@@ -67,8 +68,7 @@ import {
|
|
|
67
68
|
import { EventEmitter } from "events";
|
|
68
69
|
import { REST } from "@fluxerjs/rest";
|
|
69
70
|
import { WebSocketManager } from "@fluxerjs/ws";
|
|
70
|
-
import { Routes as
|
|
71
|
-
import { Collection as Collection3 } from "@fluxerjs/collection";
|
|
71
|
+
import { Routes as Routes4 } from "@fluxerjs/types";
|
|
72
72
|
|
|
73
73
|
// src/client/ChannelManager.ts
|
|
74
74
|
import { Collection } from "@fluxerjs/collection";
|
|
@@ -93,7 +93,7 @@ var ChannelManager = class extends Collection {
|
|
|
93
93
|
const cached = this.get(channelId);
|
|
94
94
|
if (cached) return cached;
|
|
95
95
|
try {
|
|
96
|
-
const { Channel: Channel2 } = await import("./Channel-
|
|
96
|
+
const { Channel: Channel2 } = await import("./Channel-YB3LWDHZ.mjs");
|
|
97
97
|
const data = await this.client.rest.get(
|
|
98
98
|
Routes.channel(channelId)
|
|
99
99
|
);
|
|
@@ -190,7 +190,7 @@ var GuildManager = class extends Collection2 {
|
|
|
190
190
|
const cached = this.get(guildId);
|
|
191
191
|
if (cached) return cached;
|
|
192
192
|
try {
|
|
193
|
-
const { Guild: Guild2 } = await import("./Guild-
|
|
193
|
+
const { Guild: Guild2 } = await import("./Guild-MDW7KF33.mjs");
|
|
194
194
|
const data = await this.client.rest.get(
|
|
195
195
|
Routes2.guild(guildId)
|
|
196
196
|
);
|
|
@@ -206,6 +206,76 @@ var GuildManager = class extends Collection2 {
|
|
|
206
206
|
// src/client/Client.ts
|
|
207
207
|
import { emitDeprecationWarning as emitDeprecationWarning2, formatEmoji, parseEmoji } from "@fluxerjs/util";
|
|
208
208
|
|
|
209
|
+
// src/client/UsersManager.ts
|
|
210
|
+
import { Collection as Collection3 } from "@fluxerjs/collection";
|
|
211
|
+
import { Routes as Routes3 } from "@fluxerjs/types";
|
|
212
|
+
var UsersManager = class extends Collection3 {
|
|
213
|
+
constructor(client) {
|
|
214
|
+
super();
|
|
215
|
+
this.client = client;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Fetch a user by ID from the API.
|
|
219
|
+
* Updates cache if user already exists.
|
|
220
|
+
* @param userId - Snowflake of the user
|
|
221
|
+
* @returns The user
|
|
222
|
+
* @throws FluxerError (or REST error) if user not found
|
|
223
|
+
* @example
|
|
224
|
+
* const user = await client.users.fetch(userId);
|
|
225
|
+
* console.log(user.username);
|
|
226
|
+
*/
|
|
227
|
+
async fetch(userId) {
|
|
228
|
+
const data = await this.client.rest.get(Routes3.user(userId));
|
|
229
|
+
return this.client.getOrCreateUser(data);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Fetch a user with full profile and optional guild context.
|
|
233
|
+
* Returns user, global profile, server profile (when guildId), and member (when guildId).
|
|
234
|
+
* Ideal for userinfo commands.
|
|
235
|
+
* @param userId - Snowflake of the user
|
|
236
|
+
* @param options - Optional guildId for server profile and member data
|
|
237
|
+
* @returns User, raw data, profiles, and member (when in guild)
|
|
238
|
+
* @throws FluxerError (or REST error) if user not found
|
|
239
|
+
* @example
|
|
240
|
+
* const { user, globalProfile, serverProfile, member } = await client.users.fetchWithProfile(
|
|
241
|
+
* userId,
|
|
242
|
+
* { guildId: message.guildId ?? undefined },
|
|
243
|
+
* );
|
|
244
|
+
*/
|
|
245
|
+
async fetchWithProfile(userId, options) {
|
|
246
|
+
const guildId = options?.guildId ?? void 0;
|
|
247
|
+
const [userData, globalProfileData, serverProfileData, memberData] = await Promise.all([
|
|
248
|
+
this.client.rest.get(Routes3.user(userId)),
|
|
249
|
+
this.client.rest.get(Routes3.userProfile(userId)).catch(() => null),
|
|
250
|
+
guildId ? this.client.rest.get(Routes3.userProfile(userId, guildId)).catch(() => null) : Promise.resolve(null),
|
|
251
|
+
guildId ? this.client.rest.get(Routes3.guildMember(guildId, userId)).catch(() => null) : Promise.resolve(null)
|
|
252
|
+
]);
|
|
253
|
+
const user = this.client.getOrCreateUser(userData);
|
|
254
|
+
const globalProfile = globalProfileData && typeof globalProfileData === "object" ? globalProfileData : null;
|
|
255
|
+
const serverProfile = serverProfileData && typeof serverProfileData === "object" ? serverProfileData : null;
|
|
256
|
+
let member = null;
|
|
257
|
+
if (memberData && guildId) {
|
|
258
|
+
const guild = this.client.guilds.get(guildId) ?? await this.client.guilds.fetch(guildId);
|
|
259
|
+
if (guild) {
|
|
260
|
+
member = new GuildMember(
|
|
261
|
+
this.client,
|
|
262
|
+
{ ...memberData, guild_id: guildId },
|
|
263
|
+
guild
|
|
264
|
+
);
|
|
265
|
+
guild.members.set(member.id, member);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
user,
|
|
270
|
+
userData,
|
|
271
|
+
globalProfile,
|
|
272
|
+
serverProfile,
|
|
273
|
+
member,
|
|
274
|
+
memberData
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
|
|
209
279
|
// src/client/EventHandlerRegistry.ts
|
|
210
280
|
var handlers = /* @__PURE__ */ new Map();
|
|
211
281
|
handlers.set("MESSAGE_CREATE", async (client, d) => {
|
|
@@ -237,7 +307,7 @@ handlers.set("MESSAGE_DELETE", async (client, d) => {
|
|
|
237
307
|
});
|
|
238
308
|
handlers.set("MESSAGE_REACTION_ADD", async (client, d) => {
|
|
239
309
|
const data = d;
|
|
240
|
-
const { MessageReaction: MessageReaction2 } = await import("./MessageReaction-
|
|
310
|
+
const { MessageReaction: MessageReaction2 } = await import("./MessageReaction-GYQNJ6GX.mjs");
|
|
241
311
|
const reaction = new MessageReaction2(client, data);
|
|
242
312
|
const user = client.getOrCreateUser({
|
|
243
313
|
id: data.user_id,
|
|
@@ -256,7 +326,7 @@ handlers.set("MESSAGE_REACTION_ADD", async (client, d) => {
|
|
|
256
326
|
});
|
|
257
327
|
handlers.set("MESSAGE_REACTION_REMOVE", async (client, d) => {
|
|
258
328
|
const data = d;
|
|
259
|
-
const { MessageReaction: MessageReaction2 } = await import("./MessageReaction-
|
|
329
|
+
const { MessageReaction: MessageReaction2 } = await import("./MessageReaction-GYQNJ6GX.mjs");
|
|
260
330
|
const reaction = new MessageReaction2(client, data);
|
|
261
331
|
const user = client.getOrCreateUser({
|
|
262
332
|
id: data.user_id,
|
|
@@ -283,8 +353,8 @@ handlers.set("MESSAGE_REACTION_REMOVE_EMOJI", async (client, d) => {
|
|
|
283
353
|
);
|
|
284
354
|
});
|
|
285
355
|
handlers.set("GUILD_CREATE", async (client, d) => {
|
|
286
|
-
const { Guild: Guild2 } = await import("./Guild-
|
|
287
|
-
const { Channel: Channel2 } = await import("./Channel-
|
|
356
|
+
const { Guild: Guild2 } = await import("./Guild-MDW7KF33.mjs");
|
|
357
|
+
const { Channel: Channel2 } = await import("./Channel-YB3LWDHZ.mjs");
|
|
288
358
|
const raw = d;
|
|
289
359
|
const guildData = raw?.properties != null ? { ...raw.properties, roles: raw.roles } : raw;
|
|
290
360
|
const guild = new Guild2(client, guildData);
|
|
@@ -300,7 +370,7 @@ handlers.set("GUILD_CREATE", async (client, d) => {
|
|
|
300
370
|
}
|
|
301
371
|
});
|
|
302
372
|
handlers.set("GUILD_UPDATE", async (client, d) => {
|
|
303
|
-
const { Guild: Guild2 } = await import("./Guild-
|
|
373
|
+
const { Guild: Guild2 } = await import("./Guild-MDW7KF33.mjs");
|
|
304
374
|
const raw = d;
|
|
305
375
|
const guildData = raw?.properties != null ? { ...raw.properties, roles: raw.roles } : raw;
|
|
306
376
|
const old = client.guilds.get(guildData.id);
|
|
@@ -317,7 +387,7 @@ handlers.set("GUILD_DELETE", async (client, d) => {
|
|
|
317
387
|
}
|
|
318
388
|
});
|
|
319
389
|
handlers.set("CHANNEL_CREATE", async (client, d) => {
|
|
320
|
-
const { Channel: Channel2 } = await import("./Channel-
|
|
390
|
+
const { Channel: Channel2 } = await import("./Channel-YB3LWDHZ.mjs");
|
|
321
391
|
const ch = Channel2.from(client, d);
|
|
322
392
|
if (ch) {
|
|
323
393
|
client.channels.set(ch.id, ch);
|
|
@@ -325,7 +395,7 @@ handlers.set("CHANNEL_CREATE", async (client, d) => {
|
|
|
325
395
|
}
|
|
326
396
|
});
|
|
327
397
|
handlers.set("CHANNEL_UPDATE", async (client, d) => {
|
|
328
|
-
const { Channel: Channel2 } = await import("./Channel-
|
|
398
|
+
const { Channel: Channel2 } = await import("./Channel-YB3LWDHZ.mjs");
|
|
329
399
|
const ch = d;
|
|
330
400
|
const oldCh = client.channels.get(ch.id);
|
|
331
401
|
const newCh = Channel2.from(client, ch);
|
|
@@ -411,7 +481,7 @@ handlers.set("GUILD_ROLE_CREATE", async (client, d) => {
|
|
|
411
481
|
const data = d;
|
|
412
482
|
const guild = client.guilds.get(data.guild_id);
|
|
413
483
|
if (guild) {
|
|
414
|
-
const { Role: Role2 } = await import("./Role-
|
|
484
|
+
const { Role: Role2 } = await import("./Role-N2ZEMRUQ.mjs");
|
|
415
485
|
guild.roles.set(data.role.id, new Role2(client, data.role, guild.id));
|
|
416
486
|
}
|
|
417
487
|
client.emit(Events.GuildRoleCreate, data);
|
|
@@ -420,8 +490,13 @@ handlers.set("GUILD_ROLE_UPDATE", async (client, d) => {
|
|
|
420
490
|
const data = d;
|
|
421
491
|
const guild = client.guilds.get(data.guild_id);
|
|
422
492
|
if (guild) {
|
|
423
|
-
const
|
|
424
|
-
|
|
493
|
+
const existing = guild.roles.get(data.role.id);
|
|
494
|
+
if (existing) {
|
|
495
|
+
existing._patch(data.role);
|
|
496
|
+
} else {
|
|
497
|
+
const { Role: Role2 } = await import("./Role-N2ZEMRUQ.mjs");
|
|
498
|
+
guild.roles.set(data.role.id, new Role2(client, data.role, guild.id));
|
|
499
|
+
}
|
|
425
500
|
}
|
|
426
501
|
client.emit(Events.GuildRoleUpdate, data);
|
|
427
502
|
});
|
|
@@ -498,6 +573,10 @@ var Client = class extends EventEmitter {
|
|
|
498
573
|
get: () => this.guilds,
|
|
499
574
|
configurable: true
|
|
500
575
|
});
|
|
576
|
+
Object.defineProperty(this.users, "cache", {
|
|
577
|
+
get: () => this.users,
|
|
578
|
+
configurable: true
|
|
579
|
+
});
|
|
501
580
|
this.rest = new REST({
|
|
502
581
|
api: options.rest?.api ?? "https://api.fluxer.app",
|
|
503
582
|
version: options.rest?.version ?? "1",
|
|
@@ -507,7 +586,7 @@ var Client = class extends EventEmitter {
|
|
|
507
586
|
rest;
|
|
508
587
|
guilds = new GuildManager(this);
|
|
509
588
|
channels = new ChannelManager(this);
|
|
510
|
-
users = new
|
|
589
|
+
users = new UsersManager(this);
|
|
511
590
|
/** Typed event handlers. Use client.events.MessageReactionAdd((reaction, user, messageId, channelId, emoji, userId) => {...}) or client.on(Events.MessageReactionAdd, ...). */
|
|
512
591
|
events;
|
|
513
592
|
/** The authenticated bot user. Null until READY is received. */
|
|
@@ -534,7 +613,7 @@ var Client = class extends EventEmitter {
|
|
|
534
613
|
if (parsed.id) return formatEmoji(parsed);
|
|
535
614
|
if (!/^\w+$/.test(parsed.name)) return encodeURIComponent(parsed.name);
|
|
536
615
|
if (guildId) {
|
|
537
|
-
const emojis = await this.rest.get(
|
|
616
|
+
const emojis = await this.rest.get(Routes4.guildEmojis(guildId));
|
|
538
617
|
const list = Array.isArray(emojis) ? emojis : Object.values(emojis ?? {});
|
|
539
618
|
const found = list.find((e) => e.name && e.name.toLowerCase() === parsed.name.toLowerCase());
|
|
540
619
|
if (found) return formatEmoji({ ...parsed, id: found.id, animated: found.animated });
|
|
@@ -651,9 +730,9 @@ var Client = class extends EventEmitter {
|
|
|
651
730
|
async ({
|
|
652
731
|
data
|
|
653
732
|
}) => {
|
|
654
|
-
const { ClientUser: ClientUser2 } = await import("./ClientUser-
|
|
655
|
-
const { Guild: Guild2 } = await import("./Guild-
|
|
656
|
-
const { Channel: Channel2 } = await import("./Channel-
|
|
733
|
+
const { ClientUser: ClientUser2 } = await import("./ClientUser-QQXLZ5WP.mjs");
|
|
734
|
+
const { Guild: Guild2 } = await import("./Guild-MDW7KF33.mjs");
|
|
735
|
+
const { Channel: Channel2 } = await import("./Channel-YB3LWDHZ.mjs");
|
|
657
736
|
this.user = new ClientUser2(this, data.user);
|
|
658
737
|
for (const g of data.guilds ?? []) {
|
|
659
738
|
const guildData = g && typeof g === "object" && "properties" in g && g.properties ? {
|
|
@@ -701,12 +780,12 @@ var Client = class extends EventEmitter {
|
|
|
701
780
|
return this.readyAt !== null && this.user !== null;
|
|
702
781
|
}
|
|
703
782
|
static get Routes() {
|
|
704
|
-
return
|
|
783
|
+
return Routes4;
|
|
705
784
|
}
|
|
706
785
|
};
|
|
707
786
|
|
|
708
787
|
// src/structures/GuildEmoji.ts
|
|
709
|
-
import { Routes as
|
|
788
|
+
import { Routes as Routes5 } from "@fluxerjs/types";
|
|
710
789
|
var GuildEmoji = class extends Base {
|
|
711
790
|
client;
|
|
712
791
|
id;
|
|
@@ -733,7 +812,7 @@ var GuildEmoji = class extends Base {
|
|
|
733
812
|
}
|
|
734
813
|
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
735
814
|
async delete() {
|
|
736
|
-
await this.client.rest.delete(
|
|
815
|
+
await this.client.rest.delete(Routes5.guildEmoji(this.guildId, this.id), {
|
|
737
816
|
auth: true
|
|
738
817
|
});
|
|
739
818
|
}
|
|
@@ -742,7 +821,7 @@ var GuildEmoji = class extends Base {
|
|
|
742
821
|
* Requires Manage Emojis and Stickers permission.
|
|
743
822
|
*/
|
|
744
823
|
async edit(options) {
|
|
745
|
-
const data = await this.client.rest.patch(
|
|
824
|
+
const data = await this.client.rest.patch(Routes5.guildEmoji(this.guildId, this.id), {
|
|
746
825
|
body: options,
|
|
747
826
|
auth: true
|
|
748
827
|
});
|
|
@@ -752,7 +831,7 @@ var GuildEmoji = class extends Base {
|
|
|
752
831
|
};
|
|
753
832
|
|
|
754
833
|
// src/structures/GuildSticker.ts
|
|
755
|
-
import { Routes as
|
|
834
|
+
import { Routes as Routes6 } from "@fluxerjs/types";
|
|
756
835
|
var GuildSticker = class extends Base {
|
|
757
836
|
client;
|
|
758
837
|
id;
|
|
@@ -779,7 +858,7 @@ var GuildSticker = class extends Base {
|
|
|
779
858
|
}
|
|
780
859
|
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
781
860
|
async delete() {
|
|
782
|
-
await this.client.rest.delete(
|
|
861
|
+
await this.client.rest.delete(Routes6.guildSticker(this.guildId, this.id), {
|
|
783
862
|
auth: true
|
|
784
863
|
});
|
|
785
864
|
}
|
|
@@ -788,7 +867,7 @@ var GuildSticker = class extends Base {
|
|
|
788
867
|
* Requires Manage Emojis and Stickers permission.
|
|
789
868
|
*/
|
|
790
869
|
async edit(options) {
|
|
791
|
-
const data = await this.client.rest.patch(
|
|
870
|
+
const data = await this.client.rest.patch(Routes6.guildSticker(this.guildId, this.id), {
|
|
792
871
|
body: options,
|
|
793
872
|
auth: true
|
|
794
873
|
});
|
|
@@ -801,11 +880,14 @@ var GuildSticker = class extends Base {
|
|
|
801
880
|
|
|
802
881
|
// src/index.ts
|
|
803
882
|
import { EmbedBuilder, MessagePayload, AttachmentBuilder } from "@fluxerjs/builders";
|
|
804
|
-
import { Routes as
|
|
883
|
+
import { Routes as Routes7, GatewayOpcodes, MessageAttachmentFlags } from "@fluxerjs/types";
|
|
805
884
|
import { resolveTenorToImageUrl } from "@fluxerjs/util";
|
|
806
885
|
import {
|
|
807
886
|
PermissionsBitField,
|
|
808
|
-
PermissionFlags
|
|
887
|
+
PermissionFlags,
|
|
888
|
+
resolvePermissionsToBitfield,
|
|
889
|
+
UserFlagsBitField,
|
|
890
|
+
UserFlagsBits
|
|
809
891
|
} from "@fluxerjs/util";
|
|
810
892
|
export {
|
|
811
893
|
AttachmentBuilder,
|
|
@@ -826,6 +908,7 @@ export {
|
|
|
826
908
|
GuildChannel,
|
|
827
909
|
GuildEmoji,
|
|
828
910
|
GuildMember,
|
|
911
|
+
GuildMemberManager,
|
|
829
912
|
GuildSticker,
|
|
830
913
|
Invite,
|
|
831
914
|
LinkChannel,
|
|
@@ -839,9 +922,12 @@ export {
|
|
|
839
922
|
PermissionsBitField,
|
|
840
923
|
ReactionCollector,
|
|
841
924
|
Role,
|
|
842
|
-
|
|
925
|
+
Routes7 as Routes,
|
|
843
926
|
TextChannel,
|
|
844
927
|
User,
|
|
928
|
+
UserFlagsBitField,
|
|
929
|
+
UserFlagsBits,
|
|
930
|
+
UsersManager,
|
|
845
931
|
VoiceChannel,
|
|
846
932
|
Webhook,
|
|
847
933
|
cdnAvatarURL,
|
|
@@ -850,5 +936,6 @@ export {
|
|
|
850
936
|
cdnDisplayAvatarURL,
|
|
851
937
|
cdnMemberAvatarURL,
|
|
852
938
|
cdnMemberBannerURL,
|
|
939
|
+
resolvePermissionsToBitfield,
|
|
853
940
|
resolveTenorToImageUrl
|
|
854
941
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.1.
|
|
6
|
+
"version": "1.1.2",
|
|
7
7
|
"description": "A fully-featured SDK for Fluxer bots",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@fluxerjs/rest": "1.1.
|
|
38
|
-
"@fluxerjs/ws": "1.1.
|
|
39
|
-
"@fluxerjs/
|
|
40
|
-
"@fluxerjs/
|
|
41
|
-
"@fluxerjs/
|
|
42
|
-
"@fluxerjs/
|
|
37
|
+
"@fluxerjs/rest": "1.1.2",
|
|
38
|
+
"@fluxerjs/ws": "1.1.2",
|
|
39
|
+
"@fluxerjs/builders": "1.1.2",
|
|
40
|
+
"@fluxerjs/util": "1.1.2",
|
|
41
|
+
"@fluxerjs/types": "1.1.2",
|
|
42
|
+
"@fluxerjs/collection": "1.1.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^20.0.0",
|
package/dist/chunk-DQ4TNBPG.mjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Base
|
|
3
|
-
} from "./chunk-XNS4O6QJ.mjs";
|
|
4
|
-
|
|
5
|
-
// src/structures/Role.ts
|
|
6
|
-
import { PermissionFlags } from "@fluxerjs/util";
|
|
7
|
-
var Role = class extends Base {
|
|
8
|
-
client;
|
|
9
|
-
id;
|
|
10
|
-
guildId;
|
|
11
|
-
name;
|
|
12
|
-
color;
|
|
13
|
-
position;
|
|
14
|
-
permissions;
|
|
15
|
-
hoist;
|
|
16
|
-
mentionable;
|
|
17
|
-
unicodeEmoji;
|
|
18
|
-
/** Separately sorted position for hoisted roles. Null if not set. */
|
|
19
|
-
hoistPosition;
|
|
20
|
-
/** @param client - The client instance */
|
|
21
|
-
/** @param data - API role from GET /guilds/{id}/roles or gateway role events */
|
|
22
|
-
/** @param guildId - The guild this role belongs to */
|
|
23
|
-
constructor(client, data, guildId) {
|
|
24
|
-
super();
|
|
25
|
-
this.client = client;
|
|
26
|
-
this.id = data.id;
|
|
27
|
-
this.guildId = guildId;
|
|
28
|
-
this.name = data.name;
|
|
29
|
-
this.color = data.color;
|
|
30
|
-
this.position = data.position;
|
|
31
|
-
this.permissions = data.permissions;
|
|
32
|
-
this.hoist = !!data.hoist;
|
|
33
|
-
this.mentionable = !!data.mentionable;
|
|
34
|
-
this.unicodeEmoji = data.unicode_emoji ?? null;
|
|
35
|
-
this.hoistPosition = data.hoist_position ?? null;
|
|
36
|
-
}
|
|
37
|
-
/** Returns a mention string (e.g. `<@&123456>`). */
|
|
38
|
-
toString() {
|
|
39
|
-
return `<@&${this.id}>`;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Check if this role has a permission. Administrator grants all permissions.
|
|
43
|
-
* @param permission - Permission flag, name, or resolvable
|
|
44
|
-
* @returns true if the role has the permission
|
|
45
|
-
* @example
|
|
46
|
-
* if (role.has(PermissionFlags.BanMembers)) { ... }
|
|
47
|
-
* if (role.has('ManageChannels')) { ... }
|
|
48
|
-
*/
|
|
49
|
-
has(permission) {
|
|
50
|
-
const perm = typeof permission === "number" ? permission : PermissionFlags[permission];
|
|
51
|
-
if (perm === void 0) return false;
|
|
52
|
-
const permNum = Number(perm);
|
|
53
|
-
const rolePerms = BigInt(this.permissions);
|
|
54
|
-
const permBig = BigInt(permNum);
|
|
55
|
-
if (permBig < 0) return false;
|
|
56
|
-
if ((rolePerms & BigInt(PermissionFlags.Administrator)) !== 0n) return true;
|
|
57
|
-
return (rolePerms & permBig) === permBig;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export {
|
|
62
|
-
Role
|
|
63
|
-
};
|