@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
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import { Collection } from '@fluxerjs/collection';
1
2
  import * as _fluxerjs_types from '@fluxerjs/types';
2
- import { APIUserPartial, APIMessageAttachment, APIMessage, APIEmbed, APIWebhook, ChannelType, APIChannelPartial, APIChannel, APIGuild, APIGuildMember, GatewayPresenceUpdateData, GatewaySendPayload, Routes, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayVoiceServerUpdateDispatchData } from '@fluxerjs/types';
3
+ import { APIWebhook, APIChannel, APIChannelPartial, ChannelType, APIRole, APIGuild, APIMessageAttachment, APIMessage, APIEmbed, APIUserPartial, APIGuildMember, GatewayReactionEmoji, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayPresenceUpdateData, GatewaySendPayload, Routes, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayVoiceServerUpdateDispatchData } from '@fluxerjs/types';
3
4
  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,56 +12,35 @@ declare abstract class Base {
12
12
  abstract readonly client: Client;
13
13
  }
14
14
 
15
- declare class User extends Base {
16
- readonly client: Client;
17
- readonly id: string;
18
- username: string;
19
- discriminator: string;
20
- globalName: string | null;
21
- avatar: string | null;
22
- readonly bot: boolean;
23
- constructor(client: Client, data: APIUserPartial);
24
- avatarURL(options?: {
25
- size?: number;
26
- extension?: string;
27
- }): string | null;
28
- displayAvatarURL(options?: {
29
- size?: number;
30
- }): string;
31
- toString(): string;
32
- }
33
-
34
- /** Options for editing a message (content and/or embeds). */
35
- interface MessageEditOptions {
36
- content?: string;
37
- embeds?: (APIEmbed | EmbedBuilder)[];
38
- }
39
- declare class Message extends Base {
40
- readonly client: Client;
41
- readonly id: string;
42
- readonly channelId: string;
43
- readonly guildId: string | null;
44
- readonly author: User;
45
- content: string;
46
- readonly createdAt: Date;
47
- readonly editedAt: Date | null;
48
- pinned: boolean;
49
- readonly attachments: Collection<string, APIMessageAttachment>;
50
- channel?: Channel;
51
- constructor(client: Client, data: APIMessage);
52
- reply(options: string | {
53
- content?: string;
54
- embeds?: APIEmbed[];
55
- }): Promise<Message>;
56
- edit(options: MessageEditOptions): Promise<Message>;
57
- delete(): Promise<void>;
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>;
58
31
  }
59
32
 
33
+ /** Options for sending a message via webhook. */
60
34
  interface WebhookSendOptions {
35
+ /** Message text content */
61
36
  content?: string;
37
+ /** Embed objects (use EmbedBuilder.toJSON()) */
62
38
  embeds?: Array<Record<string, unknown>>;
39
+ /** Override the webhook's default username */
63
40
  username?: string;
41
+ /** Override the webhook's default avatar URL */
64
42
  avatar_url?: string;
43
+ /** Text-to-speech */
65
44
  tts?: boolean;
66
45
  }
67
46
  /**
@@ -77,6 +56,7 @@ declare class Webhook extends Base {
77
56
  avatar: string | null;
78
57
  /** Present only when webhook was created via createWebhook(); not returned when fetching. */
79
58
  readonly token: string | null;
59
+ /** @param data - API webhook from POST /channels/{id}/webhooks (has token) or GET /webhooks/{id} (no token) */
80
60
  constructor(client: Client, data: APIWebhook & {
81
61
  token?: string | null;
82
62
  });
@@ -88,12 +68,18 @@ declare class Webhook extends Base {
88
68
  */
89
69
  send(options: string | WebhookSendOptions): Promise<void>;
90
70
  /**
91
- * Fetch a webhook by ID using bot auth. The returned webhook will not have a token (cannot send).
71
+ * Fetch a webhook by ID using bot auth.
72
+ * @param client - The client instance
73
+ * @param webhookId - The webhook ID
74
+ * @returns Webhook without token (cannot send)
92
75
  */
93
76
  static fetch(client: Client, webhookId: string): Promise<Webhook>;
94
77
  /**
95
78
  * Create a Webhook instance from an ID and token (e.g. from a stored webhook URL).
96
- * Useful when you have the token from a previous createWebhook() call.
79
+ * @param client - The client instance
80
+ * @param webhookId - The webhook ID
81
+ * @param token - The webhook token (from createWebhook or stored)
82
+ * @param options - Optional channelId, guildId, name for display
97
83
  */
98
84
  static fromToken(client: Client, webhookId: string, token: string, options?: {
99
85
  channelId?: string;
@@ -102,12 +88,32 @@ declare class Webhook extends Base {
102
88
  }): Webhook;
103
89
  }
104
90
 
91
+ /** Base class for all channel types. */
105
92
  declare abstract class Channel extends Base {
93
+ /** Whether this channel has a send method (TextChannel, DMChannel). */
94
+ isSendable(): this is TextChannel | DMChannel;
95
+ /** Whether this channel is a DM or Group DM. */
96
+ isDM(): boolean;
97
+ /** Whether this channel is voice-based (VoiceChannel). */
98
+ isVoice(): boolean;
99
+ /** Create a DM channel from API data (type DM or GroupDM). */
100
+ static createDM(client: Client, data: APIChannelPartial): DMChannel;
106
101
  readonly client: Client;
107
102
  readonly id: string;
108
103
  type: ChannelType;
104
+ /** @param data - API channel from GET /channels/{id} or GET /guilds/{id}/channels */
109
105
  constructor(client: Client, data: APIChannelPartial);
106
+ /**
107
+ * Create the appropriate channel subclass from API data.
108
+ * @param client - The client instance
109
+ * @param data - Channel data from the API
110
+ */
110
111
  static from(client: Client, data: APIChannel | APIChannelPartial): GuildChannel | TextChannel | null;
112
+ /**
113
+ * Create a channel from API data, including DM and GroupDM.
114
+ * Used by ChannelManager.fetch() for GET /channels/{id}.
115
+ */
116
+ static fromOrCreate(client: Client, data: APIChannel | APIChannelPartial): TextChannel | DMChannel | GuildChannel | null;
111
117
  }
112
118
  declare class GuildChannel extends Channel {
113
119
  readonly guildId: string;
@@ -115,12 +121,19 @@ declare class GuildChannel extends Channel {
115
121
  position?: number;
116
122
  parentId: string | null;
117
123
  constructor(client: Client, data: APIChannel);
118
- /** Create a webhook in this channel. Returns the webhook with token (required for send()). */
124
+ /**
125
+ * Create a webhook in this channel.
126
+ * @param options - Webhook name and optional avatar URL
127
+ * @returns The webhook with token (required for send()). Requires Manage Webhooks permission.
128
+ */
119
129
  createWebhook(options: {
120
130
  name: string;
121
131
  avatar?: string | null;
122
132
  }): Promise<Webhook>;
123
- /** Fetch all webhooks in this channel. Returned webhooks do not include the token (cannot send). */
133
+ /**
134
+ * Fetch all webhooks in this channel.
135
+ * @returns Webhooks (includes token when listing from channel; can send via send())
136
+ */
124
137
  fetchWebhooks(): Promise<Webhook[]>;
125
138
  }
126
139
  declare class TextChannel extends GuildChannel {
@@ -129,10 +142,23 @@ declare class TextChannel extends GuildChannel {
129
142
  rateLimitPerUser?: number;
130
143
  lastMessageId?: string | null;
131
144
  constructor(client: Client, data: APIChannel);
145
+ /**
146
+ * Send a message to this channel.
147
+ * @param options - Text content or object with `content` and/or `embeds`
148
+ */
132
149
  send(options: string | {
133
150
  content?: string;
134
151
  embeds?: unknown[];
135
152
  }): Promise<Message>;
153
+ /** Message manager for this channel. Use channel.messages.fetch(messageId). */
154
+ get messages(): MessageManager;
155
+ /**
156
+ * Fetch a message by ID from this channel.
157
+ * @param messageId - Snowflake of the message
158
+ * @returns The message, or null if not found
159
+ * @deprecated Use channel.messages.fetch(messageId) instead.
160
+ */
161
+ fetchMessage(messageId: string): Promise<Message | null>;
136
162
  }
137
163
  declare class CategoryChannel extends GuildChannel {
138
164
  }
@@ -146,7 +172,50 @@ declare class LinkChannel extends GuildChannel {
146
172
  url?: string | null;
147
173
  constructor(client: Client, data: APIChannel);
148
174
  }
175
+ /** DM channel (direct message between bot and a user). */
176
+ declare class DMChannel extends Channel {
177
+ lastMessageId?: string | null;
178
+ constructor(client: Client, data: APIChannelPartial);
179
+ /**
180
+ * Send a message to this DM channel.
181
+ * @param options - Text content or object with `content` and/or `embeds`
182
+ */
183
+ send(options: string | {
184
+ content?: string;
185
+ embeds?: unknown[];
186
+ }): Promise<Message>;
187
+ /** Message manager for this channel. Use channel.messages.fetch(messageId). */
188
+ get messages(): MessageManager;
189
+ /**
190
+ * Fetch a message by ID from this DM channel.
191
+ * @param messageId - Snowflake of the message
192
+ * @returns The message, or null if not found
193
+ * @deprecated Use channel.messages.fetch(messageId) instead.
194
+ */
195
+ fetchMessage(messageId: string): Promise<Message | null>;
196
+ }
197
+
198
+ /** Represents a role in a guild. */
199
+ declare class Role extends Base {
200
+ readonly client: Client;
201
+ readonly id: string;
202
+ readonly guildId: string;
203
+ name: string;
204
+ color: number;
205
+ position: number;
206
+ permissions: string;
207
+ hoist: boolean;
208
+ mentionable: boolean;
209
+ unicodeEmoji: string | null;
210
+ /** @param client - The client instance */
211
+ /** @param data - API role from GET /guilds/{id}/roles or gateway role events */
212
+ /** @param guildId - The guild this role belongs to */
213
+ constructor(client: Client, data: APIRole, guildId: string);
214
+ /** Returns a mention string (e.g. `<@&123456>`). */
215
+ toString(): string;
216
+ }
149
217
 
218
+ /** Represents a Fluxer guild (server). */
150
219
  declare class Guild extends Base {
151
220
  readonly client: Client;
152
221
  readonly id: string;
@@ -156,17 +225,206 @@ declare class Guild extends Base {
156
225
  readonly ownerId: string;
157
226
  members: Collection<string, GuildMember>;
158
227
  channels: Collection<string, GuildChannel>;
159
- constructor(client: Client, data: APIGuild);
228
+ roles: Collection<string, Role>;
229
+ /** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
230
+ constructor(client: Client, data: APIGuild & {
231
+ roles?: APIRole[];
232
+ });
233
+ /** Get the guild icon URL, or null if no icon. */
160
234
  iconURL(options?: {
161
235
  size?: number;
162
236
  }): string | null;
237
+ /** Get the guild banner URL, or null if no banner. */
163
238
  bannerURL(options?: {
164
239
  size?: number;
165
240
  }): string | null;
241
+ /**
242
+ * Add a role to a member by user ID. Does not require fetching the member first.
243
+ * @param userId - The user ID of the member
244
+ * @param roleId - The role ID to add (or use guild.resolveRoleId for mention/name resolution)
245
+ * Requires Manage Roles permission.
246
+ */
247
+ addRoleToMember(userId: string, roleId: string): Promise<void>;
248
+ /**
249
+ * Remove a role from a member by user ID. Does not require fetching the member first.
250
+ * @param userId - The user ID of the member
251
+ * @param roleId - The role ID to remove
252
+ * Requires Manage Roles permission.
253
+ */
254
+ removeRoleFromMember(userId: string, roleId: string): Promise<void>;
255
+ /**
256
+ * Resolve a role ID from an argument (role mention, raw ID, or name).
257
+ * Fetches guild roles if name is provided.
258
+ * @param arg - Role mention (@role), role ID, or role name
259
+ * @returns The role ID, or null if not found
260
+ */
261
+ resolveRoleId(arg: string): Promise<string | null>;
262
+ /**
263
+ * Fetch a guild member by user ID.
264
+ * @param userId - The user ID of the member to fetch
265
+ * @returns The guild member, or null if not found
266
+ */
267
+ fetchMember(userId: string): Promise<GuildMember | null>;
166
268
  /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
167
269
  fetchWebhooks(): Promise<Webhook[]>;
168
270
  }
169
271
 
272
+ /** Options for editing a message (content and/or embeds). */
273
+ interface MessageEditOptions {
274
+ /** New text content */
275
+ content?: string;
276
+ /** New embeds (replaces existing) */
277
+ embeds?: (APIEmbed | EmbedBuilder)[];
278
+ }
279
+ /** Represents a message in a channel. */
280
+ declare class Message extends Base {
281
+ readonly client: Client;
282
+ readonly id: string;
283
+ readonly channelId: string;
284
+ readonly guildId: string | null;
285
+ readonly author: User;
286
+ content: string;
287
+ readonly createdAt: Date;
288
+ readonly editedAt: Date | null;
289
+ pinned: boolean;
290
+ readonly attachments: Collection<string, APIMessageAttachment>;
291
+ /** Channel where this message was sent. Resolved from cache; null if not cached (e.g. DM channel not in cache). */
292
+ get channel(): Channel | null;
293
+ /** Guild where this message was sent. Resolved from cache; null for DMs or if not cached. */
294
+ get guild(): Guild | null;
295
+ /** @param data - API message from POST/PATCH /channels/{id}/messages or gateway MESSAGE_CREATE */
296
+ constructor(client: Client, data: APIMessage);
297
+ /**
298
+ * Send a message to this channel without replying. Use when you want a standalone message.
299
+ * @param options - Text content or object with content and/or embeds
300
+ * @example
301
+ * await message.send('Pong!');
302
+ * await message.send({ embeds: [embed.toJSON()] });
303
+ */
304
+ send(options: string | {
305
+ content?: string;
306
+ embeds?: APIEmbed[];
307
+ }): Promise<Message>;
308
+ /**
309
+ * Send a message to a specific channel. Use for logging, forwarding, or sending to another channel in the guild.
310
+ * @param channelId - Snowflake of the target channel (e.g. log channel ID)
311
+ * @param options - Text content or object with content and/or embeds
312
+ * @example
313
+ * await message.sendTo(logChannelId, 'User ' + message.author.username + ' said: ' + message.content);
314
+ * await message.sendTo(announceChannelId, { embeds: [embed.toJSON()] });
315
+ */
316
+ sendTo(channelId: string, options: string | {
317
+ content?: string;
318
+ embeds?: APIEmbed[];
319
+ }): Promise<Message>;
320
+ /**
321
+ * Reply to this message.
322
+ * @param options - Text content or object with content and/or embeds
323
+ */
324
+ reply(options: string | {
325
+ content?: string;
326
+ embeds?: APIEmbed[];
327
+ }): Promise<Message>;
328
+ /**
329
+ * Edit this message. Only the author (or admins) can edit.
330
+ * @param options - New content and/or embeds
331
+ */
332
+ edit(options: MessageEditOptions): Promise<Message>;
333
+ /**
334
+ * Re-fetch this message from the API to get the latest content, embeds, reactions, etc.
335
+ * Use when you have a stale Message (e.g. from an old event or cache) and need fresh data.
336
+ * @returns The updated message, or null if deleted or not found
337
+ * @example
338
+ * const updated = await message.fetch();
339
+ * if (updated) console.log('Latest content:', updated.content);
340
+ */
341
+ fetch(): Promise<Message | null>;
342
+ /** Delete this message. */
343
+ delete(): Promise<void>;
344
+ /**
345
+ * Format emoji for reaction API: unicode string or "name:id" for custom.
346
+ * For string resolution (e.g. :name:), use client.resolveEmoji; Message methods resolve automatically when guildId is available.
347
+ */
348
+ private static formatEmoji;
349
+ private resolveEmojiForReaction;
350
+ /**
351
+ * Add a reaction to this message (as the bot).
352
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
353
+ */
354
+ react(emoji: string | {
355
+ name: string;
356
+ id?: string;
357
+ animated?: boolean;
358
+ }): Promise<void>;
359
+ /**
360
+ * Remove the bot's reaction, or a specific user's reaction if userId is provided.
361
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
362
+ * @param userId - If provided, removes that user's reaction (requires moderator permissions)
363
+ */
364
+ removeReaction(emoji: string | {
365
+ name: string;
366
+ id?: string;
367
+ animated?: boolean;
368
+ }, userId?: string): Promise<void>;
369
+ /**
370
+ * Remove all reactions from this message.
371
+ * Requires moderator permissions.
372
+ */
373
+ removeAllReactions(): Promise<void>;
374
+ /**
375
+ * Remove all reactions of a specific emoji from this message.
376
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`. Requires moderator permissions.
377
+ */
378
+ removeReactionEmoji(emoji: string | {
379
+ name: string;
380
+ id?: string;
381
+ animated?: boolean;
382
+ }): Promise<void>;
383
+ }
384
+
385
+ /** Represents a user (or bot) on Fluxer. */
386
+ declare class User extends Base {
387
+ readonly client: Client;
388
+ readonly id: string;
389
+ username: string;
390
+ discriminator: string;
391
+ globalName: string | null;
392
+ avatar: string | null;
393
+ readonly bot: boolean;
394
+ /** @param data - API user from message author, GET /users/{id}, or GET /users/@me */
395
+ constructor(client: Client, data: APIUserPartial);
396
+ /** Update mutable fields from fresh API data. Used by getOrCreateUser cache. */
397
+ _patch(data: APIUserPartial): void;
398
+ /**
399
+ * Get the URL for this user's avatar.
400
+ * @param options - Optional `size` and `extension` (default: `png`)
401
+ */
402
+ avatarURL(options?: {
403
+ size?: number;
404
+ extension?: string;
405
+ }): string | null;
406
+ /** Get the avatar URL, or the default avatar if none set. */
407
+ displayAvatarURL(options?: {
408
+ size?: number;
409
+ }): string;
410
+ /** Returns a mention string (e.g. `<@123456>`). */
411
+ toString(): string;
412
+ /**
413
+ * Create or get a DM channel with this user.
414
+ * Returns the DM channel; use {@link DMChannel.send} to send messages.
415
+ */
416
+ createDM(): Promise<DMChannel>;
417
+ /**
418
+ * Send a DM to this user.
419
+ * Convenience method that creates the DM channel and sends the message.
420
+ */
421
+ send(options: string | {
422
+ content?: string;
423
+ embeds?: unknown[];
424
+ }): Promise<Message>;
425
+ }
426
+
427
+ /** Represents a member of a guild. */
170
428
  declare class GuildMember extends Base {
171
429
  readonly client: Client;
172
430
  readonly id: string;
@@ -176,10 +434,113 @@ declare class GuildMember extends Base {
176
434
  readonly roles: string[];
177
435
  readonly joinedAt: Date;
178
436
  communicationDisabledUntil: Date | null;
437
+ /** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
179
438
  constructor(client: Client, data: APIGuildMember & {
180
439
  guild_id?: string;
181
440
  }, guild: Guild);
441
+ /** Nickname, or global name, or username. */
182
442
  get displayName(): string;
443
+ /**
444
+ * Add a role to this member.
445
+ * @param roleId - The role ID to add
446
+ * Requires Manage Roles permission.
447
+ */
448
+ addRole(roleId: string): Promise<void>;
449
+ /**
450
+ * Remove a role from this member.
451
+ * @param roleId - The role ID to remove
452
+ * Requires Manage Roles permission.
453
+ */
454
+ removeRole(roleId: string): Promise<void>;
455
+ }
456
+
457
+ /** Represents a reaction added to or removed from a message. */
458
+ declare class MessageReaction extends Base {
459
+ readonly client: Client;
460
+ readonly messageId: string;
461
+ readonly channelId: string;
462
+ readonly guildId: string | null;
463
+ readonly emoji: GatewayReactionEmoji;
464
+ /** Raw gateway payload for low-level access. */
465
+ readonly _data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData;
466
+ constructor(client: Client, data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData);
467
+ /** Emoji as a string: unicode or "name:id" for custom. */
468
+ get emojiIdentifier(): string;
469
+ /** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
470
+ get guild(): Guild | null;
471
+ /**
472
+ * Fetch the message this reaction belongs to.
473
+ * Use when you need to edit, delete, or otherwise interact with the message.
474
+ */
475
+ fetchMessage(): Promise<Message | null>;
476
+ }
477
+
478
+ /** Minimal message data for MessageDelete when the full message is not available. */
479
+ interface PartialMessage {
480
+ id: string;
481
+ channelId: string;
482
+ channel?: Channel | null;
483
+ }
484
+
485
+ /**
486
+ * Manages channels with fetch and send.
487
+ * Extends Collection so you can use .get(), .set(), .filter(), etc.
488
+ */
489
+ declare class ChannelManager extends Collection<string, Channel> {
490
+ private readonly client;
491
+ constructor(client: Client);
492
+ /**
493
+ * Fetch a channel by ID from the API (or return from cache if present).
494
+ * @param channelId - Snowflake of the channel
495
+ * @returns The channel, or null if not found
496
+ * @example
497
+ * const channel = await client.channels.fetch(channelId);
498
+ * if (channel?.isSendable()) await channel.send('Hello!');
499
+ */
500
+ fetch(channelId: string): Promise<Channel | null>;
501
+ /**
502
+ * Fetch a message by ID from the API.
503
+ * @param channelId - Snowflake of the channel
504
+ * @param messageId - Snowflake of the message
505
+ * @returns The message, or null if not found
506
+ * @deprecated Use channel.messages.fetch(messageId). Prefer (await client.channels.fetch(channelId))?.messages?.fetch(messageId).
507
+ * @example
508
+ * const channel = await client.channels.fetch(channelId);
509
+ * const message = await channel?.messages?.fetch(messageId);
510
+ */
511
+ fetchMessage(channelId: string, messageId: string): Promise<Message | null>;
512
+ /**
513
+ * Send a message to a channel by ID. Works even when the channel is not cached.
514
+ * Skips the fetch when you only need to send.
515
+ * @param channelId - Snowflake of the channel (text channel or DM)
516
+ * @param payload - Text content or object with content and/or embeds
517
+ * @returns The created message
518
+ * @example
519
+ * await client.channels.send(logChannelId, 'User joined!');
520
+ * await client.channels.send(channelId, { embeds: [embed.toJSON()] });
521
+ */
522
+ send(channelId: string, payload: string | {
523
+ content?: string;
524
+ embeds?: _fluxerjs_types.APIEmbed[];
525
+ }): Promise<Message>;
526
+ }
527
+
528
+ /**
529
+ * Manages guilds with fetch.
530
+ * Extends Collection so you can use .get(), .set(), .filter(), etc.
531
+ */
532
+ declare class GuildManager extends Collection<string, Guild> {
533
+ private readonly client;
534
+ constructor(client: Client);
535
+ /**
536
+ * Fetch a guild by ID from the API (or return from cache if present).
537
+ * @param guildId - Snowflake of the guild
538
+ * @returns The guild, or null if not found
539
+ * @example
540
+ * const guild = await client.guilds.fetch(guildId);
541
+ * if (guild) console.log(guild.name);
542
+ */
543
+ fetch(guildId: string): Promise<Guild | null>;
183
544
  }
184
545
 
185
546
  interface ClientOptions {
@@ -207,6 +568,7 @@ declare const Events: {
207
568
  readonly MessageCreate: "messageCreate";
208
569
  readonly MessageUpdate: "messageUpdate";
209
570
  readonly MessageDelete: "messageDelete";
571
+ readonly MessageDeleteBulk: "messageDeleteBulk";
210
572
  readonly MessageReactionAdd: "messageReactionAdd";
211
573
  readonly MessageReactionRemove: "messageReactionRemove";
212
574
  readonly MessageReactionRemoveAll: "messageReactionRemoveAll";
@@ -215,15 +577,34 @@ declare const Events: {
215
577
  readonly GuildCreate: "guildCreate";
216
578
  readonly GuildUpdate: "guildUpdate";
217
579
  readonly GuildDelete: "guildDelete";
218
- readonly ChannelCreate: "channelCreate";
219
- readonly ChannelUpdate: "channelUpdate";
220
- readonly ChannelDelete: "channelDelete";
580
+ readonly GuildBanAdd: "guildBanAdd";
581
+ readonly GuildBanRemove: "guildBanRemove";
582
+ readonly GuildEmojisUpdate: "guildEmojisUpdate";
583
+ readonly GuildStickersUpdate: "guildStickersUpdate";
584
+ readonly GuildIntegrationsUpdate: "guildIntegrationsUpdate";
221
585
  readonly GuildMemberAdd: "guildMemberAdd";
222
586
  readonly GuildMemberUpdate: "guildMemberUpdate";
223
587
  readonly GuildMemberRemove: "guildMemberRemove";
588
+ readonly GuildRoleCreate: "guildRoleCreate";
589
+ readonly GuildRoleUpdate: "guildRoleUpdate";
590
+ readonly GuildRoleDelete: "guildRoleDelete";
591
+ readonly GuildScheduledEventCreate: "guildScheduledEventCreate";
592
+ readonly GuildScheduledEventUpdate: "guildScheduledEventUpdate";
593
+ readonly GuildScheduledEventDelete: "guildScheduledEventDelete";
594
+ readonly ChannelCreate: "channelCreate";
595
+ readonly ChannelUpdate: "channelUpdate";
596
+ readonly ChannelDelete: "channelDelete";
597
+ readonly ChannelPinsUpdate: "channelPinsUpdate";
598
+ readonly InviteCreate: "inviteCreate";
599
+ readonly InviteDelete: "inviteDelete";
600
+ readonly TypingStart: "typingStart";
601
+ readonly UserUpdate: "userUpdate";
602
+ readonly PresenceUpdate: "presenceUpdate";
224
603
  readonly VoiceStateUpdate: "voiceStateUpdate";
225
604
  readonly VoiceServerUpdate: "voiceServerUpdate";
226
605
  readonly VoiceStatesSync: "voiceStatesSync";
606
+ readonly WebhooksUpdate: "webhooksUpdate";
607
+ readonly Resumed: "resumed";
227
608
  readonly Error: "error";
228
609
  readonly Debug: "debug";
229
610
  };
@@ -231,16 +612,24 @@ declare const Events: {
231
612
  interface ClientEvents {
232
613
  [Events.Ready]: [];
233
614
  [Events.MessageCreate]: [message: Message];
234
- [Events.MessageUpdate]: [oldMessage: Message | null, newMessage: Message];
235
- [Events.MessageDelete]: [message: Message | {
236
- id: string;
237
- channelId: string;
238
- }];
239
- [Events.MessageReactionAdd]: [data: GatewayMessageReactionAddDispatchData];
240
- [Events.MessageReactionRemove]: [data: GatewayMessageReactionRemoveDispatchData];
615
+ [Events.MessageUpdate]: [
616
+ oldMessage: Message | null,
617
+ newMessage: Message
618
+ ];
619
+ [Events.MessageDelete]: [message: PartialMessage];
620
+ [Events.MessageReactionAdd]: [
621
+ reaction: MessageReaction,
622
+ user: User
623
+ ];
624
+ [Events.MessageReactionRemove]: [
625
+ reaction: MessageReaction,
626
+ user: User
627
+ ];
241
628
  [Events.MessageReactionRemoveAll]: [data: GatewayMessageReactionRemoveAllDispatchData];
242
629
  [Events.MessageReactionRemoveEmoji]: [data: GatewayMessageReactionRemoveEmojiDispatchData];
243
- [Events.InteractionCreate]: [interaction: _fluxerjs_types.APIApplicationCommandInteraction];
630
+ [Events.InteractionCreate]: [
631
+ interaction: _fluxerjs_types.APIApplicationCommandInteraction
632
+ ];
244
633
  [Events.GuildCreate]: [guild: Guild];
245
634
  [Events.GuildUpdate]: [oldGuild: Guild, newGuild: Guild];
246
635
  [Events.GuildDelete]: [guild: Guild];
@@ -248,36 +637,113 @@ interface ClientEvents {
248
637
  [Events.ChannelUpdate]: [oldChannel: Channel, newChannel: Channel];
249
638
  [Events.ChannelDelete]: [channel: Channel];
250
639
  [Events.GuildMemberAdd]: [member: GuildMember];
251
- [Events.GuildMemberUpdate]: [oldMember: GuildMember, newMember: GuildMember];
640
+ [Events.GuildMemberUpdate]: [
641
+ oldMember: GuildMember,
642
+ newMember: GuildMember
643
+ ];
252
644
  [Events.GuildMemberRemove]: [member: GuildMember];
253
645
  [Events.VoiceStateUpdate]: [data: GatewayVoiceStateUpdateDispatchData];
254
646
  [Events.VoiceServerUpdate]: [data: GatewayVoiceServerUpdateDispatchData];
255
- [Events.VoiceStatesSync]: [data: {
256
- guildId: string;
257
- voiceStates: Array<{
258
- user_id: string;
259
- channel_id: string | null;
260
- }>;
261
- }];
647
+ [Events.VoiceStatesSync]: [
648
+ data: {
649
+ guildId: string;
650
+ voiceStates: Array<{
651
+ user_id: string;
652
+ channel_id: string | null;
653
+ }>;
654
+ }
655
+ ];
656
+ [Events.MessageDeleteBulk]: [
657
+ data: _fluxerjs_types.GatewayMessageDeleteBulkDispatchData
658
+ ];
659
+ [Events.GuildBanAdd]: [data: _fluxerjs_types.GatewayGuildBanAddDispatchData];
660
+ [Events.GuildBanRemove]: [data: _fluxerjs_types.GatewayGuildBanRemoveDispatchData];
661
+ [Events.GuildEmojisUpdate]: [data: unknown];
662
+ [Events.GuildStickersUpdate]: [data: unknown];
663
+ [Events.GuildIntegrationsUpdate]: [data: unknown];
664
+ [Events.GuildRoleCreate]: [data: _fluxerjs_types.GatewayGuildRoleCreateDispatchData];
665
+ [Events.GuildRoleUpdate]: [data: _fluxerjs_types.GatewayGuildRoleUpdateDispatchData];
666
+ [Events.GuildRoleDelete]: [data: _fluxerjs_types.GatewayGuildRoleDeleteDispatchData];
667
+ [Events.GuildScheduledEventCreate]: [data: unknown];
668
+ [Events.GuildScheduledEventUpdate]: [data: unknown];
669
+ [Events.GuildScheduledEventDelete]: [data: unknown];
670
+ [Events.ChannelPinsUpdate]: [data: unknown];
671
+ [Events.InviteCreate]: [data: unknown];
672
+ [Events.InviteDelete]: [data: unknown];
673
+ [Events.TypingStart]: [data: _fluxerjs_types.GatewayTypingStartDispatchData];
674
+ [Events.UserUpdate]: [data: _fluxerjs_types.GatewayUserUpdateDispatchData];
675
+ [Events.PresenceUpdate]: [data: unknown];
676
+ [Events.WebhooksUpdate]: [data: unknown];
677
+ [Events.Resumed]: [];
262
678
  [Events.Error]: [error: Error];
263
679
  [Events.Debug]: [message: string];
264
680
  }
681
+ /** Main Fluxer bot client. Connects to the gateway, emits events, and provides REST access. */
265
682
  declare class Client extends EventEmitter {
266
683
  readonly options: ClientOptions;
267
684
  readonly rest: REST;
268
- readonly guilds: Collection<string, Guild>;
269
- readonly channels: Collection<string, Channel>;
685
+ readonly guilds: GuildManager;
686
+ readonly channels: ChannelManager;
270
687
  readonly users: Collection<string, User>;
271
688
  user: ClientUser | null;
272
689
  readyAt: Date | null;
273
690
  private _ws;
691
+ /** @param options - Token, REST config, WebSocket, presence, etc. */
274
692
  constructor(options?: ClientOptions);
693
+ /**
694
+ * Resolve an emoji argument to the API format (unicode or "name:id").
695
+ * Supports: <:name:id>, :name:, name:id, { name, id }, unicode.
696
+ * When id is missing (e.g. :name:), fetches guild emojis if guildId provided.
697
+ * @param emoji - Emoji string or object
698
+ * @param guildId - Guild ID for resolving custom emoji by name (required when id is missing)
699
+ * @returns API-formatted string for reactions
700
+ */
701
+ resolveEmoji(emoji: string | {
702
+ name: string;
703
+ id?: string;
704
+ animated?: boolean;
705
+ }, guildId?: string | null): Promise<string>;
706
+ /**
707
+ * Fetch a message by channel and message ID. Use when you have IDs (e.g. from a DB).
708
+ * @param channelId - Snowflake of the channel
709
+ * @param messageId - Snowflake of the message
710
+ * @returns The message, or null if not found
711
+ * @deprecated Use channel.messages.fetch(messageId). For IDs-only: (await client.channels.fetch(channelId))?.messages?.fetch(messageId)
712
+ * @example
713
+ * const channel = await client.channels.fetch(channelId);
714
+ * const message = await channel?.messages?.fetch(messageId);
715
+ */
716
+ fetchMessage(channelId: string, messageId: string): Promise<Message | null>;
717
+ /**
718
+ * Send a message to any channel by ID. Shorthand for client.channels.send().
719
+ * Works even when the channel is not cached.
720
+ */
721
+ sendToChannel(channelId: string, payload: string | {
722
+ content?: string;
723
+ embeds?: _fluxerjs_types.APIEmbed[];
724
+ }): Promise<Message>;
725
+ /**
726
+ * Get or create a User from API data. Caches in client.users.
727
+ * Updates existing user's username, avatar, etc. when fresh data is provided.
728
+ */
729
+ getOrCreateUser(data: APIUserPartial): User;
730
+ /** WebSocket manager. Throws if not logged in. */
275
731
  get ws(): WebSocketManager;
276
- /** Send a payload to the gateway (e.g. Voice State Update). Uses shard 0 when single-shard. */
732
+ /**
733
+ * Send a payload to the gateway (e.g. Voice State Update).
734
+ * @param shardId - Shard ID (use 0 for single-shard)
735
+ * @param payload - Gateway payload to send
736
+ */
277
737
  sendToGateway(shardId: number, payload: GatewaySendPayload): void;
278
738
  private handleDispatch;
739
+ /**
740
+ * Connect to the Fluxer gateway and authenticate.
741
+ * @param token - Bot token (e.g. from FLUXER_BOT_TOKEN)
742
+ */
279
743
  login(token: string): Promise<string>;
744
+ /** Disconnect from the gateway and clear cached data. */
280
745
  destroy(): Promise<void>;
746
+ /** Returns true if the client has received Ready and `user` is set. */
281
747
  isReady(): this is Client & {
282
748
  user: NonNullable<Client['user']>;
283
749
  };
@@ -293,4 +759,4 @@ declare const ErrorCodes: {
293
759
  readonly InvalidToken: "INVALID_TOKEN";
294
760
  };
295
761
 
296
- export { Base, CategoryChannel, Channel, Client, type ClientEvents, ClientUser, ErrorCodes, Events, FluxerError, Guild, GuildChannel, GuildMember, LinkChannel, Message, type MessageEditOptions, TextChannel, User, VoiceChannel, Webhook, type WebhookSendOptions };
762
+ export { Base, CategoryChannel, Channel, ChannelManager, Client, type ClientEvents, ClientUser, DMChannel, ErrorCodes, Events, FluxerError, Guild, GuildChannel, GuildMember, LinkChannel, Message, type MessageEditOptions, MessageManager, MessageReaction, type PartialMessage, Role, TextChannel, User, VoiceChannel, Webhook, type WebhookSendOptions };