@fluxerjs/core 1.0.6 → 1.0.8

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 (59) hide show
  1. package/dist/{Channel-2WNJ445K.mjs → Channel-TWPDKW2P.mjs} +3 -1
  2. package/dist/{ClientUser-J6HQVSDJ.mjs → ClientUser-2K2BACK7.mjs} +1 -2
  3. package/dist/{Guild-GOQZ7XP4.mjs → Guild-CMZGA6DW.mjs} +3 -1
  4. package/dist/GuildMember-DW2N6ITI.mjs +7 -0
  5. package/dist/{Webhook-NUQCJAWZ.mjs → Message-G2QIKZQK.mjs} +3 -3
  6. package/dist/MessageReaction-XRPYZDSC.mjs +7 -0
  7. package/dist/Role-SVLWIAMN.mjs +7 -0
  8. package/dist/{Webhook-2RHBXH7R.mjs → Webhook-2MQESB7Z.mjs} +1 -1
  9. package/dist/chunk-4GCZFOS5.mjs +86 -0
  10. package/dist/chunk-CO5EL5LH.mjs +168 -0
  11. package/dist/chunk-CZIO2D7F.mjs +207 -0
  12. package/dist/chunk-HBF5QEDH.mjs +42 -0
  13. package/dist/chunk-JVEOQFUX.mjs +52 -0
  14. package/dist/chunk-SQVCCSNN.mjs +41 -0
  15. package/dist/chunk-TJVZEILY.mjs +120 -0
  16. package/dist/{chunk-BUEXP5SZ.mjs → chunk-ZGMM6IPQ.mjs} +12 -3
  17. package/dist/index.d.mts +539 -73
  18. package/dist/index.d.ts +539 -73
  19. package/dist/index.js +1125 -355
  20. package/dist/index.mjs +520 -194
  21. package/package.json +27 -8
  22. package/dist/Channel-HM2UY4DN.mjs +0 -17
  23. package/dist/Channel-IKL3SJXN.mjs +0 -17
  24. package/dist/Channel-KILNV5V3.mjs +0 -17
  25. package/dist/Channel-TOAQGSRX.mjs +0 -17
  26. package/dist/Channel-VENHOL7S.mjs +0 -17
  27. package/dist/ClientUser-RNDKHQ3Z.mjs +0 -9
  28. package/dist/Guild-36EGAAEW.mjs +0 -8
  29. package/dist/Guild-CA3W6DOD.mjs +0 -8
  30. package/dist/Guild-NHNQ5TIA.mjs +0 -8
  31. package/dist/Guild-ZOFF5LFR.mjs +0 -8
  32. package/dist/GuildMember-RGVPVUAG.mjs +0 -9
  33. package/dist/GuildMember-XF7K2R45.mjs +0 -9
  34. package/dist/Message-23Z3RPCZ.mjs +0 -9
  35. package/dist/Message-33APPS76.mjs +0 -9
  36. package/dist/Message-PZUU7ZFR.mjs +0 -9
  37. package/dist/Message-XB5WNMHL.mjs +0 -9
  38. package/dist/chunk-3CNUPFDI.mjs +0 -59
  39. package/dist/chunk-4DBGMFOQ.mjs +0 -14
  40. package/dist/chunk-6CEMF2LO.mjs +0 -14
  41. package/dist/chunk-6EBNOON4.mjs +0 -86
  42. package/dist/chunk-72OY7B3D.mjs +0 -72
  43. package/dist/chunk-7FYM4D2E.mjs +0 -50
  44. package/dist/chunk-7GZN6JXT.mjs +0 -50
  45. package/dist/chunk-7H3TKJUT.mjs +0 -53
  46. package/dist/chunk-EF32ILJL.mjs +0 -102
  47. package/dist/chunk-F2EEQP5O.mjs +0 -86
  48. package/dist/chunk-GUNWHOQO.mjs +0 -42
  49. package/dist/chunk-L25ON7WB.mjs +0 -52
  50. package/dist/chunk-LBBIQOSH.mjs +0 -53
  51. package/dist/chunk-OHIHIQAS.mjs +0 -102
  52. package/dist/chunk-P4IRDGB4.mjs +0 -43
  53. package/dist/chunk-QDCFQF6J.mjs +0 -36
  54. package/dist/chunk-QDNFJVVE.mjs +0 -70
  55. package/dist/chunk-SW6KNICI.mjs +0 -52
  56. package/dist/chunk-TE5IC7IP.mjs +0 -36
  57. package/dist/chunk-WFONGZGK.mjs +0 -42
  58. package/dist/chunk-XXCBJJZE.mjs +0 -88
  59. package/dist/chunk-ZHRQQZ4X.mjs +0 -102
@@ -1,15 +1,17 @@
1
1
  import {
2
2
  CategoryChannel,
3
3
  Channel,
4
+ DMChannel,
4
5
  GuildChannel,
5
6
  LinkChannel,
6
7
  TextChannel,
7
8
  VoiceChannel
8
- } from "./chunk-ZHRQQZ4X.mjs";
9
+ } from "./chunk-CZIO2D7F.mjs";
9
10
  import "./chunk-XNS4O6QJ.mjs";
10
11
  export {
11
12
  CategoryChannel,
12
13
  Channel,
14
+ DMChannel,
13
15
  GuildChannel,
14
16
  LinkChannel,
15
17
  TextChannel,
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  ClientUser
3
- } from "./chunk-4DBGMFOQ.mjs";
4
- import "./chunk-SW6KNICI.mjs";
3
+ } from "./chunk-4GCZFOS5.mjs";
5
4
  import "./chunk-HQMYRYMY.mjs";
6
5
  import "./chunk-XNS4O6QJ.mjs";
7
6
  export {
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  Guild
3
- } from "./chunk-GUNWHOQO.mjs";
3
+ } from "./chunk-TJVZEILY.mjs";
4
4
  import "./chunk-HQMYRYMY.mjs";
5
+ import "./chunk-JVEOQFUX.mjs";
6
+ import "./chunk-SQVCCSNN.mjs";
5
7
  import "./chunk-XNS4O6QJ.mjs";
6
8
  export {
7
9
  Guild
@@ -0,0 +1,7 @@
1
+ import {
2
+ GuildMember
3
+ } from "./chunk-JVEOQFUX.mjs";
4
+ import "./chunk-XNS4O6QJ.mjs";
5
+ export {
6
+ GuildMember
7
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
- Webhook
3
- } from "./chunk-QDNFJVVE.mjs";
2
+ Message
3
+ } from "./chunk-CO5EL5LH.mjs";
4
4
  import "./chunk-XNS4O6QJ.mjs";
5
5
  export {
6
- Webhook
6
+ Message
7
7
  };
@@ -0,0 +1,7 @@
1
+ import {
2
+ MessageReaction
3
+ } from "./chunk-HBF5QEDH.mjs";
4
+ import "./chunk-XNS4O6QJ.mjs";
5
+ export {
6
+ MessageReaction
7
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ Role
3
+ } from "./chunk-SQVCCSNN.mjs";
4
+ import "./chunk-XNS4O6QJ.mjs";
5
+ export {
6
+ Role
7
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Webhook
3
- } from "./chunk-BUEXP5SZ.mjs";
3
+ } from "./chunk-ZGMM6IPQ.mjs";
4
4
  import "./chunk-XNS4O6QJ.mjs";
5
5
  export {
6
6
  Webhook
@@ -0,0 +1,86 @@
1
+ import {
2
+ CDN_URL
3
+ } from "./chunk-HQMYRYMY.mjs";
4
+ import {
5
+ Base
6
+ } from "./chunk-XNS4O6QJ.mjs";
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
+ /** Update mutable fields from fresh API data. Used by getOrCreateUser cache. */
30
+ _patch(data) {
31
+ this.username = data.username;
32
+ this.discriminator = data.discriminator;
33
+ this.globalName = data.global_name ?? null;
34
+ this.avatar = data.avatar ?? null;
35
+ }
36
+ /**
37
+ * Get the URL for this user's avatar.
38
+ * @param options - Optional `size` and `extension` (default: `png`)
39
+ */
40
+ avatarURL(options) {
41
+ if (!this.avatar) return null;
42
+ const ext = options?.extension ?? "png";
43
+ const size = options?.size ? `?size=${options.size}` : "";
44
+ return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
45
+ }
46
+ /** Get the avatar URL, or the default avatar if none set. */
47
+ displayAvatarURL(options) {
48
+ return this.avatarURL(options) ?? `${CDN_URL}/avatars/0/0.png`;
49
+ }
50
+ /** Returns a mention string (e.g. `<@123456>`). */
51
+ toString() {
52
+ return `<@${this.id}>`;
53
+ }
54
+ /**
55
+ * Create or get a DM channel with this user.
56
+ * Returns the DM channel; use {@link DMChannel.send} to send messages.
57
+ */
58
+ async createDM() {
59
+ const { DMChannel: DMChannelClass } = await import("./Channel-TWPDKW2P.mjs");
60
+ const data = await this.client.rest.post(Routes.userMeChannels(), {
61
+ body: { recipient_id: this.id },
62
+ auth: true
63
+ });
64
+ return new DMChannelClass(this.client, data);
65
+ }
66
+ /**
67
+ * Send a DM to this user.
68
+ * Convenience method that creates the DM channel and sends the message.
69
+ */
70
+ async send(options) {
71
+ const dm = await this.createDM();
72
+ return dm.send(options);
73
+ }
74
+ };
75
+
76
+ // src/client/ClientUser.ts
77
+ var ClientUser = class extends User {
78
+ constructor(client, data) {
79
+ super(client, { ...data });
80
+ }
81
+ };
82
+
83
+ export {
84
+ User,
85
+ ClientUser
86
+ };
@@ -0,0 +1,168 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/Message.ts
6
+ import { Collection } from "@fluxerjs/collection";
7
+ import { Routes } from "@fluxerjs/types";
8
+ import { EmbedBuilder } from "@fluxerjs/builders";
9
+ var Message = class _Message extends Base {
10
+ client;
11
+ id;
12
+ channelId;
13
+ guildId;
14
+ author;
15
+ content;
16
+ createdAt;
17
+ editedAt;
18
+ pinned;
19
+ attachments;
20
+ /** Channel where this message was sent. Resolved from cache; null if not cached (e.g. DM channel not in cache). */
21
+ get channel() {
22
+ return this.client.channels.get(this.channelId) ?? null;
23
+ }
24
+ /** Guild where this message was sent. Resolved from cache; null for DMs or if not cached. */
25
+ get guild() {
26
+ return this.guildId ? this.client.guilds.get(this.guildId) ?? null : null;
27
+ }
28
+ /** @param data - API message from POST/PATCH /channels/{id}/messages or gateway MESSAGE_CREATE */
29
+ constructor(client, data) {
30
+ super();
31
+ this.client = client;
32
+ this.id = data.id;
33
+ this.channelId = data.channel_id;
34
+ this.guildId = data.guild_id ?? null;
35
+ this.author = client.getOrCreateUser(data.author);
36
+ this.content = data.content;
37
+ this.createdAt = new Date(data.timestamp);
38
+ this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
39
+ this.pinned = data.pinned;
40
+ this.attachments = new Collection();
41
+ for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
42
+ }
43
+ /**
44
+ * Send a message to this channel without replying. Use when you want a standalone message.
45
+ * @param options - Text content or object with content and/or embeds
46
+ * @example
47
+ * await message.send('Pong!');
48
+ * await message.send({ embeds: [embed.toJSON()] });
49
+ */
50
+ async send(options) {
51
+ const body = typeof options === "string" ? { content: options } : options;
52
+ const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
53
+ return new _Message(this.client, data);
54
+ }
55
+ /**
56
+ * Send a message to a specific channel. Use for logging, forwarding, or sending to another channel in the guild.
57
+ * @param channelId - Snowflake of the target channel (e.g. log channel ID)
58
+ * @param options - Text content or object with content and/or embeds
59
+ * @example
60
+ * await message.sendTo(logChannelId, 'User ' + message.author.username + ' said: ' + message.content);
61
+ * await message.sendTo(announceChannelId, { embeds: [embed.toJSON()] });
62
+ */
63
+ async sendTo(channelId, options) {
64
+ return this.client.channels.send(channelId, options);
65
+ }
66
+ /**
67
+ * Reply to this message.
68
+ * @param options - Text content or object with content and/or embeds
69
+ */
70
+ async reply(options) {
71
+ const body = typeof options === "string" ? {
72
+ content: options,
73
+ message_reference: {
74
+ channel_id: this.channelId,
75
+ message_id: this.id,
76
+ guild_id: this.guildId ?? void 0
77
+ }
78
+ } : {
79
+ ...options,
80
+ message_reference: {
81
+ channel_id: this.channelId,
82
+ message_id: this.id,
83
+ guild_id: this.guildId ?? void 0
84
+ }
85
+ };
86
+ const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
87
+ return new _Message(this.client, data);
88
+ }
89
+ /**
90
+ * Edit this message. Only the author (or admins) can edit.
91
+ * @param options - New content and/or embeds
92
+ */
93
+ async edit(options) {
94
+ const body = {};
95
+ if (options.content !== void 0) body.content = options.content;
96
+ if (options.embeds?.length) {
97
+ body.embeds = options.embeds.map((e) => e instanceof EmbedBuilder ? e.toJSON() : e);
98
+ }
99
+ const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), {
100
+ body
101
+ });
102
+ return new _Message(this.client, data);
103
+ }
104
+ /**
105
+ * Re-fetch this message from the API to get the latest content, embeds, reactions, etc.
106
+ * Use when you have a stale Message (e.g. from an old event or cache) and need fresh data.
107
+ * @returns The updated message, or null if deleted or not found
108
+ * @example
109
+ * const updated = await message.fetch();
110
+ * if (updated) console.log('Latest content:', updated.content);
111
+ */
112
+ async fetch() {
113
+ return this.client.channels.fetchMessage(this.channelId, this.id);
114
+ }
115
+ /** Delete this message. */
116
+ async delete() {
117
+ await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
118
+ }
119
+ /**
120
+ * Format emoji for reaction API: unicode string or "name:id" for custom.
121
+ * For string resolution (e.g. :name:), use client.resolveEmoji; Message methods resolve automatically when guildId is available.
122
+ */
123
+ static formatEmoji(emoji) {
124
+ if (typeof emoji === "string") return emoji;
125
+ return `${emoji.name}:${emoji.id}`;
126
+ }
127
+ resolveEmojiForReaction(emoji) {
128
+ return this.client.resolveEmoji(emoji, this.guildId);
129
+ }
130
+ /**
131
+ * Add a reaction to this message (as the bot).
132
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
133
+ */
134
+ async react(emoji) {
135
+ const emojiStr = await this.resolveEmojiForReaction(emoji);
136
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/@me`;
137
+ await this.client.rest.put(route);
138
+ }
139
+ /**
140
+ * Remove the bot's reaction, or a specific user's reaction if userId is provided.
141
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
142
+ * @param userId - If provided, removes that user's reaction (requires moderator permissions)
143
+ */
144
+ async removeReaction(emoji, userId) {
145
+ const emojiStr = await this.resolveEmojiForReaction(emoji);
146
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/${userId ?? "@me"}`;
147
+ await this.client.rest.delete(route);
148
+ }
149
+ /**
150
+ * Remove all reactions from this message.
151
+ * Requires moderator permissions.
152
+ */
153
+ async removeAllReactions() {
154
+ await this.client.rest.delete(Routes.channelMessageReactions(this.channelId, this.id));
155
+ }
156
+ /**
157
+ * Remove all reactions of a specific emoji from this message.
158
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`. Requires moderator permissions.
159
+ */
160
+ async removeReactionEmoji(emoji) {
161
+ const emojiStr = await this.resolveEmojiForReaction(emoji);
162
+ await this.client.rest.delete(Routes.channelMessageReaction(this.channelId, this.id, emojiStr));
163
+ }
164
+ };
165
+
166
+ export {
167
+ Message
168
+ };
@@ -0,0 +1,207 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/client/MessageManager.ts
6
+ var MessageManager = class {
7
+ constructor(client, channelId) {
8
+ this.client = client;
9
+ this.channelId = channelId;
10
+ }
11
+ /**
12
+ * Fetch a message by ID from this channel.
13
+ * @param messageId - Snowflake of the message
14
+ * @returns The message, or null if not found
15
+ */
16
+ async fetch(messageId) {
17
+ return this.client.channels.fetchMessage(this.channelId, messageId);
18
+ }
19
+ };
20
+
21
+ // src/structures/Channel.ts
22
+ import { ChannelType, Routes } from "@fluxerjs/types";
23
+ var Channel = class _Channel extends Base {
24
+ /** Whether this channel has a send method (TextChannel, DMChannel). */
25
+ isSendable() {
26
+ return "send" in this;
27
+ }
28
+ /** Whether this channel is a DM or Group DM. */
29
+ isDM() {
30
+ return this.type === ChannelType.DM || this.type === ChannelType.GroupDM;
31
+ }
32
+ /** Whether this channel is voice-based (VoiceChannel). */
33
+ isVoice() {
34
+ return "bitrate" in this;
35
+ }
36
+ /** Create a DM channel from API data (type DM or GroupDM). */
37
+ static createDM(client, data) {
38
+ return new DMChannel(client, data);
39
+ }
40
+ client;
41
+ id;
42
+ type;
43
+ /** @param data - API channel from GET /channels/{id} or GET /guilds/{id}/channels */
44
+ constructor(client, data) {
45
+ super();
46
+ this.client = client;
47
+ this.id = data.id;
48
+ this.type = data.type;
49
+ }
50
+ /**
51
+ * Create the appropriate channel subclass from API data.
52
+ * @param client - The client instance
53
+ * @param data - Channel data from the API
54
+ */
55
+ static from(client, data) {
56
+ const type = data.type ?? 0;
57
+ if (type === ChannelType.GuildText) return new TextChannel(client, data);
58
+ if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
59
+ if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
60
+ if (type === ChannelType.GuildLink || type === ChannelType.GuildLinkExtended)
61
+ return new LinkChannel(client, data);
62
+ return new GuildChannel(client, data);
63
+ }
64
+ /**
65
+ * Create a channel from API data, including DM and GroupDM.
66
+ * Used by ChannelManager.fetch() for GET /channels/{id}.
67
+ */
68
+ static fromOrCreate(client, data) {
69
+ const type = data.type ?? 0;
70
+ if (type === ChannelType.DM || type === ChannelType.GroupDM)
71
+ return _Channel.createDM(client, data);
72
+ return _Channel.from(client, data);
73
+ }
74
+ };
75
+ var GuildChannel = class extends Channel {
76
+ guildId;
77
+ name;
78
+ position;
79
+ parentId;
80
+ constructor(client, data) {
81
+ super(client, data);
82
+ this.guildId = data.guild_id ?? "";
83
+ this.name = data.name ?? null;
84
+ this.position = data.position;
85
+ this.parentId = data.parent_id ?? null;
86
+ }
87
+ /**
88
+ * Create a webhook in this channel.
89
+ * @param options - Webhook name and optional avatar URL
90
+ * @returns The webhook with token (required for send()). Requires Manage Webhooks permission.
91
+ */
92
+ async createWebhook(options) {
93
+ const { Webhook } = await import("./Webhook-2MQESB7Z.mjs");
94
+ const data = await this.client.rest.post(Routes.channelWebhooks(this.id), {
95
+ body: options,
96
+ auth: true
97
+ });
98
+ return new Webhook(this.client, data);
99
+ }
100
+ /**
101
+ * Fetch all webhooks in this channel.
102
+ * @returns Webhooks (includes token when listing from channel; can send via send())
103
+ */
104
+ async fetchWebhooks() {
105
+ const { Webhook } = await import("./Webhook-2MQESB7Z.mjs");
106
+ const data = await this.client.rest.get(Routes.channelWebhooks(this.id));
107
+ const list = Array.isArray(data) ? data : Object.values(data ?? {});
108
+ return list.map((w) => new Webhook(this.client, w));
109
+ }
110
+ };
111
+ var TextChannel = class extends GuildChannel {
112
+ topic;
113
+ nsfw;
114
+ rateLimitPerUser;
115
+ lastMessageId;
116
+ constructor(client, data) {
117
+ super(client, data);
118
+ this.topic = data.topic ?? null;
119
+ this.nsfw = data.nsfw ?? false;
120
+ this.rateLimitPerUser = data.rate_limit_per_user ?? 0;
121
+ this.lastMessageId = data.last_message_id ?? null;
122
+ }
123
+ /**
124
+ * Send a message to this channel.
125
+ * @param options - Text content or object with `content` and/or `embeds`
126
+ */
127
+ async send(options) {
128
+ const body = typeof options === "string" ? { content: options } : options;
129
+ const { Message } = await import("./Message-G2QIKZQK.mjs");
130
+ const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
131
+ return new Message(this.client, data);
132
+ }
133
+ /** Message manager for this channel. Use channel.messages.fetch(messageId). */
134
+ get messages() {
135
+ return new MessageManager(this.client, this.id);
136
+ }
137
+ /**
138
+ * Fetch a message by ID from this channel.
139
+ * @param messageId - Snowflake of the message
140
+ * @returns The message, or null if not found
141
+ * @deprecated Use channel.messages.fetch(messageId) instead.
142
+ */
143
+ async fetchMessage(messageId) {
144
+ return this.client.channels.fetchMessage(this.id, messageId);
145
+ }
146
+ };
147
+ var CategoryChannel = class extends GuildChannel {
148
+ };
149
+ var VoiceChannel = class extends GuildChannel {
150
+ bitrate;
151
+ userLimit;
152
+ rtcRegion;
153
+ constructor(client, data) {
154
+ super(client, data);
155
+ this.bitrate = data.bitrate ?? null;
156
+ this.userLimit = data.user_limit ?? null;
157
+ this.rtcRegion = data.rtc_region ?? null;
158
+ }
159
+ };
160
+ var LinkChannel = class extends GuildChannel {
161
+ url;
162
+ constructor(client, data) {
163
+ super(client, data);
164
+ this.url = data.url ?? null;
165
+ }
166
+ };
167
+ var DMChannel = class extends Channel {
168
+ lastMessageId;
169
+ constructor(client, data) {
170
+ super(client, data);
171
+ this.lastMessageId = data.last_message_id ?? null;
172
+ }
173
+ /**
174
+ * Send a message to this DM channel.
175
+ * @param options - Text content or object with `content` and/or `embeds`
176
+ */
177
+ async send(options) {
178
+ const body = typeof options === "string" ? { content: options } : options;
179
+ const { Message } = await import("./Message-G2QIKZQK.mjs");
180
+ const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
181
+ return new Message(this.client, data);
182
+ }
183
+ /** Message manager for this channel. Use channel.messages.fetch(messageId). */
184
+ get messages() {
185
+ return new MessageManager(this.client, this.id);
186
+ }
187
+ /**
188
+ * Fetch a message by ID from this DM channel.
189
+ * @param messageId - Snowflake of the message
190
+ * @returns The message, or null if not found
191
+ * @deprecated Use channel.messages.fetch(messageId) instead.
192
+ */
193
+ async fetchMessage(messageId) {
194
+ return this.client.channels.fetchMessage(this.id, messageId);
195
+ }
196
+ };
197
+
198
+ export {
199
+ MessageManager,
200
+ Channel,
201
+ GuildChannel,
202
+ TextChannel,
203
+ CategoryChannel,
204
+ VoiceChannel,
205
+ LinkChannel,
206
+ DMChannel
207
+ };
@@ -0,0 +1,42 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/MessageReaction.ts
6
+ var MessageReaction = class extends Base {
7
+ client;
8
+ messageId;
9
+ channelId;
10
+ guildId;
11
+ emoji;
12
+ /** Raw gateway payload for low-level access. */
13
+ _data;
14
+ constructor(client, data) {
15
+ super();
16
+ this.client = client;
17
+ this._data = data;
18
+ this.messageId = data.message_id;
19
+ this.channelId = data.channel_id;
20
+ this.guildId = data.guild_id ?? null;
21
+ this.emoji = data.emoji;
22
+ }
23
+ /** Emoji as a string: unicode or "name:id" for custom. */
24
+ get emojiIdentifier() {
25
+ return this.emoji.id ? `${this.emoji.name}:${this.emoji.id}` : this.emoji.name;
26
+ }
27
+ /** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
28
+ get guild() {
29
+ return this.guildId ? this.client.guilds.get(this.guildId) ?? null : null;
30
+ }
31
+ /**
32
+ * Fetch the message this reaction belongs to.
33
+ * Use when you need to edit, delete, or otherwise interact with the message.
34
+ */
35
+ async fetchMessage() {
36
+ return this.client.channels.fetchMessage(this.channelId, this.messageId);
37
+ }
38
+ };
39
+
40
+ export {
41
+ MessageReaction
42
+ };
@@ -0,0 +1,52 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/GuildMember.ts
6
+ import { Routes } from "@fluxerjs/types";
7
+ var GuildMember = class extends Base {
8
+ client;
9
+ id;
10
+ user;
11
+ guild;
12
+ nick;
13
+ roles;
14
+ joinedAt;
15
+ communicationDisabledUntil;
16
+ /** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
17
+ constructor(client, data, guild) {
18
+ super();
19
+ this.client = client;
20
+ this.user = client.getOrCreateUser(data.user);
21
+ this.id = data.user.id;
22
+ this.guild = guild;
23
+ this.nick = data.nick ?? null;
24
+ this.roles = data.roles ?? [];
25
+ this.joinedAt = new Date(data.joined_at);
26
+ this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
27
+ }
28
+ /** Nickname, or global name, or username. */
29
+ get displayName() {
30
+ return this.nick ?? this.user.globalName ?? this.user.username;
31
+ }
32
+ /**
33
+ * Add a role to this member.
34
+ * @param roleId - The role ID to add
35
+ * Requires Manage Roles permission.
36
+ */
37
+ async addRole(roleId) {
38
+ await this.client.rest.put(Routes.guildMemberRole(this.guild.id, this.id, roleId));
39
+ }
40
+ /**
41
+ * Remove a role from this member.
42
+ * @param roleId - The role ID to remove
43
+ * Requires Manage Roles permission.
44
+ */
45
+ async removeRole(roleId) {
46
+ await this.client.rest.delete(Routes.guildMemberRole(this.guild.id, this.id, roleId));
47
+ }
48
+ };
49
+
50
+ export {
51
+ GuildMember
52
+ };
@@ -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
+ };