@fluxerjs/core 1.1.0 → 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/LICENSE +203 -0
- package/dist/{Channel-WJZZSNML.mjs → Channel-YB3LWDHZ.mjs} +2 -1
- package/dist/{ClientUser-DJO2FS7P.mjs → ClientUser-QQXLZ5WP.mjs} +1 -1
- package/dist/{Guild-2P77HBQM.mjs → Guild-MDW7KF33.mjs} +3 -2
- package/dist/{MessageReaction-V4UZ7OXE.mjs → MessageReaction-GYQNJ6GX.mjs} +2 -1
- package/dist/{Role-5MWSGL66.mjs → Role-N2ZEMRUQ.mjs} +1 -1
- package/dist/chunk-5I54OXBG.mjs +111 -0
- package/dist/{chunk-JHNKZIHY.mjs → chunk-G2YVDCRB.mjs} +2 -2
- package/dist/{chunk-4XJIM6SC.mjs → chunk-KOTF4TTZ.mjs} +117 -29
- package/dist/chunk-PU73YRKJ.mjs +27 -0
- package/dist/{chunk-CEABHTAF.mjs → chunk-YL5S4W6R.mjs} +22 -1
- package/dist/{chunk-LU2SNC5G.mjs → chunk-ZKKBIQBA.mjs} +33 -12
- package/dist/index.d.mts +134 -6
- package/dist/index.d.ts +134 -6
- package/dist/index.js +548 -254
- package/dist/index.mjs +130 -38
- package/package.json +8 -8
- package/dist/chunk-DQ4TNBPG.mjs +0 -63
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-4XJIM6SC.mjs";
|
|
2
|
+
Guild,
|
|
3
|
+
GuildMemberManager
|
|
4
|
+
} from "./chunk-KOTF4TTZ.mjs";
|
|
6
5
|
import {
|
|
7
6
|
MessageReaction
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YL5S4W6R.mjs";
|
|
9
8
|
import {
|
|
10
9
|
ClientUser,
|
|
11
10
|
User
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-G2YVDCRB.mjs";
|
|
13
12
|
import {
|
|
14
13
|
Message,
|
|
15
14
|
ReactionCollector
|
|
@@ -30,7 +29,11 @@ import {
|
|
|
30
29
|
MessageManager,
|
|
31
30
|
TextChannel,
|
|
32
31
|
VoiceChannel
|
|
33
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-ZKKBIQBA.mjs";
|
|
33
|
+
import {
|
|
34
|
+
ErrorCodes,
|
|
35
|
+
FluxerError
|
|
36
|
+
} from "./chunk-PU73YRKJ.mjs";
|
|
34
37
|
import {
|
|
35
38
|
Events
|
|
36
39
|
} from "./chunk-AH7KYH2Z.mjs";
|
|
@@ -53,7 +56,7 @@ import {
|
|
|
53
56
|
} from "./chunk-HQMYRYMY.mjs";
|
|
54
57
|
import {
|
|
55
58
|
Role
|
|
56
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-5I54OXBG.mjs";
|
|
57
60
|
import {
|
|
58
61
|
GuildBan
|
|
59
62
|
} from "./chunk-UXIF75BV.mjs";
|
|
@@ -65,8 +68,7 @@ import {
|
|
|
65
68
|
import { EventEmitter } from "events";
|
|
66
69
|
import { REST } from "@fluxerjs/rest";
|
|
67
70
|
import { WebSocketManager } from "@fluxerjs/ws";
|
|
68
|
-
import { Routes as
|
|
69
|
-
import { Collection as Collection3 } from "@fluxerjs/collection";
|
|
71
|
+
import { Routes as Routes4 } from "@fluxerjs/types";
|
|
70
72
|
|
|
71
73
|
// src/client/ChannelManager.ts
|
|
72
74
|
import { Collection } from "@fluxerjs/collection";
|
|
@@ -91,7 +93,7 @@ var ChannelManager = class extends Collection {
|
|
|
91
93
|
const cached = this.get(channelId);
|
|
92
94
|
if (cached) return cached;
|
|
93
95
|
try {
|
|
94
|
-
const { Channel: Channel2 } = await import("./Channel-
|
|
96
|
+
const { Channel: Channel2 } = await import("./Channel-YB3LWDHZ.mjs");
|
|
95
97
|
const data = await this.client.rest.get(
|
|
96
98
|
Routes.channel(channelId)
|
|
97
99
|
);
|
|
@@ -188,7 +190,7 @@ var GuildManager = class extends Collection2 {
|
|
|
188
190
|
const cached = this.get(guildId);
|
|
189
191
|
if (cached) return cached;
|
|
190
192
|
try {
|
|
191
|
-
const { Guild: Guild2 } = await import("./Guild-
|
|
193
|
+
const { Guild: Guild2 } = await import("./Guild-MDW7KF33.mjs");
|
|
192
194
|
const data = await this.client.rest.get(
|
|
193
195
|
Routes2.guild(guildId)
|
|
194
196
|
);
|
|
@@ -204,6 +206,76 @@ var GuildManager = class extends Collection2 {
|
|
|
204
206
|
// src/client/Client.ts
|
|
205
207
|
import { emitDeprecationWarning as emitDeprecationWarning2, formatEmoji, parseEmoji } from "@fluxerjs/util";
|
|
206
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
|
+
|
|
207
279
|
// src/client/EventHandlerRegistry.ts
|
|
208
280
|
var handlers = /* @__PURE__ */ new Map();
|
|
209
281
|
handlers.set("MESSAGE_CREATE", async (client, d) => {
|
|
@@ -235,7 +307,7 @@ handlers.set("MESSAGE_DELETE", async (client, d) => {
|
|
|
235
307
|
});
|
|
236
308
|
handlers.set("MESSAGE_REACTION_ADD", async (client, d) => {
|
|
237
309
|
const data = d;
|
|
238
|
-
const { MessageReaction: MessageReaction2 } = await import("./MessageReaction-
|
|
310
|
+
const { MessageReaction: MessageReaction2 } = await import("./MessageReaction-GYQNJ6GX.mjs");
|
|
239
311
|
const reaction = new MessageReaction2(client, data);
|
|
240
312
|
const user = client.getOrCreateUser({
|
|
241
313
|
id: data.user_id,
|
|
@@ -254,7 +326,7 @@ handlers.set("MESSAGE_REACTION_ADD", async (client, d) => {
|
|
|
254
326
|
});
|
|
255
327
|
handlers.set("MESSAGE_REACTION_REMOVE", async (client, d) => {
|
|
256
328
|
const data = d;
|
|
257
|
-
const { MessageReaction: MessageReaction2 } = await import("./MessageReaction-
|
|
329
|
+
const { MessageReaction: MessageReaction2 } = await import("./MessageReaction-GYQNJ6GX.mjs");
|
|
258
330
|
const reaction = new MessageReaction2(client, data);
|
|
259
331
|
const user = client.getOrCreateUser({
|
|
260
332
|
id: data.user_id,
|
|
@@ -281,8 +353,8 @@ handlers.set("MESSAGE_REACTION_REMOVE_EMOJI", async (client, d) => {
|
|
|
281
353
|
);
|
|
282
354
|
});
|
|
283
355
|
handlers.set("GUILD_CREATE", async (client, d) => {
|
|
284
|
-
const { Guild: Guild2 } = await import("./Guild-
|
|
285
|
-
const { Channel: Channel2 } = await import("./Channel-
|
|
356
|
+
const { Guild: Guild2 } = await import("./Guild-MDW7KF33.mjs");
|
|
357
|
+
const { Channel: Channel2 } = await import("./Channel-YB3LWDHZ.mjs");
|
|
286
358
|
const raw = d;
|
|
287
359
|
const guildData = raw?.properties != null ? { ...raw.properties, roles: raw.roles } : raw;
|
|
288
360
|
const guild = new Guild2(client, guildData);
|
|
@@ -298,7 +370,7 @@ handlers.set("GUILD_CREATE", async (client, d) => {
|
|
|
298
370
|
}
|
|
299
371
|
});
|
|
300
372
|
handlers.set("GUILD_UPDATE", async (client, d) => {
|
|
301
|
-
const { Guild: Guild2 } = await import("./Guild-
|
|
373
|
+
const { Guild: Guild2 } = await import("./Guild-MDW7KF33.mjs");
|
|
302
374
|
const raw = d;
|
|
303
375
|
const guildData = raw?.properties != null ? { ...raw.properties, roles: raw.roles } : raw;
|
|
304
376
|
const old = client.guilds.get(guildData.id);
|
|
@@ -315,7 +387,7 @@ handlers.set("GUILD_DELETE", async (client, d) => {
|
|
|
315
387
|
}
|
|
316
388
|
});
|
|
317
389
|
handlers.set("CHANNEL_CREATE", async (client, d) => {
|
|
318
|
-
const { Channel: Channel2 } = await import("./Channel-
|
|
390
|
+
const { Channel: Channel2 } = await import("./Channel-YB3LWDHZ.mjs");
|
|
319
391
|
const ch = Channel2.from(client, d);
|
|
320
392
|
if (ch) {
|
|
321
393
|
client.channels.set(ch.id, ch);
|
|
@@ -323,7 +395,7 @@ handlers.set("CHANNEL_CREATE", async (client, d) => {
|
|
|
323
395
|
}
|
|
324
396
|
});
|
|
325
397
|
handlers.set("CHANNEL_UPDATE", async (client, d) => {
|
|
326
|
-
const { Channel: Channel2 } = await import("./Channel-
|
|
398
|
+
const { Channel: Channel2 } = await import("./Channel-YB3LWDHZ.mjs");
|
|
327
399
|
const ch = d;
|
|
328
400
|
const oldCh = client.channels.get(ch.id);
|
|
329
401
|
const newCh = Channel2.from(client, ch);
|
|
@@ -409,7 +481,7 @@ handlers.set("GUILD_ROLE_CREATE", async (client, d) => {
|
|
|
409
481
|
const data = d;
|
|
410
482
|
const guild = client.guilds.get(data.guild_id);
|
|
411
483
|
if (guild) {
|
|
412
|
-
const { Role: Role2 } = await import("./Role-
|
|
484
|
+
const { Role: Role2 } = await import("./Role-N2ZEMRUQ.mjs");
|
|
413
485
|
guild.roles.set(data.role.id, new Role2(client, data.role, guild.id));
|
|
414
486
|
}
|
|
415
487
|
client.emit(Events.GuildRoleCreate, data);
|
|
@@ -418,8 +490,13 @@ handlers.set("GUILD_ROLE_UPDATE", async (client, d) => {
|
|
|
418
490
|
const data = d;
|
|
419
491
|
const guild = client.guilds.get(data.guild_id);
|
|
420
492
|
if (guild) {
|
|
421
|
-
const
|
|
422
|
-
|
|
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
|
+
}
|
|
423
500
|
}
|
|
424
501
|
client.emit(Events.GuildRoleUpdate, data);
|
|
425
502
|
});
|
|
@@ -496,6 +573,10 @@ var Client = class extends EventEmitter {
|
|
|
496
573
|
get: () => this.guilds,
|
|
497
574
|
configurable: true
|
|
498
575
|
});
|
|
576
|
+
Object.defineProperty(this.users, "cache", {
|
|
577
|
+
get: () => this.users,
|
|
578
|
+
configurable: true
|
|
579
|
+
});
|
|
499
580
|
this.rest = new REST({
|
|
500
581
|
api: options.rest?.api ?? "https://api.fluxer.app",
|
|
501
582
|
version: options.rest?.version ?? "1",
|
|
@@ -505,7 +586,7 @@ var Client = class extends EventEmitter {
|
|
|
505
586
|
rest;
|
|
506
587
|
guilds = new GuildManager(this);
|
|
507
588
|
channels = new ChannelManager(this);
|
|
508
|
-
users = new
|
|
589
|
+
users = new UsersManager(this);
|
|
509
590
|
/** Typed event handlers. Use client.events.MessageReactionAdd((reaction, user, messageId, channelId, emoji, userId) => {...}) or client.on(Events.MessageReactionAdd, ...). */
|
|
510
591
|
events;
|
|
511
592
|
/** The authenticated bot user. Null until READY is received. */
|
|
@@ -525,11 +606,14 @@ var Client = class extends EventEmitter {
|
|
|
525
606
|
if (typeof emoji === "object" && emoji.id) {
|
|
526
607
|
return formatEmoji({ name: emoji.name, id: emoji.id, animated: emoji.animated });
|
|
527
608
|
}
|
|
528
|
-
const parsed = parseEmoji(
|
|
609
|
+
const parsed = parseEmoji(
|
|
610
|
+
typeof emoji === "string" ? emoji : emoji.id ? `:${emoji.name}:` : emoji.name
|
|
611
|
+
);
|
|
529
612
|
if (!parsed) throw new Error("Invalid emoji");
|
|
530
613
|
if (parsed.id) return formatEmoji(parsed);
|
|
614
|
+
if (!/^\w+$/.test(parsed.name)) return encodeURIComponent(parsed.name);
|
|
531
615
|
if (guildId) {
|
|
532
|
-
const emojis = await this.rest.get(
|
|
616
|
+
const emojis = await this.rest.get(Routes4.guildEmojis(guildId));
|
|
533
617
|
const list = Array.isArray(emojis) ? emojis : Object.values(emojis ?? {});
|
|
534
618
|
const found = list.find((e) => e.name && e.name.toLowerCase() === parsed.name.toLowerCase());
|
|
535
619
|
if (found) return formatEmoji({ ...parsed, id: found.id, animated: found.animated });
|
|
@@ -646,9 +730,9 @@ var Client = class extends EventEmitter {
|
|
|
646
730
|
async ({
|
|
647
731
|
data
|
|
648
732
|
}) => {
|
|
649
|
-
const { ClientUser: ClientUser2 } = await import("./ClientUser-
|
|
650
|
-
const { Guild: Guild2 } = await import("./Guild-
|
|
651
|
-
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");
|
|
652
736
|
this.user = new ClientUser2(this, data.user);
|
|
653
737
|
for (const g of data.guilds ?? []) {
|
|
654
738
|
const guildData = g && typeof g === "object" && "properties" in g && g.properties ? {
|
|
@@ -696,12 +780,12 @@ var Client = class extends EventEmitter {
|
|
|
696
780
|
return this.readyAt !== null && this.user !== null;
|
|
697
781
|
}
|
|
698
782
|
static get Routes() {
|
|
699
|
-
return
|
|
783
|
+
return Routes4;
|
|
700
784
|
}
|
|
701
785
|
};
|
|
702
786
|
|
|
703
787
|
// src/structures/GuildEmoji.ts
|
|
704
|
-
import { Routes as
|
|
788
|
+
import { Routes as Routes5 } from "@fluxerjs/types";
|
|
705
789
|
var GuildEmoji = class extends Base {
|
|
706
790
|
client;
|
|
707
791
|
id;
|
|
@@ -728,7 +812,7 @@ var GuildEmoji = class extends Base {
|
|
|
728
812
|
}
|
|
729
813
|
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
730
814
|
async delete() {
|
|
731
|
-
await this.client.rest.delete(
|
|
815
|
+
await this.client.rest.delete(Routes5.guildEmoji(this.guildId, this.id), {
|
|
732
816
|
auth: true
|
|
733
817
|
});
|
|
734
818
|
}
|
|
@@ -737,7 +821,7 @@ var GuildEmoji = class extends Base {
|
|
|
737
821
|
* Requires Manage Emojis and Stickers permission.
|
|
738
822
|
*/
|
|
739
823
|
async edit(options) {
|
|
740
|
-
const data = await this.client.rest.patch(
|
|
824
|
+
const data = await this.client.rest.patch(Routes5.guildEmoji(this.guildId, this.id), {
|
|
741
825
|
body: options,
|
|
742
826
|
auth: true
|
|
743
827
|
});
|
|
@@ -747,7 +831,7 @@ var GuildEmoji = class extends Base {
|
|
|
747
831
|
};
|
|
748
832
|
|
|
749
833
|
// src/structures/GuildSticker.ts
|
|
750
|
-
import { Routes as
|
|
834
|
+
import { Routes as Routes6 } from "@fluxerjs/types";
|
|
751
835
|
var GuildSticker = class extends Base {
|
|
752
836
|
client;
|
|
753
837
|
id;
|
|
@@ -774,7 +858,7 @@ var GuildSticker = class extends Base {
|
|
|
774
858
|
}
|
|
775
859
|
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
776
860
|
async delete() {
|
|
777
|
-
await this.client.rest.delete(
|
|
861
|
+
await this.client.rest.delete(Routes6.guildSticker(this.guildId, this.id), {
|
|
778
862
|
auth: true
|
|
779
863
|
});
|
|
780
864
|
}
|
|
@@ -783,7 +867,7 @@ var GuildSticker = class extends Base {
|
|
|
783
867
|
* Requires Manage Emojis and Stickers permission.
|
|
784
868
|
*/
|
|
785
869
|
async edit(options) {
|
|
786
|
-
const data = await this.client.rest.patch(
|
|
870
|
+
const data = await this.client.rest.patch(Routes6.guildSticker(this.guildId, this.id), {
|
|
787
871
|
body: options,
|
|
788
872
|
auth: true
|
|
789
873
|
});
|
|
@@ -796,11 +880,14 @@ var GuildSticker = class extends Base {
|
|
|
796
880
|
|
|
797
881
|
// src/index.ts
|
|
798
882
|
import { EmbedBuilder, MessagePayload, AttachmentBuilder } from "@fluxerjs/builders";
|
|
799
|
-
import { Routes as
|
|
883
|
+
import { Routes as Routes7, GatewayOpcodes, MessageAttachmentFlags } from "@fluxerjs/types";
|
|
800
884
|
import { resolveTenorToImageUrl } from "@fluxerjs/util";
|
|
801
885
|
import {
|
|
802
886
|
PermissionsBitField,
|
|
803
|
-
PermissionFlags
|
|
887
|
+
PermissionFlags,
|
|
888
|
+
resolvePermissionsToBitfield,
|
|
889
|
+
UserFlagsBitField,
|
|
890
|
+
UserFlagsBits
|
|
804
891
|
} from "@fluxerjs/util";
|
|
805
892
|
export {
|
|
806
893
|
AttachmentBuilder,
|
|
@@ -821,6 +908,7 @@ export {
|
|
|
821
908
|
GuildChannel,
|
|
822
909
|
GuildEmoji,
|
|
823
910
|
GuildMember,
|
|
911
|
+
GuildMemberManager,
|
|
824
912
|
GuildSticker,
|
|
825
913
|
Invite,
|
|
826
914
|
LinkChannel,
|
|
@@ -834,9 +922,12 @@ export {
|
|
|
834
922
|
PermissionsBitField,
|
|
835
923
|
ReactionCollector,
|
|
836
924
|
Role,
|
|
837
|
-
|
|
925
|
+
Routes7 as Routes,
|
|
838
926
|
TextChannel,
|
|
839
927
|
User,
|
|
928
|
+
UserFlagsBitField,
|
|
929
|
+
UserFlagsBits,
|
|
930
|
+
UsersManager,
|
|
840
931
|
VoiceChannel,
|
|
841
932
|
Webhook,
|
|
842
933
|
cdnAvatarURL,
|
|
@@ -845,5 +936,6 @@ export {
|
|
|
845
936
|
cdnDisplayAvatarURL,
|
|
846
937
|
cdnMemberAvatarURL,
|
|
847
938
|
cdnMemberBannerURL,
|
|
939
|
+
resolvePermissionsToBitfield,
|
|
848
940
|
resolveTenorToImageUrl
|
|
849
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",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"bot",
|
|
20
20
|
"api"
|
|
21
21
|
],
|
|
22
|
-
"license": "
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
23
|
"main": "./dist/index.js",
|
|
24
24
|
"module": "./dist/index.mjs",
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@fluxerjs/
|
|
38
|
-
"@fluxerjs/
|
|
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
|
-
};
|