@fluxerjs/core 1.0.7 → 1.0.9

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.
Files changed (117) hide show
  1. package/dist/{Channel-OSOB6ELO.mjs → Channel-ICWNKXBR.mjs} +1 -1
  2. package/dist/{ClientUser-RNDKHQ3Z.mjs → ClientUser-WWXUMO5O.mjs} +1 -2
  3. package/dist/{Guild-GOQZ7XP4.mjs → Guild-TM6YGJWB.mjs} +3 -1
  4. package/dist/GuildBan-M4PA3HAA.mjs +7 -0
  5. package/dist/{GuildMember-BJJNCL6W.mjs → GuildMember-RZWZ3OCG.mjs} +1 -2
  6. package/dist/{Webhook-AG6QFM2I.mjs → Invite-UM5BU5A6.mjs} +3 -3
  7. package/dist/{Message-QXPHQOVC.mjs → Message-6IYEYSV6.mjs} +1 -2
  8. package/dist/MessageReaction-XRPYZDSC.mjs +7 -0
  9. package/dist/{Webhook-NUQCJAWZ.mjs → Role-SVLWIAMN.mjs} +3 -3
  10. package/dist/{Webhook-2RHBXH7R.mjs → Webhook-32VJD4AL.mjs} +1 -1
  11. package/dist/{chunk-T2NSVWBH.mjs → chunk-53Y37KRG.mjs} +35 -1
  12. package/dist/chunk-DSPSRPHF.mjs +200 -0
  13. package/dist/{chunk-WYSHH4LR.mjs → chunk-FJS5FBXO.mjs} +98 -6
  14. package/dist/{chunk-J3EIGOXQ.mjs → chunk-GCIJYVRC.mjs} +20 -6
  15. package/dist/{chunk-NISGA2YZ.mjs → chunk-GFUJVQ7L.mjs} +13 -4
  16. package/dist/chunk-HBF5QEDH.mjs +42 -0
  17. package/dist/chunk-QEXIYXXU.mjs +62 -0
  18. package/dist/chunk-RCP27MRC.mjs +33 -0
  19. package/dist/chunk-SQVCCSNN.mjs +41 -0
  20. package/dist/chunk-X77DFNE3.mjs +136 -0
  21. package/dist/index.d.mts +520 -55
  22. package/dist/index.d.ts +520 -55
  23. package/dist/index.js +1333 -404
  24. package/dist/index.mjs +616 -189
  25. package/package.json +27 -8
  26. package/dist/Channel-2WNJ445K.mjs +0 -17
  27. package/dist/Channel-BEZOW4VC.mjs +0 -17
  28. package/dist/Channel-DPLLHL7Y.mjs +0 -19
  29. package/dist/Channel-HM2UY4DN.mjs +0 -17
  30. package/dist/Channel-IKL3SJXN.mjs +0 -17
  31. package/dist/Channel-KILNV5V3.mjs +0 -17
  32. package/dist/Channel-KOTARBSF.mjs +0 -17
  33. package/dist/Channel-ON7O3D3M.mjs +0 -17
  34. package/dist/Channel-TOAQGSRX.mjs +0 -17
  35. package/dist/Channel-VENHOL7S.mjs +0 -17
  36. package/dist/Channel-YVGPVOVB.mjs +0 -17
  37. package/dist/ClientUser-6HBAPU6H.mjs +0 -8
  38. package/dist/ClientUser-ALGC4FNY.mjs +0 -8
  39. package/dist/ClientUser-J6HQVSDJ.mjs +0 -9
  40. package/dist/ClientUser-LLL6WX35.mjs +0 -8
  41. package/dist/ClientUser-N7ZXYAQ3.mjs +0 -8
  42. package/dist/Guild-36EGAAEW.mjs +0 -8
  43. package/dist/Guild-5UBZNIGD.mjs +0 -9
  44. package/dist/Guild-CA3W6DOD.mjs +0 -8
  45. package/dist/Guild-GIXJJBFM.mjs +0 -9
  46. package/dist/Guild-NHNQ5TIA.mjs +0 -8
  47. package/dist/Guild-S436SLOP.mjs +0 -9
  48. package/dist/Guild-WAFXK2EX.mjs +0 -9
  49. package/dist/Guild-XPOMHZZG.mjs +0 -9
  50. package/dist/Guild-ZOFF5LFR.mjs +0 -8
  51. package/dist/GuildMember-FX2JAWES.mjs +0 -8
  52. package/dist/GuildMember-K5FLBNHV.mjs +0 -8
  53. package/dist/GuildMember-RGVPVUAG.mjs +0 -9
  54. package/dist/GuildMember-UBNHZBCO.mjs +0 -8
  55. package/dist/GuildMember-UU26WJGN.mjs +0 -8
  56. package/dist/GuildMember-XF7K2R45.mjs +0 -9
  57. package/dist/Message-23Z3RPCZ.mjs +0 -9
  58. package/dist/Message-33APPS76.mjs +0 -9
  59. package/dist/Message-6RSAGIRP.mjs +0 -8
  60. package/dist/Message-OXTQHFCF.mjs +0 -8
  61. package/dist/Message-PZUU7ZFR.mjs +0 -9
  62. package/dist/Message-R7GZYIQQ.mjs +0 -8
  63. package/dist/Message-W624MHJF.mjs +0 -8
  64. package/dist/Message-XB5WNMHL.mjs +0 -9
  65. package/dist/Message-ZCS7IGJX.mjs +0 -8
  66. package/dist/Webhook-TGAZZRQQ.mjs +0 -7
  67. package/dist/chunk-2FIZRRSO.mjs +0 -88
  68. package/dist/chunk-3CNUPFDI.mjs +0 -59
  69. package/dist/chunk-4DBGMFOQ.mjs +0 -14
  70. package/dist/chunk-5HQRX3KJ.mjs +0 -70
  71. package/dist/chunk-62S4AB2S.mjs +0 -54
  72. package/dist/chunk-6CEMF2LO.mjs +0 -14
  73. package/dist/chunk-6EBNOON4.mjs +0 -86
  74. package/dist/chunk-72OY7B3D.mjs +0 -72
  75. package/dist/chunk-7FYM4D2E.mjs +0 -50
  76. package/dist/chunk-7GZN6JXT.mjs +0 -50
  77. package/dist/chunk-7H3TKJUT.mjs +0 -53
  78. package/dist/chunk-7SIS5CUA.mjs +0 -14
  79. package/dist/chunk-BGJSL6JI.mjs +0 -14
  80. package/dist/chunk-BUEXP5SZ.mjs +0 -70
  81. package/dist/chunk-BYTAODAO.mjs +0 -70
  82. package/dist/chunk-CQ5ZVTLX.mjs +0 -71
  83. package/dist/chunk-DJBCSVZX.mjs +0 -102
  84. package/dist/chunk-DLROMCIJ.mjs +0 -50
  85. package/dist/chunk-DPZHAYCK.mjs +0 -71
  86. package/dist/chunk-E75ZVY3I.mjs +0 -14
  87. package/dist/chunk-EF32ILJL.mjs +0 -102
  88. package/dist/chunk-F2EEQP5O.mjs +0 -86
  89. package/dist/chunk-FK5X6HFL.mjs +0 -111
  90. package/dist/chunk-FNFID6QB.mjs +0 -45
  91. package/dist/chunk-G4L7WAJS.mjs +0 -64
  92. package/dist/chunk-GUNWHOQO.mjs +0 -42
  93. package/dist/chunk-IPHFDI2L.mjs +0 -68
  94. package/dist/chunk-JJHZBWZM.mjs +0 -118
  95. package/dist/chunk-L25ON7WB.mjs +0 -52
  96. package/dist/chunk-LBBIQOSH.mjs +0 -53
  97. package/dist/chunk-LVMFPATK.mjs +0 -54
  98. package/dist/chunk-NOLYW3V4.mjs +0 -140
  99. package/dist/chunk-OHIHIQAS.mjs +0 -102
  100. package/dist/chunk-P4IRDGB4.mjs +0 -43
  101. package/dist/chunk-PO5JZQVN.mjs +0 -111
  102. package/dist/chunk-PYYXC7US.mjs +0 -76
  103. package/dist/chunk-QDCFQF6J.mjs +0 -36
  104. package/dist/chunk-QDNFJVVE.mjs +0 -70
  105. package/dist/chunk-QXJNV5EJ.mjs +0 -110
  106. package/dist/chunk-RXHJYGSJ.mjs +0 -53
  107. package/dist/chunk-SW6KNICI.mjs +0 -52
  108. package/dist/chunk-TE5IC7IP.mjs +0 -36
  109. package/dist/chunk-TMDZALIN.mjs +0 -110
  110. package/dist/chunk-WFONGZGK.mjs +0 -42
  111. package/dist/chunk-WZVY7DA6.mjs +0 -44
  112. package/dist/chunk-XTDZQD4A.mjs +0 -110
  113. package/dist/chunk-XXCBJJZE.mjs +0 -88
  114. package/dist/chunk-YKP7JHV2.mjs +0 -102
  115. package/dist/chunk-YSKZR66G.mjs +0 -102
  116. package/dist/chunk-ZHRQQZ4X.mjs +0 -102
  117. package/dist/chunk-ZMIMAMO2.mjs +0 -14
@@ -0,0 +1,62 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/Invite.ts
6
+ import { Routes } from "@fluxerjs/types";
7
+ var Invite = class extends Base {
8
+ client;
9
+ code;
10
+ type;
11
+ guild;
12
+ channel;
13
+ inviter;
14
+ memberCount;
15
+ presenceCount;
16
+ expiresAt;
17
+ temporary;
18
+ createdAt;
19
+ uses;
20
+ maxUses;
21
+ maxAge;
22
+ /** @param data - API invite from GET /invites/{code}, channel/guild invite list, or gateway INVITE_CREATE */
23
+ constructor(client, data) {
24
+ super();
25
+ this.client = client;
26
+ this.code = data.code;
27
+ this.type = data.type;
28
+ this.guild = data.guild;
29
+ this.channel = data.channel;
30
+ this.inviter = data.inviter ? client.getOrCreateUser(data.inviter) : null;
31
+ this.memberCount = data.member_count ?? null;
32
+ this.presenceCount = data.presence_count ?? null;
33
+ this.expiresAt = data.expires_at ?? null;
34
+ this.temporary = data.temporary ?? null;
35
+ this.createdAt = data.created_at ?? null;
36
+ this.uses = data.uses ?? null;
37
+ this.maxUses = data.max_uses ?? null;
38
+ this.maxAge = data.max_age ?? null;
39
+ }
40
+ /** Full invite URL (https://fluxer.gg/{code} or instance-specific). */
41
+ get url() {
42
+ return `https://fluxer.gg/${this.code}`;
43
+ }
44
+ /**
45
+ * Resolve the guild from cache if available.
46
+ * @returns The guild, or null if not cached
47
+ */
48
+ getGuild() {
49
+ return this.guild?.id ? this.client.guilds.get(this.guild.id) ?? null : null;
50
+ }
51
+ /**
52
+ * Delete this invite.
53
+ * Requires Manage Guild or Create Instant Invite permission.
54
+ */
55
+ async delete() {
56
+ await this.client.rest.delete(Routes.invite(this.code), { auth: true });
57
+ }
58
+ };
59
+
60
+ export {
61
+ Invite
62
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/GuildBan.ts
6
+ import { Routes } from "@fluxerjs/types";
7
+ var GuildBan = class extends Base {
8
+ client;
9
+ guildId;
10
+ user;
11
+ reason;
12
+ /** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
13
+ constructor(client, data, guildId) {
14
+ super();
15
+ this.client = client;
16
+ this.guildId = data.guild_id ?? guildId;
17
+ this.user = client.getOrCreateUser(data.user);
18
+ this.reason = data.reason ?? null;
19
+ }
20
+ /**
21
+ * Remove this ban (unban the user).
22
+ * Requires Ban Members permission.
23
+ */
24
+ async unban() {
25
+ await this.client.rest.delete(Routes.guildBan(this.guildId, this.user.id), {
26
+ auth: true
27
+ });
28
+ }
29
+ };
30
+
31
+ export {
32
+ GuildBan
33
+ };
@@ -0,0 +1,41 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/Role.ts
6
+ var Role = class extends Base {
7
+ client;
8
+ id;
9
+ guildId;
10
+ name;
11
+ color;
12
+ position;
13
+ permissions;
14
+ hoist;
15
+ mentionable;
16
+ unicodeEmoji;
17
+ /** @param client - The client instance */
18
+ /** @param data - API role from GET /guilds/{id}/roles or gateway role events */
19
+ /** @param guildId - The guild this role belongs to */
20
+ constructor(client, data, guildId) {
21
+ super();
22
+ this.client = client;
23
+ this.id = data.id;
24
+ this.guildId = guildId;
25
+ this.name = data.name;
26
+ this.color = data.color;
27
+ this.position = data.position;
28
+ this.permissions = data.permissions;
29
+ this.hoist = !!data.hoist;
30
+ this.mentionable = !!data.mentionable;
31
+ this.unicodeEmoji = data.unicode_emoji ?? null;
32
+ }
33
+ /** Returns a mention string (e.g. `<@&123456>`). */
34
+ toString() {
35
+ return `<@&${this.id}>`;
36
+ }
37
+ };
38
+
39
+ export {
40
+ Role
41
+ };
@@ -0,0 +1,136 @@
1
+ import {
2
+ CDN_URL
3
+ } from "./chunk-HQMYRYMY.mjs";
4
+ import {
5
+ GuildMember
6
+ } from "./chunk-GFUJVQ7L.mjs";
7
+ import {
8
+ Role
9
+ } from "./chunk-SQVCCSNN.mjs";
10
+ import {
11
+ Base
12
+ } from "./chunk-XNS4O6QJ.mjs";
13
+
14
+ // src/structures/Guild.ts
15
+ import { parseRoleMention } from "@fluxerjs/util";
16
+ import { Collection } from "@fluxerjs/collection";
17
+ import { Routes } from "@fluxerjs/types";
18
+ var Guild = class extends Base {
19
+ client;
20
+ id;
21
+ name;
22
+ icon;
23
+ banner;
24
+ ownerId;
25
+ members = new Collection();
26
+ channels = new Collection();
27
+ roles = new Collection();
28
+ /** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
29
+ constructor(client, data) {
30
+ super();
31
+ this.client = client;
32
+ this.id = data.id;
33
+ this.name = data.name;
34
+ this.icon = data.icon ?? null;
35
+ this.banner = data.banner ?? null;
36
+ this.ownerId = data.owner_id;
37
+ for (const r of data.roles ?? []) {
38
+ this.roles.set(r.id, new Role(client, r, this.id));
39
+ }
40
+ }
41
+ /** Get the guild icon URL, or null if no icon. */
42
+ iconURL(options) {
43
+ if (!this.icon) return null;
44
+ const size = options?.size ? `?size=${options.size}` : "";
45
+ return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
46
+ }
47
+ /** Get the guild banner URL, or null if no banner. */
48
+ bannerURL(options) {
49
+ if (!this.banner) return null;
50
+ const size = options?.size ? `?size=${options.size}` : "";
51
+ return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
52
+ }
53
+ /**
54
+ * Add a role to a member by user ID. Does not require fetching the member first.
55
+ * @param userId - The user ID of the member
56
+ * @param roleId - The role ID to add (or use guild.resolveRoleId for mention/name resolution)
57
+ * Requires Manage Roles permission.
58
+ */
59
+ async addRoleToMember(userId, roleId) {
60
+ await this.client.rest.put(Routes.guildMemberRole(this.id, userId, roleId));
61
+ }
62
+ /**
63
+ * Remove a role from a member by user ID. Does not require fetching the member first.
64
+ * @param userId - The user ID of the member
65
+ * @param roleId - The role ID to remove
66
+ * Requires Manage Roles permission.
67
+ */
68
+ async removeRoleFromMember(userId, roleId) {
69
+ await this.client.rest.delete(Routes.guildMemberRole(this.id, userId, roleId));
70
+ }
71
+ /**
72
+ * Resolve a role ID from an argument (role mention, raw ID, or name).
73
+ * Fetches guild roles if name is provided.
74
+ * @param arg - Role mention (@role), role ID, or role name
75
+ * @returns The role ID, or null if not found
76
+ */
77
+ async resolveRoleId(arg) {
78
+ const parsed = parseRoleMention(arg);
79
+ if (parsed) return parsed;
80
+ if (/^\d{17,19}$/.test(arg.trim())) return arg.trim();
81
+ const cached = this.roles.find(
82
+ (r) => !!(r.name && r.name.toLowerCase() === arg.trim().toLowerCase())
83
+ );
84
+ if (cached) return cached.id;
85
+ const roles = await this.client.rest.get(Routes.guildRoles(this.id));
86
+ const list = Array.isArray(roles) ? roles : Object.values(roles ?? {});
87
+ const role = list.find((r) => !!(r.name && r.name.toLowerCase() === arg.trim().toLowerCase()));
88
+ if (role) {
89
+ this.roles.set(role.id, new Role(this.client, role, this.id));
90
+ return role.id;
91
+ }
92
+ return null;
93
+ }
94
+ /**
95
+ * Fetch a guild member by user ID.
96
+ * @param userId - The user ID of the member to fetch
97
+ * @returns The guild member, or null if not found
98
+ */
99
+ async fetchMember(userId) {
100
+ try {
101
+ const data = await this.client.rest.get(
102
+ Routes.guildMember(this.id, userId)
103
+ );
104
+ return new GuildMember(this.client, { ...data, guild_id: this.id }, this);
105
+ } catch {
106
+ return null;
107
+ }
108
+ }
109
+ /**
110
+ * Fetch guild audit logs. Requires View Audit Log permission.
111
+ * @param options - Optional limit, before, after, user_id, action_type for filtering
112
+ */
113
+ async fetchAuditLogs(options) {
114
+ const params = new URLSearchParams();
115
+ if (options?.limit != null) params.set("limit", String(options.limit));
116
+ if (options?.before) params.set("before", options.before);
117
+ if (options?.after) params.set("after", options.after);
118
+ if (options?.userId) params.set("user_id", options.userId);
119
+ if (options?.actionType != null)
120
+ params.set("action_type", String(options.actionType));
121
+ const qs = params.toString();
122
+ const url = Routes.guildAuditLogs(this.id) + (qs ? `?${qs}` : "");
123
+ return this.client.rest.get(url);
124
+ }
125
+ /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
126
+ async fetchWebhooks() {
127
+ const { Webhook } = await import("./Webhook-32VJD4AL.mjs");
128
+ const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
129
+ const list = Array.isArray(data) ? data : Object.values(data ?? {});
130
+ return list.map((w) => new Webhook(this.client, w));
131
+ }
132
+ };
133
+
134
+ export {
135
+ Guild
136
+ };