@fluxerjs/core 1.0.6 → 1.0.7

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 (65) hide show
  1. package/dist/Channel-BEZOW4VC.mjs +17 -0
  2. package/dist/Channel-DPLLHL7Y.mjs +19 -0
  3. package/dist/Channel-KOTARBSF.mjs +17 -0
  4. package/dist/Channel-ON7O3D3M.mjs +17 -0
  5. package/dist/Channel-OSOB6ELO.mjs +19 -0
  6. package/dist/Channel-YVGPVOVB.mjs +17 -0
  7. package/dist/ClientUser-6HBAPU6H.mjs +8 -0
  8. package/dist/ClientUser-ALGC4FNY.mjs +8 -0
  9. package/dist/ClientUser-LLL6WX35.mjs +8 -0
  10. package/dist/ClientUser-N7ZXYAQ3.mjs +8 -0
  11. package/dist/Guild-5UBZNIGD.mjs +9 -0
  12. package/dist/Guild-GIXJJBFM.mjs +9 -0
  13. package/dist/Guild-S436SLOP.mjs +9 -0
  14. package/dist/Guild-WAFXK2EX.mjs +9 -0
  15. package/dist/Guild-XPOMHZZG.mjs +9 -0
  16. package/dist/GuildMember-BJJNCL6W.mjs +8 -0
  17. package/dist/GuildMember-FX2JAWES.mjs +8 -0
  18. package/dist/GuildMember-K5FLBNHV.mjs +8 -0
  19. package/dist/GuildMember-UBNHZBCO.mjs +8 -0
  20. package/dist/GuildMember-UU26WJGN.mjs +8 -0
  21. package/dist/Message-6RSAGIRP.mjs +8 -0
  22. package/dist/Message-OXTQHFCF.mjs +8 -0
  23. package/dist/Message-QXPHQOVC.mjs +8 -0
  24. package/dist/Message-R7GZYIQQ.mjs +8 -0
  25. package/dist/Message-W624MHJF.mjs +8 -0
  26. package/dist/Message-ZCS7IGJX.mjs +8 -0
  27. package/dist/Webhook-AG6QFM2I.mjs +7 -0
  28. package/dist/Webhook-TGAZZRQQ.mjs +7 -0
  29. package/dist/chunk-2FIZRRSO.mjs +88 -0
  30. package/dist/chunk-5HQRX3KJ.mjs +70 -0
  31. package/dist/chunk-62S4AB2S.mjs +54 -0
  32. package/dist/chunk-7SIS5CUA.mjs +14 -0
  33. package/dist/chunk-BGJSL6JI.mjs +14 -0
  34. package/dist/chunk-BYTAODAO.mjs +70 -0
  35. package/dist/chunk-CQ5ZVTLX.mjs +71 -0
  36. package/dist/chunk-DJBCSVZX.mjs +102 -0
  37. package/dist/chunk-DLROMCIJ.mjs +50 -0
  38. package/dist/chunk-DPZHAYCK.mjs +71 -0
  39. package/dist/chunk-E75ZVY3I.mjs +14 -0
  40. package/dist/chunk-FK5X6HFL.mjs +111 -0
  41. package/dist/chunk-FNFID6QB.mjs +45 -0
  42. package/dist/chunk-G4L7WAJS.mjs +64 -0
  43. package/dist/chunk-IPHFDI2L.mjs +68 -0
  44. package/dist/chunk-J3EIGOXQ.mjs +72 -0
  45. package/dist/chunk-JJHZBWZM.mjs +118 -0
  46. package/dist/chunk-LVMFPATK.mjs +54 -0
  47. package/dist/chunk-NISGA2YZ.mjs +55 -0
  48. package/dist/chunk-NOLYW3V4.mjs +140 -0
  49. package/dist/chunk-PO5JZQVN.mjs +111 -0
  50. package/dist/chunk-PYYXC7US.mjs +76 -0
  51. package/dist/chunk-QXJNV5EJ.mjs +110 -0
  52. package/dist/chunk-RXHJYGSJ.mjs +53 -0
  53. package/dist/chunk-T2NSVWBH.mjs +77 -0
  54. package/dist/chunk-TMDZALIN.mjs +110 -0
  55. package/dist/chunk-WYSHH4LR.mjs +141 -0
  56. package/dist/chunk-WZVY7DA6.mjs +44 -0
  57. package/dist/chunk-XTDZQD4A.mjs +110 -0
  58. package/dist/chunk-YKP7JHV2.mjs +102 -0
  59. package/dist/chunk-YSKZR66G.mjs +102 -0
  60. package/dist/chunk-ZMIMAMO2.mjs +14 -0
  61. package/dist/index.d.mts +206 -53
  62. package/dist/index.d.ts +206 -53
  63. package/dist/index.js +357 -179
  64. package/dist/index.mjs +38 -25
  65. package/package.json +7 -7
@@ -0,0 +1,17 @@
1
+ import {
2
+ CategoryChannel,
3
+ Channel,
4
+ GuildChannel,
5
+ LinkChannel,
6
+ TextChannel,
7
+ VoiceChannel
8
+ } from "./chunk-YKP7JHV2.mjs";
9
+ import "./chunk-XNS4O6QJ.mjs";
10
+ export {
11
+ CategoryChannel,
12
+ Channel,
13
+ GuildChannel,
14
+ LinkChannel,
15
+ TextChannel,
16
+ VoiceChannel
17
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ CategoryChannel,
3
+ Channel,
4
+ DMChannel,
5
+ GuildChannel,
6
+ LinkChannel,
7
+ TextChannel,
8
+ VoiceChannel
9
+ } from "./chunk-NOLYW3V4.mjs";
10
+ import "./chunk-XNS4O6QJ.mjs";
11
+ export {
12
+ CategoryChannel,
13
+ Channel,
14
+ DMChannel,
15
+ GuildChannel,
16
+ LinkChannel,
17
+ TextChannel,
18
+ VoiceChannel
19
+ };
@@ -0,0 +1,17 @@
1
+ import {
2
+ CategoryChannel,
3
+ Channel,
4
+ GuildChannel,
5
+ LinkChannel,
6
+ TextChannel,
7
+ VoiceChannel
8
+ } from "./chunk-DJBCSVZX.mjs";
9
+ import "./chunk-XNS4O6QJ.mjs";
10
+ export {
11
+ CategoryChannel,
12
+ Channel,
13
+ GuildChannel,
14
+ LinkChannel,
15
+ TextChannel,
16
+ VoiceChannel
17
+ };
@@ -0,0 +1,17 @@
1
+ import {
2
+ CategoryChannel,
3
+ Channel,
4
+ GuildChannel,
5
+ LinkChannel,
6
+ TextChannel,
7
+ VoiceChannel
8
+ } from "./chunk-JJHZBWZM.mjs";
9
+ import "./chunk-XNS4O6QJ.mjs";
10
+ export {
11
+ CategoryChannel,
12
+ Channel,
13
+ GuildChannel,
14
+ LinkChannel,
15
+ TextChannel,
16
+ VoiceChannel
17
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ CategoryChannel,
3
+ Channel,
4
+ DMChannel,
5
+ GuildChannel,
6
+ LinkChannel,
7
+ TextChannel,
8
+ VoiceChannel
9
+ } from "./chunk-WYSHH4LR.mjs";
10
+ import "./chunk-XNS4O6QJ.mjs";
11
+ export {
12
+ CategoryChannel,
13
+ Channel,
14
+ DMChannel,
15
+ GuildChannel,
16
+ LinkChannel,
17
+ TextChannel,
18
+ VoiceChannel
19
+ };
@@ -0,0 +1,17 @@
1
+ import {
2
+ CategoryChannel,
3
+ Channel,
4
+ GuildChannel,
5
+ LinkChannel,
6
+ TextChannel,
7
+ VoiceChannel
8
+ } from "./chunk-YSKZR66G.mjs";
9
+ import "./chunk-XNS4O6QJ.mjs";
10
+ export {
11
+ CategoryChannel,
12
+ Channel,
13
+ GuildChannel,
14
+ LinkChannel,
15
+ TextChannel,
16
+ VoiceChannel
17
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ ClientUser
3
+ } from "./chunk-BGJSL6JI.mjs";
4
+ import "./chunk-J3EIGOXQ.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ ClientUser
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ ClientUser
3
+ } from "./chunk-E75ZVY3I.mjs";
4
+ import "./chunk-CQ5ZVTLX.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ ClientUser
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ ClientUser
3
+ } from "./chunk-ZMIMAMO2.mjs";
4
+ import "./chunk-DLROMCIJ.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ ClientUser
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ ClientUser
3
+ } from "./chunk-7SIS5CUA.mjs";
4
+ import "./chunk-WZVY7DA6.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ ClientUser
8
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ Guild
3
+ } from "./chunk-G4L7WAJS.mjs";
4
+ import "./chunk-FNFID6QB.mjs";
5
+ import "./chunk-WZVY7DA6.mjs";
6
+ import "./chunk-XNS4O6QJ.mjs";
7
+ export {
8
+ Guild
9
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ Guild
3
+ } from "./chunk-DPZHAYCK.mjs";
4
+ import "./chunk-NISGA2YZ.mjs";
5
+ import "./chunk-J3EIGOXQ.mjs";
6
+ import "./chunk-XNS4O6QJ.mjs";
7
+ export {
8
+ Guild
9
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ Guild
3
+ } from "./chunk-BYTAODAO.mjs";
4
+ import "./chunk-LVMFPATK.mjs";
5
+ import "./chunk-DLROMCIJ.mjs";
6
+ import "./chunk-XNS4O6QJ.mjs";
7
+ export {
8
+ Guild
9
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ Guild
3
+ } from "./chunk-IPHFDI2L.mjs";
4
+ import "./chunk-RXHJYGSJ.mjs";
5
+ import "./chunk-WZVY7DA6.mjs";
6
+ import "./chunk-XNS4O6QJ.mjs";
7
+ export {
8
+ Guild
9
+ };
@@ -0,0 +1,9 @@
1
+ import {
2
+ Guild
3
+ } from "./chunk-5HQRX3KJ.mjs";
4
+ import "./chunk-62S4AB2S.mjs";
5
+ import "./chunk-CQ5ZVTLX.mjs";
6
+ import "./chunk-XNS4O6QJ.mjs";
7
+ export {
8
+ Guild
9
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-62S4AB2S.mjs";
4
+ import "./chunk-CQ5ZVTLX.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ GuildMember
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-LVMFPATK.mjs";
4
+ import "./chunk-DLROMCIJ.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ GuildMember
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-FNFID6QB.mjs";
4
+ import "./chunk-WZVY7DA6.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ GuildMember
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-RXHJYGSJ.mjs";
4
+ import "./chunk-WZVY7DA6.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ GuildMember
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-NISGA2YZ.mjs";
4
+ import "./chunk-J3EIGOXQ.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ GuildMember
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ Message
3
+ } from "./chunk-QXJNV5EJ.mjs";
4
+ import "./chunk-WZVY7DA6.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ Message
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ Message
3
+ } from "./chunk-2FIZRRSO.mjs";
4
+ import "./chunk-WZVY7DA6.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ Message
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ Message
3
+ } from "./chunk-XTDZQD4A.mjs";
4
+ import "./chunk-DLROMCIJ.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ Message
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ Message
3
+ } from "./chunk-FK5X6HFL.mjs";
4
+ import "./chunk-WZVY7DA6.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ Message
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ Message
3
+ } from "./chunk-PO5JZQVN.mjs";
4
+ import "./chunk-J3EIGOXQ.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ Message
8
+ };
@@ -0,0 +1,8 @@
1
+ import {
2
+ Message
3
+ } from "./chunk-TMDZALIN.mjs";
4
+ import "./chunk-CQ5ZVTLX.mjs";
5
+ import "./chunk-XNS4O6QJ.mjs";
6
+ export {
7
+ Message
8
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ Webhook
3
+ } from "./chunk-PYYXC7US.mjs";
4
+ import "./chunk-XNS4O6QJ.mjs";
5
+ export {
6
+ Webhook
7
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ Webhook
3
+ } from "./chunk-T2NSVWBH.mjs";
4
+ import "./chunk-XNS4O6QJ.mjs";
5
+ export {
6
+ Webhook
7
+ };
@@ -0,0 +1,88 @@
1
+ import {
2
+ User
3
+ } from "./chunk-WZVY7DA6.mjs";
4
+ import {
5
+ Base
6
+ } from "./chunk-XNS4O6QJ.mjs";
7
+
8
+ // src/structures/Message.ts
9
+ import { Collection } from "@fluxerjs/collection";
10
+ import { Routes } from "@fluxerjs/types";
11
+ import { EmbedBuilder } from "@fluxerjs/builders";
12
+ var Message = class _Message extends Base {
13
+ client;
14
+ id;
15
+ channelId;
16
+ guildId;
17
+ author;
18
+ content;
19
+ createdAt;
20
+ editedAt;
21
+ pinned;
22
+ attachments;
23
+ channel;
24
+ constructor(client, data) {
25
+ super();
26
+ this.client = client;
27
+ this.id = data.id;
28
+ this.channelId = data.channel_id;
29
+ this.guildId = data.guild_id ?? null;
30
+ this.author = new User(client, data.author);
31
+ this.content = data.content;
32
+ this.createdAt = new Date(data.timestamp);
33
+ this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
34
+ this.pinned = data.pinned;
35
+ this.attachments = new Collection();
36
+ for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
37
+ }
38
+ async reply(options) {
39
+ const body = typeof options === "string" ? { content: options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } } : { ...options, message_reference: { channel_id: this.channelId, message_id: this.id, guild_id: this.guildId ?? void 0 } };
40
+ const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
41
+ return new _Message(this.client, data);
42
+ }
43
+ async edit(options) {
44
+ const body = {};
45
+ if (options.content !== void 0) body.content = options.content;
46
+ if (options.embeds?.length) {
47
+ body.embeds = options.embeds.map((e) => e instanceof EmbedBuilder ? e.toJSON() : e);
48
+ }
49
+ const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), { body });
50
+ return new _Message(this.client, data);
51
+ }
52
+ async delete() {
53
+ await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
54
+ }
55
+ /**
56
+ * Format emoji for reaction API: unicode string or "name:id" for custom.
57
+ * @param emoji - Unicode emoji (e.g. "👍") or custom { name, id } or "name:id" string
58
+ */
59
+ static formatEmoji(emoji) {
60
+ if (typeof emoji === "string") return emoji;
61
+ return `${emoji.name}:${emoji.id}`;
62
+ }
63
+ /** Add a reaction to this message (as the bot). */
64
+ async react(emoji) {
65
+ const emojiStr = _Message.formatEmoji(emoji);
66
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/@me`;
67
+ await this.client.rest.put(route);
68
+ }
69
+ /** Remove the bot's reaction, or a specific user's reaction if userId is provided. */
70
+ async removeReaction(emoji, userId) {
71
+ const emojiStr = _Message.formatEmoji(emoji);
72
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/${userId ?? "@me"}`;
73
+ await this.client.rest.delete(route);
74
+ }
75
+ /** Remove all reactions from this message. Requires moderator permissions. */
76
+ async removeAllReactions() {
77
+ await this.client.rest.delete(Routes.channelMessageReactions(this.channelId, this.id));
78
+ }
79
+ /** Remove all reactions of a specific emoji from this message. Requires moderator permissions. */
80
+ async removeReactionEmoji(emoji) {
81
+ const emojiStr = _Message.formatEmoji(emoji);
82
+ await this.client.rest.delete(Routes.channelMessageReaction(this.channelId, this.id, emojiStr));
83
+ }
84
+ };
85
+
86
+ export {
87
+ Message
88
+ };
@@ -0,0 +1,70 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-62S4AB2S.mjs";
4
+ import {
5
+ CDN_URL
6
+ } from "./chunk-CQ5ZVTLX.mjs";
7
+ import {
8
+ Base
9
+ } from "./chunk-XNS4O6QJ.mjs";
10
+
11
+ // src/structures/Guild.ts
12
+ import { Collection } from "@fluxerjs/collection";
13
+ import { Routes } from "@fluxerjs/types";
14
+ var Guild = class extends Base {
15
+ client;
16
+ id;
17
+ name;
18
+ icon;
19
+ banner;
20
+ ownerId;
21
+ members = new Collection();
22
+ channels = new Collection();
23
+ constructor(client, data) {
24
+ super();
25
+ this.client = client;
26
+ this.id = data.id;
27
+ this.name = data.name;
28
+ this.icon = data.icon ?? null;
29
+ this.banner = data.banner ?? null;
30
+ this.ownerId = data.owner_id;
31
+ }
32
+ /** Get the guild icon URL, or null if no icon. */
33
+ iconURL(options) {
34
+ if (!this.icon) return null;
35
+ const size = options?.size ? `?size=${options.size}` : "";
36
+ return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
37
+ }
38
+ /** Get the guild banner URL, or null if no banner. */
39
+ bannerURL(options) {
40
+ if (!this.banner) return null;
41
+ const size = options?.size ? `?size=${options.size}` : "";
42
+ return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
43
+ }
44
+ /**
45
+ * Fetch a guild member by user ID.
46
+ * @param userId - The user ID of the member to fetch
47
+ * @returns The guild member, or null if not found
48
+ */
49
+ async fetchMember(userId) {
50
+ try {
51
+ const data = await this.client.rest.get(
52
+ Routes.guildMember(this.id, userId)
53
+ );
54
+ return new GuildMember(this.client, { ...data, guild_id: this.id }, this);
55
+ } catch {
56
+ return null;
57
+ }
58
+ }
59
+ /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
60
+ async fetchWebhooks() {
61
+ const { Webhook } = await import("./Webhook-AG6QFM2I.mjs");
62
+ const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
63
+ const list = Array.isArray(data) ? data : Object.values(data ?? {});
64
+ return list.map((w) => new Webhook(this.client, w));
65
+ }
66
+ };
67
+
68
+ export {
69
+ Guild
70
+ };
@@ -0,0 +1,54 @@
1
+ import {
2
+ User
3
+ } from "./chunk-CQ5ZVTLX.mjs";
4
+ import {
5
+ Base
6
+ } from "./chunk-XNS4O6QJ.mjs";
7
+
8
+ // src/structures/GuildMember.ts
9
+ import { Routes } from "@fluxerjs/types";
10
+ var GuildMember = class extends Base {
11
+ client;
12
+ id;
13
+ user;
14
+ guild;
15
+ nick;
16
+ roles;
17
+ joinedAt;
18
+ communicationDisabledUntil;
19
+ constructor(client, data, guild) {
20
+ super();
21
+ this.client = client;
22
+ this.user = new User(client, data.user);
23
+ this.id = data.user.id;
24
+ this.guild = guild;
25
+ this.nick = data.nick ?? null;
26
+ this.roles = data.roles ?? [];
27
+ this.joinedAt = new Date(data.joined_at);
28
+ this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
29
+ }
30
+ /** Nickname, or global name, or username. */
31
+ get displayName() {
32
+ return this.nick ?? this.user.globalName ?? this.user.username;
33
+ }
34
+ /**
35
+ * Add a role to this member.
36
+ * @param roleId - The role ID to add
37
+ * Requires Manage Roles permission.
38
+ */
39
+ async addRole(roleId) {
40
+ await this.client.rest.put(Routes.guildMemberRole(this.guild.id, this.id, roleId));
41
+ }
42
+ /**
43
+ * Remove a role from this member.
44
+ * @param roleId - The role ID to remove
45
+ * Requires Manage Roles permission.
46
+ */
47
+ async removeRole(roleId) {
48
+ await this.client.rest.delete(Routes.guildMemberRole(this.guild.id, this.id, roleId));
49
+ }
50
+ };
51
+
52
+ export {
53
+ GuildMember
54
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ User
3
+ } from "./chunk-WZVY7DA6.mjs";
4
+
5
+ // src/client/ClientUser.ts
6
+ var ClientUser = class extends User {
7
+ constructor(client, data) {
8
+ super(client, { ...data });
9
+ }
10
+ };
11
+
12
+ export {
13
+ ClientUser
14
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ User
3
+ } from "./chunk-J3EIGOXQ.mjs";
4
+
5
+ // src/client/ClientUser.ts
6
+ var ClientUser = class extends User {
7
+ constructor(client, data) {
8
+ super(client, { ...data });
9
+ }
10
+ };
11
+
12
+ export {
13
+ ClientUser
14
+ };
@@ -0,0 +1,70 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-LVMFPATK.mjs";
4
+ import {
5
+ CDN_URL
6
+ } from "./chunk-DLROMCIJ.mjs";
7
+ import {
8
+ Base
9
+ } from "./chunk-XNS4O6QJ.mjs";
10
+
11
+ // src/structures/Guild.ts
12
+ import { Collection } from "@fluxerjs/collection";
13
+ import { Routes } from "@fluxerjs/types";
14
+ var Guild = class extends Base {
15
+ client;
16
+ id;
17
+ name;
18
+ icon;
19
+ banner;
20
+ ownerId;
21
+ members = new Collection();
22
+ channels = new Collection();
23
+ constructor(client, data) {
24
+ super();
25
+ this.client = client;
26
+ this.id = data.id;
27
+ this.name = data.name;
28
+ this.icon = data.icon ?? null;
29
+ this.banner = data.banner ?? null;
30
+ this.ownerId = data.owner_id;
31
+ }
32
+ /** Get the guild icon URL, or null if no icon. */
33
+ iconURL(options) {
34
+ if (!this.icon) return null;
35
+ const size = options?.size ? `?size=${options.size}` : "";
36
+ return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
37
+ }
38
+ /** Get the guild banner URL, or null if no banner. */
39
+ bannerURL(options) {
40
+ if (!this.banner) return null;
41
+ const size = options?.size ? `?size=${options.size}` : "";
42
+ return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
43
+ }
44
+ /**
45
+ * Fetch a guild member by user ID.
46
+ * @param userId - The user ID of the member to fetch
47
+ * @returns The guild member, or null if not found
48
+ */
49
+ async fetchMember(userId) {
50
+ try {
51
+ const data = await this.client.rest.get(
52
+ Routes.guildMember(this.id, userId)
53
+ );
54
+ return new GuildMember(this.client, { ...data, guild_id: this.id }, this);
55
+ } catch {
56
+ return null;
57
+ }
58
+ }
59
+ /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
60
+ async fetchWebhooks() {
61
+ const { Webhook } = await import("./Webhook-AG6QFM2I.mjs");
62
+ const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
63
+ const list = Array.isArray(data) ? data : Object.values(data ?? {});
64
+ return list.map((w) => new Webhook(this.client, w));
65
+ }
66
+ };
67
+
68
+ export {
69
+ Guild
70
+ };