@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
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Collection } from '@fluxerjs/collection';
2
1
  import * as _fluxerjs_types from '@fluxerjs/types';
3
- import { APIWebhook, APIChannelPartial, ChannelType, APIChannel, APIMessageAttachment, APIMessage, APIEmbed, APIUserPartial, APIGuild, APIGuildMember, GatewayPresenceUpdateData, GatewaySendPayload, Routes, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayVoiceServerUpdateDispatchData } from '@fluxerjs/types';
2
+ import { APIWebhook, APIWebhookUpdateRequest, APIWebhookTokenUpdateRequest, APIChannel, APIChannelPartial, ChannelType, APIMessageAttachment, MessageType, APIEmbed, APIMessageSticker, APIMessageReaction, APIMessageReference, APIMessageSnapshot, APIMessageCall, APIMessage, APIUserPartial, APIGuildMember, APIRole, APIGuild, APIGuildAuditLog, APIGuildPartial, APIInvite, APIBan, GatewayReactionEmoji, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayPresenceUpdateData, GatewaySendPayload, Routes, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayVoiceServerUpdateDispatchData, APIEmoji, APISticker } from '@fluxerjs/types';
4
3
  export { GatewayOpcodes, Routes } from '@fluxerjs/types';
4
+ import { Collection } from '@fluxerjs/collection';
5
5
  import { EmbedBuilder } from '@fluxerjs/builders';
6
6
  export { AttachmentBuilder, EmbedBuilder, MessagePayload } from '@fluxerjs/builders';
7
7
  import { EventEmitter } from 'events';
@@ -12,6 +12,24 @@ declare abstract class Base {
12
12
  abstract readonly client: Client;
13
13
  }
14
14
 
15
+ /**
16
+ * Manages messages for a channel. Access via channel.messages.
17
+ * @example
18
+ * const message = await channel.messages.fetch(messageId);
19
+ * if (message) await message.edit({ content: 'Updated!' });
20
+ */
21
+ declare class MessageManager {
22
+ private readonly client;
23
+ private readonly channelId;
24
+ constructor(client: Client, channelId: string);
25
+ /**
26
+ * Fetch a message by ID from this channel.
27
+ * @param messageId - Snowflake of the message
28
+ * @returns The message, or null if not found
29
+ */
30
+ fetch(messageId: string): Promise<Message | null>;
31
+ }
32
+
15
33
  /** Options for sending a message via webhook. */
16
34
  interface WebhookSendOptions {
17
35
  /** Message text content */
@@ -33,7 +51,7 @@ declare class Webhook extends Base {
33
51
  readonly client: Client;
34
52
  readonly id: string;
35
53
  readonly guildId: string;
36
- readonly channelId: string;
54
+ channelId: string;
37
55
  name: string;
38
56
  avatar: string | null;
39
57
  /** Present only when webhook was created via createWebhook(); not returned when fetching. */
@@ -44,6 +62,12 @@ declare class Webhook extends Base {
44
62
  });
45
63
  /** Delete this webhook. Requires bot token with Manage Webhooks permission. */
46
64
  delete(): Promise<void>;
65
+ /**
66
+ * Edit this webhook. With token: name and avatar only. Without token (bot auth): name, avatar, and channel_id.
67
+ * @param options - Fields to update (name, avatar, channel_id when using bot auth)
68
+ * @returns This webhook instance with updated fields
69
+ */
70
+ edit(options: APIWebhookUpdateRequest | APIWebhookTokenUpdateRequest): Promise<Webhook>;
47
71
  /**
48
72
  * Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
49
73
  * @throws Error if token is not available
@@ -72,6 +96,12 @@ declare class Webhook extends Base {
72
96
 
73
97
  /** Base class for all channel types. */
74
98
  declare abstract class Channel extends Base {
99
+ /** Whether this channel has a send method (TextChannel, DMChannel). */
100
+ isSendable(): this is TextChannel | DMChannel;
101
+ /** Whether this channel is a DM or Group DM. */
102
+ isDM(): boolean;
103
+ /** Whether this channel is voice-based (VoiceChannel). */
104
+ isVoice(): boolean;
75
105
  /** Create a DM channel from API data (type DM or GroupDM). */
76
106
  static createDM(client: Client, data: APIChannelPartial): DMChannel;
77
107
  readonly client: Client;
@@ -85,6 +115,11 @@ declare abstract class Channel extends Base {
85
115
  * @param data - Channel data from the API
86
116
  */
87
117
  static from(client: Client, data: APIChannel | APIChannelPartial): GuildChannel | TextChannel | null;
118
+ /**
119
+ * Create a channel from API data, including DM and GroupDM.
120
+ * Used by ChannelManager.fetch() for GET /channels/{id}.
121
+ */
122
+ static fromOrCreate(client: Client, data: APIChannel | APIChannelPartial): TextChannel | DMChannel | GuildChannel | null;
88
123
  }
89
124
  declare class GuildChannel extends Channel {
90
125
  readonly guildId: string;
@@ -121,6 +156,20 @@ declare class TextChannel extends GuildChannel {
121
156
  content?: string;
122
157
  embeds?: unknown[];
123
158
  }): Promise<Message>;
159
+ /** Message manager for this channel. Use channel.messages.fetch(messageId). */
160
+ get messages(): MessageManager;
161
+ /**
162
+ * Fetch pinned messages in this channel.
163
+ * @returns Pinned messages
164
+ */
165
+ fetchPinnedMessages(): Promise<Message[]>;
166
+ /**
167
+ * Fetch a message by ID from this channel.
168
+ * @param messageId - Snowflake of the message
169
+ * @returns The message, or null if not found
170
+ * @deprecated Use channel.messages.fetch(messageId) instead.
171
+ */
172
+ fetchMessage(messageId: string): Promise<Message | null>;
124
173
  }
125
174
  declare class CategoryChannel extends GuildChannel {
126
175
  }
@@ -146,6 +195,20 @@ declare class DMChannel extends Channel {
146
195
  content?: string;
147
196
  embeds?: unknown[];
148
197
  }): Promise<Message>;
198
+ /** Message manager for this channel. Use channel.messages.fetch(messageId). */
199
+ get messages(): MessageManager;
200
+ /**
201
+ * Fetch pinned messages in this DM channel.
202
+ * @returns Pinned messages
203
+ */
204
+ fetchPinnedMessages(): Promise<Message[]>;
205
+ /**
206
+ * Fetch a message by ID from this DM channel.
207
+ * @param messageId - Snowflake of the message
208
+ * @returns The message, or null if not found
209
+ * @deprecated Use channel.messages.fetch(messageId) instead.
210
+ */
211
+ fetchMessage(messageId: string): Promise<Message | null>;
149
212
  }
150
213
 
151
214
  /** Options for editing a message (content and/or embeds). */
@@ -167,9 +230,46 @@ declare class Message extends Base {
167
230
  readonly editedAt: Date | null;
168
231
  pinned: boolean;
169
232
  readonly attachments: Collection<string, APIMessageAttachment>;
170
- channel?: Channel;
233
+ readonly type: MessageType;
234
+ readonly flags: number;
235
+ readonly mentionEveryone: boolean;
236
+ readonly tts: boolean;
237
+ readonly embeds: APIEmbed[];
238
+ readonly stickers: APIMessageSticker[];
239
+ readonly reactions: APIMessageReaction[];
240
+ readonly messageReference: APIMessageReference | null;
241
+ readonly messageSnapshots: APIMessageSnapshot[];
242
+ readonly call: APIMessageCall | null;
243
+ readonly referencedMessage: Message | null;
244
+ /** Channel where this message was sent. Resolved from cache; null if not cached (e.g. DM channel not in cache). */
245
+ get channel(): Channel | null;
246
+ /** Guild where this message was sent. Resolved from cache; null for DMs or if not cached. */
247
+ get guild(): Guild | null;
171
248
  /** @param data - API message from POST/PATCH /channels/{id}/messages or gateway MESSAGE_CREATE */
172
249
  constructor(client: Client, data: APIMessage);
250
+ /**
251
+ * Send a message to this channel without replying. Use when you want a standalone message.
252
+ * @param options - Text content or object with content and/or embeds
253
+ * @example
254
+ * await message.send('Pong!');
255
+ * await message.send({ embeds: [embed.toJSON()] });
256
+ */
257
+ send(options: string | {
258
+ content?: string;
259
+ embeds?: APIEmbed[];
260
+ }): Promise<Message>;
261
+ /**
262
+ * Send a message to a specific channel. Use for logging, forwarding, or sending to another channel in the guild.
263
+ * @param channelId - Snowflake of the target channel (e.g. log channel ID)
264
+ * @param options - Text content or object with content and/or embeds
265
+ * @example
266
+ * await message.sendTo(logChannelId, 'User ' + message.author.username + ' said: ' + message.content);
267
+ * await message.sendTo(announceChannelId, { embeds: [embed.toJSON()] });
268
+ */
269
+ sendTo(channelId: string, options: string | {
270
+ content?: string;
271
+ embeds?: APIEmbed[];
272
+ }): Promise<Message>;
173
273
  /**
174
274
  * Reply to this message.
175
275
  * @param options - Text content or object with content and/or embeds
@@ -183,29 +283,45 @@ declare class Message extends Base {
183
283
  * @param options - New content and/or embeds
184
284
  */
185
285
  edit(options: MessageEditOptions): Promise<Message>;
286
+ /**
287
+ * Re-fetch this message from the API to get the latest content, embeds, reactions, etc.
288
+ * Use when you have a stale Message (e.g. from an old event or cache) and need fresh data.
289
+ * @returns The updated message, or null if deleted or not found
290
+ * @example
291
+ * const updated = await message.fetch();
292
+ * if (updated) console.log('Latest content:', updated.content);
293
+ */
294
+ fetch(): Promise<Message | null>;
186
295
  /** Delete this message. */
187
296
  delete(): Promise<void>;
297
+ /** Pin this message to the channel. Requires Manage Messages permission. */
298
+ pin(): Promise<void>;
299
+ /** Unpin this message from the channel. Requires Manage Messages permission. */
300
+ unpin(): Promise<void>;
188
301
  /**
189
302
  * Format emoji for reaction API: unicode string or "name:id" for custom.
190
- * @param emoji - Unicode emoji (e.g. "👍") or custom { name, id } or "name:id" string
303
+ * For string resolution (e.g. :name:), use client.resolveEmoji; Message methods resolve automatically when guildId is available.
191
304
  */
192
305
  private static formatEmoji;
306
+ private resolveEmojiForReaction;
193
307
  /**
194
308
  * Add a reaction to this message (as the bot).
195
- * @param emoji - Unicode emoji (e.g. `👍`) or custom emoji `{ name, id }`
309
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
196
310
  */
197
311
  react(emoji: string | {
198
312
  name: string;
199
- id: string;
313
+ id?: string;
314
+ animated?: boolean;
200
315
  }): Promise<void>;
201
316
  /**
202
317
  * Remove the bot's reaction, or a specific user's reaction if userId is provided.
203
- * @param emoji - Unicode emoji or custom `{ name, id }`
318
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
204
319
  * @param userId - If provided, removes that user's reaction (requires moderator permissions)
205
320
  */
206
321
  removeReaction(emoji: string | {
207
322
  name: string;
208
- id: string;
323
+ id?: string;
324
+ animated?: boolean;
209
325
  }, userId?: string): Promise<void>;
210
326
  /**
211
327
  * Remove all reactions from this message.
@@ -214,11 +330,12 @@ declare class Message extends Base {
214
330
  removeAllReactions(): Promise<void>;
215
331
  /**
216
332
  * Remove all reactions of a specific emoji from this message.
217
- * @param emoji - Unicode emoji or custom `{ name, id }`. Requires moderator permissions.
333
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`. Requires moderator permissions.
218
334
  */
219
335
  removeReactionEmoji(emoji: string | {
220
336
  name: string;
221
- id: string;
337
+ id?: string;
338
+ animated?: boolean;
222
339
  }): Promise<void>;
223
340
  }
224
341
 
@@ -233,6 +350,8 @@ declare class User extends Base {
233
350
  readonly bot: boolean;
234
351
  /** @param data - API user from message author, GET /users/{id}, or GET /users/@me */
235
352
  constructor(client: Client, data: APIUserPartial);
353
+ /** Update mutable fields from fresh API data. Used by getOrCreateUser cache. */
354
+ _patch(data: APIUserPartial): void;
236
355
  /**
237
356
  * Get the URL for this user's avatar.
238
357
  * @param options - Optional `size` and `extension` (default: `png`)
@@ -262,6 +381,62 @@ declare class User extends Base {
262
381
  }): Promise<Message>;
263
382
  }
264
383
 
384
+ /** Represents a member of a guild. */
385
+ declare class GuildMember extends Base {
386
+ readonly client: Client;
387
+ readonly id: string;
388
+ readonly user: User;
389
+ readonly guild: Guild;
390
+ nick: string | null;
391
+ readonly roles: string[];
392
+ readonly joinedAt: Date;
393
+ communicationDisabledUntil: Date | null;
394
+ readonly mute: boolean;
395
+ readonly deaf: boolean;
396
+ readonly avatar: string | null;
397
+ readonly banner: string | null;
398
+ readonly accentColor: number | null;
399
+ readonly profileFlags: number | null;
400
+ /** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
401
+ constructor(client: Client, data: APIGuildMember & {
402
+ guild_id?: string;
403
+ }, guild: Guild);
404
+ /** Nickname, or global name, or username. */
405
+ get displayName(): string;
406
+ /**
407
+ * Add a role to this member.
408
+ * @param roleId - The role ID to add
409
+ * Requires Manage Roles permission.
410
+ */
411
+ addRole(roleId: string): Promise<void>;
412
+ /**
413
+ * Remove a role from this member.
414
+ * @param roleId - The role ID to remove
415
+ * Requires Manage Roles permission.
416
+ */
417
+ removeRole(roleId: string): Promise<void>;
418
+ }
419
+
420
+ /** Represents a role in a guild. */
421
+ declare class Role extends Base {
422
+ readonly client: Client;
423
+ readonly id: string;
424
+ readonly guildId: string;
425
+ name: string;
426
+ color: number;
427
+ position: number;
428
+ permissions: string;
429
+ hoist: boolean;
430
+ mentionable: boolean;
431
+ unicodeEmoji: string | null;
432
+ /** @param client - The client instance */
433
+ /** @param data - API role from GET /guilds/{id}/roles or gateway role events */
434
+ /** @param guildId - The guild this role belongs to */
435
+ constructor(client: Client, data: APIRole, guildId: string);
436
+ /** Returns a mention string (e.g. `<@&123456>`). */
437
+ toString(): string;
438
+ }
439
+
265
440
  /** Represents a Fluxer guild (server). */
266
441
  declare class Guild extends Base {
267
442
  readonly client: Client;
@@ -272,8 +447,11 @@ declare class Guild extends Base {
272
447
  readonly ownerId: string;
273
448
  members: Collection<string, GuildMember>;
274
449
  channels: Collection<string, GuildChannel>;
450
+ roles: Collection<string, Role>;
275
451
  /** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
276
- constructor(client: Client, data: APIGuild);
452
+ constructor(client: Client, data: APIGuild & {
453
+ roles?: APIRole[];
454
+ });
277
455
  /** Get the guild icon URL, or null if no icon. */
278
456
  iconURL(options?: {
279
457
  size?: number;
@@ -282,44 +460,184 @@ declare class Guild extends Base {
282
460
  bannerURL(options?: {
283
461
  size?: number;
284
462
  }): string | null;
463
+ /**
464
+ * Add a role to a member by user ID. Does not require fetching the member first.
465
+ * @param userId - The user ID of the member
466
+ * @param roleId - The role ID to add (or use guild.resolveRoleId for mention/name resolution)
467
+ * Requires Manage Roles permission.
468
+ */
469
+ addRoleToMember(userId: string, roleId: string): Promise<void>;
470
+ /**
471
+ * Remove a role from a member by user ID. Does not require fetching the member first.
472
+ * @param userId - The user ID of the member
473
+ * @param roleId - The role ID to remove
474
+ * Requires Manage Roles permission.
475
+ */
476
+ removeRoleFromMember(userId: string, roleId: string): Promise<void>;
477
+ /**
478
+ * Resolve a role ID from an argument (role mention, raw ID, or name).
479
+ * Fetches guild roles if name is provided.
480
+ * @param arg - Role mention (@role), role ID, or role name
481
+ * @returns The role ID, or null if not found
482
+ */
483
+ resolveRoleId(arg: string): Promise<string | null>;
285
484
  /**
286
485
  * Fetch a guild member by user ID.
287
486
  * @param userId - The user ID of the member to fetch
288
487
  * @returns The guild member, or null if not found
289
488
  */
290
489
  fetchMember(userId: string): Promise<GuildMember | null>;
490
+ /**
491
+ * Fetch guild audit logs. Requires View Audit Log permission.
492
+ * @param options - Optional limit, before, after, user_id, action_type for filtering
493
+ */
494
+ fetchAuditLogs(options?: {
495
+ limit?: number;
496
+ before?: string;
497
+ after?: string;
498
+ userId?: string;
499
+ actionType?: number;
500
+ }): Promise<APIGuildAuditLog>;
291
501
  /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
292
502
  fetchWebhooks(): Promise<Webhook[]>;
293
503
  }
294
504
 
295
- /** Represents a member of a guild. */
296
- declare class GuildMember extends Base {
505
+ /** Represents an invite to a guild or channel. */
506
+ declare class Invite extends Base {
297
507
  readonly client: Client;
298
- readonly id: string;
508
+ readonly code: string;
509
+ readonly type: number;
510
+ readonly guild: APIGuildPartial;
511
+ readonly channel: APIChannelPartial;
512
+ readonly inviter: User | null;
513
+ readonly memberCount: number | null;
514
+ readonly presenceCount: number | null;
515
+ readonly expiresAt: string | null;
516
+ readonly temporary: boolean | null;
517
+ readonly createdAt: string | null;
518
+ readonly uses: number | null;
519
+ readonly maxUses: number | null;
520
+ readonly maxAge: number | null;
521
+ /** @param data - API invite from GET /invites/{code}, channel/guild invite list, or gateway INVITE_CREATE */
522
+ constructor(client: Client, data: APIInvite);
523
+ /** Full invite URL (https://fluxer.gg/{code} or instance-specific). */
524
+ get url(): string;
525
+ /**
526
+ * Resolve the guild from cache if available.
527
+ * @returns The guild, or null if not cached
528
+ */
529
+ getGuild(): Guild | null;
530
+ /**
531
+ * Delete this invite.
532
+ * Requires Manage Guild or Create Instant Invite permission.
533
+ */
534
+ delete(): Promise<void>;
535
+ }
536
+
537
+ /** Represents a ban in a guild. */
538
+ declare class GuildBan extends Base {
539
+ readonly client: Client;
540
+ readonly guildId: string;
299
541
  readonly user: User;
300
- readonly guild: Guild;
301
- nick: string | null;
302
- readonly roles: string[];
303
- readonly joinedAt: Date;
304
- communicationDisabledUntil: Date | null;
305
- /** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
306
- constructor(client: Client, data: APIGuildMember & {
542
+ readonly reason: string | null;
543
+ /** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
544
+ constructor(client: Client, data: APIBan & {
307
545
  guild_id?: string;
308
- }, guild: Guild);
309
- /** Nickname, or global name, or username. */
310
- get displayName(): string;
546
+ }, guildId: string);
311
547
  /**
312
- * Add a role to this member.
313
- * @param roleId - The role ID to add
314
- * Requires Manage Roles permission.
548
+ * Remove this ban (unban the user).
549
+ * Requires Ban Members permission.
315
550
  */
316
- addRole(roleId: string): Promise<void>;
551
+ unban(): Promise<void>;
552
+ }
553
+
554
+ /** Represents a reaction added to or removed from a message. */
555
+ declare class MessageReaction extends Base {
556
+ readonly client: Client;
557
+ readonly messageId: string;
558
+ readonly channelId: string;
559
+ readonly guildId: string | null;
560
+ readonly emoji: GatewayReactionEmoji;
561
+ /** Raw gateway payload for low-level access. */
562
+ readonly _data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData;
563
+ constructor(client: Client, data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData);
564
+ /** Emoji as a string: unicode or "name:id" for custom. */
565
+ get emojiIdentifier(): string;
566
+ /** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
567
+ get guild(): Guild | null;
317
568
  /**
318
- * Remove a role from this member.
319
- * @param roleId - The role ID to remove
320
- * Requires Manage Roles permission.
569
+ * Fetch the message this reaction belongs to.
570
+ * Use when you need to edit, delete, or otherwise interact with the message.
321
571
  */
322
- removeRole(roleId: string): Promise<void>;
572
+ fetchMessage(): Promise<Message | null>;
573
+ }
574
+
575
+ /** Minimal message data for MessageDelete when the full message is not available. */
576
+ interface PartialMessage {
577
+ id: string;
578
+ channelId: string;
579
+ channel?: Channel | null;
580
+ }
581
+
582
+ /**
583
+ * Manages channels with fetch and send.
584
+ * Extends Collection so you can use .get(), .set(), .filter(), etc.
585
+ */
586
+ declare class ChannelManager extends Collection<string, Channel> {
587
+ private readonly client;
588
+ constructor(client: Client);
589
+ /**
590
+ * Fetch a channel by ID from the API (or return from cache if present).
591
+ * @param channelId - Snowflake of the channel
592
+ * @returns The channel, or null if not found
593
+ * @example
594
+ * const channel = await client.channels.fetch(channelId);
595
+ * if (channel?.isSendable()) await channel.send('Hello!');
596
+ */
597
+ fetch(channelId: string): Promise<Channel | null>;
598
+ /**
599
+ * Fetch a message by ID from the API.
600
+ * @param channelId - Snowflake of the channel
601
+ * @param messageId - Snowflake of the message
602
+ * @returns The message, or null if not found
603
+ * @deprecated Use channel.messages.fetch(messageId). Prefer (await client.channels.fetch(channelId))?.messages?.fetch(messageId).
604
+ * @example
605
+ * const channel = await client.channels.fetch(channelId);
606
+ * const message = await channel?.messages?.fetch(messageId);
607
+ */
608
+ fetchMessage(channelId: string, messageId: string): Promise<Message | null>;
609
+ /**
610
+ * Send a message to a channel by ID. Works even when the channel is not cached.
611
+ * Skips the fetch when you only need to send.
612
+ * @param channelId - Snowflake of the channel (text channel or DM)
613
+ * @param payload - Text content or object with content and/or embeds
614
+ * @returns The created message
615
+ * @example
616
+ * await client.channels.send(logChannelId, 'User joined!');
617
+ * await client.channels.send(channelId, { embeds: [embed.toJSON()] });
618
+ */
619
+ send(channelId: string, payload: string | {
620
+ content?: string;
621
+ embeds?: _fluxerjs_types.APIEmbed[];
622
+ }): Promise<Message>;
623
+ }
624
+
625
+ /**
626
+ * Manages guilds with fetch.
627
+ * Extends Collection so you can use .get(), .set(), .filter(), etc.
628
+ */
629
+ declare class GuildManager extends Collection<string, Guild> {
630
+ private readonly client;
631
+ constructor(client: Client);
632
+ /**
633
+ * Fetch a guild by ID from the API (or return from cache if present).
634
+ * @param guildId - Snowflake of the guild
635
+ * @returns The guild, or null if not found
636
+ * @example
637
+ * const guild = await client.guilds.fetch(guildId);
638
+ * if (guild) console.log(guild.name);
639
+ */
640
+ fetch(guildId: string): Promise<Guild | null>;
323
641
  }
324
642
 
325
643
  interface ClientOptions {
@@ -347,6 +665,7 @@ declare const Events: {
347
665
  readonly MessageCreate: "messageCreate";
348
666
  readonly MessageUpdate: "messageUpdate";
349
667
  readonly MessageDelete: "messageDelete";
668
+ readonly MessageDeleteBulk: "messageDeleteBulk";
350
669
  readonly MessageReactionAdd: "messageReactionAdd";
351
670
  readonly MessageReactionRemove: "messageReactionRemove";
352
671
  readonly MessageReactionRemoveAll: "messageReactionRemoveAll";
@@ -355,15 +674,34 @@ declare const Events: {
355
674
  readonly GuildCreate: "guildCreate";
356
675
  readonly GuildUpdate: "guildUpdate";
357
676
  readonly GuildDelete: "guildDelete";
358
- readonly ChannelCreate: "channelCreate";
359
- readonly ChannelUpdate: "channelUpdate";
360
- readonly ChannelDelete: "channelDelete";
677
+ readonly GuildBanAdd: "guildBanAdd";
678
+ readonly GuildBanRemove: "guildBanRemove";
679
+ readonly GuildEmojisUpdate: "guildEmojisUpdate";
680
+ readonly GuildStickersUpdate: "guildStickersUpdate";
681
+ readonly GuildIntegrationsUpdate: "guildIntegrationsUpdate";
361
682
  readonly GuildMemberAdd: "guildMemberAdd";
362
683
  readonly GuildMemberUpdate: "guildMemberUpdate";
363
684
  readonly GuildMemberRemove: "guildMemberRemove";
685
+ readonly GuildRoleCreate: "guildRoleCreate";
686
+ readonly GuildRoleUpdate: "guildRoleUpdate";
687
+ readonly GuildRoleDelete: "guildRoleDelete";
688
+ readonly GuildScheduledEventCreate: "guildScheduledEventCreate";
689
+ readonly GuildScheduledEventUpdate: "guildScheduledEventUpdate";
690
+ readonly GuildScheduledEventDelete: "guildScheduledEventDelete";
691
+ readonly ChannelCreate: "channelCreate";
692
+ readonly ChannelUpdate: "channelUpdate";
693
+ readonly ChannelDelete: "channelDelete";
694
+ readonly ChannelPinsUpdate: "channelPinsUpdate";
695
+ readonly InviteCreate: "inviteCreate";
696
+ readonly InviteDelete: "inviteDelete";
697
+ readonly TypingStart: "typingStart";
698
+ readonly UserUpdate: "userUpdate";
699
+ readonly PresenceUpdate: "presenceUpdate";
364
700
  readonly VoiceStateUpdate: "voiceStateUpdate";
365
701
  readonly VoiceServerUpdate: "voiceServerUpdate";
366
702
  readonly VoiceStatesSync: "voiceStatesSync";
703
+ readonly WebhooksUpdate: "webhooksUpdate";
704
+ readonly Resumed: "resumed";
367
705
  readonly Error: "error";
368
706
  readonly Debug: "debug";
369
707
  };
@@ -371,16 +709,24 @@ declare const Events: {
371
709
  interface ClientEvents {
372
710
  [Events.Ready]: [];
373
711
  [Events.MessageCreate]: [message: Message];
374
- [Events.MessageUpdate]: [oldMessage: Message | null, newMessage: Message];
375
- [Events.MessageDelete]: [message: Message | {
376
- id: string;
377
- channelId: string;
378
- }];
379
- [Events.MessageReactionAdd]: [data: GatewayMessageReactionAddDispatchData];
380
- [Events.MessageReactionRemove]: [data: GatewayMessageReactionRemoveDispatchData];
712
+ [Events.MessageUpdate]: [
713
+ oldMessage: Message | null,
714
+ newMessage: Message
715
+ ];
716
+ [Events.MessageDelete]: [message: PartialMessage];
717
+ [Events.MessageReactionAdd]: [
718
+ reaction: MessageReaction,
719
+ user: User
720
+ ];
721
+ [Events.MessageReactionRemove]: [
722
+ reaction: MessageReaction,
723
+ user: User
724
+ ];
381
725
  [Events.MessageReactionRemoveAll]: [data: GatewayMessageReactionRemoveAllDispatchData];
382
726
  [Events.MessageReactionRemoveEmoji]: [data: GatewayMessageReactionRemoveEmojiDispatchData];
383
- [Events.InteractionCreate]: [interaction: _fluxerjs_types.APIApplicationCommandInteraction];
727
+ [Events.InteractionCreate]: [
728
+ interaction: _fluxerjs_types.APIApplicationCommandInteraction
729
+ ];
384
730
  [Events.GuildCreate]: [guild: Guild];
385
731
  [Events.GuildUpdate]: [oldGuild: Guild, newGuild: Guild];
386
732
  [Events.GuildDelete]: [guild: Guild];
@@ -388,17 +734,46 @@ interface ClientEvents {
388
734
  [Events.ChannelUpdate]: [oldChannel: Channel, newChannel: Channel];
389
735
  [Events.ChannelDelete]: [channel: Channel];
390
736
  [Events.GuildMemberAdd]: [member: GuildMember];
391
- [Events.GuildMemberUpdate]: [oldMember: GuildMember, newMember: GuildMember];
737
+ [Events.GuildMemberUpdate]: [
738
+ oldMember: GuildMember,
739
+ newMember: GuildMember
740
+ ];
392
741
  [Events.GuildMemberRemove]: [member: GuildMember];
393
742
  [Events.VoiceStateUpdate]: [data: GatewayVoiceStateUpdateDispatchData];
394
743
  [Events.VoiceServerUpdate]: [data: GatewayVoiceServerUpdateDispatchData];
395
- [Events.VoiceStatesSync]: [data: {
396
- guildId: string;
397
- voiceStates: Array<{
398
- user_id: string;
399
- channel_id: string | null;
400
- }>;
401
- }];
744
+ [Events.VoiceStatesSync]: [
745
+ data: {
746
+ guildId: string;
747
+ voiceStates: Array<{
748
+ user_id: string;
749
+ channel_id: string | null;
750
+ }>;
751
+ }
752
+ ];
753
+ [Events.MessageDeleteBulk]: [
754
+ data: _fluxerjs_types.GatewayMessageDeleteBulkDispatchData
755
+ ];
756
+ [Events.GuildBanAdd]: [ban: GuildBan];
757
+ [Events.GuildBanRemove]: [ban: GuildBan];
758
+ [Events.GuildEmojisUpdate]: [data: unknown];
759
+ [Events.GuildStickersUpdate]: [data: unknown];
760
+ [Events.GuildIntegrationsUpdate]: [data: unknown];
761
+ [Events.GuildRoleCreate]: [data: _fluxerjs_types.GatewayGuildRoleCreateDispatchData];
762
+ [Events.GuildRoleUpdate]: [data: _fluxerjs_types.GatewayGuildRoleUpdateDispatchData];
763
+ [Events.GuildRoleDelete]: [data: _fluxerjs_types.GatewayGuildRoleDeleteDispatchData];
764
+ [Events.GuildScheduledEventCreate]: [data: unknown];
765
+ [Events.GuildScheduledEventUpdate]: [data: unknown];
766
+ [Events.GuildScheduledEventDelete]: [data: unknown];
767
+ [Events.ChannelPinsUpdate]: [data: unknown];
768
+ [Events.InviteCreate]: [invite: Invite];
769
+ [Events.InviteDelete]: [
770
+ data: _fluxerjs_types.GatewayInviteDeleteDispatchData
771
+ ];
772
+ [Events.TypingStart]: [data: _fluxerjs_types.GatewayTypingStartDispatchData];
773
+ [Events.UserUpdate]: [data: _fluxerjs_types.GatewayUserUpdateDispatchData];
774
+ [Events.PresenceUpdate]: [data: unknown];
775
+ [Events.WebhooksUpdate]: [data: unknown];
776
+ [Events.Resumed]: [];
402
777
  [Events.Error]: [error: Error];
403
778
  [Events.Debug]: [message: string];
404
779
  }
@@ -406,14 +781,51 @@ interface ClientEvents {
406
781
  declare class Client extends EventEmitter {
407
782
  readonly options: ClientOptions;
408
783
  readonly rest: REST;
409
- readonly guilds: Collection<string, Guild>;
410
- readonly channels: Collection<string, Channel>;
784
+ readonly guilds: GuildManager;
785
+ readonly channels: ChannelManager;
411
786
  readonly users: Collection<string, User>;
412
787
  user: ClientUser | null;
413
788
  readyAt: Date | null;
414
789
  private _ws;
415
790
  /** @param options - Token, REST config, WebSocket, presence, etc. */
416
791
  constructor(options?: ClientOptions);
792
+ /**
793
+ * Resolve an emoji argument to the API format (unicode or "name:id").
794
+ * Supports: <:name:id>, :name:, name:id, { name, id }, unicode.
795
+ * When id is missing (e.g. :name:), fetches guild emojis if guildId provided.
796
+ * @param emoji - Emoji string or object
797
+ * @param guildId - Guild ID for resolving custom emoji by name (required when id is missing)
798
+ * @returns API-formatted string for reactions
799
+ */
800
+ resolveEmoji(emoji: string | {
801
+ name: string;
802
+ id?: string;
803
+ animated?: boolean;
804
+ }, guildId?: string | null): Promise<string>;
805
+ /**
806
+ * Fetch a message by channel and message ID. Use when you have IDs (e.g. from a DB).
807
+ * @param channelId - Snowflake of the channel
808
+ * @param messageId - Snowflake of the message
809
+ * @returns The message, or null if not found
810
+ * @deprecated Use channel.messages.fetch(messageId). For IDs-only: (await client.channels.fetch(channelId))?.messages?.fetch(messageId)
811
+ * @example
812
+ * const channel = await client.channels.fetch(channelId);
813
+ * const message = await channel?.messages?.fetch(messageId);
814
+ */
815
+ fetchMessage(channelId: string, messageId: string): Promise<Message | null>;
816
+ /**
817
+ * Send a message to any channel by ID. Shorthand for client.channels.send().
818
+ * Works even when the channel is not cached.
819
+ */
820
+ sendToChannel(channelId: string, payload: string | {
821
+ content?: string;
822
+ embeds?: _fluxerjs_types.APIEmbed[];
823
+ }): Promise<Message>;
824
+ /**
825
+ * Get or create a User from API data. Caches in client.users.
826
+ * Updates existing user's username, avatar, etc. when fresh data is provided.
827
+ */
828
+ getOrCreateUser(data: APIUserPartial): User;
417
829
  /** WebSocket manager. Throws if not logged in. */
418
830
  get ws(): WebSocketManager;
419
831
  /**
@@ -437,6 +849,59 @@ declare class Client extends EventEmitter {
437
849
  static get Routes(): typeof Routes;
438
850
  }
439
851
 
852
+ /** Represents a custom emoji in a guild. */
853
+ declare class GuildEmoji extends Base {
854
+ readonly client: Client;
855
+ readonly id: string;
856
+ readonly guildId: string;
857
+ name: string;
858
+ readonly animated: boolean;
859
+ /** @param data - API emoji from GET /guilds/{id}/emojis or guild emoji events */
860
+ constructor(client: Client, data: APIEmoji & {
861
+ guild_id?: string;
862
+ }, guildId: string);
863
+ /** CDN URL for this emoji image. */
864
+ get url(): string;
865
+ /** Emoji identifier for use in reactions: `name:id` */
866
+ get identifier(): string;
867
+ /** Delete this emoji. Requires Manage Emojis and Stickers permission. */
868
+ delete(): Promise<void>;
869
+ /**
870
+ * Edit this emoji's name.
871
+ * Requires Manage Emojis and Stickers permission.
872
+ */
873
+ edit(options: {
874
+ name: string;
875
+ }): Promise<GuildEmoji>;
876
+ }
877
+
878
+ /** Represents a custom sticker in a guild. */
879
+ declare class GuildSticker extends Base {
880
+ readonly client: Client;
881
+ readonly id: string;
882
+ readonly guildId: string;
883
+ name: string;
884
+ description: string;
885
+ readonly tags: string[];
886
+ readonly animated: boolean;
887
+ /** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
888
+ constructor(client: Client, data: APISticker & {
889
+ guild_id?: string;
890
+ }, guildId: string);
891
+ /** CDN URL for this sticker image. */
892
+ get url(): string;
893
+ /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
894
+ delete(): Promise<void>;
895
+ /**
896
+ * Edit this sticker's name and/or description.
897
+ * Requires Manage Emojis and Stickers permission.
898
+ */
899
+ edit(options: {
900
+ name?: string;
901
+ description?: string;
902
+ }): Promise<GuildSticker>;
903
+ }
904
+
440
905
  declare class FluxerError extends Error {
441
906
  constructor(message: string);
442
907
  }
@@ -446,4 +911,4 @@ declare const ErrorCodes: {
446
911
  readonly InvalidToken: "INVALID_TOKEN";
447
912
  };
448
913
 
449
- export { Base, CategoryChannel, Channel, Client, type ClientEvents, ClientUser, DMChannel, ErrorCodes, Events, FluxerError, Guild, GuildChannel, GuildMember, LinkChannel, Message, type MessageEditOptions, TextChannel, User, VoiceChannel, Webhook, type WebhookSendOptions };
914
+ export { Base, CategoryChannel, Channel, ChannelManager, Client, type ClientEvents, ClientUser, DMChannel, ErrorCodes, Events, FluxerError, Guild, GuildBan, GuildChannel, GuildEmoji, GuildMember, GuildSticker, Invite, LinkChannel, Message, type MessageEditOptions, MessageManager, MessageReaction, type PartialMessage, Role, TextChannel, User, VoiceChannel, Webhook, type WebhookSendOptions };