@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,71 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/util/Constants.ts
6
+ var CDN_URL = "https://fluxerusercontent.com";
7
+
8
+ // src/structures/User.ts
9
+ import { Routes } from "@fluxerjs/types";
10
+ var User = class extends Base {
11
+ client;
12
+ id;
13
+ username;
14
+ discriminator;
15
+ globalName;
16
+ avatar;
17
+ bot;
18
+ constructor(client, data) {
19
+ super();
20
+ this.client = client;
21
+ this.id = data.id;
22
+ this.username = data.username;
23
+ this.discriminator = data.discriminator;
24
+ this.globalName = data.global_name ?? null;
25
+ this.avatar = data.avatar ?? null;
26
+ this.bot = !!data.bot;
27
+ }
28
+ /**
29
+ * Get the URL for this user's avatar.
30
+ * @param options - Optional `size` and `extension` (default: `png`)
31
+ */
32
+ avatarURL(options) {
33
+ if (!this.avatar) return null;
34
+ const ext = options?.extension ?? "png";
35
+ const size = options?.size ? `?size=${options.size}` : "";
36
+ return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
37
+ }
38
+ /** Get the avatar URL, or the default avatar if none set. */
39
+ displayAvatarURL(options) {
40
+ return this.avatarURL(options) ?? `${CDN_URL}/avatars/0/0.png`;
41
+ }
42
+ /** Returns a mention string (e.g. `<@123456>`). */
43
+ toString() {
44
+ return `<@${this.id}>`;
45
+ }
46
+ /**
47
+ * Create or get a DM channel with this user.
48
+ * Returns the DM channel; use {@link DMChannel.send} to send messages.
49
+ */
50
+ async createDM() {
51
+ const { DMChannel: DMChannelClass } = await import("./Channel-DPLLHL7Y.mjs");
52
+ const data = await this.client.rest.post(Routes.userMeChannels(), {
53
+ body: { recipient_id: this.id },
54
+ auth: true
55
+ });
56
+ return new DMChannelClass(this.client, data);
57
+ }
58
+ /**
59
+ * Send a DM to this user.
60
+ * Convenience method that creates the DM channel and sends the message.
61
+ */
62
+ async send(options) {
63
+ const dm = await this.createDM();
64
+ return dm.send(options);
65
+ }
66
+ };
67
+
68
+ export {
69
+ CDN_URL,
70
+ User
71
+ };
@@ -0,0 +1,102 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/Channel.ts
6
+ import { ChannelType, Routes } from "@fluxerjs/types";
7
+ var Channel = class extends Base {
8
+ client;
9
+ id;
10
+ type;
11
+ constructor(client, data) {
12
+ super();
13
+ this.client = client;
14
+ this.id = data.id;
15
+ this.type = data.type;
16
+ }
17
+ static from(client, data) {
18
+ const type = data.type ?? 0;
19
+ if (type === ChannelType.GuildText) return new TextChannel(client, data);
20
+ if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
21
+ if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
22
+ if (type === ChannelType.GuildLink) return new LinkChannel(client, data);
23
+ return new GuildChannel(client, data);
24
+ }
25
+ };
26
+ var GuildChannel = class extends Channel {
27
+ guildId;
28
+ name;
29
+ position;
30
+ parentId;
31
+ constructor(client, data) {
32
+ super(client, data);
33
+ this.guildId = data.guild_id ?? "";
34
+ this.name = data.name ?? null;
35
+ this.position = data.position;
36
+ this.parentId = data.parent_id ?? null;
37
+ }
38
+ /** Create a webhook in this channel. Returns the webhook with token (required for send()). */
39
+ async createWebhook(options) {
40
+ const { Webhook } = await import("./Webhook-2RHBXH7R.mjs");
41
+ const data = await this.client.rest.post(Routes.channelWebhooks(this.id), {
42
+ body: options,
43
+ auth: true
44
+ });
45
+ return new Webhook(this.client, data);
46
+ }
47
+ /** Fetch all webhooks in this channel. Returned webhooks do not include the token (cannot send). */
48
+ async fetchWebhooks() {
49
+ const { Webhook } = await import("./Webhook-2RHBXH7R.mjs");
50
+ const data = await this.client.rest.get(Routes.channelWebhooks(this.id));
51
+ const list = Array.isArray(data) ? data : Object.values(data ?? {});
52
+ return list.map((w) => new Webhook(this.client, w));
53
+ }
54
+ };
55
+ var TextChannel = class extends GuildChannel {
56
+ topic;
57
+ nsfw;
58
+ rateLimitPerUser;
59
+ lastMessageId;
60
+ constructor(client, data) {
61
+ super(client, data);
62
+ this.topic = data.topic ?? null;
63
+ this.nsfw = data.nsfw ?? false;
64
+ this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
65
+ this.lastMessageId = data.last_message_id ?? null;
66
+ }
67
+ async send(options) {
68
+ const body = typeof options === "string" ? { content: options } : options;
69
+ const { Message } = await import("./Message-OXTQHFCF.mjs");
70
+ const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
71
+ return new Message(this.client, data);
72
+ }
73
+ };
74
+ var CategoryChannel = class extends GuildChannel {
75
+ };
76
+ var VoiceChannel = class extends GuildChannel {
77
+ bitrate;
78
+ userLimit;
79
+ rtcRegion;
80
+ constructor(client, data) {
81
+ super(client, data);
82
+ this.bitrate = data.bitrate ?? null;
83
+ this.userLimit = data.user_limit ?? null;
84
+ this.rtcRegion = data.rtc_region ?? null;
85
+ }
86
+ };
87
+ var LinkChannel = class extends GuildChannel {
88
+ url;
89
+ constructor(client, data) {
90
+ super(client, data);
91
+ this.url = data.url ?? null;
92
+ }
93
+ };
94
+
95
+ export {
96
+ Channel,
97
+ GuildChannel,
98
+ TextChannel,
99
+ CategoryChannel,
100
+ VoiceChannel,
101
+ LinkChannel
102
+ };
@@ -0,0 +1,50 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/util/Constants.ts
6
+ var CDN_URL = "https://fluxerusercontent.com";
7
+
8
+ // src/structures/User.ts
9
+ var User = class extends Base {
10
+ client;
11
+ id;
12
+ username;
13
+ discriminator;
14
+ globalName;
15
+ avatar;
16
+ bot;
17
+ constructor(client, data) {
18
+ super();
19
+ this.client = client;
20
+ this.id = data.id;
21
+ this.username = data.username;
22
+ this.discriminator = data.discriminator;
23
+ this.globalName = data.global_name ?? null;
24
+ this.avatar = data.avatar ?? null;
25
+ this.bot = !!data.bot;
26
+ }
27
+ /**
28
+ * Get the URL for this user's avatar.
29
+ * @param options - Optional `size` and `extension` (default: `png`)
30
+ */
31
+ avatarURL(options) {
32
+ if (!this.avatar) return null;
33
+ const ext = options?.extension ?? "png";
34
+ const size = options?.size ? `?size=${options.size}` : "";
35
+ return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
36
+ }
37
+ /** Get the avatar URL, or the default avatar if none set. */
38
+ displayAvatarURL(options) {
39
+ return this.avatarURL(options) ?? `${CDN_URL}/avatars/0/0.png`;
40
+ }
41
+ /** Returns a mention string (e.g. `<@123456>`). */
42
+ toString() {
43
+ return `<@${this.id}>`;
44
+ }
45
+ };
46
+
47
+ export {
48
+ CDN_URL,
49
+ User
50
+ };
@@ -0,0 +1,71 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-NISGA2YZ.mjs";
4
+ import {
5
+ CDN_URL
6
+ } from "./chunk-J3EIGOXQ.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
+ /** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
24
+ constructor(client, data) {
25
+ super();
26
+ this.client = client;
27
+ this.id = data.id;
28
+ this.name = data.name;
29
+ this.icon = data.icon ?? null;
30
+ this.banner = data.banner ?? null;
31
+ this.ownerId = data.owner_id;
32
+ }
33
+ /** Get the guild icon URL, or null if no icon. */
34
+ iconURL(options) {
35
+ if (!this.icon) return null;
36
+ const size = options?.size ? `?size=${options.size}` : "";
37
+ return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
38
+ }
39
+ /** Get the guild banner URL, or null if no banner. */
40
+ bannerURL(options) {
41
+ if (!this.banner) return null;
42
+ const size = options?.size ? `?size=${options.size}` : "";
43
+ return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
44
+ }
45
+ /**
46
+ * Fetch a guild member by user ID.
47
+ * @param userId - The user ID of the member to fetch
48
+ * @returns The guild member, or null if not found
49
+ */
50
+ async fetchMember(userId) {
51
+ try {
52
+ const data = await this.client.rest.get(
53
+ Routes.guildMember(this.id, userId)
54
+ );
55
+ return new GuildMember(this.client, { ...data, guild_id: this.id }, this);
56
+ } catch {
57
+ return null;
58
+ }
59
+ }
60
+ /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
61
+ async fetchWebhooks() {
62
+ const { Webhook } = await import("./Webhook-TGAZZRQQ.mjs");
63
+ const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
64
+ const list = Array.isArray(data) ? data : Object.values(data ?? {});
65
+ return list.map((w) => new Webhook(this.client, w));
66
+ }
67
+ };
68
+
69
+ export {
70
+ Guild
71
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ User
3
+ } from "./chunk-CQ5ZVTLX.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,111 @@
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
+ /**
39
+ * Reply to this message.
40
+ * @param options - Text content or object with content and/or embeds
41
+ */
42
+ async reply(options) {
43
+ 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 } };
44
+ const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
45
+ return new _Message(this.client, data);
46
+ }
47
+ /**
48
+ * Edit this message. Only the author (or admins) can edit.
49
+ * @param options - New content and/or embeds
50
+ */
51
+ async edit(options) {
52
+ const body = {};
53
+ if (options.content !== void 0) body.content = options.content;
54
+ if (options.embeds?.length) {
55
+ body.embeds = options.embeds.map((e) => e instanceof EmbedBuilder ? e.toJSON() : e);
56
+ }
57
+ const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), { body });
58
+ return new _Message(this.client, data);
59
+ }
60
+ /** Delete this message. */
61
+ async delete() {
62
+ await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
63
+ }
64
+ /**
65
+ * Format emoji for reaction API: unicode string or "name:id" for custom.
66
+ * @param emoji - Unicode emoji (e.g. "👍") or custom { name, id } or "name:id" string
67
+ */
68
+ static formatEmoji(emoji) {
69
+ if (typeof emoji === "string") return emoji;
70
+ return `${emoji.name}:${emoji.id}`;
71
+ }
72
+ /**
73
+ * Add a reaction to this message (as the bot).
74
+ * @param emoji - Unicode emoji (e.g. "👍") or custom emoji object { name, id }
75
+ */
76
+ async react(emoji) {
77
+ const emojiStr = _Message.formatEmoji(emoji);
78
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/@me`;
79
+ await this.client.rest.put(route);
80
+ }
81
+ /**
82
+ * Remove the bot's reaction, or a specific user's reaction if userId is provided.
83
+ * @param emoji - Unicode emoji or custom { name, id }
84
+ * @param userId - If provided, removes that user's reaction (requires moderator permissions)
85
+ */
86
+ async removeReaction(emoji, userId) {
87
+ const emojiStr = _Message.formatEmoji(emoji);
88
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/${userId ?? "@me"}`;
89
+ await this.client.rest.delete(route);
90
+ }
91
+ /**
92
+ * Remove all reactions from this message.
93
+ * Requires moderator permissions.
94
+ */
95
+ async removeAllReactions() {
96
+ await this.client.rest.delete(Routes.channelMessageReactions(this.channelId, this.id));
97
+ }
98
+ /**
99
+ * Remove all reactions of a specific emoji from this message.
100
+ * @param emoji - Unicode emoji or custom { name, id }
101
+ * Requires moderator permissions.
102
+ */
103
+ async removeReactionEmoji(emoji) {
104
+ const emojiStr = _Message.formatEmoji(emoji);
105
+ await this.client.rest.delete(Routes.channelMessageReaction(this.channelId, this.id, emojiStr));
106
+ }
107
+ };
108
+
109
+ export {
110
+ Message
111
+ };
@@ -0,0 +1,45 @@
1
+ import {
2
+ User
3
+ } from "./chunk-WZVY7DA6.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
+ get displayName() {
31
+ return this.nick ?? this.user.globalName ?? this.user.username;
32
+ }
33
+ /** Add a role to this member. Requires Manage Roles permission. */
34
+ async addRole(roleId) {
35
+ await this.client.rest.put(Routes.guildMemberRole(this.guild.id, this.id, roleId));
36
+ }
37
+ /** Remove a role from this member. Requires Manage Roles permission. */
38
+ async removeRole(roleId) {
39
+ await this.client.rest.delete(Routes.guildMemberRole(this.guild.id, this.id, roleId));
40
+ }
41
+ };
42
+
43
+ export {
44
+ GuildMember
45
+ };
@@ -0,0 +1,64 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-FNFID6QB.mjs";
4
+ import {
5
+ CDN_URL
6
+ } from "./chunk-WZVY7DA6.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
+ iconURL(options) {
33
+ if (!this.icon) return null;
34
+ const size = options?.size ? `?size=${options.size}` : "";
35
+ return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
36
+ }
37
+ bannerURL(options) {
38
+ if (!this.banner) return null;
39
+ const size = options?.size ? `?size=${options.size}` : "";
40
+ return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
41
+ }
42
+ /** Fetch a guild member by user ID. Returns null if the member is not in the guild. */
43
+ async fetchMember(userId) {
44
+ try {
45
+ const data = await this.client.rest.get(
46
+ Routes.guildMember(this.id, userId)
47
+ );
48
+ return new GuildMember(this.client, { ...data, guild_id: this.id }, this);
49
+ } catch {
50
+ return null;
51
+ }
52
+ }
53
+ /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
54
+ async fetchWebhooks() {
55
+ const { Webhook } = await import("./Webhook-2RHBXH7R.mjs");
56
+ const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
57
+ const list = Array.isArray(data) ? data : Object.values(data ?? {});
58
+ return list.map((w) => new Webhook(this.client, w));
59
+ }
60
+ };
61
+
62
+ export {
63
+ Guild
64
+ };
@@ -0,0 +1,68 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-RXHJYGSJ.mjs";
4
+ import {
5
+ CDN_URL
6
+ } from "./chunk-WZVY7DA6.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
+ iconURL(options) {
33
+ if (!this.icon) return null;
34
+ const size = options?.size ? `?size=${options.size}` : "";
35
+ return `${CDN_URL}/icons/${this.id}/${this.icon}.png${size}`;
36
+ }
37
+ bannerURL(options) {
38
+ if (!this.banner) return null;
39
+ const size = options?.size ? `?size=${options.size}` : "";
40
+ return `${CDN_URL}/banners/${this.id}/${this.banner}.png${size}`;
41
+ }
42
+ /**
43
+ * Fetch a guild member by user ID.
44
+ * @param userId - The user ID of the member to fetch
45
+ * @returns The guild member, or null if not found
46
+ */
47
+ async fetchMember(userId) {
48
+ try {
49
+ const data = await this.client.rest.get(
50
+ Routes.guildMember(this.id, userId)
51
+ );
52
+ return new GuildMember(this.client, { ...data, guild_id: this.id }, this);
53
+ } catch {
54
+ return null;
55
+ }
56
+ }
57
+ /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
58
+ async fetchWebhooks() {
59
+ const { Webhook } = await import("./Webhook-2RHBXH7R.mjs");
60
+ const data = await this.client.rest.get(Routes.guildWebhooks(this.id));
61
+ const list = Array.isArray(data) ? data : Object.values(data ?? {});
62
+ return list.map((w) => new Webhook(this.client, w));
63
+ }
64
+ };
65
+
66
+ export {
67
+ Guild
68
+ };
@@ -0,0 +1,72 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/util/Constants.ts
6
+ var CDN_URL = "https://fluxerusercontent.com";
7
+
8
+ // src/structures/User.ts
9
+ import { Routes } from "@fluxerjs/types";
10
+ var User = class extends Base {
11
+ client;
12
+ id;
13
+ username;
14
+ discriminator;
15
+ globalName;
16
+ avatar;
17
+ bot;
18
+ /** @param data - API user from message author, GET /users/{id}, or GET /users/@me */
19
+ constructor(client, data) {
20
+ super();
21
+ this.client = client;
22
+ this.id = data.id;
23
+ this.username = data.username;
24
+ this.discriminator = data.discriminator;
25
+ this.globalName = data.global_name ?? null;
26
+ this.avatar = data.avatar ?? null;
27
+ this.bot = !!data.bot;
28
+ }
29
+ /**
30
+ * Get the URL for this user's avatar.
31
+ * @param options - Optional `size` and `extension` (default: `png`)
32
+ */
33
+ avatarURL(options) {
34
+ if (!this.avatar) return null;
35
+ const ext = options?.extension ?? "png";
36
+ const size = options?.size ? `?size=${options.size}` : "";
37
+ return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
38
+ }
39
+ /** Get the avatar URL, or the default avatar if none set. */
40
+ displayAvatarURL(options) {
41
+ return this.avatarURL(options) ?? `${CDN_URL}/avatars/0/0.png`;
42
+ }
43
+ /** Returns a mention string (e.g. `<@123456>`). */
44
+ toString() {
45
+ return `<@${this.id}>`;
46
+ }
47
+ /**
48
+ * Create or get a DM channel with this user.
49
+ * Returns the DM channel; use {@link DMChannel.send} to send messages.
50
+ */
51
+ async createDM() {
52
+ const { DMChannel: DMChannelClass } = await import("./Channel-OSOB6ELO.mjs");
53
+ const data = await this.client.rest.post(Routes.userMeChannels(), {
54
+ body: { recipient_id: this.id },
55
+ auth: true
56
+ });
57
+ return new DMChannelClass(this.client, data);
58
+ }
59
+ /**
60
+ * Send a DM to this user.
61
+ * Convenience method that creates the DM channel and sends the message.
62
+ */
63
+ async send(options) {
64
+ const dm = await this.createDM();
65
+ return dm.send(options);
66
+ }
67
+ };
68
+
69
+ export {
70
+ CDN_URL,
71
+ User
72
+ };