@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
@@ -6,7 +6,7 @@ import {
6
6
  LinkChannel,
7
7
  TextChannel,
8
8
  VoiceChannel
9
- } from "./chunk-WYSHH4LR.mjs";
9
+ } from "./chunk-FJS5FBXO.mjs";
10
10
  import "./chunk-XNS4O6QJ.mjs";
11
11
  export {
12
12
  CategoryChannel,
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  ClientUser
3
- } from "./chunk-6CEMF2LO.mjs";
4
- import "./chunk-P4IRDGB4.mjs";
3
+ } from "./chunk-GCIJYVRC.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-X77DFNE3.mjs";
4
4
  import "./chunk-HQMYRYMY.mjs";
5
+ import "./chunk-GFUJVQ7L.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
+ GuildBan
3
+ } from "./chunk-RCP27MRC.mjs";
4
+ import "./chunk-XNS4O6QJ.mjs";
5
+ export {
6
+ GuildBan
7
+ };
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  GuildMember
3
- } from "./chunk-62S4AB2S.mjs";
4
- import "./chunk-CQ5ZVTLX.mjs";
3
+ } from "./chunk-GFUJVQ7L.mjs";
5
4
  import "./chunk-XNS4O6QJ.mjs";
6
5
  export {
7
6
  GuildMember
@@ -1,7 +1,7 @@
1
1
  import {
2
- Webhook
3
- } from "./chunk-PYYXC7US.mjs";
2
+ Invite
3
+ } from "./chunk-QEXIYXXU.mjs";
4
4
  import "./chunk-XNS4O6QJ.mjs";
5
5
  export {
6
- Webhook
6
+ Invite
7
7
  };
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  Message
3
- } from "./chunk-XTDZQD4A.mjs";
4
- import "./chunk-DLROMCIJ.mjs";
3
+ } from "./chunk-DSPSRPHF.mjs";
5
4
  import "./chunk-XNS4O6QJ.mjs";
6
5
  export {
7
6
  Message
@@ -0,0 +1,7 @@
1
+ import {
2
+ MessageReaction
3
+ } from "./chunk-HBF5QEDH.mjs";
4
+ import "./chunk-XNS4O6QJ.mjs";
5
+ export {
6
+ MessageReaction
7
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
- Webhook
3
- } from "./chunk-QDNFJVVE.mjs";
2
+ Role
3
+ } from "./chunk-SQVCCSNN.mjs";
4
4
  import "./chunk-XNS4O6QJ.mjs";
5
5
  export {
6
- Webhook
6
+ Role
7
7
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Webhook
3
- } from "./chunk-BUEXP5SZ.mjs";
3
+ } from "./chunk-53Y37KRG.mjs";
4
4
  import "./chunk-XNS4O6QJ.mjs";
5
5
  export {
6
6
  Webhook
@@ -28,13 +28,47 @@ var Webhook = class _Webhook extends Base {
28
28
  async delete() {
29
29
  await this.client.rest.delete(Routes.webhook(this.id), { auth: true });
30
30
  }
31
+ /**
32
+ * Edit this webhook. With token: name and avatar only. Without token (bot auth): name, avatar, and channel_id.
33
+ * @param options - Fields to update (name, avatar, channel_id when using bot auth)
34
+ * @returns This webhook instance with updated fields
35
+ */
36
+ async edit(options) {
37
+ const body = {};
38
+ if (options.name !== void 0) body.name = options.name;
39
+ if (options.avatar !== void 0) body.avatar = options.avatar;
40
+ if ("channel_id" in options && options.channel_id !== void 0 && !this.token) {
41
+ body.channel_id = options.channel_id;
42
+ }
43
+ if (this.token) {
44
+ const data2 = await this.client.rest.patch(
45
+ Routes.webhookExecute(this.id, this.token),
46
+ { body, auth: false }
47
+ );
48
+ const w2 = data2;
49
+ this.name = w2.name ?? this.name;
50
+ this.avatar = w2.avatar ?? null;
51
+ return this;
52
+ }
53
+ const data = await this.client.rest.patch(Routes.webhook(this.id), {
54
+ body,
55
+ auth: true
56
+ });
57
+ const w = data;
58
+ this.name = w.name ?? this.name;
59
+ this.avatar = w.avatar ?? null;
60
+ this.channelId = w.channel_id ?? this.channelId;
61
+ return this;
62
+ }
31
63
  /**
32
64
  * Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
33
65
  * @throws Error if token is not available
34
66
  */
35
67
  async send(options) {
36
68
  if (!this.token) {
37
- throw new Error("Webhook token is required to send. The token is only returned when creating a webhook; fetched webhooks cannot send.");
69
+ throw new Error(
70
+ "Webhook token is required to send. The token is only returned when creating a webhook; fetched webhooks cannot send."
71
+ );
38
72
  }
39
73
  const body = typeof options === "string" ? { content: options } : options;
40
74
  await this.client.rest.post(Routes.webhookExecute(this.id, this.token), {
@@ -0,0 +1,200 @@
1
+ import {
2
+ Base
3
+ } from "./chunk-XNS4O6QJ.mjs";
4
+
5
+ // src/structures/Message.ts
6
+ import { Collection } from "@fluxerjs/collection";
7
+ import { MessageType, 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
+ type;
21
+ flags;
22
+ mentionEveryone;
23
+ tts;
24
+ embeds;
25
+ stickers;
26
+ reactions;
27
+ messageReference;
28
+ messageSnapshots;
29
+ call;
30
+ referencedMessage;
31
+ /** Channel where this message was sent. Resolved from cache; null if not cached (e.g. DM channel not in cache). */
32
+ get channel() {
33
+ return this.client.channels.get(this.channelId) ?? null;
34
+ }
35
+ /** Guild where this message was sent. Resolved from cache; null for DMs or if not cached. */
36
+ get guild() {
37
+ return this.guildId ? this.client.guilds.get(this.guildId) ?? null : null;
38
+ }
39
+ /** @param data - API message from POST/PATCH /channels/{id}/messages or gateway MESSAGE_CREATE */
40
+ constructor(client, data) {
41
+ super();
42
+ this.client = client;
43
+ this.id = data.id;
44
+ this.channelId = data.channel_id;
45
+ this.guildId = data.guild_id ?? null;
46
+ this.author = client.getOrCreateUser(data.author);
47
+ this.content = data.content;
48
+ this.createdAt = new Date(data.timestamp);
49
+ this.editedAt = data.edited_timestamp ? new Date(data.edited_timestamp) : null;
50
+ this.pinned = data.pinned;
51
+ this.attachments = new Collection();
52
+ for (const a of data.attachments ?? []) this.attachments.set(a.id, a);
53
+ this.type = data.type ?? MessageType.Default;
54
+ this.flags = data.flags ?? 0;
55
+ this.mentionEveryone = data.mention_everyone ?? false;
56
+ this.tts = data.tts ?? false;
57
+ this.embeds = data.embeds ?? [];
58
+ this.stickers = data.stickers ?? [];
59
+ this.reactions = data.reactions ?? [];
60
+ this.messageReference = data.message_reference ?? null;
61
+ this.messageSnapshots = data.message_snapshots ?? [];
62
+ this.call = data.call ?? null;
63
+ this.referencedMessage = data.referenced_message ? new _Message(client, data.referenced_message) : null;
64
+ }
65
+ /**
66
+ * Send a message to this channel without replying. Use when you want a standalone message.
67
+ * @param options - Text content or object with content and/or embeds
68
+ * @example
69
+ * await message.send('Pong!');
70
+ * await message.send({ embeds: [embed.toJSON()] });
71
+ */
72
+ async send(options) {
73
+ const body = typeof options === "string" ? { content: options } : options;
74
+ const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
75
+ return new _Message(this.client, data);
76
+ }
77
+ /**
78
+ * Send a message to a specific channel. Use for logging, forwarding, or sending to another channel in the guild.
79
+ * @param channelId - Snowflake of the target channel (e.g. log channel ID)
80
+ * @param options - Text content or object with content and/or embeds
81
+ * @example
82
+ * await message.sendTo(logChannelId, 'User ' + message.author.username + ' said: ' + message.content);
83
+ * await message.sendTo(announceChannelId, { embeds: [embed.toJSON()] });
84
+ */
85
+ async sendTo(channelId, options) {
86
+ return this.client.channels.send(channelId, options);
87
+ }
88
+ /**
89
+ * Reply to this message.
90
+ * @param options - Text content or object with content and/or embeds
91
+ */
92
+ async reply(options) {
93
+ const body = typeof options === "string" ? {
94
+ content: options,
95
+ message_reference: {
96
+ channel_id: this.channelId,
97
+ message_id: this.id,
98
+ guild_id: this.guildId ?? void 0
99
+ }
100
+ } : {
101
+ ...options,
102
+ message_reference: {
103
+ channel_id: this.channelId,
104
+ message_id: this.id,
105
+ guild_id: this.guildId ?? void 0
106
+ }
107
+ };
108
+ const data = await this.client.rest.post(Routes.channelMessages(this.channelId), { body });
109
+ return new _Message(this.client, data);
110
+ }
111
+ /**
112
+ * Edit this message. Only the author (or admins) can edit.
113
+ * @param options - New content and/or embeds
114
+ */
115
+ async edit(options) {
116
+ const body = {};
117
+ if (options.content !== void 0) body.content = options.content;
118
+ if (options.embeds?.length) {
119
+ body.embeds = options.embeds.map((e) => e instanceof EmbedBuilder ? e.toJSON() : e);
120
+ }
121
+ const data = await this.client.rest.patch(Routes.channelMessage(this.channelId, this.id), {
122
+ body
123
+ });
124
+ return new _Message(this.client, data);
125
+ }
126
+ /**
127
+ * Re-fetch this message from the API to get the latest content, embeds, reactions, etc.
128
+ * Use when you have a stale Message (e.g. from an old event or cache) and need fresh data.
129
+ * @returns The updated message, or null if deleted or not found
130
+ * @example
131
+ * const updated = await message.fetch();
132
+ * if (updated) console.log('Latest content:', updated.content);
133
+ */
134
+ async fetch() {
135
+ return this.client.channels.fetchMessage(this.channelId, this.id);
136
+ }
137
+ /** Delete this message. */
138
+ async delete() {
139
+ await this.client.rest.delete(Routes.channelMessage(this.channelId, this.id));
140
+ }
141
+ /** Pin this message to the channel. Requires Manage Messages permission. */
142
+ async pin() {
143
+ await this.client.rest.put(Routes.channelPinMessage(this.channelId, this.id));
144
+ this.pinned = true;
145
+ }
146
+ /** Unpin this message from the channel. Requires Manage Messages permission. */
147
+ async unpin() {
148
+ await this.client.rest.delete(Routes.channelPinMessage(this.channelId, this.id));
149
+ this.pinned = false;
150
+ }
151
+ /**
152
+ * Format emoji for reaction API: unicode string or "name:id" for custom.
153
+ * For string resolution (e.g. :name:), use client.resolveEmoji; Message methods resolve automatically when guildId is available.
154
+ */
155
+ static formatEmoji(emoji) {
156
+ if (typeof emoji === "string") return emoji;
157
+ return `${emoji.name}:${emoji.id}`;
158
+ }
159
+ resolveEmojiForReaction(emoji) {
160
+ return this.client.resolveEmoji(emoji, this.guildId);
161
+ }
162
+ /**
163
+ * Add a reaction to this message (as the bot).
164
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
165
+ */
166
+ async react(emoji) {
167
+ const emojiStr = await this.resolveEmojiForReaction(emoji);
168
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/@me`;
169
+ await this.client.rest.put(route);
170
+ }
171
+ /**
172
+ * Remove the bot's reaction, or a specific user's reaction if userId is provided.
173
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
174
+ * @param userId - If provided, removes that user's reaction (requires moderator permissions)
175
+ */
176
+ async removeReaction(emoji, userId) {
177
+ const emojiStr = await this.resolveEmojiForReaction(emoji);
178
+ const route = `${Routes.channelMessageReaction(this.channelId, this.id, emojiStr)}/${userId ?? "@me"}`;
179
+ await this.client.rest.delete(route);
180
+ }
181
+ /**
182
+ * Remove all reactions from this message.
183
+ * Requires moderator permissions.
184
+ */
185
+ async removeAllReactions() {
186
+ await this.client.rest.delete(Routes.channelMessageReactions(this.channelId, this.id));
187
+ }
188
+ /**
189
+ * Remove all reactions of a specific emoji from this message.
190
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`. Requires moderator permissions.
191
+ */
192
+ async removeReactionEmoji(emoji) {
193
+ const emojiStr = await this.resolveEmojiForReaction(emoji);
194
+ await this.client.rest.delete(Routes.channelMessageReaction(this.channelId, this.id, emojiStr));
195
+ }
196
+ };
197
+
198
+ export {
199
+ Message
200
+ };
@@ -2,9 +2,37 @@ import {
2
2
  Base
3
3
  } from "./chunk-XNS4O6QJ.mjs";
4
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
+
5
21
  // src/structures/Channel.ts
6
22
  import { ChannelType, Routes } from "@fluxerjs/types";
7
- var Channel = class extends Base {
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
+ }
8
36
  /** Create a DM channel from API data (type DM or GroupDM). */
9
37
  static createDM(client, data) {
10
38
  return new DMChannel(client, data);
@@ -29,9 +57,20 @@ var Channel = class extends Base {
29
57
  if (type === ChannelType.GuildText) return new TextChannel(client, data);
30
58
  if (type === ChannelType.GuildCategory) return new CategoryChannel(client, data);
31
59
  if (type === ChannelType.GuildVoice) return new VoiceChannel(client, data);
32
- if (type === ChannelType.GuildLink || type === ChannelType.GuildLinkExtended) return new LinkChannel(client, data);
60
+ if (type === ChannelType.GuildLink || type === ChannelType.GuildLinkExtended)
61
+ return new LinkChannel(client, data);
33
62
  return new GuildChannel(client, data);
34
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
+ }
35
74
  };
36
75
  var GuildChannel = class extends Channel {
37
76
  guildId;
@@ -51,7 +90,7 @@ var GuildChannel = class extends Channel {
51
90
  * @returns The webhook with token (required for send()). Requires Manage Webhooks permission.
52
91
  */
53
92
  async createWebhook(options) {
54
- const { Webhook } = await import("./Webhook-TGAZZRQQ.mjs");
93
+ const { Webhook } = await import("./Webhook-32VJD4AL.mjs");
55
94
  const data = await this.client.rest.post(Routes.channelWebhooks(this.id), {
56
95
  body: options,
57
96
  auth: true
@@ -63,7 +102,7 @@ var GuildChannel = class extends Channel {
63
102
  * @returns Webhooks (includes token when listing from channel; can send via send())
64
103
  */
65
104
  async fetchWebhooks() {
66
- const { Webhook } = await import("./Webhook-TGAZZRQQ.mjs");
105
+ const { Webhook } = await import("./Webhook-32VJD4AL.mjs");
67
106
  const data = await this.client.rest.get(Routes.channelWebhooks(this.id));
68
107
  const list = Array.isArray(data) ? data : Object.values(data ?? {});
69
108
  return list.map((w) => new Webhook(this.client, w));
@@ -87,10 +126,36 @@ var TextChannel = class extends GuildChannel {
87
126
  */
88
127
  async send(options) {
89
128
  const body = typeof options === "string" ? { content: options } : options;
90
- const { Message } = await import("./Message-W624MHJF.mjs");
129
+ const { Message } = await import("./Message-6IYEYSV6.mjs");
91
130
  const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
92
131
  return new Message(this.client, data);
93
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 pinned messages in this channel.
139
+ * @returns Pinned messages
140
+ */
141
+ async fetchPinnedMessages() {
142
+ const { Message } = await import("./Message-6IYEYSV6.mjs");
143
+ const data = await this.client.rest.get(Routes.channelPins(this.id));
144
+ const list = Array.isArray(data) ? data : data?.items ?? [];
145
+ return list.map((item) => {
146
+ const msg = typeof item === "object" && item && "message" in item ? item.message : item;
147
+ return new Message(this.client, msg);
148
+ });
149
+ }
150
+ /**
151
+ * Fetch a message by ID from this channel.
152
+ * @param messageId - Snowflake of the message
153
+ * @returns The message, or null if not found
154
+ * @deprecated Use channel.messages.fetch(messageId) instead.
155
+ */
156
+ async fetchMessage(messageId) {
157
+ return this.client.channels.fetchMessage(this.id, messageId);
158
+ }
94
159
  };
95
160
  var CategoryChannel = class extends GuildChannel {
96
161
  };
@@ -124,13 +189,40 @@ var DMChannel = class extends Channel {
124
189
  */
125
190
  async send(options) {
126
191
  const body = typeof options === "string" ? { content: options } : options;
127
- const { Message } = await import("./Message-W624MHJF.mjs");
192
+ const { Message } = await import("./Message-6IYEYSV6.mjs");
128
193
  const data = await this.client.rest.post(Routes.channelMessages(this.id), { body });
129
194
  return new Message(this.client, data);
130
195
  }
196
+ /** Message manager for this channel. Use channel.messages.fetch(messageId). */
197
+ get messages() {
198
+ return new MessageManager(this.client, this.id);
199
+ }
200
+ /**
201
+ * Fetch pinned messages in this DM channel.
202
+ * @returns Pinned messages
203
+ */
204
+ async fetchPinnedMessages() {
205
+ const { Message } = await import("./Message-6IYEYSV6.mjs");
206
+ const data = await this.client.rest.get(Routes.channelPins(this.id));
207
+ const list = Array.isArray(data) ? data : data?.items ?? [];
208
+ return list.map((item) => {
209
+ const msg = typeof item === "object" && item && "message" in item ? item.message : item;
210
+ return new Message(this.client, msg);
211
+ });
212
+ }
213
+ /**
214
+ * Fetch a message by ID from this DM channel.
215
+ * @param messageId - Snowflake of the message
216
+ * @returns The message, or null if not found
217
+ * @deprecated Use channel.messages.fetch(messageId) instead.
218
+ */
219
+ async fetchMessage(messageId) {
220
+ return this.client.channels.fetchMessage(this.id, messageId);
221
+ }
131
222
  };
132
223
 
133
224
  export {
225
+ MessageManager,
134
226
  Channel,
135
227
  GuildChannel,
136
228
  TextChannel,
@@ -1,10 +1,10 @@
1
+ import {
2
+ CDN_URL
3
+ } from "./chunk-HQMYRYMY.mjs";
1
4
  import {
2
5
  Base
3
6
  } from "./chunk-XNS4O6QJ.mjs";
4
7
 
5
- // src/util/Constants.ts
6
- var CDN_URL = "https://fluxerusercontent.com";
7
-
8
8
  // src/structures/User.ts
9
9
  import { Routes } from "@fluxerjs/types";
10
10
  var User = class extends Base {
@@ -26,6 +26,13 @@ var User = class extends Base {
26
26
  this.avatar = data.avatar ?? null;
27
27
  this.bot = !!data.bot;
28
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
+ }
29
36
  /**
30
37
  * Get the URL for this user's avatar.
31
38
  * @param options - Optional `size` and `extension` (default: `png`)
@@ -49,7 +56,7 @@ var User = class extends Base {
49
56
  * Returns the DM channel; use {@link DMChannel.send} to send messages.
50
57
  */
51
58
  async createDM() {
52
- const { DMChannel: DMChannelClass } = await import("./Channel-OSOB6ELO.mjs");
59
+ const { DMChannel: DMChannelClass } = await import("./Channel-ICWNKXBR.mjs");
53
60
  const data = await this.client.rest.post(Routes.userMeChannels(), {
54
61
  body: { recipient_id: this.id },
55
62
  auth: true
@@ -66,7 +73,14 @@ var User = class extends Base {
66
73
  }
67
74
  };
68
75
 
76
+ // src/client/ClientUser.ts
77
+ var ClientUser = class extends User {
78
+ constructor(client, data) {
79
+ super(client, { ...data });
80
+ }
81
+ };
82
+
69
83
  export {
70
- CDN_URL,
71
- User
84
+ User,
85
+ ClientUser
72
86
  };
@@ -1,6 +1,3 @@
1
- import {
2
- User
3
- } from "./chunk-J3EIGOXQ.mjs";
4
1
  import {
5
2
  Base
6
3
  } from "./chunk-XNS4O6QJ.mjs";
@@ -16,17 +13,29 @@ var GuildMember = class extends Base {
16
13
  roles;
17
14
  joinedAt;
18
15
  communicationDisabledUntil;
16
+ mute;
17
+ deaf;
18
+ avatar;
19
+ banner;
20
+ accentColor;
21
+ profileFlags;
19
22
  /** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
20
23
  constructor(client, data, guild) {
21
24
  super();
22
25
  this.client = client;
23
- this.user = new User(client, data.user);
26
+ this.user = client.getOrCreateUser(data.user);
24
27
  this.id = data.user.id;
25
28
  this.guild = guild;
26
29
  this.nick = data.nick ?? null;
27
30
  this.roles = data.roles ?? [];
28
31
  this.joinedAt = new Date(data.joined_at);
29
32
  this.communicationDisabledUntil = data.communication_disabled_until ? new Date(data.communication_disabled_until) : null;
33
+ this.mute = data.mute ?? false;
34
+ this.deaf = data.deaf ?? false;
35
+ this.avatar = data.avatar ?? null;
36
+ this.banner = data.banner ?? null;
37
+ this.accentColor = data.accent_color ?? null;
38
+ this.profileFlags = data.profile_flags ?? null;
30
39
  }
31
40
  /** Nickname, or global name, or username. */
32
41
  get displayName() {
@@ -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
+ };