@fluxerjs/core 3.2.0 → 3.3.0

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.
@@ -1,14 +1,14 @@
1
1
  import * as _fluxerjs_types from '@fluxerjs/types';
2
- import { APIGuild, APIRole, SystemChannelFlagsValue, DefaultMessageNotifications, GuildVerificationLevel, GuildMFALevel, GuildExplicitContentFilter, SplashCardAlignment, GuildNSFWLevel, ContentWarningLevel, GuildFeature, EmbedType, RESTPostAPIEmbed, RESTPostAPIMessageUploadedAttachment, APIAllowedMentions, MessageReferenceType, APIMessageReference, APIEmoji, APISticker, APIUserPartial, InviteType, ChannelType, APIInvite, APIWebhook, APIBan, AuditLogActionType, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, APIMessageReaction, APIMessageSticker, MessageType, APIMessage, APIInstanceEndpoints, APIInstance, APIGuildMember, OverwriteType, APIChannelOverwrite, APIChannel, APIChannelPartial, GatewayVoiceStateUpdateDispatchData, GatewayVoiceStateAckDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayEntranceSoundPlayDispatchData, GatewayVoiceStatesSyncData, GatewayUserConnectionsUpdateDispatchData, GatewayWebAuthnCredentialsUpdateDispatchData, GatewayReceivePayload, APIGatewayBotResponse, APIEmojiMetadata, APIStickerMetadata, APIApplicationMe, APIOAuthApplication, APIPreloadMessagesResponse, APIBulkMessageFetchResponse, GatewaySendPayload, Routes } from '@fluxerjs/types';
2
+ import { APIGuild, APIRole, SystemChannelFlagsValue, DefaultMessageNotifications, GuildVerificationLevel, GuildMFALevel, GuildExplicitContentFilter, SplashCardAlignment, GuildNSFWLevel, ContentWarningLevel, GuildFeature, EmbedType, ChannelType, APIChannel, APIUserPartial, APIBan, APIEmoji, APISticker, InviteType, APIInvite, WebhookType, APIWebhook, RESTPostAPIEmbed, AuditLogActionType, APIInstanceEndpoints, APIInstance, APIGuildMember, APIMessageReaction, APIMessageSticker, MessageType, APIChannelPartial, OverwriteType, APIChannelOverwrite, APIForumTag, APIDefaultReactionEmoji, ForumSortOrder, ForumTagSetting, ForumLayout, APIThreadMember, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, APIMessage, GatewayVoiceStateUpdateDispatchData, GatewayVoiceStateAckDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayEntranceSoundPlayDispatchData, GatewayVoiceStatesSyncData, GatewayUserConnectionsUpdateDispatchData, GatewayWebAuthnCredentialsUpdateDispatchData, GatewayReceivePayload, APIGatewayBotResponse, APIEmojiMetadata, APIStickerMetadata, APIApplicationMe, APIOAuthApplication, APIPreloadMessagesResponse, APIBulkMessageFetchResponse, GatewaySendPayload, Routes } from '@fluxerjs/types';
3
3
  import * as _fluxerjs_collection from '@fluxerjs/collection';
4
4
  import { LimitedCollection, Collection } from '@fluxerjs/collection';
5
- import { PermissionsBitField, MessageFlagsResolvable, MessageFlagsBitField, LogLevel, Logger, PermissionResolvable } from '@fluxerjs/util';
5
+ import { PermissionsBitField, LogLevel, Logger, MessageFlagsResolvable, PermissionResolvable, MessageFlagsBitField } from '@fluxerjs/util';
6
6
  import { EventEmitter } from 'node:events';
7
7
  import { REST } from '@fluxerjs/rest';
8
8
  import * as _fluxerjs_ws from '@fluxerjs/ws';
9
9
  import { WebSocketManager } from '@fluxerjs/ws';
10
- import { a as RoleEditOptions, I as GuildMemberSearchOptions, M as MessageAttachmentEdit, F as GuildChannelCreateOptions, R as RoleCreateOptions, E as DiscoveryStatusPayload, D as DiscoveryApplicationOptions, z as DiscoveryApplicationPayload, S as SudoVerificationOptions, P as PresenceUpdateOptions, O as ProfilePayload, v as AttachmentUploadPlanItem, w as AttachmentUploadPlanResponse, A as AttachmentUploadCompleteItem, u as AttachmentUploadCompleteResponse, Q as RtcRegionPayload, y as ChannelSlowmodePayload, x as ChannelInviteCreateOptions, C as ChannelEditOptions, G as GroupDmEditOptions, H as GuildMemberEditOptions, B as BulkFetchMessagesRequest, K as MessageSearchOptions, L as MessageSearchResponse } from './Sudo-DwxTf-jj.js';
11
- import { EmbedBuilder, AttachmentBuilder, MessagePayload } from '@fluxerjs/builders';
10
+ import { T as GuildMemberSearchOptions, a5 as StartThreadOptions, a3 as StartForumThreadOptions, I as FetchArchivedThreadsOptions, J as FetchJoinedArchivedThreadsOptions, aa as ThreadSearchOptions, a9 as ThreadParentEditOptions, V as MessagePrepareInput, a as RoleEditOptions, $ as MessageSendOptions, U as MessageAttachmentEdit, u as AllowedMentionsOptions, Q as GuildChannelCreateOptions, R as RoleCreateOptions, H as DiscoveryStatusPayload, F as DiscoveryApplicationOptions, G as DiscoveryApplicationPayload, a6 as SudoVerificationOptions, a0 as PresenceUpdateOptions, a1 as ProfilePayload, W as MessageReplyTarget, ab as prepareMessagePostPayload, x as AttachmentUploadPlanItem, y as AttachmentUploadPlanResponse, v as AttachmentUploadCompleteItem, w as AttachmentUploadCompleteResponse, a2 as RtcRegionPayload, D as ChannelSlowmodePayload, P as GroupDmEditOptions, z as ChannelInviteCreateOptions, C as ChannelEditOptions, M as ForumParentEditOptions, L as ForumAvailableTag, E as DefaultReactionEmojiInput, O as ForumTagOptions, K as FetchThreadMembersOptions, a7 as ThreadEditOptions, a8 as ThreadMemberSettingsOptions, a4 as StartThreadFromMessageOptions, S as GuildMemberEditOptions, B as BulkFetchMessagesRequest, Y as MessageSearchOptions, Z as MessageSearchResponse } from './Sudo-mzPLv6YU.js';
11
+ import { EmbedBuilder } from '@fluxerjs/builders';
12
12
 
13
13
  type GuildData = Partial<APIGuild> & {
14
14
  id: string;
@@ -155,145 +155,239 @@ interface MessageEmbed {
155
155
  htmlHeight: number | null;
156
156
  }
157
157
 
158
- /** Resolved file data (after URL fetch). Used internally by REST layer. */
159
- interface ResolvedMessageFile {
160
- name: string;
161
- data: Blob | ArrayBuffer | Uint8Array | Buffer;
162
- filename?: string;
158
+ /** Options for single-member {@link GuildMemberManager.fetch}. */
159
+ interface FetchGuildMemberOptions {
160
+ /** When true, always hit REST even if the member is cached. */
161
+ force?: boolean;
163
162
  }
164
- /** File data for message attachment uploads. Use `data` for buffers or `url` to fetch from a URL. */
165
- type MessageFileData = {
166
- name: string;
167
- data: Blob | ArrayBuffer | Uint8Array | Buffer;
168
- filename?: string;
169
- } | {
170
- name: string;
171
- url: string;
172
- filename?: string;
173
- };
174
- /** Attachment metadata for file uploads (id matches FormData index). */
175
- interface MessageAttachmentMeta {
176
- id: number;
177
- filename: string;
178
- title?: string | null;
179
- description?: string | null;
180
- /** MessageAttachmentFlags: IS_SPOILER (8), CONTAINS_EXPLICIT_MEDIA (16), IS_ANIMATED (32) */
181
- flags?: number;
163
+ /** Options for list {@link GuildMemberManager.fetch}. */
164
+ interface FetchGuildMembersOptions {
165
+ /** Max members to return (1-1000). */
166
+ limit?: number;
167
+ /** User ID cursor for pagination. */
168
+ after?: string;
182
169
  }
183
- /** SDK options for allowed mentions (camelCase). Converted to APIAllowedMentions on send. */
184
- type AllowedMentionsOptions = {
185
- /** Mention parse groups to allow (`users`, `roles`, `everyone`). Empty array suppresses all. */
186
- parse?: APIAllowedMentions['parse'];
187
- /** Explicit user IDs that may be mentioned. */
188
- users?: string[];
189
- /** Explicit role IDs that may be mentioned. */
190
- roles?: string[];
191
- /** Whether to @mention and notify the author of the replied-to message. */
192
- repliedUser?: boolean;
193
- };
194
170
  /**
195
- * Common allowed-mentions presets.
196
- * @example
197
- * await message.reply('Got it!', { ping: false });
198
- * await message.reply({ content: 'Got it!', allowedMentions: AllowedMentions.suppressReplyPing });
171
+ * Manages guild members with a Collection-like API.
172
+ * Extends LimitedCollection so you can use .get(), .set(), .filter(), etc.
199
173
  */
200
- declare const AllowedMentions: {
201
- readonly suppressReplyPing: {
202
- repliedUser: false;
203
- };
204
- readonly none: {
205
- parse: never[];
206
- };
207
- readonly all: {
208
- parse: ("roles" | "users" | "everyone")[];
209
- };
210
- };
211
- /** Target message for `replyTo` / `forward` on send options. */
212
- type MessageReplyTarget = {
213
- /** Channel that owns the target message. */
214
- channelId: string;
215
- /** Target message snowflake. */
216
- messageId: string;
217
- /** Guild id when known (optional for DMs / partials). */
218
- guildId?: string | null;
219
- /** {@link MessageReferenceType.Default} = reply, {@link MessageReferenceType.Forward} = forward */
220
- type?: MessageReferenceType;
221
- /** Attachment ids to include when forwarding. */
222
- attachmentIds?: string[];
223
- /** Embed indices to include when forwarding. */
224
- embedIndices?: number[];
225
- };
226
- /** Options for sending a message via channel/message helpers. */
227
- type MessageSendOptions = {
228
- /** Plain text body. */
229
- content?: string;
230
- /** Embed payloads or {@link EmbedBuilder} instances. */
231
- embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
232
- /** Local files, remote URLs, or {@link AttachmentBuilder} instances. */
233
- files?: Array<MessageFileData | AttachmentBuilder>;
234
- /** Attachment metadata aligned with uploaded `files` indices (or {@link AttachmentMeta}). */
235
- attachments?: MessageAttachmentMeta[];
236
- /** Already-uploaded CDN attachments (skip multipart). */
237
- uploadedAttachments?: RESTPostAPIMessageUploadedAttachment[];
238
- /** Who may be mentioned; see {@link AllowedMentionsOptions}. */
239
- allowedMentions?: AllowedMentionsOptions;
240
- /** Reply to an existing message (sets message_reference). */
241
- replyTo?: MessageReplyTarget;
242
- /** Forward an existing message into this channel. */
243
- forward?: MessageReplyTarget;
174
+ declare class GuildMemberManager extends LimitedCollection<string, GuildMember> {
175
+ private readonly guild;
176
+ constructor(guild: Guild);
244
177
  /**
245
- * Shortcut for reply pings. `false` sets `allowedMentions.repliedUser` to false.
246
- * Prefer explicit {@link AllowedMentionsOptions} when you need full control.
178
+ * Get a guild member from cache or fetch from the API if not present.
179
+ * Convenience helper to avoid repeating `guild.members.get(userId) ?? (await guild.fetchMember(userId))`.
180
+ * @param userId - Snowflake of the user
181
+ * @returns The guild member
182
+ * @throws FluxerError with MEMBER_NOT_FOUND if user is not in the guild (404)
183
+ * @example
184
+ * const member = await guild.members.resolve(userId);
185
+ * console.log(member.displayName);
247
186
  */
248
- ping?: boolean;
249
- /** Text-to-speech flag. */
250
- tts?: boolean;
251
- /** Sticker snowflakes to attach. */
252
- stickerIds?: string[];
253
- /** Client-generated nonce for deduplication. */
254
- nonce?: string;
255
- /** Favorite meme id when sending a saved meme. */
256
- favoriteMemeId?: string;
257
- /** Message flags bitfield. */
258
- flags?: number;
259
- };
260
- /** API-ready body from MessageSendOptions. */
261
- interface SendBodyResult {
262
- content?: string;
263
- embeds?: RESTPostAPIEmbed[];
264
- attachments?: Array<{
265
- id: number;
266
- filename: string;
267
- title?: string | null;
268
- description?: string | null;
269
- flags?: number;
270
- } | RESTPostAPIMessageUploadedAttachment>;
271
- allowed_mentions?: APIAllowedMentions;
272
- message_reference?: APIMessageReference;
273
- sticker_ids?: string[];
274
- nonce?: string;
275
- favorite_meme_id?: string;
276
- tts?: boolean;
277
- flags?: number;
187
+ resolve(userId: string): Promise<GuildMember>;
188
+ /**
189
+ * The current bot user as a GuildMember in this guild.
190
+ * Returns null if the bot's member is not cached or client.user is null.
191
+ * Use fetchMe() to load the bot's member when not cached.
192
+ *
193
+ * @example
194
+ * const perms = guild.members.me?.permissions;
195
+ * if (perms?.has(PermissionFlags.BanMembers)) { ... }
196
+ */
197
+ get me(): GuildMember | null;
198
+ /**
199
+ * Fetch the current bot user as a GuildMember in this guild.
200
+ * Caches the result in guild.members.
201
+ *
202
+ * @throws FluxerError with CLIENT_NOT_READY if client.user is null
203
+ * @example
204
+ * const me = await guild.members.fetchMe();
205
+ * console.log(me.displayName);
206
+ */
207
+ fetchMe(): Promise<GuildMember>;
208
+ /**
209
+ * Fetch a single guild member by user ID.
210
+ * Returns the cached member unless `force` is set.
211
+ * @throws FluxerError with MEMBER_NOT_FOUND if missing
212
+ */
213
+ fetch(userId: string, options?: FetchGuildMemberOptions): Promise<GuildMember>;
214
+ /**
215
+ * Fetch guild members with pagination. GET /guilds/{id}/members.
216
+ * @param options - limit (1-1000), after (user ID for pagination)
217
+ * @returns Array of GuildMember objects (cached in guild.members)
218
+ */
219
+ fetch(options?: FetchGuildMembersOptions): Promise<GuildMember[]>;
220
+ private fetchMany;
221
+ /**
222
+ * Search guild members. POST /guilds/{id}/members-search.
223
+ * @param options - CamelCase search query, filters, and pagination
224
+ * @returns CamelCase search results; `member` is set from cache when present
225
+ * @example
226
+ * const { members } = await guild.members.search({ query: 'alex', limit: 25 });
227
+ */
228
+ search(options?: GuildMemberSearchOptions): Promise<GuildMemberSearchPayload>;
278
229
  }
279
- /** REST post payload for POST /channels/{id}/messages. */
280
- interface MessagePostPayload {
281
- body: SendBodyResult;
282
- files?: ResolvedMessageFile[];
230
+
231
+ /** Structural parent a {@link ThreadManager} is bound to. */
232
+ interface ThreadParentChannel {
233
+ id: string;
234
+ client: Client;
235
+ type: ChannelType;
283
236
  }
284
237
 
285
- /** Optional client defaults applied when a send omits the matching field. */
286
- type MessagePrepareDefaults = {
287
- defaultAllowedMentions?: AllowedMentionsOptions;
238
+ /** A page of threads plus the current user's membership in each joined thread. */
239
+ interface FetchedThreads {
240
+ threads: ThreadChannel[];
241
+ members: ThreadMember[];
242
+ /** Whether another page may exist. Active-thread listings are a single page. */
243
+ hasMore: boolean;
244
+ }
245
+ /** Thread search hit list, or a not-ready index. */
246
+ type ThreadSearchPage = (FetchedThreads & {
247
+ totalResults: number;
248
+ firstMessages: Message[];
249
+ }) | {
250
+ indexing: true;
251
+ retryAfter: number;
252
+ message: string;
288
253
  };
289
- /** Input accepted by {@link prepareMessagePostPayload} and channel send helpers. */
290
- type MessagePrepareInput = string | MessageSendOptions | MessagePayload;
254
+ /** Create, list, and search threads in one parent channel. */
255
+ declare class ThreadManager {
256
+ private readonly channel;
257
+ constructor(channel: ThreadParentChannel);
258
+ /**
259
+ * Start a thread in a text or announcement channel.
260
+ * Forum and media channels must use {@link createPost}.
261
+ */
262
+ create(options: StartThreadOptions): Promise<ThreadChannel>;
263
+ /**
264
+ * Start a post in a forum or media channel.
265
+ * The post is a public thread. `message` is its first message.
266
+ */
267
+ createPost(options: StartForumThreadOptions): Promise<ThreadChannel>;
268
+ /**
269
+ * List archived threads in this channel.
270
+ * `before` is an ISO-8601 archive timestamp.
271
+ */
272
+ fetchArchived(options: FetchArchivedThreadsOptions): Promise<FetchedThreads>;
273
+ /**
274
+ * List private archived threads in this channel that the current user has joined.
275
+ * `before` is a thread snowflake.
276
+ */
277
+ fetchJoinedPrivateArchived(options?: FetchJoinedArchivedThreadsOptions): Promise<FetchedThreads>;
278
+ /**
279
+ * Search threads in this channel.
280
+ * Returns `{ indexing: true }` while the search index is still building.
281
+ */
282
+ search(options?: ThreadSearchOptions): Promise<ThreadSearchPage>;
283
+ /** Set the auto-archive and slowmode defaults copied onto new threads. */
284
+ editDefaults(options: ThreadParentEditOptions): Promise<APIChannel>;
285
+ }
286
+ /** Active threads in a guild (GET /guilds/{id}/threads/active). */
287
+ declare function fetchActiveThreads(client: Client, guildId: string): Promise<FetchedThreads>;
288
+
291
289
  /**
292
- * Build a full message POST payload (body + optional files) from send options
293
- * or a builders {@link MessagePayload}.
294
- * Applies {@link MessagePrepareDefaults.defaultAllowedMentions} when the call omits `allowedMentions`.
290
+ * User (or bot) on Fluxer.
291
+ * Cached in {@link Client.users} and hydrated via {@link Client.getOrCreateUser}.
295
292
  */
296
- declare function prepareMessagePostPayload(options: MessagePrepareInput, defaults?: MessagePrepareDefaults): Promise<MessagePostPayload>;
293
+ declare class User extends Base {
294
+ /** Parent client instance. */
295
+ readonly client: Client;
296
+ /** User snowflake ID. */
297
+ readonly id: string;
298
+ /** Username (not unique across the platform). */
299
+ username: string;
300
+ /** Legacy discriminator (e.g., `"0001"`). */
301
+ discriminator: string;
302
+ /** Display name (preferred over username). */
303
+ globalName: string | null;
304
+ /** Avatar hash (null = default avatar). */
305
+ avatar: string | null;
306
+ /** Whether this user is a bot. */
307
+ readonly bot: boolean;
308
+ /** Accent color for the profile (24-bit RGB). */
309
+ avatarColor: number | null;
310
+ /** User flags bitfield (badges, staff, etc.). */
311
+ flags: number | null;
312
+ /** Whether this is a system user (e.g., Fluxer System). */
313
+ readonly system: boolean;
314
+ /** Banner hash for profile. */
315
+ banner: string | null;
316
+ constructor(client: Client, data: APIUserPartial & {
317
+ banner?: string | null;
318
+ });
319
+ /** @internal */
320
+ _patch(data: APIUserPartial & {
321
+ banner?: string | null;
322
+ }): void;
323
+ private cdnOpts;
324
+ /**
325
+ * User avatar CDN URL (null if no custom avatar set).
326
+ * @param options - Size and extension options
327
+ * @returns CDN URL or null
328
+ */
329
+ avatarURL(options?: {
330
+ size?: number;
331
+ extension?: string;
332
+ }): string | null;
333
+ /**
334
+ * User avatar URL or default avatar fallback.
335
+ * @param options - Size and extension options
336
+ * @returns CDN URL (never null)
337
+ */
338
+ displayAvatarURL(options?: {
339
+ size?: number;
340
+ extension?: string;
341
+ }): string;
342
+ /**
343
+ * User banner CDN URL (null if no banner set).
344
+ * @param options - Size and extension options
345
+ * @returns CDN URL or null
346
+ */
347
+ bannerURL(options?: {
348
+ size?: number;
349
+ extension?: string;
350
+ }): string | null;
351
+ /**
352
+ * Format as a mention string (`<@id>`).
353
+ * @returns Mention syntax
354
+ */
355
+ /** Unix timestamp (ms) when this account was created, derived from its snowflake ID. */
356
+ get createdTimestamp(): number;
357
+ /** Date when this account was created, derived from its snowflake ID. */
358
+ get createdAt(): Date;
359
+ toString(): string;
360
+ /**
361
+ * Create or fetch the DM channel with this user.
362
+ * @returns DM channel instance (cached if already open)
363
+ */
364
+ createDM(): Promise<DMChannel>;
365
+ /**
366
+ * Send a DM to this user.
367
+ * @param options - {@link MessagePrepareInput}
368
+ * @returns Sent message
369
+ */
370
+ send(options: MessagePrepareInput): Promise<Message>;
371
+ }
372
+
373
+ /** Represents a ban in a guild. */
374
+ declare class GuildBan extends Base {
375
+ readonly client: Client;
376
+ readonly guildId: string;
377
+ readonly user: User;
378
+ readonly reason: string | null;
379
+ /** When a temporary ban expires. Null for permanent bans. */
380
+ readonly expiresAt: Date | null;
381
+ /** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
382
+ constructor(client: Client, data: APIBan & {
383
+ guild_id?: string;
384
+ }, guildId: string);
385
+ /**
386
+ * Remove this ban (unban the user).
387
+ * Requires Ban Members permission.
388
+ */
389
+ unban(reason?: string): Promise<void>;
390
+ }
297
391
 
298
392
  /** Represents a custom emoji in a guild. */
299
393
  declare class GuildEmoji extends Base {
@@ -334,46 +428,6 @@ declare class GuildEmoji extends Base {
334
428
  }): Promise<GuildEmoji>;
335
429
  }
336
430
 
337
- /** Represents a custom sticker in a guild. */
338
- declare class GuildSticker extends Base {
339
- readonly client: Client;
340
- readonly id: string;
341
- readonly guildId: string;
342
- name: string;
343
- description: string;
344
- tags: string[];
345
- readonly animated: boolean;
346
- /** Whether this sticker is classified as NSFW */
347
- nsfw: boolean;
348
- /** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
349
- constructor(client: Client, data: APISticker & {
350
- guild_id?: string;
351
- }, guildId: string);
352
- /**
353
- * Patch mutable fields in place. Does not change `id` or `animated`
354
- * (callers should replace the instance when `animated` changes).
355
- * @internal
356
- */
357
- _patch(data: APISticker): void;
358
- /** CDN URL for this sticker image. */
359
- get url(): string;
360
- /** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
361
- get createdTimestamp(): number;
362
- /** Date when this sticker was created, derived from its snowflake ID. */
363
- get createdAt(): Date;
364
- /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
365
- delete(reason?: string): Promise<void>;
366
- /**
367
- * Edit this sticker's name and/or description.
368
- * Requires Manage Emojis and Stickers permission.
369
- */
370
- edit(options: {
371
- name?: string;
372
- description?: string;
373
- reason?: string;
374
- }): Promise<GuildSticker>;
375
- }
376
-
377
431
  /**
378
432
  * Guild role.
379
433
  * Cached in {@link Guild.roles}; permissions computed via {@link GuildMember.permissions}.
@@ -441,522 +495,150 @@ declare class Role extends Base {
441
495
  delete(reason?: string): Promise<void>;
442
496
  }
443
497
 
498
+ /** Role ID or Role object. */
499
+ type RoleResolvable = string | Role;
444
500
  /**
445
- * User (or bot) on Fluxer.
446
- * Cached in {@link Client.users} and hydrated via {@link Client.getOrCreateUser}.
501
+ * Manages a guild member's roles (`add` / `remove` / `set` / `cache`).
502
+ * Requires Manage Roles for mutations.
447
503
  */
448
- declare class User extends Base {
449
- /** Parent client instance. */
504
+ declare class GuildMemberRoleManager {
505
+ private readonly member;
506
+ private ids;
507
+ constructor(member: GuildMember, initial?: string[]);
508
+ get roleIds(): readonly string[];
509
+ has(roleOrId: RoleResolvable): boolean;
510
+ /** Live Role objects from `guild.roles` for this member's role IDs. */
511
+ get cache(): Collection<string, Role>;
512
+ add(roleOrId: RoleResolvable): Promise<void>;
513
+ remove(roleOrId: RoleResolvable): Promise<void>;
514
+ set(roleIds: string[]): Promise<void>;
515
+ /** @internal Sync from API member payload. */
516
+ _patch(roleIds: string[]): void;
517
+ }
518
+
519
+ /** Represents a custom sticker in a guild. */
520
+ declare class GuildSticker extends Base {
450
521
  readonly client: Client;
451
- /** User snowflake ID. */
452
522
  readonly id: string;
453
- /** Username (not unique across the platform). */
454
- username: string;
455
- /** Legacy discriminator (e.g., `"0001"`). */
456
- discriminator: string;
457
- /** Display name (preferred over username). */
458
- globalName: string | null;
459
- /** Avatar hash (null = default avatar). */
460
- avatar: string | null;
461
- /** Whether this user is a bot. */
462
- readonly bot: boolean;
463
- /** Accent color for the profile (24-bit RGB). */
464
- avatarColor: number | null;
465
- /** User flags bitfield (badges, staff, etc.). */
466
- flags: number | null;
467
- /** Whether this is a system user (e.g., Fluxer System). */
468
- readonly system: boolean;
469
- /** Banner hash for profile. */
470
- banner: string | null;
471
- constructor(client: Client, data: APIUserPartial & {
472
- banner?: string | null;
473
- });
474
- /** @internal */
475
- _patch(data: APIUserPartial & {
476
- banner?: string | null;
477
- }): void;
478
- private cdnOpts;
479
- /**
480
- * User avatar CDN URL (null if no custom avatar set).
481
- * @param options - Size and extension options
482
- * @returns CDN URL or null
483
- */
484
- avatarURL(options?: {
485
- size?: number;
486
- extension?: string;
487
- }): string | null;
488
- /**
489
- * User avatar URL or default avatar fallback.
490
- * @param options - Size and extension options
491
- * @returns CDN URL (never null)
492
- */
493
- displayAvatarURL(options?: {
494
- size?: number;
495
- extension?: string;
496
- }): string;
497
- /**
498
- * User banner CDN URL (null if no banner set).
499
- * @param options - Size and extension options
500
- * @returns CDN URL or null
501
- */
502
- bannerURL(options?: {
503
- size?: number;
504
- extension?: string;
505
- }): string | null;
523
+ readonly guildId: string;
524
+ name: string;
525
+ description: string;
526
+ tags: string[];
527
+ readonly animated: boolean;
528
+ /** Whether this sticker is classified as NSFW */
529
+ nsfw: boolean;
530
+ /** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
531
+ constructor(client: Client, data: APISticker & {
532
+ guild_id?: string;
533
+ }, guildId: string);
506
534
  /**
507
- * Format as a mention string (`<@id>`).
508
- * @returns Mention syntax
535
+ * Patch mutable fields in place. Does not change `id` or `animated`
536
+ * (callers should replace the instance when `animated` changes).
537
+ * @internal
509
538
  */
510
- /** Unix timestamp (ms) when this account was created, derived from its snowflake ID. */
539
+ _patch(data: APISticker): void;
540
+ /** CDN URL for this sticker image. */
541
+ get url(): string;
542
+ /** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
511
543
  get createdTimestamp(): number;
512
- /** Date when this account was created, derived from its snowflake ID. */
544
+ /** Date when this sticker was created, derived from its snowflake ID. */
513
545
  get createdAt(): Date;
514
- toString(): string;
515
- /**
516
- * Create or fetch the DM channel with this user.
517
- * @returns DM channel instance (cached if already open)
518
- */
519
- createDM(): Promise<DMChannel>;
546
+ /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
547
+ delete(reason?: string): Promise<void>;
520
548
  /**
521
- * Send a DM to this user.
522
- * @param options - {@link MessagePrepareInput}
523
- * @returns Sent message
549
+ * Edit this sticker's name and/or description.
550
+ * Requires Manage Emojis and Stickers permission.
524
551
  */
525
- send(options: MessagePrepareInput): Promise<Message>;
552
+ edit(options: {
553
+ name?: string;
554
+ description?: string;
555
+ reason?: string;
556
+ }): Promise<GuildSticker>;
526
557
  }
527
558
 
528
559
  /**
529
- * Uncached or incomplete message (`MessageDelete`, uncached `MessageUpdate`,
530
- * `MessageDeleteBulk` entries). Not a {@link Message}: no `edit()` / `reply()`.
531
- * Call {@link fetch} to hydrate, or narrow with `message.partial`.
560
+ * Uncached `guildMemberRemove` payload.
561
+ * Has `user` and `guild` (what leave logs need) but not `joinedAt`, roles, or member methods.
562
+ * Narrow with `member.partial` (`GuildMember.partial` is `false`).
563
+ * Call {@link fetch} to hydrate when the member is still in the guild.
532
564
  */
533
- declare class PartialMessage {
565
+ declare class PartialGuildMember {
534
566
  readonly partial: true;
535
567
  readonly client: Client;
536
568
  readonly id: string;
537
- readonly channelId: string;
538
- readonly guildId: string | null;
539
- readonly content: string | null;
540
- readonly authorId: string | null;
541
- readonly author: User | null;
542
- readonly createdAt: Date | null;
543
- constructor(client: Client, data: {
569
+ readonly user: User;
570
+ readonly guildId: string;
571
+ readonly guild: Guild;
572
+ constructor(data: {
573
+ client: Client;
544
574
  id: string;
545
- channelId: string;
546
- guildId?: string | null;
547
- channel?: TextBasedChannel | null;
548
- content?: string | null;
549
- authorId?: string | null;
550
- author?: User | null;
551
- createdAt?: Date | null;
575
+ user: User;
576
+ guild: Guild;
552
577
  });
553
578
  /**
554
- * Live text-capable channel from cache, or null if uncached / not text-based.
555
- * Same contract as {@link Message.channel}.
556
- */
557
- get channel(): TextBasedChannel | null;
558
- /**
559
- * Fetch this message's channel (cache first). The returned {@link Channel}
560
- * has {@link Channel.delete} and {@link Channel.send}.
561
- * @example
562
- * const channel = await message.resolveChannel();
563
- * await channel.delete();
564
- */
565
- resolveChannel(): Promise<Channel>;
566
- /**
567
- * Fetch the full message from the API.
568
- * @example
569
- * const message = await partial.fetch();
570
- * await message.reply('Pong!');
579
+ * Fetch the full {@link GuildMember} from the API (cache-aware via `guild.members.fetch`).
580
+ * @throws FluxerError with MEMBER_NOT_FOUND if the user is not in the guild
571
581
  */
572
- fetch(): Promise<Message>;
582
+ fetch(): Promise<GuildMember>;
573
583
  }
574
584
 
575
- /** CamelCase emoji on reaction events. */
576
- interface ReactionEmojiPayload {
577
- id?: string;
578
- name: string;
579
- animated?: boolean;
580
- }
581
585
  /**
582
- * Payload emitted for {@link Events.MessageReactionAdd} / {@link Events.MessageReactionRemove}.
586
+ * Guild role cache. Extends {@link LimitedCollection} (`.get()`, `.set()`, `.filter()`, …).
587
+ * Access via {@link Guild.roles}.
583
588
  */
584
- interface MessageReactionPayload {
585
- reaction: MessageReaction;
586
- user: User;
587
- /** Cached message, or null if it was not in the message cache. Use `reaction.fetchMessage()` otherwise. */
588
- message: Message | null;
589
- /** Cached text-capable channel, or null if uncached / not text-based. */
590
- channel: TextBasedChannel | null;
591
- /** Cached reacting member when the gateway included one, otherwise null. */
592
- member: GuildMember | null;
593
- messageId: string;
594
- channelId: string;
595
- emoji: ReactionEmojiPayload;
596
- userId: string;
589
+ declare class GuildRoleManager extends LimitedCollection<string, Role> {
590
+ private readonly guildId;
591
+ constructor(guildId: string, options?: ConstructorParameters<typeof LimitedCollection<string, Role>>[0]);
592
+ /** The @everyone role (`id === guild.id`), or undefined if uncached. */
593
+ get everyone(): Role | undefined;
597
594
  }
598
- /**
599
- * Payload emitted for {@link Events.GuildRoleDelete}.
600
- */
601
- interface GuildRoleDeletePayload {
602
- roleId: string;
603
- guildId: string;
604
- role: Role | null;
595
+
596
+ /** CamelCase guild metadata embedded on a guild invite (not a cached {@link Guild}). */
597
+ interface InviteGuildSnapshot {
598
+ id: string;
599
+ name: string;
600
+ icon: string | null;
601
+ banner: string | null;
602
+ splash: string | null;
603
+ features: string[];
604
+ }
605
+ /** CamelCase channel metadata embedded on a guild or group-DM invite. */
606
+ interface InviteChannelSnapshot {
607
+ id: string;
608
+ name: string | null;
609
+ type: ChannelType;
610
+ icon: string | null;
611
+ parentId: string | null;
605
612
  }
606
613
  /**
607
- * Payload emitted for {@link Events.MessageDeleteBulk}.
608
- * Normalized from `GatewayMessageDeleteBulkDispatchData`.
614
+ * Invite to a guild channel or group DM.
615
+ * Discriminate with `type` / `isGuild()` / `isGroupDM()`.
616
+ * `guildSnapshot` / `channelSnapshot` are camelCase metadata, not cached structures.
617
+ * Use {@link resolveGuild} / {@link resolveChannel} for live structures.
609
618
  */
610
- interface MessageDeleteBulkPayload {
611
- /** IDs of the deleted messages. */
612
- ids: string[];
613
- /** Channel from which the messages were deleted. */
614
- channelId: string;
615
- /** Guild the channel belongs to, or `null` for DMs. */
616
- guildId: string | null;
617
- /** Cached text-capable channel, or null if uncached / not text-based. */
618
- channel: TextBasedChannel | null;
619
+ declare class Invite extends Base {
620
+ readonly client: Client;
621
+ readonly code: string;
622
+ readonly type: InviteType;
623
+ readonly guildSnapshot: InviteGuildSnapshot | null;
624
+ readonly channelSnapshot: InviteChannelSnapshot | null;
625
+ readonly inviter: User | null;
626
+ readonly memberCount: number | null;
627
+ readonly presenceCount: number | null;
628
+ readonly expiresAt: Date | null;
629
+ readonly temporary: boolean | null;
630
+ readonly createdAt: Date | null;
631
+ readonly uses: number | null;
632
+ readonly maxUses: number | null;
633
+ readonly maxAge: number | null;
634
+ constructor(client: Client, data: APIInvite);
635
+ isGuild(): boolean;
636
+ isGroupDM(): boolean;
637
+ /** Full invite URL (uses this client's instance invite base). */
638
+ get url(): string;
619
639
  /**
620
- * One {@link PartialMessage} per id. Cached fields (content, author, createdAt) are
621
- * filled when the message was in cache; otherwise those fields are null.
622
- */
623
- messages: PartialMessage[];
624
- }
625
- /**
626
- * Payload emitted for {@link Events.InviteDelete}.
627
- * Normalized from `GatewayInviteDeleteDispatchData`.
628
- */
629
- interface InviteDeletePayload {
630
- /** Invite code that was deleted. */
631
- code: string;
632
- /** Guild the invite belonged to, or `null` for DMs / group DMs. */
633
- guildId: string | null;
634
- /** Channel the invite pointed to, or `null` if unknown. */
635
- channelId: string | null;
636
- }
637
- /**
638
- * Payload emitted for {@link Events.TypingStart}.
639
- * Normalized from `GatewayTypingStartDispatchData`.
640
- */
641
- interface TypingStartPayload {
642
- /** Channel where the user started typing. */
643
- channelId: string;
644
- /** Guild the channel belongs to, or `null` for DMs. */
645
- guildId: string | null;
646
- /** ID of the user who started typing. */
647
- userId: string;
648
- /** Unix timestamp (seconds) when typing began. */
649
- timestamp: number;
650
- }
651
- /**
652
- * Payload emitted for {@link Events.GuildEmojisUpdate}.
653
- * Contains the fully-cached {@link GuildEmoji} instances after the update.
654
- */
655
- interface GuildEmojisUpdatePayload {
656
- /** Guild whose emoji list changed. */
657
- guildId: string;
658
- /** Updated list of {@link GuildEmoji} instances (from cache). */
659
- emojis: GuildEmoji[];
660
- }
661
- /**
662
- * Payload emitted for {@link Events.GuildStickersUpdate}.
663
- * Contains cached {@link GuildSticker} instances after the update.
664
- */
665
- interface GuildStickersUpdatePayload {
666
- /** Guild whose sticker list changed. */
667
- guildId: string;
668
- /** Updated list of {@link GuildSticker} instances (from cache). */
669
- stickers: GuildSticker[];
670
- }
671
- /** Payload for {@link Events.MessageReactionRemoveAll}. */
672
- interface MessageReactionRemoveAllPayload {
673
- messageId: string;
674
- channelId: string;
675
- guildId: string | null;
676
- message: Message | null;
677
- channel: TextBasedChannel | null;
678
- }
679
- /** Payload for {@link Events.MessageReactionRemoveEmoji}. */
680
- interface MessageReactionRemoveEmojiPayload {
681
- messageId: string;
682
- channelId: string;
683
- guildId: string | null;
684
- emoji: ReactionEmojiPayload;
685
- message: Message | null;
686
- channel: TextBasedChannel | null;
687
- }
688
- /** Single entry in {@link MessageReactionAddManyPayload}. */
689
- interface MessageReactionAddManyEntry {
690
- userId: string;
691
- emoji: ReactionEmojiPayload;
692
- member: GuildMember | null;
693
- }
694
- /** Payload for {@link Events.MessageReactionAddMany}. */
695
- interface MessageReactionAddManyPayload {
696
- channelId: string;
697
- messageId: string;
698
- guildId: string | null;
699
- message: Message | null;
700
- channel: TextBasedChannel | null;
701
- reactions: MessageReactionAddManyEntry[];
702
- }
703
- /** Payload for {@link Events.ChannelPinsUpdate}. */
704
- interface ChannelPinsUpdatePayload {
705
- channelId: string;
706
- guildId: string | null;
707
- lastPinTimestamp: string | null;
708
- }
709
- /** Presence activity (camelCase). */
710
- interface PresenceActivity {
711
- name: string;
712
- type: number;
713
- url?: string | null;
714
- }
715
- /** Payload for {@link Events.PresenceUpdate}. */
716
- interface PresenceUpdatePayload {
717
- userId: string;
718
- guildId: string | null;
719
- status: string | null;
720
- activities: PresenceActivity[];
721
- customStatus: {
722
- text?: string | null;
723
- emojiId?: string | null;
724
- emojiName?: string | null;
725
- } | null;
726
- }
727
- /** Payload for {@link Events.PresenceUpdateBulk}. */
728
- interface PresenceUpdateBulkPayload {
729
- guildId: string | null;
730
- presences: PresenceUpdatePayload[];
731
- }
732
- /** Payload for {@link Events.WebhooksUpdate}. */
733
- interface WebhooksUpdatePayload {
734
- channelId: string;
735
- guildId: string;
736
- }
737
- /** Payload for {@link Events.GuildMembersChunk}. */
738
- interface GuildMembersChunkPayload {
739
- guildId: string;
740
- members: GuildMember[];
741
- chunkIndex: number;
742
- chunkCount: number;
743
- notFound: string[];
744
- nonce: string | null;
745
- }
746
- /** Audit log change (camelCase). */
747
- interface AuditLogChange {
748
- key: string;
749
- oldValue?: string | number | boolean | null;
750
- newValue?: string | number | boolean | null;
751
- }
752
- /** Payload for {@link Events.GuildAuditLogEntryCreate} and audit fetch entries. */
753
- interface AuditLogEntryPayload {
754
- id: string;
755
- actionType: number;
756
- userId: string | null;
757
- targetId: string | null;
758
- reason: string | null;
759
- options: Record<string, string> | null;
760
- changes: AuditLogChange[];
761
- guildId: string | null;
762
- }
763
- /** Payload for {@link Events.GuildCountsUpdate}. */
764
- interface GuildCountsUpdatePayload {
765
- counts: Array<{
766
- guildId: string;
767
- memberCount: number;
768
- onlineCount: number;
769
- }>;
770
- }
771
- /** Payload for {@link Events.ChannelMemberCountsUpdate}. */
772
- interface ChannelMemberCountsUpdatePayload {
773
- counts: Array<{
774
- guildId: string;
775
- channelId: string;
776
- memberCount: number;
777
- onlineCount: number;
778
- }>;
779
- }
780
- /** Role update with optional previous snapshot. */
781
- interface GuildRoleUpdatePayload {
782
- /** Role after the update (cached instance). */
783
- role: Role;
784
- /** Shallow previous field snapshot when the role was already cached. */
785
- oldRole: Role | null;
786
- }
787
- /** Vanity URL result (camelCase). */
788
- interface VanityURLPayload {
789
- code: string | null;
790
- uses: number;
791
- }
792
- /** Result of {@link Guild.fetchAuditLogs}. */
793
- interface AuditLogFetchPayload {
794
- entries: AuditLogEntryPayload[];
795
- users: User[];
796
- }
797
- /** Guild member search result row (camelCase). */
798
- interface GuildMemberSearchHit {
799
- id: string;
800
- guildId: string;
801
- userId: string;
802
- username: string;
803
- discriminator: string;
804
- globalName: string | null;
805
- nickname: string | null;
806
- /** Cached {@link GuildMember} when available after search hydration. */
807
- member: GuildMember | null;
808
- }
809
- /** Guild member search response (camelCase). */
810
- interface GuildMemberSearchPayload {
811
- guildId: string;
812
- members: GuildMemberSearchHit[];
813
- /** Total matches across pages (`total_result_count`). */
814
- total?: number;
815
- /** Results on this page (`page_result_count`). */
816
- pageResultCount?: number;
817
- /** Whether more pages exist after this offset. */
818
- hasMore?: boolean;
819
- /** Search index still building. */
820
- indexing?: boolean;
821
- }
822
- /** Partial guild from GET /users/@me/guilds. */
823
- interface PartialUserGuildPayload {
824
- id: string;
825
- name: string;
826
- icon: string | null;
827
- owner?: boolean;
828
- permissions?: string | null;
829
- features?: string[];
830
- /** Present when fetched with `{ withCounts: true }`. */
831
- approximateMemberCount?: number;
832
- /** Present when fetched with `{ withCounts: true }`. */
833
- approximatePresenceCount?: number;
834
- }
835
- /** Payload for {@link Events.ChannelRecipientAdd} / {@link Events.ChannelRecipientRemove}. */
836
- interface ChannelRecipientPayload {
837
- channelId: string;
838
- user: User;
839
- }
840
-
841
- /** Options for single-member {@link GuildMemberManager.fetch}. */
842
- interface FetchGuildMemberOptions {
843
- /** When true, always hit REST even if the member is cached. */
844
- force?: boolean;
845
- }
846
- /** Options for list {@link GuildMemberManager.fetch}. */
847
- interface FetchGuildMembersOptions {
848
- /** Max members to return (1-1000). */
849
- limit?: number;
850
- /** User ID cursor for pagination. */
851
- after?: string;
852
- }
853
- /**
854
- * Manages guild members with a Collection-like API.
855
- * Extends LimitedCollection so you can use .get(), .set(), .filter(), etc.
856
- */
857
- declare class GuildMemberManager extends LimitedCollection<string, GuildMember> {
858
- private readonly guild;
859
- constructor(guild: Guild);
860
- /**
861
- * Get a guild member from cache or fetch from the API if not present.
862
- * Convenience helper to avoid repeating `guild.members.get(userId) ?? (await guild.fetchMember(userId))`.
863
- * @param userId - Snowflake of the user
864
- * @returns The guild member
865
- * @throws FluxerError with MEMBER_NOT_FOUND if user is not in the guild (404)
866
- * @example
867
- * const member = await guild.members.resolve(userId);
868
- * console.log(member.displayName);
869
- */
870
- resolve(userId: string): Promise<GuildMember>;
871
- /**
872
- * The current bot user as a GuildMember in this guild.
873
- * Returns null if the bot's member is not cached or client.user is null.
874
- * Use fetchMe() to load the bot's member when not cached.
875
- *
876
- * @example
877
- * const perms = guild.members.me?.permissions;
878
- * if (perms?.has(PermissionFlags.BanMembers)) { ... }
879
- */
880
- get me(): GuildMember | null;
881
- /**
882
- * Fetch the current bot user as a GuildMember in this guild.
883
- * Caches the result in guild.members.
884
- *
885
- * @throws FluxerError with CLIENT_NOT_READY if client.user is null
886
- * @example
887
- * const me = await guild.members.fetchMe();
888
- * console.log(me.displayName);
889
- */
890
- fetchMe(): Promise<GuildMember>;
891
- /**
892
- * Fetch a single guild member by user ID.
893
- * Returns the cached member unless `force` is set.
894
- * @throws FluxerError with MEMBER_NOT_FOUND if missing
895
- */
896
- fetch(userId: string, options?: FetchGuildMemberOptions): Promise<GuildMember>;
897
- /**
898
- * Fetch guild members with pagination. GET /guilds/{id}/members.
899
- * @param options - limit (1-1000), after (user ID for pagination)
900
- * @returns Array of GuildMember objects (cached in guild.members)
901
- */
902
- fetch(options?: FetchGuildMembersOptions): Promise<GuildMember[]>;
903
- private fetchMany;
904
- /**
905
- * Search guild members. POST /guilds/{id}/members-search.
906
- * @param options - CamelCase search query, filters, and pagination
907
- * @returns CamelCase search results; `member` is set from cache when present
908
- * @example
909
- * const { members } = await guild.members.search({ query: 'alex', limit: 25 });
910
- */
911
- search(options?: GuildMemberSearchOptions): Promise<GuildMemberSearchPayload>;
912
- }
913
-
914
- /** CamelCase guild metadata embedded on a guild invite (not a cached {@link Guild}). */
915
- interface InviteGuildSnapshot {
916
- id: string;
917
- name: string;
918
- icon: string | null;
919
- banner: string | null;
920
- splash: string | null;
921
- features: string[];
922
- }
923
- /** CamelCase channel metadata embedded on a guild or group-DM invite. */
924
- interface InviteChannelSnapshot {
925
- id: string;
926
- name: string | null;
927
- type: ChannelType;
928
- icon: string | null;
929
- parentId: string | null;
930
- }
931
- /**
932
- * Invite to a guild channel or group DM.
933
- * Discriminate with `type` / `isGuild()` / `isGroupDM()`.
934
- * `guildSnapshot` / `channelSnapshot` are camelCase metadata, not cached structures.
935
- * Use {@link resolveGuild} / {@link resolveChannel} for live structures.
936
- */
937
- declare class Invite extends Base {
938
- readonly client: Client;
939
- readonly code: string;
940
- readonly type: InviteType;
941
- readonly guildSnapshot: InviteGuildSnapshot | null;
942
- readonly channelSnapshot: InviteChannelSnapshot | null;
943
- readonly inviter: User | null;
944
- readonly memberCount: number | null;
945
- readonly presenceCount: number | null;
946
- readonly expiresAt: Date | null;
947
- readonly temporary: boolean | null;
948
- readonly createdAt: Date | null;
949
- readonly uses: number | null;
950
- readonly maxUses: number | null;
951
- readonly maxAge: number | null;
952
- constructor(client: Client, data: APIInvite);
953
- isGuild(): boolean;
954
- isGroupDM(): boolean;
955
- /** Full invite URL (uses this client's instance invite base). */
956
- get url(): string;
957
- /**
958
- * Resolve the cached/fetched {@link Guild} for this invite, or null.
959
- * `guildSnapshot` is metadata only.
640
+ * Resolve the cached/fetched {@link Guild} for this invite, or null.
641
+ * `guildSnapshot` is metadata only.
960
642
  */
961
643
  resolveGuild(): Promise<Guild | null>;
962
644
  /**
@@ -1006,8 +688,11 @@ declare class Webhook extends Base {
1006
688
  readonly token: string | null;
1007
689
  /** The user that created this webhook. */
1008
690
  readonly user: User;
691
+ /** Incoming or channel-follower webhook. */
692
+ readonly type: WebhookType;
1009
693
  constructor(client: Client, data: APIWebhook & {
1010
694
  token?: string | null;
695
+ type?: WebhookType;
1011
696
  });
1012
697
  avatarURL(options?: {
1013
698
  size?: number;
@@ -1034,46 +719,16 @@ declare class Webhook extends Base {
1034
719
  fetchMessage(messageId: string): Promise<Message>;
1035
720
  /** Delete a message sent by this webhook. Requires token. */
1036
721
  deleteMessage(messageId: string): Promise<void>;
1037
- /** Fetch a webhook by ID (bot auth; no token). */
1038
- static fetch(client: Client, webhookId: string): Promise<Webhook>;
1039
- /** Build a webhook from a stored id + token (e.g. webhook URL). */
1040
- static fromToken(client: Client, webhookId: string, token: string, options?: {
1041
- channelId?: string;
1042
- guildId?: string;
1043
- name?: string;
1044
- }): Webhook;
1045
- private requireToken;
1046
- private messageRoute;
1047
- }
1048
-
1049
- /** Represents a ban in a guild. */
1050
- declare class GuildBan extends Base {
1051
- readonly client: Client;
1052
- readonly guildId: string;
1053
- readonly user: User;
1054
- readonly reason: string | null;
1055
- /** When a temporary ban expires. Null for permanent bans. */
1056
- readonly expiresAt: Date | null;
1057
- /** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
1058
- constructor(client: Client, data: APIBan & {
1059
- guild_id?: string;
1060
- }, guildId: string);
1061
- /**
1062
- * Remove this ban (unban the user).
1063
- * Requires Ban Members permission.
1064
- */
1065
- unban(reason?: string): Promise<void>;
1066
- }
1067
-
1068
- /**
1069
- * Guild role cache. Extends {@link LimitedCollection} (`.get()`, `.set()`, `.filter()`, …).
1070
- * Access via {@link Guild.roles}.
1071
- */
1072
- declare class GuildRoleManager extends LimitedCollection<string, Role> {
1073
- private readonly guildId;
1074
- constructor(guildId: string, options?: ConstructorParameters<typeof LimitedCollection<string, Role>>[0]);
1075
- /** The @everyone role (`id === guild.id`), or undefined if uncached. */
1076
- get everyone(): Role | undefined;
722
+ /** Fetch a webhook by ID (bot auth; no token). */
723
+ static fetch(client: Client, webhookId: string): Promise<Webhook>;
724
+ /** Build a webhook from a stored id + token (e.g. webhook URL). */
725
+ static fromToken(client: Client, webhookId: string, token: string, options?: {
726
+ channelId?: string;
727
+ guildId?: string;
728
+ name?: string;
729
+ }): Webhook;
730
+ private requireToken;
731
+ private messageRoute;
1077
732
  }
1078
733
 
1079
734
  /** Represents a Fluxer guild (server). */
@@ -1187,12 +842,14 @@ declare class Guild extends Base {
1187
842
  size?: number;
1188
843
  }): string | null;
1189
844
  /**
1190
- * Create a channel. `type`: 0=text, 2=voice, 4=category, 998=link (set `url`).
845
+ * Create a channel. `type`: 0=text, 2=voice, 4=category, 5=announcement, 15=forum, 16=media, 998=link (set `url`).
1191
846
  * Requires Manage Channels.
1192
847
  */
1193
848
  createChannel(options: GuildChannelCreateOptions): Promise<GuildChannel>;
1194
849
  /** Fetch all channels in this guild from the API. */
1195
850
  fetchChannels(): Promise<GuildChannel[]>;
851
+ /** Fetch active threads in this guild. */
852
+ fetchActiveThreads(): Promise<FetchedThreads>;
1196
853
  /** Update channel positions (reordering). */
1197
854
  setChannelPositions(updates: ChannelPositionUpdate[]): Promise<void>;
1198
855
  /** Fetch all webhooks in this guild. */
@@ -1315,1371 +972,1921 @@ declare class Guild extends Base {
1315
972
  transferOwnership(newOwnerId: string, password?: string): Promise<void>;
1316
973
  }
1317
974
 
1318
- /** Role ID or Role object. */
1319
- type RoleResolvable = string | Role;
1320
975
  /**
1321
- * Manages a guild member's roles (`add` / `remove` / `set` / `cache`).
1322
- * Requires Manage Roles for mutations.
976
+ * Optional cache size limits (FIFO eviction when exceeded).
977
+ *
978
+ * | Value | Meaning |
979
+ * |-------|---------|
980
+ * | positive number | Max entries |
981
+ * | `0` or `Infinity` | Unbounded |
982
+ * | `false` (`messages` only) | Message cache disabled |
983
+ *
984
+ * @see {@link DEFAULT_CACHE_LIMITS}
985
+ * @see {@link resolveCacheLimits}
1323
986
  */
1324
- declare class GuildMemberRoleManager {
1325
- private readonly member;
1326
- private ids;
1327
- constructor(member: GuildMember, initial?: string[]);
1328
- get roleIds(): readonly string[];
1329
- has(roleOrId: RoleResolvable): boolean;
1330
- /** Live Role objects from `guild.roles` for this member's role IDs. */
1331
- get cache(): Collection<string, Role>;
1332
- add(roleOrId: RoleResolvable): Promise<void>;
1333
- remove(roleOrId: RoleResolvable): Promise<void>;
1334
- set(roleIds: string[]): Promise<void>;
1335
- /** @internal Sync from API member payload. */
1336
- _patch(roleIds: string[]): void;
987
+ interface CacheSizeLimits {
988
+ /** Max channels cached globally. `0` = unbounded. */
989
+ channels?: number;
990
+ /** Max guilds cached. `0` = unbounded. */
991
+ guilds?: number;
992
+ /** Max users cached globally. `0` = unbounded. */
993
+ users?: number;
994
+ /**
995
+ * Max messages per channel, or `false` to disable message caching.
996
+ * `0` / `Infinity` = unbounded (legacy `0` previously meant off — use `false`).
997
+ */
998
+ messages?: number | false;
999
+ /** Max members per guild. `0` = unbounded. */
1000
+ members?: number;
1001
+ /** Max roles per guild. `0` = unbounded. @default 0 */
1002
+ roles?: number;
1003
+ /** Max emojis per guild. `0` = unbounded. @default 0 */
1004
+ emojis?: number;
1005
+ /** Max stickers per guild. `0` = unbounded. @default 0 */
1006
+ stickers?: number;
1337
1007
  }
1338
-
1339
1008
  /**
1340
- * Uncached `guildMemberRemove` payload.
1341
- * Has `user` and `guild` (what leave logs need) but not `joinedAt`, roles, or member methods.
1342
- * Narrow with `member.partial` (`GuildMember.partial` is `false`).
1343
- * Call {@link fetch} to hydrate when the member is still in the guild.
1009
+ * Default cache policy — opt out per field with `0` (or `messages: false` to disable).
1010
+ * Applied when {@link ClientOptions.cache} is omitted or partial.
1344
1011
  */
1345
- declare class PartialGuildMember {
1346
- readonly partial: true;
1347
- readonly client: Client;
1348
- readonly id: string;
1349
- readonly user: User;
1350
- readonly guildId: string;
1351
- readonly guild: Guild;
1352
- constructor(data: {
1353
- client: Client;
1354
- id: string;
1355
- user: User;
1356
- guild: Guild;
1357
- });
1012
+ declare const DEFAULT_CACHE_LIMITS: Required<Omit<CacheSizeLimits, 'messages'>> & {
1013
+ messages: number;
1014
+ };
1015
+ /**
1016
+ * Fully resolved cache limits used at runtime.
1017
+ * Numeric buckets use `Infinity` for unbounded; `messages` may be `false` (disabled).
1018
+ */
1019
+ interface ResolvedCacheLimits {
1020
+ guilds: number;
1021
+ channels: number;
1022
+ users: number;
1023
+ members: number;
1024
+ /** Per-channel message cap, `Infinity` if unbounded, or `false` if disabled. */
1025
+ messages: number | false;
1026
+ roles: number;
1027
+ emojis: number;
1028
+ stickers: number;
1029
+ }
1030
+ /** Result of {@link resolveCacheLimits}. */
1031
+ interface ResolvedCacheOptions {
1032
+ /** Limits for LimitedCollection / MessageCache. */
1033
+ limits: ResolvedCacheLimits;
1034
+ /** Merged options object stored on `client.options.cache`. */
1035
+ cache: Required<Omit<CacheSizeLimits, 'messages'>> & {
1036
+ messages: number | false;
1037
+ };
1038
+ }
1039
+ /**
1040
+ * Normalize a numeric cache limit.
1041
+ * Positive finite → floored max; `0` / `Infinity` / NaN / negative → unbounded (`Infinity`).
1042
+ */
1043
+ declare function normalizeCacheLimit(value: number | undefined, fallback: number): number;
1044
+ /**
1045
+ * Resolve and validate {@link ClientOptions.cache} once at Client construction.
1046
+ * Emits a warning when `messages: 0` is passed (legacy “off”; now unbounded — use `false`).
1047
+ */
1048
+ declare function resolveCacheLimits(input?: CacheSizeLimits): ResolvedCacheOptions;
1049
+ /**
1050
+ * Configuration options for {@link Client}.
1051
+ * @example
1052
+ * ```ts
1053
+ * const client = new Client({
1054
+ * instance: { api_public: 'https://api.example.com' },
1055
+ * cache: { guilds: 100, messages: 20 },
1056
+ * waitForGuilds: true,
1057
+ * });
1058
+ * ```
1059
+ */
1060
+ interface ClientOptions {
1061
+ /**
1062
+ * Instance endpoints for this client (API, CDN, invite, etc.).
1063
+ * Pass a partial map to override hosted defaults, or a full discovery document.
1064
+ * Prefer this over `rest.api` for multi-instance / self-hosted bots.
1065
+ * REST uses `api_public`; `api` / `api_client` are kept for inspection.
1066
+ * @see {@link Client.fromDiscovery}
1067
+ */
1068
+ instance?: Partial<APIInstanceEndpoints> | APIInstance;
1069
+ /**
1070
+ * REST options. Prefer {@link ClientOptions.instance} for the API host.
1071
+ * If both `instance.api_public` (or resolved default) and `rest.api` are set and differ, construction throws.
1072
+ */
1073
+ rest?: Partial<ConstructorParameters<typeof REST>[0]>;
1074
+ /**
1075
+ * BCP 47 locale sent as REST `Accept-Language`. Defaults to {@link import('@fluxerjs/rest').DEFAULT_LOCALE}.
1076
+ * Overrides `rest.locale` when both are set.
1077
+ * @see {@link ClientOptions.rest}
1078
+ */
1079
+ locale?: string;
1080
+ /**
1081
+ * @deprecated Fluxer has no intents. Prefer {@link ClientOptions.ignoredEvents}. Kept only for migration; identify always sends `0`.
1082
+ */
1083
+ intents?: number;
1084
+ /**
1085
+ * @deprecated No-op. Fluxer has no intents warning to suppress.
1086
+ */
1087
+ suppressIntentWarning?: boolean;
1088
+ /** {@link import('@fluxerjs/types').GatewayIdentifyFlags} bitfield sent as Identify `flags`. */
1089
+ identifyFlags?: number;
1090
+ /** Dispatch event names to suppress for this session (`ignored_events`). */
1091
+ ignoredEvents?: string[];
1092
+ /** Prefer hydrating this guild first after READY (`initial_guild_id`). */
1093
+ initialGuildId?: string;
1094
+ /**
1095
+ * Delay {@link Events.Ready} until all READY guilds arrive via GUILD_CREATE; queue other dispatches until then.
1096
+ * Startup backfill emits {@link Events.GuildAvailable} (not {@link Events.GuildCreate}) unless
1097
+ * {@link ClientOptions.emitGuildCreateOnStartup} is set.
1098
+ * @default false
1099
+ * @see {@link ClientOptions.emitGuildCreateOnStartup}
1100
+ */
1101
+ waitForGuilds?: boolean;
1102
+ /**
1103
+ * Emit {@link Events.GuildCreate} for READY / initial-stream guild hydrations instead of {@link Events.GuildAvailable}.
1104
+ * Default behavior matches Discord.js: startup backfill uses {@link Events.GuildAvailable}, and
1105
+ * {@link Events.GuildCreate} means the bot joined after {@link Events.Ready}.
1106
+ * @default false
1107
+ * @see {@link ClientOptions.waitForGuilds}
1108
+ */
1109
+ emitGuildCreateOnStartup?: boolean;
1110
+ /**
1111
+ * Cache size limits per bucket. Defaults to {@link DEFAULT_CACHE_LIMITS}.
1112
+ * Pass `0` / `Infinity` per numeric field for unbounded; `messages: false` to disable message caching.
1113
+ * @see {@link CacheSizeLimits}
1114
+ */
1115
+ cache?: CacheSizeLimits;
1116
+ /**
1117
+ * Default allowed mentions when a send omits them (per-call wins).
1118
+ * @example
1119
+ * ```ts
1120
+ * defaultAllowedMentions: {
1121
+ * parse: ['users'],
1122
+ * repliedUser: false,
1123
+ * }
1124
+ * ```
1125
+ */
1126
+ defaultAllowedMentions?: {
1127
+ /** Mention types to parse (`roles`, `users`, `everyone`). */
1128
+ parse?: Array<'roles' | 'users' | 'everyone'>;
1129
+ /** Specific role IDs allowed to be mentioned. */
1130
+ roles?: string[];
1131
+ /** Specific user IDs allowed to be mentioned. */
1132
+ users?: string[];
1133
+ /** Whether to ping the user being replied to. */
1134
+ repliedUser?: boolean;
1135
+ };
1136
+ /**
1137
+ * Default reply ping for `message.reply` when `ping` is omitted.
1138
+ * @default true
1139
+ */
1140
+ defaultReplyPing?: boolean;
1141
+ /**
1142
+ * Initial presence on identify (also updatable via `client.user.setPresence`).
1143
+ * CamelCase only; mapped to gateway wire internally.
1144
+ */
1145
+ presence?: PresenceUpdateOptions;
1146
+ /**
1147
+ * Emit gateway debug strings.
1148
+ * @default true
1149
+ */
1150
+ gatewayDebug?: boolean;
1151
+ /**
1152
+ * Total gateway shard count, or `'auto'` to derive from guild count.
1153
+ * Fluxer's `/gateway/bot` currently stubs `shards: 1`, so prefer `'auto'` or an explicit count
1154
+ * for large bots (max 2500 guilds per shard).
1155
+ * Alias: `totalShards`.
1156
+ */
1157
+ shardCount?: number | 'auto';
1158
+ /**
1159
+ * Alias of {@link shardCount} (matches {@link import('@fluxerjs/sharding').ShardingManager} vocabulary).
1160
+ * @deprecated Prefer {@link shardCount}.
1161
+ */
1162
+ totalShards?: number | 'auto';
1163
+ /** Explicit shard ids this client should connect (defaults to `0..shardCount-1`). Alias: `shardList`. */
1164
+ shardIds?: number[];
1165
+ /**
1166
+ * Alias of {@link shardIds}.
1167
+ * @deprecated Prefer {@link shardIds}.
1168
+ */
1169
+ shardList?: number[];
1170
+ /**
1171
+ * Guilds per shard when {@link shardCount} is `'auto'`.
1172
+ * @default 1500
1173
+ */
1174
+ guildsPerShard?: number;
1175
+ /**
1176
+ * Custom WebSocket sharding strategy builder (e.g. WorkerShardingStrategy).
1177
+ * @see {@link import('@fluxerjs/ws').WorkerShardingStrategy}
1178
+ */
1179
+ buildStrategy?: _fluxerjs_ws.BuildShardingStrategyFn;
1180
+ /**
1181
+ * Optional session store for RESUME across restarts (defaults to in-memory).
1182
+ */
1183
+ sessionStore?: _fluxerjs_ws.ISessionStore;
1184
+ /**
1185
+ * Optional identify throttler (e.g. parent-backed when under ShardingManager).
1186
+ */
1187
+ identifyThrottler?: _fluxerjs_ws.IIdentifyThrottler;
1188
+ /** Minimum log level for {@link Client.logger}. Default: `warn`. */
1189
+ logLevel?: LogLevel;
1190
+ /** Custom logger instance (overrides {@link logLevel} sink defaults). */
1191
+ logger?: Logger;
1358
1192
  /**
1359
- * Fetch the full {@link GuildMember} from the API (cache-aware via `guild.members.fetch`).
1360
- * @throws FluxerError with MEMBER_NOT_FOUND if the user is not in the guild
1193
+ * Defer dispatch handlers to the next macrotask so WS `message` stays responsive.
1194
+ * @default true (`false` useful in tests)
1361
1195
  */
1362
- fetch(): Promise<GuildMember>;
1363
- }
1364
-
1365
- type GatewayReactionData = GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData;
1366
- /** Context needed to hydrate a reaction aggregate from a message payload. */
1367
- type MessageReactionContext = {
1368
- client: Client;
1369
- id: string;
1370
- channelId: string;
1371
- guildId: string | null;
1372
- };
1373
- /** Represents a reaction on a message (gateway event or message aggregate). */
1374
- declare class MessageReaction extends Base {
1375
- readonly client: Client;
1376
- readonly messageId: string;
1377
- readonly channelId: string;
1378
- readonly guildId: string | null;
1379
- readonly emoji: ReactionEmojiPayload;
1380
- /** Total count when hydrated from a message payload; `1` for gateway add events. */
1381
- count: number;
1382
- /** Whether the current user reacted (message payload); false for gateway remove. */
1383
- me: boolean;
1384
- /** Raw gateway payload for low-level access (null when built from a message aggregate). */
1385
- readonly _data: GatewayReactionData | null;
1386
- constructor(client: Client, data: GatewayReactionData);
1387
- /** Build a reaction aggregate from a message's `reactions` array entry. */
1388
- static fromMessage(message: MessageReactionContext, data: APIMessageReaction): MessageReaction;
1389
- /** Emoji as a string for reaction routes: unicode or `name:id` (`a:name:id` when animated). */
1390
- get emojiIdentifier(): string;
1391
- /** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
1392
- get guild(): Guild | null;
1393
- /** Cached message this reaction belongs to, or null if the message was not cached. */
1394
- get message(): Message | null;
1395
- /** Cached text-capable channel, or null if uncached / not text-based. */
1396
- get channel(): TextBasedChannel | null;
1196
+ gatewayDeferHandlers?: boolean;
1397
1197
  /**
1398
- * Fetch the message this reaction belongs to (cache first, then REST).
1399
- * @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
1198
+ * Optional WebSocket constructor (e.g. `ws` in Node).
1199
+ * Provide if the runtime lacks a native WebSocket implementation.
1400
1200
  */
1401
- fetchMessage(): Promise<Message>;
1201
+ WebSocket?: new (url: string) => {
1202
+ send(data: string | ArrayBufferLike): void;
1203
+ close(code?: number): void;
1204
+ readyState: number;
1205
+ addEventListener?(type: string, listener: (e: unknown) => void): void;
1206
+ on?(event: string, cb: (data?: unknown) => void): void;
1207
+ };
1402
1208
  }
1403
1209
 
1404
- /** Options for {@link ReactionCollector} / `message.createReactionCollector()`. */
1405
- interface ReactionCollectorOptions {
1406
- /** Filter function. Return true to collect the reaction. */
1407
- filter?: (reaction: MessageReaction, user: User) => boolean;
1408
- /** Max duration in ms. Collector stops when time expires. */
1409
- time?: number;
1410
- /** Max reactions to collect. Collector stops when limit reached. */
1411
- max?: number;
1412
- }
1413
- type ReactionCollectorEndReason = 'time' | 'limit' | 'user';
1414
- /** A single collected reaction paired with the user who added it. */
1415
- interface CollectedReaction {
1416
- reaction: MessageReaction;
1417
- user: User;
1418
- }
1419
- /** Typed event map for {@link ReactionCollector}: `collect` per reaction, `end` when it stops. */
1420
- interface ReactionCollectorEvents {
1421
- collect: [reaction: MessageReaction, user: User];
1422
- end: [collected: Collection<string, CollectedReaction>, reason: ReactionCollectorEndReason];
1423
- }
1424
- /**
1425
- * Collects reactions on a message. Use message.createReactionCollector().
1426
- *
1427
- * Listens to both {@link Events.MessageReactionAdd} and {@link Events.MessageReactionAddMany}
1428
- * (gateway may batch rapid reactions into ADD_MANY instead of individual ADD events).
1429
- *
1430
- * @example
1431
- * const collector = message.createReactionCollector({ filter: (r, u) => u.id === userId, time: 10000 });
1432
- * collector.on('collect', (reaction, user) => console.log(user.username, 'reacted', reaction.emoji.name));
1433
- * collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
1434
- */
1435
- declare class ReactionCollector extends EventEmitter {
1436
- readonly client: Client;
1437
- readonly messageId: string;
1438
- readonly channelId: string;
1439
- readonly options: Required<ReactionCollectorOptions>;
1440
- readonly collected: Collection<string, CollectedReaction>;
1441
- private _timeout;
1442
- private _ended;
1443
- private readonly _onAdd;
1444
- private readonly _onAddMany;
1445
- constructor(client: Client, messageId: string, channelId: string, options?: ReactionCollectorOptions);
1446
- private _collect;
1447
- stop(reason?: ReactionCollectorEndReason): void;
1448
- /**
1449
- * One-shot helper used by {@link Message.awaitReactions}.
1450
- * Resolves with the collected reactions when the collector ends.
1451
- * Rejects if `options.errors` includes the end reason.
1452
- */
1453
- static awaitReactions(client: Client, messageId: string, channelId: string, options?: ReactionCollectorOptions & {
1454
- errors?: ReactionCollectorEndReason[];
1455
- }): Promise<Collection<string, CollectedReaction>>;
1456
- on<K extends keyof ReactionCollectorEvents>(event: K, listener: (...args: ReactionCollectorEvents[K]) => void): this;
1457
- emit<K extends keyof ReactionCollectorEvents>(event: K, ...args: ReactionCollectorEvents[K]): boolean;
1210
+ /** Snapshot of current cache sizes. */
1211
+ interface CacheStats {
1212
+ guilds: number;
1213
+ channels: number;
1214
+ users: number;
1215
+ members: number;
1216
+ messages: number;
1217
+ messageChannels: number;
1218
+ roles: number;
1219
+ emojis: number;
1220
+ stickers: number;
1458
1221
  }
1459
-
1460
1222
  /**
1461
- * Cached reactions on a {@link Message}, keyed by emoji identifier.
1223
+ * Public cache facade: limits, stats, sweeps, and cascade teardown entry points.
1224
+ * Not a second source of truth — wraps managers / {@link MessageCache}.
1462
1225
  */
1463
- declare class MessageReactionManager {
1464
- private readonly message;
1465
- private readonly _cache;
1466
- constructor(message: MessageReactionContext);
1467
- /** Reactions keyed by unicode name or `name:id`. */
1468
- get cache(): Collection<string, MessageReaction>;
1469
- get size(): number;
1470
- [Symbol.iterator](): IterableIterator<MessageReaction>;
1471
- /** @internal Sync from an API message payload. */
1472
- _patch(reactions: APIMessageReaction[] | null | undefined): void;
1473
- }
1474
-
1475
- /** Sticker attached to a message (domain view of {@link APIMessageSticker}). */
1476
- declare class MessageSticker extends Base {
1477
- readonly client: Client;
1478
- readonly id: string;
1479
- name: string;
1480
- description: string;
1481
- tags: string[];
1482
- readonly animated: boolean;
1483
- constructor(client: Client, data: APIMessageSticker);
1484
- /** CDN URL for this sticker image. */
1485
- get url(): string;
1486
- /** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
1487
- get createdTimestamp(): number;
1488
- /** Date when this sticker was created, derived from its snowflake ID. */
1489
- get createdAt(): Date;
1490
- }
1491
-
1492
- /** Options for PATCH /channels/{id}/messages/{id}. */
1493
- interface MessageEditOptions {
1494
- content?: string | null;
1495
- embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
1496
- allowedMentions?: AllowedMentionsOptions;
1497
- flags?: MessageFlagsResolvable | number;
1498
- /** Keep by snowflake `id`, or add via `uploadFilename` from the presigned upload flow. */
1499
- attachments?: MessageAttachmentEdit[];
1500
- }
1501
- type PreparedMessagePost = Awaited<ReturnType<typeof prepareMessagePostPayload>>;
1502
- /** CamelCase reply / forward reference on a {@link Message}. */
1503
- interface MessageReference {
1504
- channelId: string;
1505
- messageId: string;
1506
- guildId: string | null;
1507
- type?: number;
1508
- }
1509
- /** CamelCase call metadata on a {@link Message}. */
1510
- interface MessageCall {
1511
- participants: string[];
1512
- endedAt: Date | null;
1513
- }
1514
- /** CamelCase forwarded-message snapshot on a {@link Message}. */
1515
- interface MessageSnapshot {
1516
- content: string | null;
1517
- createdAt: Date;
1518
- editedAt: Date | null;
1519
- /** User IDs mentioned in the original message (API snapshots only include IDs). */
1520
- mentionUserIds: string[];
1521
- mentionRoles: string[];
1522
- embeds: MessageEmbed[];
1523
- attachments: MessageAttachment[];
1524
- stickers: MessageSticker[];
1525
- type?: MessageType;
1526
- }
1527
- /** Second-arg / inline options for `message.reply()`. */
1528
- interface ReplyOptions {
1529
- /** `false` suppresses the replied-user ping (`allowed_mentions.replied_user`). Default: client `defaultReplyPing`. */
1530
- ping?: boolean;
1531
- /** Reply to a different message. Default: this message. */
1532
- replyTo?: Message | MessageReplyTarget;
1533
- }
1534
-
1535
- type EmojiInput = string | {
1536
- name: string;
1537
- id?: string;
1538
- animated?: boolean;
1539
- };
1540
- /** A message in a channel. */
1541
- declare class Message extends Base {
1542
- /** Discriminant vs {@link PartialMessage}: always `false` on a hydrated Message. */
1543
- readonly partial: false;
1544
- /** The {@link Client} that instantiated this message. */
1545
- readonly client: Client;
1546
- /** Snowflake ID of this message. */
1547
- readonly id: string;
1548
- /** Channel ID where this message was sent. */
1549
- readonly channelId: string;
1550
- /** Guild ID if in a guild channel, null for DMs. */
1551
- readonly guildId: string | null;
1552
- /** The user who sent this message. */
1553
- readonly author: User;
1554
- /** Text content of the message. */
1555
- content: string;
1556
- /** When the message was created. */
1557
- readonly createdAt: Date;
1558
- /** When the message was last edited, or null if never edited. */
1559
- editedAt: Date | null;
1560
- /** Whether the message is pinned. */
1561
- pinned: boolean;
1562
- /** Attached files (images, videos, etc.). */
1563
- readonly attachments: Collection<string, MessageAttachment>;
1564
- /** Message type (Default, Reply, etc.). */
1565
- readonly type: MessageType;
1566
- /** Message flags bitfield. */
1567
- flags: MessageFlagsBitField;
1568
- /** Whether `@everyone` or `@here` was mentioned. */
1569
- mentionEveryone: boolean;
1570
- /** Whether this is a text-to-speech message. */
1571
- tts: boolean;
1572
- /** Embedded content (camelCase read view; send with {@link EmbedBuilder}). */
1573
- embeds: MessageEmbed[];
1574
- /** Stickers sent with the message. */
1575
- stickers: MessageSticker[];
1576
- /** Reactions on the message. */
1577
- readonly reactions: MessageReactionManager;
1578
- /** Reference to a replied-to message, if any. */
1579
- messageReference: MessageReference | null;
1580
- /** Message snapshots for forwarded messages. */
1581
- messageSnapshots: MessageSnapshot[];
1582
- /** Call data if this message represents a call event. */
1583
- call: MessageCall | null;
1584
- /** The full referenced (replied-to) message, or null. */
1585
- referencedMessage: Message | null;
1586
- /** Webhook ID if sent by a webhook. */
1587
- webhookId: string | null;
1588
- /** Users mentioned in the message. */
1589
- mentions: User[];
1590
- /** Role IDs mentioned in the message. */
1591
- mentionRoles: string[];
1592
- /** Client-side nonce for deduplication. */
1593
- nonce: string | null;
1594
- /** IDs of custom emojis in the message classified as explicit. */
1595
- nsfwEmojis: string[];
1226
+ declare class CacheController {
1227
+ private readonly client;
1228
+ /** Resolved limits applied at Client construction. */
1229
+ readonly limits: ResolvedCacheLimits;
1230
+ /** Re-entrancy guard for dual-index / guild cascade teardown. */
1231
+ private _cascading;
1232
+ constructor(client: Client, limits: ResolvedCacheLimits);
1233
+ /** Whether a cascade teardown is currently in progress. */
1234
+ get cascading(): boolean;
1235
+ /** Current sizes for each cache bucket. */
1236
+ stats(): CacheStats;
1596
1237
  /**
1597
- * Cached text-capable channel (guild text, guild voice, or DM), or null if uncached / not text-based.
1598
- * Narrowed type has {@link Channel.send} and {@link Channel.delete}.
1238
+ * Sweep cached messages. Filter receives a hydrated {@link Message} (`createdAt`).
1599
1239
  */
1600
- get channel(): TextBasedChannel | null;
1601
- /** Cached guild, or null for DMs / uncached. */
1602
- get guild(): Guild | null;
1603
- /** Cached guild member for the author, or null in DMs / if uncached. */
1604
- get member(): GuildMember | null;
1240
+ sweepMessages(filter?: (message: Message, channelId: string) => boolean, channelId?: string): number;
1241
+ sweepMembers(filter?: (member: GuildMember, guildId: string) => boolean): number;
1242
+ sweepUsers(filter?: (user: User, id: string) => boolean): number;
1605
1243
  /**
1606
- * Fetch this message's channel (cache first). The returned {@link Channel}
1607
- * has {@link Channel.delete} and {@link Channel.send}.
1608
- * @example
1609
- * const channel = await message.resolveChannel();
1610
- * await channel.delete();
1244
+ * Sweep channels from the global index (cascades guild index + message cache).
1245
+ * Returns count removed.
1611
1246
  */
1612
- resolveChannel(): Promise<Channel>;
1247
+ sweepChannels(filter?: (channel: Channel, id: string) => boolean): number;
1613
1248
  /**
1614
- * Fetch and resolve the guild, or null if a DM.
1615
- * Propagates network/auth errors; only returns null when there is no guildId.
1616
- * @example
1617
- * const guild = await message.resolveGuild();
1249
+ * Sweep guilds (cascades channels + message caches). Returns count removed.
1618
1250
  */
1619
- resolveGuild(): Promise<Guild | null>;
1251
+ sweepGuilds(filter?: (guild: Guild, id: string) => boolean): number;
1620
1252
  /**
1621
- * Construct a message from API data.
1622
- * @param data - API message from REST or MESSAGE_CREATE
1253
+ * Tear down nested caches when a guild leaves `client.guilds`.
1254
+ * Removes channels from the global index, clears message caches, and empties guild collections.
1255
+ * Does not mass-delete `client.users`.
1256
+ * @internal
1623
1257
  */
1624
- constructor(client: Client, data: APIMessage);
1258
+ cascadeGuild(guild: Guild): void;
1625
1259
  /**
1626
- * Apply an API message payload in place (cache identity / MESSAGE_UPDATE).
1260
+ * Keep dual channel indexes + message cache aligned when a channel leaves a cache.
1261
+ * Uses `Map.prototype.delete` so ChannelManager/Guild channel `delete` overrides do not re-enter.
1262
+ * @param channel - Channel being removed
1263
+ * @param from - Which index initiated the removal (`global` = client.channels, `guild` = guild.channels)
1627
1264
  * @internal
1628
1265
  */
1629
- _patch(data: APIMessage): void;
1266
+ cascadeChannel(channel: Channel, from?: 'global' | 'guild' | 'both'): void;
1267
+ }
1268
+
1269
+ /**
1270
+ * Channel cache + fetch/send helpers.
1271
+ * Extends {@link LimitedCollection} (`.get()`, `.set()`, `.filter()`, …).
1272
+ * FIFO-evicts (and keeps guild indexes / message caches aligned) at `cache.channels`.
1273
+ */
1274
+ declare class ChannelManager extends LimitedCollection<string, Channel> {
1275
+ private readonly client;
1276
+ constructor(client: Client);
1630
1277
  /**
1631
- * Send a standalone message in this channel (not a reply).
1632
- * Prefer {@link Channel.send} or {@link reply} when you already have the channel or are answering.
1278
+ * Remove a channel from cache. Does not delete it on the API.
1279
+ * Use {@link Channel.delete} after {@link fetch} to delete the channel.
1633
1280
  */
1634
- send(options: MessagePrepareInput): Promise<Message>;
1281
+ delete(key: string): boolean;
1282
+ /** Retrieve from cache, otherwise {@link fetch}. */
1283
+ resolve(channelId: string): Promise<Channel>;
1635
1284
  /**
1636
- * Send a message to another channel by ID.
1637
- * Prefer `client.channels.fetch(channelId)` then {@link Channel.send}.
1285
+ * Fetch a channel by ID. The returned {@link Channel} has {@link Channel.delete}
1286
+ * and {@link Channel.send} (send throws if the type is not text-based).
1287
+ * Returns the cached channel unless `force` is set.
1288
+ * @example
1289
+ * const channel = await client.channels.fetch(channelId);
1290
+ * await channel.delete();
1291
+ * await channel.send('hi');
1292
+ * @throws {@link FluxerError} with CHANNEL_NOT_FOUND if missing
1638
1293
  */
1639
- sendTo(channelId: string, options: MessagePrepareInput): Promise<Message>;
1294
+ fetch(channelId: string, options?: {
1295
+ force?: boolean;
1296
+ }): Promise<Channel>;
1640
1297
  /**
1641
- * Reply to this message.
1642
- * @example
1643
- * await message.reply('Pong!');
1644
- * await message.reply('No ping!', { ping: false });
1645
- * await message.reply({ content: 'Silent', allowedMentions: AllowedMentions.suppressReplyPing });
1298
+ * Fetch a message by channel + message ID (no channel resolve required).
1299
+ * Prefer `channel.messages.fetch(messageId)` when you already have a text channel.
1646
1300
  */
1647
- reply(options: string | (MessageSendOptions & ReplyOptions), replyOptions?: ReplyOptions): Promise<Message>;
1301
+ fetchMessage(channelId: string, messageId: string): Promise<Message>;
1648
1302
  /**
1649
- * Hydrate a partial message, or return the message as-is.
1303
+ * Send to a channel by ID without resolving it first.
1304
+ * Prefer {@link Channel.send} after {@link fetch} when you want the channel object.
1650
1305
  * @example
1651
- * client.on(Events.MessageUpdate, async (_old, msg) => {
1652
- * const message = await Message.resolve(msg);
1653
- * });
1306
+ * await client.channels.send(logChannelId, 'User joined!');
1654
1307
  */
1655
- static resolve(message: Message | PartialMessage): Promise<Message>;
1656
- /** Test helper — prefer {@link reply} / `prepareMessagePostPayload()`. */
1657
- static _createMessageBody(content: string | MessageSendOptions, referenced_message?: {
1658
- channel_id: string;
1659
- message_id: string;
1660
- guild_id?: string;
1661
- }, ping?: boolean): Promise<PreparedMessagePost>;
1662
- /** Send a prepared payload (internal helper). */
1663
- _send(payload: PreparedMessagePost): Promise<Message>;
1664
- /** Edit this message (requires author or admin permissions). */
1665
- edit(options: MessageEditOptions): Promise<Message>;
1666
- /** Create a {@link ReactionCollector} for this message. */
1667
- createReactionCollector(options?: ReactionCollectorOptions): ReactionCollector;
1308
+ send(channelId: string, payload: MessagePrepareInput): Promise<Message>;
1309
+ }
1310
+
1311
+ /** The logged-in bot/user (`client.user`). */
1312
+ declare class ClientUser extends User {
1313
+ readonly client: Client;
1314
+ /** Broadcast presence (gateway opcode 3) on all shards. */
1315
+ setPresence(presence: PresenceUpdateOptions): void;
1316
+ /** GET /users/@me — refresh the logged-in user from REST and patch this instance. */
1317
+ fetch(): Promise<this>;
1318
+ /** GET /users/@me/guilds — returns camelCase partial guilds. */
1319
+ fetchGuilds(options?: {
1320
+ withCounts?: boolean;
1321
+ }): Promise<PartialUserGuildPayload[]>;
1668
1322
  /**
1669
- * Wait for reactions matching the filter, then resolve the collected set.
1670
- * Pass `errors: ['time']` to reject when the timer fires instead of resolving.
1323
+ * Leave a guild (`client.user.leaveGuild`).
1324
+ * DELETE /users/@me/guilds/{guild_id}.
1325
+ *
1326
+ * @param guildId - Guild to leave
1327
+ * @param options - Optional sudo / MFA body for user accounts
1328
+ * @example
1329
+ * await client.user.leaveGuild(guildId);
1671
1330
  */
1672
- awaitReactions(options?: ReactionCollectorOptions & {
1673
- errors?: ReactionCollectorEndReason[];
1674
- }): Promise<Collection<string, CollectedReaction>>;
1675
- /** Fetch the latest version of this message from the API. */
1676
- fetch(): Promise<Message>;
1677
- /** Delete this message. */
1678
- delete(reason?: string): Promise<void>;
1679
- /** Delete a specific attachment from this message. */
1680
- deleteAttachment(attachmentId: string): Promise<void>;
1681
- /** Pin this message in the channel. */
1682
- pin(): Promise<void>;
1683
- /** Unpin this message from the channel. */
1684
- unpin(): Promise<void>;
1685
- /** React to this message with an emoji. */
1686
- react(emoji: EmojiInput): Promise<void>;
1687
- /** Remove a reaction (bot's own or a user's if ID is provided). */
1688
- removeReaction(emoji: EmojiInput, userId?: string): Promise<void>;
1689
- /** Remove all reactions from this message. */
1690
- removeAllReactions(): Promise<void>;
1691
- /** Remove all reactions of a specific emoji. */
1692
- removeReactionEmoji(emoji: EmojiInput): Promise<void>;
1693
- /** Fetch users who reacted with a specific emoji. */
1694
- fetchReactionUsers(emoji: EmojiInput, options?: {
1695
- limit?: number;
1696
- after?: string;
1697
- }): Promise<User[]>;
1698
- /** Fetch reaction users with pagination metadata. */
1699
- fetchReactionUsersPage(emoji: EmojiInput, options?: {
1700
- limit?: number;
1701
- after?: string;
1702
- }): Promise<{
1703
- users: User[];
1704
- hasMore: boolean;
1705
- nextAfter: string | null;
1706
- }>;
1331
+ leaveGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
1332
+ /** Delete every message authored by the caller across a guild (sudo). */
1333
+ bulkDeleteMyMessagesInGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
1707
1334
  }
1708
1335
 
1709
- /** Options for GET /channels/{id}/messages. */
1710
- interface FetchMessagesOptions {
1711
- limit?: number;
1712
- before?: string;
1713
- after?: string;
1714
- around?: string;
1715
- }
1716
- /** Options for {@link Client.bulkFetchMessages} (user-account only). */
1717
- interface BulkFetchMessagesOptions {
1718
- /** When true (default), hydrate {@link Message}s and update the cache. */
1719
- hydrate?: boolean;
1336
+ /**
1337
+ * Guild cache and manager with fetch.
1338
+ * Extends {@link LimitedCollection} so you can use `.get()`, `.set()`, `.filter()`, etc.
1339
+ * FIFO-evicts (and cascades nested caches) when at the resolved `cache.guilds` limit.
1340
+ */
1341
+ declare class GuildManager extends LimitedCollection<string, Guild> {
1342
+ private readonly client;
1343
+ constructor(client: Client);
1344
+ /**
1345
+ * Remove a guild from cache and cascade its channels / message caches.
1346
+ * Does not leave the guild. Use {@link ClientUser.leaveGuild} for that.
1347
+ */
1348
+ delete(key: string): boolean;
1349
+ /**
1350
+ * Get a guild from cache or fetch from the API if not present.
1351
+ * @param guildId - Snowflake of the guild
1352
+ * @returns The guild
1353
+ * @throws FluxerError with GUILD_NOT_FOUND if missing
1354
+ */
1355
+ resolve(guildId: string): Promise<Guild>;
1356
+ /**
1357
+ * Fetch a guild by ID.
1358
+ * Returns the cached guild unless `force` is set, in which case REST metadata is applied via `_patch`.
1359
+ * @throws FluxerError with GUILD_NOT_FOUND if missing
1360
+ */
1361
+ fetch(guildId: string, options?: {
1362
+ force?: boolean;
1363
+ }): Promise<Guild>;
1720
1364
  }
1721
- /** One channel's slice of a bulk message fetch. */
1722
- interface BulkFetchMessagesChannelResult {
1723
- channelId: string;
1724
- messages: Collection<string, Message>;
1365
+
1366
+ type MemberPayload = APIGuildMember & {
1367
+ user: {
1368
+ id: string;
1369
+ };
1370
+ };
1371
+ /** Result of {@link UserManager.fetchWithProfile}. */
1372
+ interface FetchedUserWithProfile {
1373
+ user: User;
1374
+ userData: APIUserPartial;
1375
+ globalProfile: ProfilePayload | null;
1376
+ serverProfile: ProfilePayload | null;
1377
+ member: GuildMember | null;
1378
+ memberData: MemberPayload | null;
1725
1379
  }
1726
- /** Result of {@link MessageManager.bulkFetch}: per-channel message collections. */
1727
- interface BulkFetchMessagesResult {
1728
- channels: BulkFetchMessagesChannelResult[];
1380
+ /**
1381
+ * User cache + fetch/profile helpers.
1382
+ * Extends LimitedCollection (`.get()`, `.set()`, `.filter()`, …).
1383
+ * Access via {@link Client.users}.
1384
+ */
1385
+ declare class UserManager extends LimitedCollection<string, User> {
1386
+ private readonly client;
1387
+ constructor(client: Client);
1388
+ /** Remove matching users (skips `client.user`). Returns count removed. */
1389
+ sweep(filter?: (user: User, id: string) => boolean): number;
1390
+ /** Fetch a user by ID and update cache. Returns cache unless `force` is set. */
1391
+ fetch(userId: string, options?: {
1392
+ force?: boolean;
1393
+ }): Promise<User>;
1394
+ /** Return a cached user, otherwise {@link fetch}. */
1395
+ resolve(userId: string): Promise<User>;
1396
+ /**
1397
+ * Fetch user + profiles (+ optional guild member). Ideal for userinfo commands.
1398
+ * @example
1399
+ * const { user, globalProfile, member } = await client.users.fetchWithProfile(
1400
+ * userId,
1401
+ * { guildId: message.guildId ?? undefined },
1402
+ * );
1403
+ */
1404
+ fetchWithProfile(userId: string, options?: {
1405
+ guildId?: string | null;
1406
+ }): Promise<FetchedUserWithProfile>;
1729
1407
  }
1408
+
1730
1409
  /**
1731
- * Per-channel message cache + fetch. Access via `channel.messages`.
1732
- *
1733
- * `get` returns the same {@link Message} instance for a cached id (identity).
1734
- * `fetch` always writes through the client message cache (when enabled).
1410
+ * Cached reactions on a {@link Message}, keyed by emoji identifier.
1735
1411
  */
1736
- declare class MessageManager {
1737
- private readonly client;
1738
- private readonly channelId;
1739
- /** Structure cache keyed by message id (identity for {@link get}). */
1740
- private readonly _structures;
1741
- constructor(client: Client, channelId: string);
1742
- /** Retrieve a cached message by ID, or `undefined` if missing / caching disabled. */
1743
- get(messageId: string): Message | undefined;
1744
- /** Retrieve from cache, otherwise {@link fetch}. */
1745
- resolve(messageId: string): Promise<Message>;
1746
- /** Fetch a single message by ID. */
1747
- fetch(messageId: string): Promise<Message>;
1748
- /** Fetch multiple messages with query options (limit, before, after, around). */
1749
- fetch(options: FetchMessagesOptions): Promise<Collection<string, Message>>;
1750
- /** Cache API data and return a {@link Message} (reusing identity when present). */
1751
- private wrap;
1752
- /** Fetch a single message from the API. */
1753
- private fetchOne;
1754
- /** Fetch multiple messages from the API with pagination/filtering. */
1755
- private fetchMany;
1412
+ declare class MessageReactionManager {
1413
+ private readonly message;
1414
+ private readonly _cache;
1415
+ constructor(message: MessageReactionContext);
1416
+ /** Reactions keyed by unicode name or `name:id`. */
1417
+ get cache(): Collection<string, MessageReaction>;
1418
+ get size(): number;
1419
+ [Symbol.iterator](): IterableIterator<MessageReaction>;
1420
+ /** @internal Sync from an API message payload. */
1421
+ _patch(reactions: APIMessageReaction[] | null | undefined): void;
1756
1422
  }
1757
1423
 
1758
- /** Options for {@link MessageCollector} / `channel.createMessageCollector()`. */
1759
- interface MessageCollectorOptions {
1760
- /** Filter function. Return true to collect the message. */
1761
- filter?: (message: Message) => boolean;
1762
- /** Max duration in ms. Collector stops when time expires. Required unless `max` is set. */
1763
- time?: number;
1764
- /** Max messages to collect. Collector stops when limit reached. Required unless `time` is set. */
1765
- max?: number;
1766
- }
1767
- type MessageCollectorEndReason = 'time' | 'limit' | 'user';
1768
- /** Typed event map for {@link MessageCollector}: `collect` per message, `end` when it stops. */
1769
- interface MessageCollectorEvents {
1770
- collect: [message: Message];
1771
- end: [collected: Collection<string, Message>, reason: MessageCollectorEndReason];
1424
+ /** Sticker attached to a message (domain view of {@link APIMessageSticker}). */
1425
+ declare class MessageSticker extends Base {
1426
+ readonly client: Client;
1427
+ readonly id: string;
1428
+ name: string;
1429
+ description: string;
1430
+ tags: string[];
1431
+ readonly animated: boolean;
1432
+ constructor(client: Client, data: APIMessageSticker);
1433
+ /** CDN URL for this sticker image. */
1434
+ get url(): string;
1435
+ /** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
1436
+ get createdTimestamp(): number;
1437
+ /** Date when this sticker was created, derived from its snowflake ID. */
1438
+ get createdAt(): Date;
1772
1439
  }
1440
+
1773
1441
  /**
1774
- * Collects messages in a channel. Use channel.createMessageCollector().
1775
- * Requires `time` and/or `max`.
1776
- * @example
1777
- * const collector = channel.createMessageCollector({ filter: m => m.author.id === userId, time: 10000 });
1778
- * collector.on('collect', m => console.log(m.content));
1779
- * collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
1442
+ * Uncached or incomplete message (`MessageDelete`, uncached `MessageUpdate`,
1443
+ * `MessageDeleteBulk` entries). Not a {@link Message}: no `edit()` / `reply()`.
1444
+ * Call {@link fetch} to hydrate, or narrow with `message.partial`.
1780
1445
  */
1781
- declare class MessageCollector extends EventEmitter {
1446
+ declare class PartialMessage {
1447
+ readonly partial: true;
1782
1448
  readonly client: Client;
1449
+ readonly id: string;
1783
1450
  readonly channelId: string;
1784
- readonly options: Required<MessageCollectorOptions>;
1785
- readonly collected: Collection<string, Message>;
1786
- private _timeout;
1787
- private _ended;
1788
- private _listener;
1789
- constructor(client: Client, channelId: string, options?: MessageCollectorOptions);
1790
- stop(reason?: MessageCollectorEndReason): void;
1451
+ readonly guildId: string | null;
1452
+ readonly content: string | null;
1453
+ readonly authorId: string | null;
1454
+ readonly author: User | null;
1455
+ readonly createdAt: Date | null;
1456
+ constructor(client: Client, data: {
1457
+ id: string;
1458
+ channelId: string;
1459
+ guildId?: string | null;
1460
+ channel?: TextBasedChannel | null;
1461
+ content?: string | null;
1462
+ authorId?: string | null;
1463
+ author?: User | null;
1464
+ createdAt?: Date | null;
1465
+ });
1791
1466
  /**
1792
- * One-shot helper used by {@link Channel.awaitMessages}.
1793
- * Resolves with the collected messages when the collector ends for `user` (or when
1794
- * the end reason is not listed in `errors`).
1795
- * By default, `time` and `limit` reject with {@link FluxerError}
1796
- * (`CollectorIdle` / `CollectorMax`).
1467
+ * Live text-capable channel from cache, or null if uncached / not text-based.
1468
+ * Same contract as {@link Message.channel}.
1797
1469
  */
1798
- static awaitMessages(client: Client, channelId: string, options?: MessageCollectorOptions & {
1799
- errors?: MessageCollectorEndReason[];
1800
- }): Promise<Collection<string, Message>>;
1801
- on<K extends keyof MessageCollectorEvents>(event: K, listener: (...args: MessageCollectorEvents[K]) => void): this;
1802
- emit<K extends keyof MessageCollectorEvents>(event: K, ...args: MessageCollectorEvents[K]): boolean;
1803
- }
1804
-
1805
- /**
1806
- * Optional cache size limits (FIFO eviction when exceeded).
1807
- *
1808
- * | Value | Meaning |
1809
- * |-------|---------|
1810
- * | positive number | Max entries |
1811
- * | `0` or `Infinity` | Unbounded |
1812
- * | `false` (`messages` only) | Message cache disabled |
1813
- *
1814
- * @see {@link DEFAULT_CACHE_LIMITS}
1815
- * @see {@link resolveCacheLimits}
1816
- */
1817
- interface CacheSizeLimits {
1818
- /** Max channels cached globally. `0` = unbounded. */
1819
- channels?: number;
1820
- /** Max guilds cached. `0` = unbounded. */
1821
- guilds?: number;
1822
- /** Max users cached globally. `0` = unbounded. */
1823
- users?: number;
1470
+ get channel(): TextBasedChannel | null;
1824
1471
  /**
1825
- * Max messages per channel, or `false` to disable message caching.
1826
- * `0` / `Infinity` = unbounded (legacy `0` previously meant off — use `false`).
1472
+ * Fetch this message's channel (cache first). The returned {@link Channel}
1473
+ * has {@link Channel.delete} and {@link Channel.send}.
1474
+ * @example
1475
+ * const channel = await message.resolveChannel();
1476
+ * await channel.delete();
1827
1477
  */
1828
- messages?: number | false;
1829
- /** Max members per guild. `0` = unbounded. */
1830
- members?: number;
1831
- /** Max roles per guild. `0` = unbounded. @default 0 */
1832
- roles?: number;
1833
- /** Max emojis per guild. `0` = unbounded. @default 0 */
1834
- emojis?: number;
1835
- /** Max stickers per guild. `0` = unbounded. @default 0 */
1836
- stickers?: number;
1478
+ resolveChannel(): Promise<Channel>;
1479
+ /**
1480
+ * Fetch the full message from the API.
1481
+ * @example
1482
+ * const message = await partial.fetch();
1483
+ * await message.reply('Pong!');
1484
+ */
1485
+ fetch(): Promise<Message>;
1837
1486
  }
1838
- /**
1839
- * Default cache policy — opt out per field with `0` (or `messages: false` to disable).
1840
- * Applied when {@link ClientOptions.cache} is omitted or partial.
1841
- */
1842
- declare const DEFAULT_CACHE_LIMITS: Required<Omit<CacheSizeLimits, 'messages'>> & {
1843
- messages: number;
1487
+
1488
+ /** Event name constants for client.on(Events.X, handler). Use with ClientEvents for typed callbacks. */
1489
+ declare const Events: {
1490
+ readonly Ready: "ready";
1491
+ readonly MessageCreate: "messageCreate";
1492
+ readonly MessageUpdate: "messageUpdate";
1493
+ readonly MessageDelete: "messageDelete";
1494
+ readonly MessageDeleteBulk: "messageDeleteBulk";
1495
+ readonly MessageReactionAdd: "messageReactionAdd";
1496
+ readonly MessageReactionAddMany: "messageReactionAddMany";
1497
+ readonly MessageReactionRemove: "messageReactionRemove";
1498
+ readonly MessageReactionRemoveAll: "messageReactionRemoveAll";
1499
+ readonly MessageReactionRemoveEmoji: "messageReactionRemoveEmoji";
1500
+ readonly GuildCreate: "guildCreate";
1501
+ readonly GuildAvailable: "guildAvailable";
1502
+ readonly GuildUnavailable: "guildUnavailable";
1503
+ readonly GuildUpdate: "guildUpdate";
1504
+ readonly GuildDelete: "guildDelete";
1505
+ readonly GuildBanAdd: "guildBanAdd";
1506
+ readonly GuildBanRemove: "guildBanRemove";
1507
+ readonly GuildAuditLogEntryCreate: "guildAuditLogEntryCreate";
1508
+ readonly GuildEmojisUpdate: "guildEmojisUpdate";
1509
+ readonly GuildStickersUpdate: "guildStickersUpdate";
1510
+ readonly GuildCountsUpdate: "guildCountsUpdate";
1511
+ readonly ChannelMemberCountsUpdate: "channelMemberCountsUpdate";
1512
+ readonly GuildMemberAdd: "guildMemberAdd";
1513
+ readonly GuildMemberUpdate: "guildMemberUpdate";
1514
+ readonly GuildMemberRemove: "guildMemberRemove";
1515
+ readonly GuildMembersChunk: "guildMembersChunk";
1516
+ readonly GuildRoleCreate: "guildRoleCreate";
1517
+ readonly GuildRoleUpdate: "guildRoleUpdate";
1518
+ readonly GuildRoleDelete: "guildRoleDelete";
1519
+ readonly ChannelCreate: "channelCreate";
1520
+ readonly ChannelUpdate: "channelUpdate";
1521
+ readonly ChannelDelete: "channelDelete";
1522
+ readonly ThreadCreate: "threadCreate";
1523
+ readonly ThreadUpdate: "threadUpdate";
1524
+ readonly ThreadDelete: "threadDelete";
1525
+ readonly ThreadListSync: "threadListSync";
1526
+ readonly ThreadMemberUpdate: "threadMemberUpdate";
1527
+ readonly ThreadMembersUpdate: "threadMembersUpdate";
1528
+ readonly ThreadMemberListUpdate: "threadMemberListUpdate";
1529
+ readonly ForumUnreads: "forumUnreads";
1530
+ readonly ChannelPinsUpdate: "channelPinsUpdate";
1531
+ readonly ChannelRecipientAdd: "channelRecipientAdd";
1532
+ readonly ChannelRecipientRemove: "channelRecipientRemove";
1533
+ readonly InviteCreate: "inviteCreate";
1534
+ readonly InviteDelete: "inviteDelete";
1535
+ readonly TypingStart: "typingStart";
1536
+ readonly UserUpdate: "userUpdate";
1537
+ readonly UserConnectionsUpdate: "userConnectionsUpdate";
1538
+ readonly WebAuthnCredentialsUpdate: "webauthnCredentialsUpdate";
1539
+ readonly PresenceUpdate: "presenceUpdate";
1540
+ readonly PresenceUpdateBulk: "presenceUpdateBulk";
1541
+ readonly VoiceStateUpdate: "voiceStateUpdate";
1542
+ readonly VoiceStateAck: "voiceStateAck";
1543
+ readonly VoiceServerUpdate: "voiceServerUpdate";
1544
+ readonly EntranceSoundPlay: "entranceSoundPlay";
1545
+ readonly VoiceStatesSync: "voiceStatesSync";
1546
+ readonly WebhooksUpdate: "webhooksUpdate";
1547
+ readonly Resumed: "resumed";
1548
+ readonly Error: "error";
1549
+ readonly Debug: "debug";
1550
+ readonly ShardReady: "shardReady";
1551
+ readonly ShardResumed: "shardResumed";
1552
+ readonly ShardDisconnect: "shardDisconnect";
1553
+ readonly ShardReconnecting: "shardReconnecting";
1554
+ readonly ShardError: "shardError";
1555
+ readonly ShardingRequired: "shardingRequired";
1844
1556
  };
1845
- /**
1846
- * Fully resolved cache limits used at runtime.
1847
- * Numeric buckets use `Infinity` for unbounded; `messages` may be `false` (disabled).
1848
- */
1849
- interface ResolvedCacheLimits {
1850
- guilds: number;
1851
- channels: number;
1852
- users: number;
1853
- members: number;
1854
- /** Per-channel message cap, `Infinity` if unbounded, or `false` if disabled. */
1855
- messages: number | false;
1856
- roles: number;
1857
- emojis: number;
1858
- stickers: number;
1859
- }
1860
- /** Result of {@link resolveCacheLimits}. */
1861
- interface ResolvedCacheOptions {
1862
- /** Limits for LimitedCollection / MessageCache. */
1863
- limits: ResolvedCacheLimits;
1864
- /** Merged options object stored on `client.options.cache`. */
1865
- cache: Required<Omit<CacheSizeLimits, 'messages'>> & {
1866
- messages: number | false;
1867
- };
1557
+
1558
+ /** Hosted Fluxer production endpoints (default when no instance is configured). */
1559
+ declare const DEFAULT_INSTANCE_ENDPOINTS: Readonly<APIInstanceEndpoints>;
1560
+ /** Immutable resolved instance descriptor attached to each {@link Client}. */
1561
+ interface ResolvedInstance {
1562
+ readonly endpoints: Readonly<APIInstanceEndpoints>;
1563
+ /** Full discovery document when available (fromDiscovery / fetchInstance). */
1564
+ readonly discovery: Readonly<APIInstance> | null;
1868
1565
  }
1566
+ /** Unversioned well-known path (`GET /.well-known/fluxer`). */
1567
+ declare const INSTANCE_DISCOVERY_PATH: "/.well-known/fluxer";
1869
1568
  /**
1870
- * Normalize a numeric cache limit.
1871
- * Positive finite → floored max; `0` / `Infinity` / NaN / negative → unbounded (`Infinity`).
1569
+ * Absolute unversioned discovery URL for an origin.
1570
+ * Hosted Fluxer: `https://fluxer.app/.well-known/fluxer` (may 308 to `api_public`).
1872
1571
  */
1873
- declare function normalizeCacheLimit(value: number | undefined, fallback: number): number;
1572
+ declare function instanceDiscoveryUrl(origin: string): string;
1573
+ /** Strip trailing `/vN` and trailing slash from an API origin. */
1574
+ declare function normalizeApiOrigin(api: string): string;
1874
1575
  /**
1875
- * Resolve and validate {@link ClientOptions.cache} once at Client construction.
1876
- * Emits a warning when `messages: 0` is passed (legacy “off”; now unbounded — use `false`).
1576
+ * Validate a raw discovery payload and return a typed {@link APIInstance}.
1577
+ * @throws FluxerError with {@link ErrorCodes.InvalidInstanceDiscovery}
1877
1578
  */
1878
- declare function resolveCacheLimits(input?: CacheSizeLimits): ResolvedCacheOptions;
1579
+ declare function parseInstanceDiscovery(raw: unknown): APIInstance;
1879
1580
  /**
1880
- * Configuration options for {@link Client}.
1581
+ * Merge partial endpoint overrides onto hosted defaults.
1582
+ * Accepts either a full {@link APIInstance} or a partial endpoint map.
1583
+ */
1584
+ declare function resolveInstanceEndpoints(input?: Partial<APIInstanceEndpoints> | APIInstance | null): ResolvedInstance;
1585
+ /** Build an invite URL for a code using the instance invite base. */
1586
+ declare function inviteUrl(inviteBase: string, code: string): string;
1587
+
1588
+ /** Options for {@link MessageCollector} / `channel.createMessageCollector()`. */
1589
+ interface MessageCollectorOptions {
1590
+ /** Filter function. Return true to collect the message. */
1591
+ filter?: (message: Message) => boolean;
1592
+ /** Max duration in ms. Collector stops when time expires. Required unless `max` is set. */
1593
+ time?: number;
1594
+ /** Max messages to collect. Collector stops when limit reached. Required unless `time` is set. */
1595
+ max?: number;
1596
+ }
1597
+ type MessageCollectorEndReason = 'time' | 'limit' | 'user';
1598
+ /** Typed event map for {@link MessageCollector}: `collect` per message, `end` when it stops. */
1599
+ interface MessageCollectorEvents {
1600
+ collect: [message: Message];
1601
+ end: [collected: Collection<string, Message>, reason: MessageCollectorEndReason];
1602
+ }
1603
+ /**
1604
+ * Collects messages in a channel. Use channel.createMessageCollector().
1605
+ * Requires `time` and/or `max`.
1881
1606
  * @example
1882
- * ```ts
1883
- * const client = new Client({
1884
- * instance: { api_public: 'https://api.example.com' },
1885
- * cache: { guilds: 100, messages: 20 },
1886
- * waitForGuilds: true,
1887
- * });
1888
- * ```
1607
+ * const collector = channel.createMessageCollector({ filter: m => m.author.id === userId, time: 10000 });
1608
+ * collector.on('collect', m => console.log(m.content));
1609
+ * collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
1889
1610
  */
1890
- interface ClientOptions {
1891
- /**
1892
- * Instance endpoints for this client (API, CDN, invite, etc.).
1893
- * Pass a partial map to override hosted defaults, or a full discovery document.
1894
- * Prefer this over `rest.api` for multi-instance / self-hosted bots.
1895
- * REST uses `api_public`; `api` / `api_client` are kept for inspection.
1896
- * @see {@link Client.fromDiscovery}
1897
- */
1898
- instance?: Partial<APIInstanceEndpoints> | APIInstance;
1899
- /**
1900
- * REST options. Prefer {@link ClientOptions.instance} for the API host.
1901
- * If both `instance.api_public` (or resolved default) and `rest.api` are set and differ, construction throws.
1902
- */
1903
- rest?: Partial<ConstructorParameters<typeof REST>[0]>;
1904
- /**
1905
- * BCP 47 locale sent as REST `Accept-Language`. Defaults to {@link import('@fluxerjs/rest').DEFAULT_LOCALE}.
1906
- * Overrides `rest.locale` when both are set.
1907
- * @see {@link ClientOptions.rest}
1908
- */
1909
- locale?: string;
1910
- /**
1911
- * @deprecated Fluxer has no intents. Prefer {@link ClientOptions.ignoredEvents}. Kept only for migration; identify always sends `0`.
1912
- */
1913
- intents?: number;
1914
- /**
1915
- * @deprecated No-op. Fluxer has no intents warning to suppress.
1916
- */
1917
- suppressIntentWarning?: boolean;
1918
- /** {@link import('@fluxerjs/types').GatewayIdentifyFlags} bitfield sent as Identify `flags`. */
1919
- identifyFlags?: number;
1920
- /** Dispatch event names to suppress for this session (`ignored_events`). */
1921
- ignoredEvents?: string[];
1922
- /** Prefer hydrating this guild first after READY (`initial_guild_id`). */
1923
- initialGuildId?: string;
1924
- /**
1925
- * Delay {@link Events.Ready} until all READY guilds arrive via GUILD_CREATE; queue other dispatches until then.
1926
- * Startup backfill emits {@link Events.GuildAvailable} (not {@link Events.GuildCreate}) unless
1927
- * {@link ClientOptions.emitGuildCreateOnStartup} is set.
1928
- * @default false
1929
- * @see {@link ClientOptions.emitGuildCreateOnStartup}
1930
- */
1931
- waitForGuilds?: boolean;
1932
- /**
1933
- * Emit {@link Events.GuildCreate} for READY / initial-stream guild hydrations instead of {@link Events.GuildAvailable}.
1934
- * Default behavior matches Discord.js: startup backfill uses {@link Events.GuildAvailable}, and
1935
- * {@link Events.GuildCreate} means the bot joined after {@link Events.Ready}.
1936
- * @default false
1937
- * @see {@link ClientOptions.waitForGuilds}
1938
- */
1939
- emitGuildCreateOnStartup?: boolean;
1940
- /**
1941
- * Cache size limits per bucket. Defaults to {@link DEFAULT_CACHE_LIMITS}.
1942
- * Pass `0` / `Infinity` per numeric field for unbounded; `messages: false` to disable message caching.
1943
- * @see {@link CacheSizeLimits}
1944
- */
1945
- cache?: CacheSizeLimits;
1946
- /**
1947
- * Default allowed mentions when a send omits them (per-call wins).
1948
- * @example
1949
- * ```ts
1950
- * defaultAllowedMentions: {
1951
- * parse: ['users'],
1952
- * repliedUser: false,
1953
- * }
1954
- * ```
1955
- */
1956
- defaultAllowedMentions?: {
1957
- /** Mention types to parse (`roles`, `users`, `everyone`). */
1958
- parse?: Array<'roles' | 'users' | 'everyone'>;
1959
- /** Specific role IDs allowed to be mentioned. */
1960
- roles?: string[];
1961
- /** Specific user IDs allowed to be mentioned. */
1962
- users?: string[];
1963
- /** Whether to ping the user being replied to. */
1964
- repliedUser?: boolean;
1965
- };
1966
- /**
1967
- * Default reply ping for `message.reply` when `ping` is omitted.
1968
- * @default true
1969
- */
1970
- defaultReplyPing?: boolean;
1971
- /**
1972
- * Initial presence on identify (also updatable via `client.user.setPresence`).
1973
- * CamelCase only; mapped to gateway wire internally.
1974
- */
1975
- presence?: PresenceUpdateOptions;
1976
- /**
1977
- * Emit gateway debug strings.
1978
- * @default true
1979
- */
1980
- gatewayDebug?: boolean;
1981
- /**
1982
- * Total gateway shard count, or `'auto'` to derive from guild count.
1983
- * Fluxer's `/gateway/bot` currently stubs `shards: 1`, so prefer `'auto'` or an explicit count
1984
- * for large bots (max 2500 guilds per shard).
1985
- * Alias: `totalShards`.
1986
- */
1987
- shardCount?: number | 'auto';
1988
- /**
1989
- * Alias of {@link shardCount} (matches {@link import('@fluxerjs/sharding').ShardingManager} vocabulary).
1990
- * @deprecated Prefer {@link shardCount}.
1991
- */
1992
- totalShards?: number | 'auto';
1993
- /** Explicit shard ids this client should connect (defaults to `0..shardCount-1`). Alias: `shardList`. */
1994
- shardIds?: number[];
1611
+ declare class MessageCollector extends EventEmitter {
1612
+ readonly client: Client;
1613
+ readonly channelId: string;
1614
+ readonly options: Required<MessageCollectorOptions>;
1615
+ readonly collected: Collection<string, Message>;
1616
+ private _timeout;
1617
+ private _ended;
1618
+ private _listener;
1619
+ constructor(client: Client, channelId: string, options?: MessageCollectorOptions);
1620
+ stop(reason?: MessageCollectorEndReason): void;
1995
1621
  /**
1996
- * Alias of {@link shardIds}.
1997
- * @deprecated Prefer {@link shardIds}.
1622
+ * One-shot helper used by {@link Channel.awaitMessages}.
1623
+ * Resolves with the collected messages when the collector ends for `user` (or when
1624
+ * the end reason is not listed in `errors`).
1625
+ * By default, `time` and `limit` reject with {@link FluxerError}
1626
+ * (`CollectorIdle` / `CollectorMax`).
1998
1627
  */
1999
- shardList?: number[];
1628
+ static awaitMessages(client: Client, channelId: string, options?: MessageCollectorOptions & {
1629
+ errors?: MessageCollectorEndReason[];
1630
+ }): Promise<Collection<string, Message>>;
1631
+ on<K extends keyof MessageCollectorEvents>(event: K, listener: (...args: MessageCollectorEvents[K]) => void): this;
1632
+ emit<K extends keyof MessageCollectorEvents>(event: K, ...args: MessageCollectorEvents[K]): boolean;
1633
+ }
1634
+
1635
+ type FetchPinnedMessagesOptions = {
1636
+ limit?: number;
1637
+ before?: string;
1638
+ };
1639
+ type PinnedMessagesPage = {
1640
+ messages: Message[];
1641
+ pinnedAt: string[];
1642
+ hasMore: boolean;
1643
+ };
1644
+
1645
+ /** Options for PATCH /channels/{id}/messages/{id}. */
1646
+ interface MessageEditOptions {
1647
+ content?: string | null;
1648
+ embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
1649
+ allowedMentions?: AllowedMentionsOptions;
1650
+ flags?: MessageFlagsResolvable | number;
1651
+ /** Keep by snowflake `id`, or add via `uploadFilename` from the presigned upload flow. */
1652
+ attachments?: MessageAttachmentEdit[];
1653
+ }
1654
+ type PreparedMessagePost = Awaited<ReturnType<typeof prepareMessagePostPayload>>;
1655
+ /** CamelCase reply / forward reference on a {@link Message}. */
1656
+ interface MessageReference {
1657
+ channelId: string;
1658
+ messageId: string;
1659
+ guildId: string | null;
1660
+ type?: number;
1661
+ }
1662
+ /** CamelCase call metadata on a {@link Message}. */
1663
+ interface MessageCall {
1664
+ participants: string[];
1665
+ endedAt: Date | null;
1666
+ }
1667
+ /** CamelCase forwarded-message snapshot on a {@link Message}. */
1668
+ interface MessageSnapshot {
1669
+ content: string | null;
1670
+ createdAt: Date;
1671
+ editedAt: Date | null;
1672
+ /** User IDs mentioned in the original message (API snapshots only include IDs). */
1673
+ mentionUserIds: string[];
1674
+ mentionRoles: string[];
1675
+ embeds: MessageEmbed[];
1676
+ attachments: MessageAttachment[];
1677
+ stickers: MessageSticker[];
1678
+ type?: MessageType;
1679
+ }
1680
+ /** Second-arg / inline options for `message.reply()`. */
1681
+ interface ReplyOptions {
1682
+ /** `false` suppresses the replied-user ping (`allowed_mentions.replied_user`). Default: client `defaultReplyPing`. */
1683
+ ping?: boolean;
1684
+ /** Reply to a different message. Default: this message. */
1685
+ replyTo?: Message | MessageReplyTarget;
1686
+ }
1687
+
1688
+ declare const DMChannel_base: (abstract new (...args: any[]) => {
1689
+ send(options: MessagePrepareInput): Promise<Message>;
1690
+ fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
1691
+ fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
1692
+ "__#private@#messages": MessageManager | undefined;
1693
+ readonly client: Client;
1694
+ readonly id: string;
1695
+ type: ChannelType;
1696
+ name: string | null;
1697
+ icon: string | null;
1698
+ lastPinTimestamp: string | null;
1699
+ get createdTimestamp(): number;
1700
+ get createdAt(): Date;
1701
+ _patch(data: APIChannelPartial | APIChannel): void;
1702
+ isTextBased(): this is TextChannel | VoiceChannel | DMChannel | ThreadChannel;
1703
+ isGuild(): this is GuildChannel;
1704
+ isThread(): this is ThreadChannel;
1705
+ isForum(): this is ForumChannel;
1706
+ isMedia(): this is MediaChannel;
1707
+ isText(): this is TextChannel;
1708
+ isAnnouncement(): this is AnnouncementChannel;
1709
+ isCategory(): this is CategoryChannel;
1710
+ isDM(): this is DMChannel;
1711
+ isPersonalNotes(): boolean;
1712
+ isVoice(): this is VoiceChannel;
1713
+ isLink(): this is LinkChannel;
1714
+ bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
1715
+ bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
1716
+ acknowledgePins(): Promise<void>;
1717
+ clearReadState(): Promise<void>;
1718
+ requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
1719
+ completeAttachmentUploads(uploads: AttachmentUploadCompleteItem[]): Promise<AttachmentUploadCompleteResponse>;
1720
+ uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
1721
+ sendTyping(): Promise<void>;
1722
+ fetchRtcRegions(): Promise<RtcRegionPayload[]>;
1723
+ fetchSlowmode(): Promise<ChannelSlowmodePayload>;
1724
+ canSendMessage(): boolean;
1725
+ get messages(): MessageManager;
1726
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
1727
+ awaitMessages(options?: MessageCollectorOptions & {
1728
+ errors?: MessageCollectorEndReason[];
1729
+ }): Promise<_fluxerjs_collection.Collection<string, Message>>;
1730
+ delete(options?: SudoVerificationOptions & {
1731
+ silent?: boolean;
1732
+ deleteMessages?: boolean;
1733
+ reason?: string;
1734
+ }): Promise<void>;
1735
+ toString(): string;
1736
+ }) & typeof Channel;
1737
+ /** DM / Group DM / personal notes channel. */
1738
+ declare class DMChannel extends DMChannel_base {
1739
+ /** ID of the last message sent in this channel. */
1740
+ lastMessageId?: string | null;
1741
+ /** Owner ID for group DMs. */
1742
+ ownerId: string | null;
1743
+ /** Recipients in this DM (includes the bot). */
1744
+ recipients: User[];
1745
+ /** Custom nicknames for users in a group DM. */
1746
+ nicks: Record<string, string>;
1747
+ constructor(client: Client, data: APIChannelPartial | APIChannel);
2000
1748
  /**
2001
- * Guilds per shard when {@link shardCount} is `'auto'`.
2002
- * @default 1500
1749
+ * Apply DM/group-DM fields in place.
1750
+ * @internal
2003
1751
  */
2004
- guildsPerShard?: number;
1752
+ _patch(data: APIChannelPartial | APIChannel): void;
2005
1753
  /**
2006
- * Custom WebSocket sharding strategy builder (e.g. WorkerShardingStrategy).
2007
- * @see {@link import('@fluxerjs/ws').WorkerShardingStrategy}
1754
+ * Edit this group DM (name, icon, nicks).
1755
+ * Transferring ownership to a bot fails (`CannotTransferOwnershipToBotError`).
2008
1756
  */
2009
- buildStrategy?: _fluxerjs_ws.BuildShardingStrategyFn;
1757
+ edit(options: GroupDmEditOptions): Promise<this>;
2010
1758
  /**
2011
- * Optional session store for RESUME across restarts (defaults to in-memory).
1759
+ * Purge all messages from personal notes. Only works on personal notes channels.
1760
+ * Notes-only; bots usually skip this.
2012
1761
  */
2013
- sessionStore?: _fluxerjs_ws.ISessionStore;
1762
+ purgeMessages(): Promise<number>;
2014
1763
  /**
2015
- * Optional identify throttler (e.g. parent-backed when under ShardingManager).
1764
+ * Pin this DM channel to the top of the DM list.
1765
+ * Session-token helper; bots usually skip this.
2016
1766
  */
2017
- identifyThrottler?: _fluxerjs_ws.IIdentifyThrottler;
2018
- /** Minimum log level for {@link Client.logger}. Default: `warn`. */
2019
- logLevel?: LogLevel;
2020
- /** Custom logger instance (overrides {@link logLevel} sink defaults). */
2021
- logger?: Logger;
1767
+ pinInList(): Promise<void>;
2022
1768
  /**
2023
- * Defer dispatch handlers to the next macrotask so WS `message` stays responsive.
2024
- * @default true (`false` useful in tests)
1769
+ * Unpin this DM channel from the DM list.
1770
+ * Session-token helper; bots usually skip this.
2025
1771
  */
2026
- gatewayDeferHandlers?: boolean;
1772
+ unpinFromList(): Promise<void>;
2027
1773
  /**
2028
- * Optional WebSocket constructor (e.g. `ws` in Node).
2029
- * Provide if the runtime lacks a native WebSocket implementation.
1774
+ * Add a user to this group DM.
1775
+ * Captcha-gated when captcha is enabled; bots are not exempt (`CaptchaRequiredError`).
2030
1776
  */
2031
- WebSocket?: new (url: string) => {
2032
- send(data: string | ArrayBufferLike): void;
2033
- close(code?: number): void;
2034
- readyState: number;
2035
- addEventListener?(type: string, listener: (e: unknown) => void): void;
2036
- on?(event: string, cb: (data?: unknown) => void): void;
2037
- };
1777
+ addRecipient(userId: string): Promise<void>;
1778
+ /** Remove a user from this group DM. */
1779
+ removeRecipient(userId: string, options?: {
1780
+ silent?: boolean;
1781
+ }): Promise<void>;
2038
1782
  }
2039
1783
 
2040
- /** Snapshot of current cache sizes. */
2041
- interface CacheStats {
2042
- guilds: number;
2043
- channels: number;
2044
- users: number;
2045
- members: number;
2046
- messages: number;
2047
- messageChannels: number;
2048
- roles: number;
2049
- emojis: number;
2050
- stickers: number;
1784
+ /** CamelCase permission overwrite on a guild channel. */
1785
+ declare class PermissionOverwrite {
1786
+ readonly id: string;
1787
+ readonly type: OverwriteType;
1788
+ /** @internal Raw allow bitfield string. */
1789
+ _allow: string;
1790
+ /** @internal Raw deny bitfield string. */
1791
+ _deny: string;
1792
+ constructor(data: APIChannelOverwrite);
1793
+ /** Allowed permissions for this overwrite. */
1794
+ get allow(): PermissionsBitField;
1795
+ /** Denied permissions for this overwrite. */
1796
+ get deny(): PermissionsBitField;
1797
+ /** Wire shape for permission computation / REST. */
1798
+ toJSON(): APIChannelOverwrite;
1799
+ }
1800
+
1801
+ /** Options for {@link PermissionOverwriteManager.edit}. */
1802
+ interface PermissionOverwriteEditOptions {
1803
+ type: OverwriteType;
1804
+ allow?: PermissionResolvable;
1805
+ deny?: PermissionResolvable;
2051
1806
  }
2052
1807
  /**
2053
- * Public cache facade: limits, stats, sweeps, and cascade teardown entry points.
2054
- * Not a second source of truth — wraps managers / {@link MessageCache}.
1808
+ * Manages channel permission overwrites (`edit` / `delete` / `cache`).
1809
+ * Requires Manage Roles for mutations.
2055
1810
  */
2056
- declare class CacheController {
2057
- private readonly client;
2058
- /** Resolved limits applied at Client construction. */
2059
- readonly limits: ResolvedCacheLimits;
2060
- /** Re-entrancy guard for dual-index / guild cascade teardown. */
2061
- private _cascading;
2062
- constructor(client: Client, limits: ResolvedCacheLimits);
2063
- /** Whether a cascade teardown is currently in progress. */
2064
- get cascading(): boolean;
2065
- /** Current sizes for each cache bucket. */
2066
- stats(): CacheStats;
1811
+ declare class PermissionOverwriteManager {
1812
+ private readonly channel;
1813
+ private readonly _cache;
1814
+ constructor(channel: GuildChannel, initial?: APIChannelOverwrite[]);
1815
+ /** Cached overwrites keyed by role/member ID. */
1816
+ get cache(): Collection<string, PermissionOverwrite>;
1817
+ get size(): number;
1818
+ [Symbol.iterator](): IterableIterator<PermissionOverwrite>;
1819
+ /** Wire-shaped overwrites for permission computation. */
1820
+ toJSON(): APIChannelOverwrite[];
1821
+ /** Edit or create a permission overwrite. */
1822
+ edit(overwriteId: string, options: PermissionOverwriteEditOptions): Promise<void>;
1823
+ /** Delete a permission overwrite. */
1824
+ delete(overwriteId: string): Promise<void>;
1825
+ /** @internal Sync from an API channel payload. */
1826
+ _patch(overwrites: APIChannelOverwrite[] | null | undefined): void;
1827
+ }
1828
+
1829
+ /** A channel in a guild (text, voice, category, etc.). */
1830
+ declare class GuildChannel extends Channel {
1831
+ /** Guild ID this channel belongs to, or null if missing from the payload. */
1832
+ readonly guildId: string | null;
1833
+ name: string | null;
1834
+ /** Position in the channel list. */
1835
+ position?: number;
1836
+ /** Parent category ID, or null if none. */
1837
+ parentId: string | null;
1838
+ /** Permission overwrites for roles/members. */
1839
+ readonly permissionOverwrites: PermissionOverwriteManager;
1840
+ constructor(client: Client, data: APIChannel);
2067
1841
  /**
2068
- * Sweep cached messages. Filter receives a hydrated {@link Message} (`createdAt`).
1842
+ * Apply guild-channel fields in place.
1843
+ * @internal
2069
1844
  */
2070
- sweepMessages(filter?: (message: Message, channelId: string) => boolean, channelId?: string): number;
2071
- sweepMembers(filter?: (member: GuildMember, guildId: string) => boolean): number;
2072
- sweepUsers(filter?: (user: User, id: string) => boolean): number;
1845
+ _patch(data: APIChannel): void;
1846
+ /** Create a webhook for this channel. Requires Manage Webhooks. */
1847
+ createWebhook(options: {
1848
+ name: string;
1849
+ avatar?: string | null;
1850
+ }): Promise<Webhook>;
1851
+ /** Fetch all webhooks in this channel. Requires Manage Webhooks. */
1852
+ fetchWebhooks(): Promise<Webhook[]>;
1853
+ /** Create an invite for this channel. Requires Create Instant Invite. */
1854
+ createInvite(options?: ChannelInviteCreateOptions): Promise<Invite>;
1855
+ /** Fetch all invites for this channel. Requires Manage Channels. */
1856
+ fetchInvites(): Promise<Invite[]>;
1857
+ /** Check if the bot can send messages in this channel (cache-only; needs `members.me`). */
1858
+ canSendMessage(): boolean;
2073
1859
  /**
2074
- * Sweep channels from the global index (cascades guild index + message cache).
2075
- * Returns count removed.
1860
+ * Like {@link canSendMessage}, but hydrates `members.me` via REST when missing.
1861
+ * Returns false when the channel has no guildId.
2076
1862
  */
2077
- sweepChannels(filter?: (channel: Channel, id: string) => boolean): number;
1863
+ canSend(): Promise<boolean>;
1864
+ /** Edit this channel's settings. Requires Manage Channels. */
1865
+ edit(options: ChannelEditOptions): Promise<this>;
1866
+ protected applyEditPatch(_data: APIChannel): void;
1867
+ }
1868
+ declare const TextChannel_base: (abstract new (...args: any[]) => {
1869
+ send(options: MessagePrepareInput): Promise<Message>;
1870
+ fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
1871
+ fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
1872
+ "__#private@#messages": MessageManager | undefined;
1873
+ readonly client: Client;
1874
+ readonly id: string;
1875
+ type: _fluxerjs_types.ChannelType;
1876
+ name: string | null;
1877
+ icon: string | null;
1878
+ lastPinTimestamp: string | null;
1879
+ get createdTimestamp(): number;
1880
+ get createdAt(): Date;
1881
+ _patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
1882
+ isTextBased(): this is TextChannel | VoiceChannel | DMChannel | ThreadChannel;
1883
+ isGuild(): this is GuildChannel;
1884
+ isThread(): this is ThreadChannel;
1885
+ isForum(): this is ForumChannel;
1886
+ isMedia(): this is MediaChannel;
1887
+ isText(): this is TextChannel;
1888
+ isAnnouncement(): this is AnnouncementChannel;
1889
+ isCategory(): this is CategoryChannel;
1890
+ isDM(): this is DMChannel;
1891
+ isPersonalNotes(): boolean;
1892
+ isVoice(): this is VoiceChannel;
1893
+ isLink(): this is LinkChannel;
1894
+ bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
1895
+ bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
1896
+ acknowledgePins(): Promise<void>;
1897
+ clearReadState(): Promise<void>;
1898
+ requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
1899
+ completeAttachmentUploads(uploads: AttachmentUploadCompleteItem[]): Promise<AttachmentUploadCompleteResponse>;
1900
+ uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
1901
+ sendTyping(): Promise<void>;
1902
+ fetchRtcRegions(): Promise<RtcRegionPayload[]>;
1903
+ fetchSlowmode(): Promise<ChannelSlowmodePayload>;
1904
+ canSendMessage(): boolean;
1905
+ get messages(): MessageManager;
1906
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
1907
+ awaitMessages(options?: MessageCollectorOptions & {
1908
+ errors?: MessageCollectorEndReason[];
1909
+ }): Promise<_fluxerjs_collection.Collection<string, Message>>;
1910
+ delete(options?: SudoVerificationOptions & {
1911
+ silent?: boolean;
1912
+ deleteMessages?: boolean;
1913
+ reason?: string;
1914
+ }): Promise<void>;
1915
+ toString(): string;
1916
+ }) & typeof GuildChannel;
1917
+ /** A text channel in a guild (supports sending messages). */
1918
+ declare class TextChannel extends TextChannel_base {
1919
+ /** Channel topic. */
1920
+ topic?: string | null;
1921
+ /** Whether this channel is marked as NSFW. */
1922
+ nsfw?: boolean;
1923
+ /** Per-channel NSFW override (`null` inherits). */
1924
+ nsfwOverride?: boolean | null;
1925
+ /** Slowmode rate limit in seconds. */
1926
+ rateLimitPerUser?: number;
1927
+ /** ID of the last message sent in this channel. */
1928
+ lastMessageId?: string | null;
1929
+ /** Content warning level. */
1930
+ contentWarningLevel?: number | null;
1931
+ /** Custom content warning text. */
1932
+ contentWarningText?: string | null;
1933
+ /** Default auto-archive duration in minutes for new threads. */
1934
+ defaultAutoArchiveDuration: number | null;
1935
+ /** Slowmode in seconds copied onto new threads. */
1936
+ defaultThreadRateLimitPerUser: number | null;
1937
+ constructor(client: Client, data: APIChannel);
1938
+ /** Create, list, and search threads in this channel. */
1939
+ get threads(): ThreadManager;
2078
1940
  /**
2079
- * Sweep guilds (cascades channels + message caches). Returns count removed.
1941
+ * Set slowmode (seconds between messages). Pass `0` to disable.
1942
+ * Requires Manage Channels. Calls {@link GuildChannel.edit} with `rateLimitPerUser`.
2080
1943
  */
2081
- sweepGuilds(filter?: (guild: Guild, id: string) => boolean): number;
1944
+ setSlowmode(seconds: number): Promise<this>;
1945
+ protected applyEditPatch(data: APIChannel): void;
2082
1946
  /**
2083
- * Tear down nested caches when a guild leaves `client.guilds`.
2084
- * Removes channels from the global index, clears message caches, and empties guild collections.
2085
- * Does not mass-delete `client.users`.
2086
- * @internal
1947
+ * Set the auto-archive and slowmode defaults copied onto new threads.
1948
+ * Sends only those fields. The thread-parent update body does not accept a channel rename.
2087
1949
  */
2088
- cascadeGuild(guild: Guild): void;
1950
+ editThreadDefaults(options: ThreadParentEditOptions): Promise<this>;
1951
+ }
1952
+ /**
1953
+ * A guild announcement channel (type 5).
1954
+ * Same fields and slowmode as a text channel. Published messages are copied into channels that follow it.
1955
+ */
1956
+ declare class AnnouncementChannel extends TextChannel {
1957
+ }
1958
+ /** A category channel (container for organizing channels). */
1959
+ declare class CategoryChannel extends GuildChannel {
1960
+ }
1961
+ declare const VoiceChannel_base: (abstract new (...args: any[]) => {
1962
+ send(options: MessagePrepareInput): Promise<Message>;
1963
+ fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
1964
+ fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
1965
+ "__#private@#messages": MessageManager | undefined;
1966
+ readonly client: Client;
1967
+ readonly id: string;
1968
+ type: _fluxerjs_types.ChannelType;
1969
+ name: string | null;
1970
+ icon: string | null;
1971
+ lastPinTimestamp: string | null;
1972
+ get createdTimestamp(): number;
1973
+ get createdAt(): Date;
1974
+ _patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
1975
+ isTextBased(): this is TextChannel | VoiceChannel | DMChannel | ThreadChannel;
1976
+ isGuild(): this is GuildChannel;
1977
+ isThread(): this is ThreadChannel;
1978
+ isForum(): this is ForumChannel;
1979
+ isMedia(): this is MediaChannel;
1980
+ isText(): this is TextChannel;
1981
+ isAnnouncement(): this is AnnouncementChannel;
1982
+ isCategory(): this is CategoryChannel;
1983
+ isDM(): this is DMChannel;
1984
+ isPersonalNotes(): boolean;
1985
+ isVoice(): this is VoiceChannel;
1986
+ isLink(): this is LinkChannel;
1987
+ bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
1988
+ bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
1989
+ acknowledgePins(): Promise<void>;
1990
+ clearReadState(): Promise<void>;
1991
+ requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
1992
+ completeAttachmentUploads(uploads: AttachmentUploadCompleteItem[]): Promise<AttachmentUploadCompleteResponse>;
1993
+ uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
1994
+ sendTyping(): Promise<void>;
1995
+ fetchRtcRegions(): Promise<RtcRegionPayload[]>;
1996
+ fetchSlowmode(): Promise<ChannelSlowmodePayload>;
1997
+ canSendMessage(): boolean;
1998
+ get messages(): MessageManager;
1999
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2000
+ awaitMessages(options?: MessageCollectorOptions & {
2001
+ errors?: MessageCollectorEndReason[];
2002
+ }): Promise<_fluxerjs_collection.Collection<string, Message>>;
2003
+ delete(options?: SudoVerificationOptions & {
2004
+ silent?: boolean;
2005
+ deleteMessages?: boolean;
2006
+ reason?: string;
2007
+ }): Promise<void>;
2008
+ toString(): string;
2009
+ }) & typeof GuildChannel;
2010
+ /** A voice channel in a guild. Voice is text-capable on Fluxer. */
2011
+ declare class VoiceChannel extends VoiceChannel_base {
2012
+ /** Guild ID. Voice channels always belong to a guild. */
2013
+ readonly guildId: string;
2014
+ /** Channel topic. */
2015
+ topic?: string | null;
2016
+ /** Whether this channel is marked as NSFW. */
2017
+ nsfw?: boolean;
2018
+ /** Per-channel NSFW override (`null` inherits). */
2019
+ nsfwOverride?: boolean | null;
2020
+ /** Slowmode rate limit in seconds. */
2021
+ rateLimitPerUser?: number;
2022
+ /** ID of the last message sent in this channel. */
2023
+ lastMessageId?: string | null;
2024
+ /** Content warning level. */
2025
+ contentWarningLevel?: number | null;
2026
+ /** Custom content warning text. */
2027
+ contentWarningText?: string | null;
2028
+ /** Voice bitrate. */
2029
+ bitrate?: number | null;
2030
+ /** Maximum number of users allowed. */
2031
+ userLimit?: number | null;
2032
+ /** Max active voice connections per user. */
2033
+ voiceConnectionLimit?: number | null;
2034
+ /** RTC region override for this channel. */
2035
+ rtcRegion?: string | null;
2036
+ constructor(client: Client, data: APIChannel);
2089
2037
  /**
2090
- * Keep dual channel indexes + message cache aligned when a channel leaves a cache.
2091
- * Uses `Map.prototype.delete` so ChannelManager/Guild channel `delete` overrides do not re-enter.
2092
- * @param channel - Channel being removed
2093
- * @param from - Which index initiated the removal (`global` = client.channels, `guild` = guild.channels)
2094
- * @internal
2038
+ * Set slowmode (seconds between messages). Pass `0` to disable.
2039
+ * Requires Manage Channels. Calls {@link GuildChannel.edit} with `rateLimitPerUser`.
2095
2040
  */
2096
- cascadeChannel(channel: Channel, from?: 'global' | 'guild' | 'both'): void;
2041
+ setSlowmode(seconds: number): Promise<this>;
2042
+ protected applyEditPatch(data: APIChannel): void;
2043
+ }
2044
+ /** A link channel (redirects to an external URL). */
2045
+ declare class LinkChannel extends GuildChannel {
2046
+ /** External URL this channel links to. */
2047
+ url: string | null;
2048
+ constructor(client: Client, data: APIChannel);
2049
+ protected applyEditPatch(data: APIChannel): void;
2097
2050
  }
2098
2051
 
2099
2052
  /**
2100
- * Channel cache + fetch/send helpers.
2101
- * Extends {@link LimitedCollection} (`.get()`, `.set()`, `.filter()`, …).
2102
- * FIFO-evicts (and keeps guild indexes / message caches aligned) at `cache.channels`.
2053
+ * A channel whose only contents are threads (forum posts or media posts).
2054
+ * Create a post with {@link ThreadManager.createPost}.
2103
2055
  */
2104
- declare class ChannelManager extends LimitedCollection<string, Channel> {
2105
- private readonly client;
2106
- constructor(client: Client);
2107
- /**
2108
- * Remove a channel from cache. Does not delete it on the API.
2109
- * Use {@link Channel.delete} after {@link fetch} to delete the channel.
2110
- */
2111
- delete(key: string): boolean;
2112
- /** Retrieve from cache, otherwise {@link fetch}. */
2113
- resolve(channelId: string): Promise<Channel>;
2114
- /**
2115
- * Fetch a channel by ID. The returned {@link Channel} has {@link Channel.delete}
2116
- * and {@link Channel.send} (send throws if the type is not text-based).
2117
- * Returns the cached channel unless `force` is set.
2118
- * @example
2119
- * const channel = await client.channels.fetch(channelId);
2120
- * await channel.delete();
2121
- * await channel.send('hi');
2122
- * @throws {@link FluxerError} with CHANNEL_NOT_FOUND if missing
2123
- */
2124
- fetch(channelId: string, options?: {
2125
- force?: boolean;
2126
- }): Promise<Channel>;
2127
- /**
2128
- * Fetch a message by channel + message ID (no channel resolve required).
2129
- * Prefer `channel.messages.fetch(messageId)` when you already have a text channel.
2130
- */
2131
- fetchMessage(channelId: string, messageId: string): Promise<Message>;
2056
+ declare class ThreadOnlyChannel extends GuildChannel {
2057
+ /** Tags that can be applied to posts. */
2058
+ availableTags: APIForumTag[];
2059
+ /** Default reaction for new posts. */
2060
+ defaultReactionEmoji: APIDefaultReactionEmoji | null;
2061
+ /** Default sort order for posts. */
2062
+ defaultSortOrder: ForumSortOrder | null;
2063
+ /** How posts are filtered when searching by several tags. */
2064
+ defaultTagSetting: ForumTagSetting | null;
2065
+ /** Default auto-archive duration in minutes for new posts. */
2066
+ defaultAutoArchiveDuration: number | null;
2067
+ /** Slowmode in seconds copied onto new posts. */
2068
+ defaultThreadRateLimitPerUser: number | null;
2069
+ /** Channel flags bitfield. */
2070
+ flags: number;
2071
+ /** Create, list, and search posts in this channel. */
2072
+ readonly threads: ThreadManager;
2073
+ constructor(client: Client, data: APIChannel);
2074
+ /** @internal */
2075
+ _patch(data: APIChannel): void;
2132
2076
  /**
2133
- * Send to a channel by ID without resolving it first.
2134
- * Prefer {@link Channel.send} after {@link fetch} when you want the channel object.
2135
- * @example
2136
- * await client.channels.send(logChannelId, 'User joined!');
2137
- */
2138
- send(channelId: string, payload: MessagePrepareInput): Promise<Message>;
2077
+ * Edit this channel.
2078
+ * Tag, sort, reaction, and thread-default fields are sent with the usual channel fields.
2079
+ * `defaultForumLayout` is sent only for forum channels.
2080
+ */
2081
+ edit(options: ForumParentEditOptions): Promise<this>;
2082
+ /** Replace the tags that can be applied to posts (max 20). */
2083
+ setAvailableTags(tags: ForumAvailableTag[], reason?: string): Promise<this>;
2084
+ /** Set or clear the default reaction on new posts. */
2085
+ setDefaultReactionEmoji(emoji: DefaultReactionEmojiInput | null, reason?: string): Promise<this>;
2086
+ /** Set or clear the default post sort order. */
2087
+ setDefaultSortOrder(order: ForumSortOrder | null, reason?: string): Promise<this>;
2088
+ /** Set or clear how posts match when several tags are selected. */
2089
+ setDefaultTagSetting(setting: ForumTagSetting | null, reason?: string): Promise<this>;
2090
+ /** Set the auto-archive and slowmode defaults copied onto new posts. */
2091
+ editThreadDefaults(options: ThreadParentEditOptions): Promise<this>;
2092
+ /** Create a tag. The response replaces {@link availableTags}. */
2093
+ createTag(options: ForumTagOptions): Promise<this>;
2094
+ /** Replace a tag. The response replaces {@link availableTags}. */
2095
+ editTag(tagId: string, options: ForumTagOptions): Promise<this>;
2096
+ /** Delete a tag. The response replaces {@link availableTags}. */
2097
+ deleteTag(tagId: string, reason?: string): Promise<this>;
2098
+ }
2099
+ /** A forum channel (type 15). Posts are public threads. */
2100
+ declare class ForumChannel extends ThreadOnlyChannel {
2101
+ /** Default layout for posts. */
2102
+ defaultForumLayout: ForumLayout | null;
2103
+ /** Set or clear the default post layout. */
2104
+ setDefaultForumLayout(layout: ForumLayout | null, reason?: string): Promise<this>;
2105
+ constructor(client: Client, data: APIChannel);
2106
+ /** @internal */
2107
+ _patch(data: APIChannel): void;
2108
+ }
2109
+ /** A media channel (type 16). Posts are public threads shown as a gallery. */
2110
+ declare class MediaChannel extends ThreadOnlyChannel {
2139
2111
  }
2140
2112
 
2141
- /** The logged-in bot/user (`client.user`). */
2142
- declare class ClientUser extends User {
2113
+ /** A user who has joined a thread. */
2114
+ declare class ThreadMember {
2115
+ /** Thread ID. */
2116
+ readonly id: string | null;
2117
+ /** User ID. */
2118
+ readonly userId: string | null;
2119
+ /** When the user last joined the thread. */
2120
+ readonly joinedAt: Date;
2121
+ /** Thread member flags bitfield. */
2122
+ flags: number;
2123
+ /** Whether the current user has muted the thread. */
2124
+ muted: boolean | null;
2125
+ /** ISO-8601 timestamp when the mute expires, if set. */
2126
+ muteEndTime: string | null;
2127
+ /** Selected mute duration in seconds, if set. */
2128
+ muteWindow: number | null;
2129
+ constructor(data: APIThreadMember);
2130
+ }
2131
+ declare const ThreadChannel_base: (abstract new (...args: any[]) => {
2132
+ send(options: MessagePrepareInput): Promise<Message>;
2133
+ fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
2134
+ fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
2135
+ "__#private@#messages": MessageManager | undefined;
2143
2136
  readonly client: Client;
2144
- /** Broadcast presence (gateway opcode 3) on all shards. */
2145
- setPresence(presence: PresenceUpdateOptions): void;
2146
- /** GET /users/@me — refresh the logged-in user from REST and patch this instance. */
2147
- fetch(): Promise<this>;
2148
- /** GET /users/@me/guilds — returns camelCase partial guilds. */
2149
- fetchGuilds(options?: {
2150
- withCounts?: boolean;
2151
- }): Promise<PartialUserGuildPayload[]>;
2137
+ readonly id: string;
2138
+ type: ChannelType;
2139
+ name: string | null;
2140
+ icon: string | null;
2141
+ lastPinTimestamp: string | null;
2142
+ get createdTimestamp(): number;
2143
+ get createdAt(): Date;
2144
+ _patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
2145
+ isTextBased(): this is TextChannel | VoiceChannel | DMChannel | ThreadChannel;
2146
+ isGuild(): this is GuildChannel;
2147
+ isThread(): this is ThreadChannel;
2148
+ isForum(): this is ForumChannel;
2149
+ isMedia(): this is MediaChannel;
2150
+ isText(): this is TextChannel;
2151
+ isAnnouncement(): this is AnnouncementChannel;
2152
+ isCategory(): this is CategoryChannel;
2153
+ isDM(): this is DMChannel;
2154
+ isPersonalNotes(): boolean;
2155
+ isVoice(): this is VoiceChannel;
2156
+ isLink(): this is LinkChannel;
2157
+ bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
2158
+ bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
2159
+ acknowledgePins(): Promise<void>;
2160
+ clearReadState(): Promise<void>;
2161
+ requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
2162
+ completeAttachmentUploads(uploads: AttachmentUploadCompleteItem[]): Promise<AttachmentUploadCompleteResponse>;
2163
+ uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
2164
+ sendTyping(): Promise<void>;
2165
+ fetchRtcRegions(): Promise<RtcRegionPayload[]>;
2166
+ fetchSlowmode(): Promise<ChannelSlowmodePayload>;
2167
+ canSendMessage(): boolean;
2168
+ get messages(): MessageManager;
2169
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2170
+ awaitMessages(options?: MessageCollectorOptions & {
2171
+ errors?: MessageCollectorEndReason[];
2172
+ }): Promise<_fluxerjs_collection.Collection<string, Message>>;
2173
+ delete(options?: SudoVerificationOptions & {
2174
+ silent?: boolean;
2175
+ deleteMessages?: boolean;
2176
+ reason?: string;
2177
+ }): Promise<void>;
2178
+ toString(): string;
2179
+ }) & typeof GuildChannel;
2180
+ /**
2181
+ * A thread inside a text, announcement, forum, or media channel.
2182
+ * Threads are text-capable channels: use {@link send} the same way as a text channel.
2183
+ */
2184
+ declare class ThreadChannel extends ThreadChannel_base {
2185
+ /** Parent channel ID. */
2186
+ parentId: string | null;
2187
+ /** User who created the thread. */
2188
+ ownerId: string | null;
2189
+ /** Whether the thread is archived. */
2190
+ archived: boolean;
2191
+ /** Minutes of inactivity before the thread archives. */
2192
+ autoArchiveDuration: number;
2193
+ /** ISO-8601 timestamp when the archive status last changed. */
2194
+ archiveTimestamp: string | null;
2195
+ /** Whether only moderators can unarchive the thread. */
2196
+ locked: boolean;
2197
+ /** Whether non-moderators can add other non-moderators. Private threads only. */
2198
+ invitable: boolean | null;
2199
+ /** Slowmode in seconds. */
2200
+ rateLimitPerUser: number;
2201
+ /** ID of the last message sent in this thread. */
2202
+ lastMessageId: string | null;
2203
+ /** Messages in the thread, excluding the starter and deleted messages. */
2204
+ messageCount: number;
2205
+ /** Messages ever sent in the thread. This count is never decremented. */
2206
+ totalMessageSent: number;
2207
+ /** Approximate member count, capped at 50. */
2208
+ memberCount: number;
2209
+ /** Tag IDs applied to a forum or media post. */
2210
+ appliedTags: string[];
2211
+ /** Channel flags bitfield. */
2212
+ flags: number;
2213
+ /** The current user's membership, when the payload included it. */
2214
+ member: ThreadMember | null;
2215
+ /** Add, remove, and list members of this thread. */
2216
+ readonly members: ThreadMemberManager;
2217
+ constructor(client: Client, data: APIChannel);
2218
+ /** @internal */
2219
+ _patch(data: APIChannel): void;
2152
2220
  /**
2153
- * Leave a guild (`client.user.leaveGuild`).
2154
- * DELETE /users/@me/guilds/{guild_id}.
2155
- *
2156
- * @param guildId - Guild to leave
2157
- * @param options - Optional sudo / MFA body for user accounts
2158
- * @example
2159
- * await client.user.leaveGuild(guildId);
2160
- */
2161
- leaveGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
2162
- /** Delete every message authored by the caller across a guild (sudo). */
2163
- bulkDeleteMyMessagesInGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
2221
+ * Edit this thread. Requires Manage Threads on public threads, or ownership on private ones.
2222
+ * `appliedTags` is sent for public and announcement threads. `invitable` is sent for private threads.
2223
+ */
2224
+ edit(options: ThreadEditOptions | ChannelEditOptions): Promise<this>;
2225
+ /** Archive or unarchive this thread. */
2226
+ setArchived(archived: boolean, reason?: string): Promise<this>;
2227
+ /** Lock or unlock this thread. Locked threads can only be unarchived by moderators. */
2228
+ setLocked(locked: boolean, reason?: string): Promise<this>;
2229
+ /** Join this thread. */
2230
+ join(): Promise<void>;
2231
+ /** Leave this thread. */
2232
+ leave(): Promise<void>;
2233
+ /** Update the current user's notification settings for this thread. */
2234
+ editSelf(options: ThreadMemberSettingsOptions): Promise<ThreadMember | null>;
2235
+ }
2236
+ /** List, add, and remove members of a {@link ThreadChannel}. */
2237
+ declare class ThreadMemberManager {
2238
+ private readonly thread;
2239
+ constructor(thread: ThreadChannel);
2240
+ /** List members of this thread. */
2241
+ fetch(options?: FetchThreadMembersOptions): Promise<ThreadMember[]>;
2242
+ /** Fetch one member of this thread. */
2243
+ fetchOne(userId: string, options?: {
2244
+ withMember?: boolean;
2245
+ }): Promise<ThreadMember>;
2246
+ /** Add a user to this thread. Private threads only, unless the caller can manage the parent. */
2247
+ add(userId: string): Promise<void>;
2248
+ /** Remove a user from this thread. */
2249
+ remove(userId: string): Promise<void>;
2250
+ }
2251
+
2252
+ /** CamelCase emoji on reaction events. */
2253
+ interface ReactionEmojiPayload {
2254
+ id?: string;
2255
+ name: string;
2256
+ animated?: boolean;
2257
+ }
2258
+ /**
2259
+ * Payload emitted for {@link Events.MessageReactionAdd} / {@link Events.MessageReactionRemove}.
2260
+ */
2261
+ interface MessageReactionPayload {
2262
+ reaction: MessageReaction;
2263
+ user: User;
2264
+ /** Cached message, or null if it was not in the message cache. Use `reaction.fetchMessage()` otherwise. */
2265
+ message: Message | null;
2266
+ /** Cached text-capable channel, or null if uncached / not text-based. */
2267
+ channel: TextBasedChannel | null;
2268
+ /** Cached reacting member when the gateway included one, otherwise null. */
2269
+ member: GuildMember | null;
2270
+ messageId: string;
2271
+ channelId: string;
2272
+ emoji: ReactionEmojiPayload;
2273
+ userId: string;
2164
2274
  }
2165
-
2166
2275
  /**
2167
- * Guild cache and manager with fetch.
2168
- * Extends {@link LimitedCollection} so you can use `.get()`, `.set()`, `.filter()`, etc.
2169
- * FIFO-evicts (and cascades nested caches) when at the resolved `cache.guilds` limit.
2276
+ * Payload emitted for {@link Events.GuildRoleDelete}.
2170
2277
  */
2171
- declare class GuildManager extends LimitedCollection<string, Guild> {
2172
- private readonly client;
2173
- constructor(client: Client);
2174
- /**
2175
- * Remove a guild from cache and cascade its channels / message caches.
2176
- * Does not leave the guild. Use {@link ClientUser.leaveGuild} for that.
2177
- */
2178
- delete(key: string): boolean;
2179
- /**
2180
- * Get a guild from cache or fetch from the API if not present.
2181
- * @param guildId - Snowflake of the guild
2182
- * @returns The guild
2183
- * @throws FluxerError with GUILD_NOT_FOUND if missing
2184
- */
2185
- resolve(guildId: string): Promise<Guild>;
2278
+ interface GuildRoleDeletePayload {
2279
+ roleId: string;
2280
+ guildId: string;
2281
+ role: Role | null;
2282
+ }
2283
+ /**
2284
+ * Payload emitted for {@link Events.MessageDeleteBulk}.
2285
+ * Normalized from `GatewayMessageDeleteBulkDispatchData`.
2286
+ */
2287
+ interface MessageDeleteBulkPayload {
2288
+ /** IDs of the deleted messages. */
2289
+ ids: string[];
2290
+ /** Channel from which the messages were deleted. */
2291
+ channelId: string;
2292
+ /** Guild the channel belongs to, or `null` for DMs. */
2293
+ guildId: string | null;
2294
+ /** Cached text-capable channel, or null if uncached / not text-based. */
2295
+ channel: TextBasedChannel | null;
2186
2296
  /**
2187
- * Fetch a guild by ID.
2188
- * Returns the cached guild unless `force` is set, in which case REST metadata is applied via `_patch`.
2189
- * @throws FluxerError with GUILD_NOT_FOUND if missing
2297
+ * One {@link PartialMessage} per id. Cached fields (content, author, createdAt) are
2298
+ * filled when the message was in cache; otherwise those fields are null.
2190
2299
  */
2191
- fetch(guildId: string, options?: {
2192
- force?: boolean;
2193
- }): Promise<Guild>;
2300
+ messages: PartialMessage[];
2194
2301
  }
2195
-
2196
- type MemberPayload = APIGuildMember & {
2197
- user: {
2198
- id: string;
2199
- };
2200
- };
2201
- /** Result of {@link UserManager.fetchWithProfile}. */
2202
- interface FetchedUserWithProfile {
2203
- user: User;
2204
- userData: APIUserPartial;
2205
- globalProfile: ProfilePayload | null;
2206
- serverProfile: ProfilePayload | null;
2302
+ /**
2303
+ * Payload emitted for {@link Events.InviteDelete}.
2304
+ * Normalized from `GatewayInviteDeleteDispatchData`.
2305
+ */
2306
+ interface InviteDeletePayload {
2307
+ /** Invite code that was deleted. */
2308
+ code: string;
2309
+ /** Guild the invite belonged to, or `null` for DMs / group DMs. */
2310
+ guildId: string | null;
2311
+ /** Channel the invite pointed to, or `null` if unknown. */
2312
+ channelId: string | null;
2313
+ }
2314
+ /**
2315
+ * Payload emitted for {@link Events.TypingStart}.
2316
+ * Normalized from `GatewayTypingStartDispatchData`.
2317
+ */
2318
+ interface TypingStartPayload {
2319
+ /** Channel where the user started typing. */
2320
+ channelId: string;
2321
+ /** Guild the channel belongs to, or `null` for DMs. */
2322
+ guildId: string | null;
2323
+ /** ID of the user who started typing. */
2324
+ userId: string;
2325
+ /** Unix timestamp (seconds) when typing began. */
2326
+ timestamp: number;
2327
+ }
2328
+ /**
2329
+ * Payload emitted for {@link Events.GuildEmojisUpdate}.
2330
+ * Contains the fully-cached {@link GuildEmoji} instances after the update.
2331
+ */
2332
+ interface GuildEmojisUpdatePayload {
2333
+ /** Guild whose emoji list changed. */
2334
+ guildId: string;
2335
+ /** Updated list of {@link GuildEmoji} instances (from cache). */
2336
+ emojis: GuildEmoji[];
2337
+ }
2338
+ /**
2339
+ * Payload emitted for {@link Events.GuildStickersUpdate}.
2340
+ * Contains cached {@link GuildSticker} instances after the update.
2341
+ */
2342
+ interface GuildStickersUpdatePayload {
2343
+ /** Guild whose sticker list changed. */
2344
+ guildId: string;
2345
+ /** Updated list of {@link GuildSticker} instances (from cache). */
2346
+ stickers: GuildSticker[];
2347
+ }
2348
+ /** Payload for {@link Events.MessageReactionRemoveAll}. */
2349
+ interface MessageReactionRemoveAllPayload {
2350
+ messageId: string;
2351
+ channelId: string;
2352
+ guildId: string | null;
2353
+ message: Message | null;
2354
+ channel: TextBasedChannel | null;
2355
+ }
2356
+ /** Payload for {@link Events.MessageReactionRemoveEmoji}. */
2357
+ interface MessageReactionRemoveEmojiPayload {
2358
+ messageId: string;
2359
+ channelId: string;
2360
+ guildId: string | null;
2361
+ emoji: ReactionEmojiPayload;
2362
+ message: Message | null;
2363
+ channel: TextBasedChannel | null;
2364
+ }
2365
+ /** Single entry in {@link MessageReactionAddManyPayload}. */
2366
+ interface MessageReactionAddManyEntry {
2367
+ userId: string;
2368
+ emoji: ReactionEmojiPayload;
2207
2369
  member: GuildMember | null;
2208
- memberData: MemberPayload | null;
2209
2370
  }
2210
- /**
2211
- * User cache + fetch/profile helpers.
2212
- * Extends LimitedCollection (`.get()`, `.set()`, `.filter()`, …).
2213
- * Access via {@link Client.users}.
2214
- */
2215
- declare class UserManager extends LimitedCollection<string, User> {
2216
- private readonly client;
2217
- constructor(client: Client);
2218
- /** Remove matching users (skips `client.user`). Returns count removed. */
2219
- sweep(filter?: (user: User, id: string) => boolean): number;
2220
- /** Fetch a user by ID and update cache. Returns cache unless `force` is set. */
2221
- fetch(userId: string, options?: {
2222
- force?: boolean;
2223
- }): Promise<User>;
2224
- /** Return a cached user, otherwise {@link fetch}. */
2225
- resolve(userId: string): Promise<User>;
2226
- /**
2227
- * Fetch user + profiles (+ optional guild member). Ideal for userinfo commands.
2228
- * @example
2229
- * const { user, globalProfile, member } = await client.users.fetchWithProfile(
2230
- * userId,
2231
- * { guildId: message.guildId ?? undefined },
2232
- * );
2233
- */
2234
- fetchWithProfile(userId: string, options?: {
2235
- guildId?: string | null;
2236
- }): Promise<FetchedUserWithProfile>;
2371
+ /** Payload for {@link Events.MessageReactionAddMany}. */
2372
+ interface MessageReactionAddManyPayload {
2373
+ channelId: string;
2374
+ messageId: string;
2375
+ guildId: string | null;
2376
+ message: Message | null;
2377
+ channel: TextBasedChannel | null;
2378
+ reactions: MessageReactionAddManyEntry[];
2379
+ }
2380
+ /** Payload for {@link Events.ChannelPinsUpdate}. */
2381
+ interface ChannelPinsUpdatePayload {
2382
+ channelId: string;
2383
+ guildId: string | null;
2384
+ lastPinTimestamp: string | null;
2385
+ }
2386
+ /** Presence activity (camelCase). */
2387
+ interface PresenceActivity {
2388
+ name: string;
2389
+ type: number;
2390
+ url?: string | null;
2391
+ }
2392
+ /** Payload for {@link Events.PresenceUpdate}. */
2393
+ interface PresenceUpdatePayload {
2394
+ userId: string;
2395
+ guildId: string | null;
2396
+ status: string | null;
2397
+ activities: PresenceActivity[];
2398
+ customStatus: {
2399
+ text?: string | null;
2400
+ emojiId?: string | null;
2401
+ emojiName?: string | null;
2402
+ } | null;
2403
+ }
2404
+ /** Payload for {@link Events.PresenceUpdateBulk}. */
2405
+ interface PresenceUpdateBulkPayload {
2406
+ guildId: string | null;
2407
+ presences: PresenceUpdatePayload[];
2408
+ }
2409
+ /** Payload for {@link Events.WebhooksUpdate}. */
2410
+ interface WebhooksUpdatePayload {
2411
+ channelId: string;
2412
+ guildId: string;
2413
+ }
2414
+ /** Payload for {@link Events.GuildMembersChunk}. */
2415
+ interface GuildMembersChunkPayload {
2416
+ guildId: string;
2417
+ members: GuildMember[];
2418
+ chunkIndex: number;
2419
+ chunkCount: number;
2420
+ notFound: string[];
2421
+ nonce: string | null;
2422
+ }
2423
+ /** Audit log change (camelCase). */
2424
+ interface AuditLogChange {
2425
+ key: string;
2426
+ oldValue?: string | number | boolean | null;
2427
+ newValue?: string | number | boolean | null;
2428
+ }
2429
+ /** Payload for {@link Events.GuildAuditLogEntryCreate} and audit fetch entries. */
2430
+ interface AuditLogEntryPayload {
2431
+ id: string;
2432
+ actionType: number;
2433
+ userId: string | null;
2434
+ targetId: string | null;
2435
+ reason: string | null;
2436
+ options: Record<string, string> | null;
2437
+ changes: AuditLogChange[];
2438
+ guildId: string | null;
2439
+ }
2440
+ /** Payload for {@link Events.GuildCountsUpdate}. */
2441
+ interface GuildCountsUpdatePayload {
2442
+ counts: Array<{
2443
+ guildId: string;
2444
+ memberCount: number;
2445
+ onlineCount: number;
2446
+ }>;
2447
+ }
2448
+ /** Payload for {@link Events.ChannelMemberCountsUpdate}. */
2449
+ interface ChannelMemberCountsUpdatePayload {
2450
+ counts: Array<{
2451
+ guildId: string;
2452
+ channelId: string;
2453
+ memberCount: number;
2454
+ onlineCount: number;
2455
+ }>;
2456
+ }
2457
+ /** Role update with optional previous snapshot. */
2458
+ interface GuildRoleUpdatePayload {
2459
+ /** Role after the update (cached instance). */
2460
+ role: Role;
2461
+ /** Shallow previous field snapshot when the role was already cached. */
2462
+ oldRole: Role | null;
2463
+ }
2464
+ /** Vanity URL result (camelCase). */
2465
+ interface VanityURLPayload {
2466
+ code: string | null;
2467
+ uses: number;
2468
+ }
2469
+ /** Result of {@link Guild.fetchAuditLogs}. */
2470
+ interface AuditLogFetchPayload {
2471
+ entries: AuditLogEntryPayload[];
2472
+ users: User[];
2473
+ }
2474
+ /** Guild member search result row (camelCase). */
2475
+ interface GuildMemberSearchHit {
2476
+ id: string;
2477
+ guildId: string;
2478
+ userId: string;
2479
+ username: string;
2480
+ discriminator: string;
2481
+ globalName: string | null;
2482
+ nickname: string | null;
2483
+ /** Cached {@link GuildMember} when available after search hydration. */
2484
+ member: GuildMember | null;
2485
+ }
2486
+ /** Guild member search response (camelCase). */
2487
+ interface GuildMemberSearchPayload {
2488
+ guildId: string;
2489
+ members: GuildMemberSearchHit[];
2490
+ /** Total matches across pages (`total_result_count`). */
2491
+ total?: number;
2492
+ /** Results on this page (`page_result_count`). */
2493
+ pageResultCount?: number;
2494
+ /** Whether more pages exist after this offset. */
2495
+ hasMore?: boolean;
2496
+ /** Search index still building. */
2497
+ indexing?: boolean;
2498
+ }
2499
+ /** Partial guild from GET /users/@me/guilds. */
2500
+ interface PartialUserGuildPayload {
2501
+ id: string;
2502
+ name: string;
2503
+ icon: string | null;
2504
+ owner?: boolean;
2505
+ permissions?: string | null;
2506
+ features?: string[];
2507
+ /** Present when fetched with `{ withCounts: true }`. */
2508
+ approximateMemberCount?: number;
2509
+ /** Present when fetched with `{ withCounts: true }`. */
2510
+ approximatePresenceCount?: number;
2511
+ }
2512
+ /** Payload for {@link Events.ChannelRecipientAdd} / {@link Events.ChannelRecipientRemove}. */
2513
+ interface ChannelRecipientPayload {
2514
+ channelId: string;
2515
+ user: User;
2237
2516
  }
2238
-
2239
- /** Event name constants for client.on(Events.X, handler). Use with ClientEvents for typed callbacks. */
2240
- declare const Events: {
2241
- readonly Ready: "ready";
2242
- readonly MessageCreate: "messageCreate";
2243
- readonly MessageUpdate: "messageUpdate";
2244
- readonly MessageDelete: "messageDelete";
2245
- readonly MessageDeleteBulk: "messageDeleteBulk";
2246
- readonly MessageReactionAdd: "messageReactionAdd";
2247
- readonly MessageReactionAddMany: "messageReactionAddMany";
2248
- readonly MessageReactionRemove: "messageReactionRemove";
2249
- readonly MessageReactionRemoveAll: "messageReactionRemoveAll";
2250
- readonly MessageReactionRemoveEmoji: "messageReactionRemoveEmoji";
2251
- readonly GuildCreate: "guildCreate";
2252
- readonly GuildAvailable: "guildAvailable";
2253
- readonly GuildUnavailable: "guildUnavailable";
2254
- readonly GuildUpdate: "guildUpdate";
2255
- readonly GuildDelete: "guildDelete";
2256
- readonly GuildBanAdd: "guildBanAdd";
2257
- readonly GuildBanRemove: "guildBanRemove";
2258
- readonly GuildAuditLogEntryCreate: "guildAuditLogEntryCreate";
2259
- readonly GuildEmojisUpdate: "guildEmojisUpdate";
2260
- readonly GuildStickersUpdate: "guildStickersUpdate";
2261
- readonly GuildCountsUpdate: "guildCountsUpdate";
2262
- readonly ChannelMemberCountsUpdate: "channelMemberCountsUpdate";
2263
- readonly GuildMemberAdd: "guildMemberAdd";
2264
- readonly GuildMemberUpdate: "guildMemberUpdate";
2265
- readonly GuildMemberRemove: "guildMemberRemove";
2266
- readonly GuildMembersChunk: "guildMembersChunk";
2267
- readonly GuildRoleCreate: "guildRoleCreate";
2268
- readonly GuildRoleUpdate: "guildRoleUpdate";
2269
- readonly GuildRoleDelete: "guildRoleDelete";
2270
- readonly ChannelCreate: "channelCreate";
2271
- readonly ChannelUpdate: "channelUpdate";
2272
- readonly ChannelDelete: "channelDelete";
2273
- readonly ChannelPinsUpdate: "channelPinsUpdate";
2274
- readonly ChannelRecipientAdd: "channelRecipientAdd";
2275
- readonly ChannelRecipientRemove: "channelRecipientRemove";
2276
- readonly InviteCreate: "inviteCreate";
2277
- readonly InviteDelete: "inviteDelete";
2278
- readonly TypingStart: "typingStart";
2279
- readonly UserUpdate: "userUpdate";
2280
- readonly UserConnectionsUpdate: "userConnectionsUpdate";
2281
- readonly WebAuthnCredentialsUpdate: "webauthnCredentialsUpdate";
2282
- readonly PresenceUpdate: "presenceUpdate";
2283
- readonly PresenceUpdateBulk: "presenceUpdateBulk";
2284
- readonly VoiceStateUpdate: "voiceStateUpdate";
2285
- readonly VoiceStateAck: "voiceStateAck";
2286
- readonly VoiceServerUpdate: "voiceServerUpdate";
2287
- readonly EntranceSoundPlay: "entranceSoundPlay";
2288
- readonly VoiceStatesSync: "voiceStatesSync";
2289
- readonly WebhooksUpdate: "webhooksUpdate";
2290
- readonly Resumed: "resumed";
2291
- readonly Error: "error";
2292
- readonly Debug: "debug";
2293
- readonly ShardReady: "shardReady";
2294
- readonly ShardResumed: "shardResumed";
2295
- readonly ShardDisconnect: "shardDisconnect";
2296
- readonly ShardReconnecting: "shardReconnecting";
2297
- readonly ShardError: "shardError";
2298
- readonly ShardingRequired: "shardingRequired";
2299
- };
2300
-
2301
- /** Hosted Fluxer production endpoints (default when no instance is configured). */
2302
- declare const DEFAULT_INSTANCE_ENDPOINTS: Readonly<APIInstanceEndpoints>;
2303
- /** Immutable resolved instance descriptor attached to each {@link Client}. */
2304
- interface ResolvedInstance {
2305
- readonly endpoints: Readonly<APIInstanceEndpoints>;
2306
- /** Full discovery document when available (fromDiscovery / fetchInstance). */
2307
- readonly discovery: Readonly<APIInstance> | null;
2517
+ /** Payload for {@link Events.ThreadListSync}. */
2518
+ interface ThreadListSyncPayload {
2519
+ guildId: string;
2520
+ /** Parent channel IDs whose active thread lists were replaced. */
2521
+ channelIds: string[];
2522
+ threads: ThreadChannel[];
2308
2523
  }
2309
- /** Unversioned well-known path (`GET /.well-known/fluxer`). */
2310
- declare const INSTANCE_DISCOVERY_PATH: "/.well-known/fluxer";
2311
- /**
2312
- * Absolute unversioned discovery URL for an origin.
2313
- * Hosted Fluxer: `https://fluxer.app/.well-known/fluxer` (may 308 to `api_public`).
2314
- */
2315
- declare function instanceDiscoveryUrl(origin: string): string;
2316
- /** Strip trailing `/vN` and trailing slash from an API origin. */
2317
- declare function normalizeApiOrigin(api: string): string;
2318
- /**
2319
- * Validate a raw discovery payload and return a typed {@link APIInstance}.
2320
- * @throws FluxerError with {@link ErrorCodes.InvalidInstanceDiscovery}
2321
- */
2322
- declare function parseInstanceDiscovery(raw: unknown): APIInstance;
2323
- /**
2324
- * Merge partial endpoint overrides onto hosted defaults.
2325
- * Accepts either a full {@link APIInstance} or a partial endpoint map.
2326
- */
2327
- declare function resolveInstanceEndpoints(input?: Partial<APIInstanceEndpoints> | APIInstance | null): ResolvedInstance;
2328
- /** Build an invite URL for a code using the instance invite base. */
2329
- declare function inviteUrl(inviteBase: string, code: string): string;
2330
-
2331
- type FetchPinnedMessagesOptions = {
2332
- limit?: number;
2333
- before?: string;
2334
- };
2335
- type PinnedMessagesPage = {
2336
- messages: Message[];
2337
- pinnedAt: string[];
2338
- hasMore: boolean;
2339
- };
2340
-
2341
- /** CamelCase permission overwrite on a guild channel. */
2342
- declare class PermissionOverwrite {
2343
- readonly id: string;
2344
- readonly type: OverwriteType;
2345
- /** @internal Raw allow bitfield string. */
2346
- _allow: string;
2347
- /** @internal Raw deny bitfield string. */
2348
- _deny: string;
2349
- constructor(data: APIChannelOverwrite);
2350
- /** Allowed permissions for this overwrite. */
2351
- get allow(): PermissionsBitField;
2352
- /** Denied permissions for this overwrite. */
2353
- get deny(): PermissionsBitField;
2354
- /** Wire shape for permission computation / REST. */
2355
- toJSON(): APIChannelOverwrite;
2524
+ /** Payload for {@link Events.ThreadMembersUpdate}. */
2525
+ interface ThreadMembersUpdatePayload {
2526
+ /** Thread ID. */
2527
+ id: string;
2528
+ guildId: string;
2529
+ memberCount: number;
2530
+ addedMembers: ThreadMember[];
2531
+ removedMemberIds: string[];
2356
2532
  }
2357
-
2358
- /** Options for {@link PermissionOverwriteManager.edit}. */
2359
- interface PermissionOverwriteEditOptions {
2360
- type: OverwriteType;
2361
- allow?: PermissionResolvable;
2362
- deny?: PermissionResolvable;
2533
+ /** One member in {@link Events.ThreadMemberListUpdate}. */
2534
+ interface ThreadMemberListEntry {
2535
+ userId: string;
2536
+ /** When the user joined the thread, or null when the gateway omitted it. */
2537
+ joinTimestamp: string | null;
2538
+ flags: number;
2539
+ /** Cached guild member when the gateway included one, otherwise null. */
2540
+ member: GuildMember | null;
2541
+ /** Presence status, or null when the gateway omitted it. */
2542
+ presence: {
2543
+ status: string | null;
2544
+ } | null;
2363
2545
  }
2364
- /**
2365
- * Manages channel permission overwrites (`edit` / `delete` / `cache`).
2366
- * Requires Manage Roles for mutations.
2367
- */
2368
- declare class PermissionOverwriteManager {
2369
- private readonly channel;
2370
- private readonly _cache;
2371
- constructor(channel: GuildChannel, initial?: APIChannelOverwrite[]);
2372
- /** Cached overwrites keyed by role/member ID. */
2373
- get cache(): Collection<string, PermissionOverwrite>;
2374
- get size(): number;
2375
- [Symbol.iterator](): IterableIterator<PermissionOverwrite>;
2376
- /** Wire-shaped overwrites for permission computation. */
2377
- toJSON(): APIChannelOverwrite[];
2378
- /** Edit or create a permission overwrite. */
2379
- edit(overwriteId: string, options: PermissionOverwriteEditOptions): Promise<void>;
2380
- /** Delete a permission overwrite. */
2381
- delete(overwriteId: string): Promise<void>;
2382
- /** @internal Sync from an API channel payload. */
2383
- _patch(overwrites: APIChannelOverwrite[] | null | undefined): void;
2546
+ /** Payload for {@link Events.ThreadMemberListUpdate}. */
2547
+ interface ThreadMemberListUpdatePayload {
2548
+ guildId: string;
2549
+ threadId: string;
2550
+ members: ThreadMemberListEntry[];
2551
+ }
2552
+ /** One post in {@link Events.ForumUnreads}. */
2553
+ interface ForumUnreadEntry {
2554
+ threadId: string;
2555
+ /** Unread messages after the sent ack, capped at 25. Null when `missing` is true. */
2556
+ count: number | null;
2557
+ /** True when the request sent no ack for this post. */
2558
+ missing: boolean;
2559
+ }
2560
+ /** Payload for {@link Events.ForumUnreads}. */
2561
+ interface ForumUnreadsPayload {
2562
+ guildId: string;
2563
+ channelId: string;
2564
+ threads: ForumUnreadEntry[];
2384
2565
  }
2385
2566
 
2386
- /** A channel in a guild (text, voice, category, etc.). */
2387
- declare class GuildChannel extends Channel {
2388
- /** Guild ID this channel belongs to, or null if missing from the payload. */
2567
+ type GatewayReactionData = GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData;
2568
+ /** Context needed to hydrate a reaction aggregate from a message payload. */
2569
+ type MessageReactionContext = {
2570
+ client: Client;
2571
+ id: string;
2572
+ channelId: string;
2573
+ guildId: string | null;
2574
+ };
2575
+ /** Represents a reaction on a message (gateway event or message aggregate). */
2576
+ declare class MessageReaction extends Base {
2577
+ readonly client: Client;
2578
+ readonly messageId: string;
2579
+ readonly channelId: string;
2389
2580
  readonly guildId: string | null;
2390
- name: string | null;
2391
- /** Position in the channel list. */
2392
- position?: number;
2393
- /** Parent category ID, or null if none. */
2394
- parentId: string | null;
2395
- /** Permission overwrites for roles/members. */
2396
- readonly permissionOverwrites: PermissionOverwriteManager;
2397
- constructor(client: Client, data: APIChannel);
2398
- /**
2399
- * Apply guild-channel fields in place.
2400
- * @internal
2401
- */
2402
- _patch(data: APIChannel): void;
2403
- /** Create a webhook for this channel. Requires Manage Webhooks. */
2404
- createWebhook(options: {
2405
- name: string;
2406
- avatar?: string | null;
2407
- }): Promise<Webhook>;
2408
- /** Fetch all webhooks in this channel. Requires Manage Webhooks. */
2409
- fetchWebhooks(): Promise<Webhook[]>;
2410
- /** Create an invite for this channel. Requires Create Instant Invite. */
2411
- createInvite(options?: ChannelInviteCreateOptions): Promise<Invite>;
2412
- /** Fetch all invites for this channel. Requires Manage Channels. */
2413
- fetchInvites(): Promise<Invite[]>;
2414
- /** Check if the bot can send messages in this channel (cache-only; needs `members.me`). */
2415
- canSendMessage(): boolean;
2581
+ readonly emoji: ReactionEmojiPayload;
2582
+ /** Total count when hydrated from a message payload; `1` for gateway add events. */
2583
+ count: number;
2584
+ /** Whether the current user reacted (message payload); false for gateway remove. */
2585
+ me: boolean;
2586
+ /** Raw gateway payload for low-level access (null when built from a message aggregate). */
2587
+ readonly _data: GatewayReactionData | null;
2588
+ constructor(client: Client, data: GatewayReactionData);
2589
+ /** Build a reaction aggregate from a message's `reactions` array entry. */
2590
+ static fromMessage(message: MessageReactionContext, data: APIMessageReaction): MessageReaction;
2591
+ /** Emoji as a string for reaction routes: unicode or `name:id` (`a:name:id` when animated). */
2592
+ get emojiIdentifier(): string;
2593
+ /** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
2594
+ get guild(): Guild | null;
2595
+ /** Cached message this reaction belongs to, or null if the message was not cached. */
2596
+ get message(): Message | null;
2597
+ /** Cached text-capable channel, or null if uncached / not text-based. */
2598
+ get channel(): TextBasedChannel | null;
2416
2599
  /**
2417
- * Like {@link canSendMessage}, but hydrates `members.me` via REST when missing.
2418
- * Returns false when the channel has no guildId.
2600
+ * Fetch the message this reaction belongs to (cache first, then REST).
2601
+ * @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
2419
2602
  */
2420
- canSend(): Promise<boolean>;
2421
- /** Edit this channel's settings. Requires Manage Channels. */
2422
- edit(options: ChannelEditOptions): Promise<this>;
2423
- protected applyEditPatch(_data: APIChannel): void;
2603
+ fetchMessage(): Promise<Message>;
2424
2604
  }
2425
- declare const TextChannel_base: (abstract new (...args: any[]) => {
2426
- send(options: MessagePrepareInput): Promise<Message>;
2427
- fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
2428
- fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
2429
- "__#private@#messages": MessageManager | undefined;
2430
- readonly client: Client;
2431
- readonly id: string;
2432
- type: _fluxerjs_types.ChannelType;
2433
- name: string | null;
2434
- icon: string | null;
2435
- lastPinTimestamp: string | null;
2436
- get createdTimestamp(): number;
2437
- get createdAt(): Date;
2438
- _patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
2439
- isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
2440
- isGuild(): this is GuildChannel;
2441
- isText(): this is TextChannel;
2442
- isAnnouncement(): this is AnnouncementChannel;
2443
- isCategory(): this is CategoryChannel;
2444
- isDM(): this is DMChannel;
2445
- isPersonalNotes(): boolean;
2446
- isVoice(): this is VoiceChannel;
2447
- isLink(): this is LinkChannel;
2448
- bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
2449
- bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
2450
- acknowledgePins(): Promise<void>;
2451
- clearReadState(): Promise<void>;
2452
- requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
2453
- completeAttachmentUploads(uploads: AttachmentUploadCompleteItem[]): Promise<AttachmentUploadCompleteResponse>;
2454
- uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
2455
- sendTyping(): Promise<void>;
2456
- fetchRtcRegions(): Promise<RtcRegionPayload[]>;
2457
- fetchSlowmode(): Promise<ChannelSlowmodePayload>;
2458
- canSendMessage(): boolean;
2459
- get messages(): MessageManager;
2460
- createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2461
- awaitMessages(options?: MessageCollectorOptions & {
2462
- errors?: MessageCollectorEndReason[];
2463
- }): Promise<_fluxerjs_collection.Collection<string, Message>>;
2464
- delete(options?: SudoVerificationOptions & {
2465
- silent?: boolean;
2466
- deleteMessages?: boolean;
2467
- reason?: string;
2468
- }): Promise<void>;
2469
- toString(): string;
2470
- }) & typeof GuildChannel;
2471
- /** A text channel in a guild (supports sending messages). */
2472
- declare class TextChannel extends TextChannel_base {
2473
- /** Channel topic. */
2474
- topic?: string | null;
2475
- /** Whether this channel is marked as NSFW. */
2476
- nsfw?: boolean;
2477
- /** Per-channel NSFW override (`null` inherits). */
2478
- nsfwOverride?: boolean | null;
2479
- /** Slowmode rate limit in seconds. */
2480
- rateLimitPerUser?: number;
2481
- /** ID of the last message sent in this channel. */
2482
- lastMessageId?: string | null;
2483
- /** Content warning level. */
2484
- contentWarningLevel?: number | null;
2485
- /** Custom content warning text. */
2486
- contentWarningText?: string | null;
2487
- constructor(client: Client, data: APIChannel);
2488
- /**
2489
- * Set slowmode (seconds between messages). Pass `0` to disable.
2490
- * Requires Manage Channels. Calls {@link GuildChannel.edit} with `rateLimitPerUser`.
2491
- */
2492
- setSlowmode(seconds: number): Promise<this>;
2493
- protected applyEditPatch(data: APIChannel): void;
2605
+
2606
+ /** Options for {@link ReactionCollector} / `message.createReactionCollector()`. */
2607
+ interface ReactionCollectorOptions {
2608
+ /** Filter function. Return true to collect the reaction. */
2609
+ filter?: (reaction: MessageReaction, user: User) => boolean;
2610
+ /** Max duration in ms. Collector stops when time expires. */
2611
+ time?: number;
2612
+ /** Max reactions to collect. Collector stops when limit reached. */
2613
+ max?: number;
2614
+ }
2615
+ type ReactionCollectorEndReason = 'time' | 'limit' | 'user';
2616
+ /** A single collected reaction paired with the user who added it. */
2617
+ interface CollectedReaction {
2618
+ reaction: MessageReaction;
2619
+ user: User;
2620
+ }
2621
+ /** Typed event map for {@link ReactionCollector}: `collect` per reaction, `end` when it stops. */
2622
+ interface ReactionCollectorEvents {
2623
+ collect: [reaction: MessageReaction, user: User];
2624
+ end: [collected: Collection<string, CollectedReaction>, reason: ReactionCollectorEndReason];
2494
2625
  }
2495
2626
  /**
2496
- * A guild announcement channel (type 5).
2497
- * Same fields and slowmode as a text channel. Published messages are copied into channels that follow it.
2627
+ * Collects reactions on a message. Use message.createReactionCollector().
2628
+ *
2629
+ * Listens to both {@link Events.MessageReactionAdd} and {@link Events.MessageReactionAddMany}
2630
+ * (gateway may batch rapid reactions into ADD_MANY instead of individual ADD events).
2631
+ *
2632
+ * @example
2633
+ * const collector = message.createReactionCollector({ filter: (r, u) => u.id === userId, time: 10000 });
2634
+ * collector.on('collect', (reaction, user) => console.log(user.username, 'reacted', reaction.emoji.name));
2635
+ * collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
2498
2636
  */
2499
- declare class AnnouncementChannel extends TextChannel {
2500
- }
2501
- /** A category channel (container for organizing channels). */
2502
- declare class CategoryChannel extends GuildChannel {
2637
+ declare class ReactionCollector extends EventEmitter {
2638
+ readonly client: Client;
2639
+ readonly messageId: string;
2640
+ readonly channelId: string;
2641
+ readonly options: Required<ReactionCollectorOptions>;
2642
+ readonly collected: Collection<string, CollectedReaction>;
2643
+ private _timeout;
2644
+ private _ended;
2645
+ private readonly _onAdd;
2646
+ private readonly _onAddMany;
2647
+ constructor(client: Client, messageId: string, channelId: string, options?: ReactionCollectorOptions);
2648
+ private _collect;
2649
+ stop(reason?: ReactionCollectorEndReason): void;
2650
+ /**
2651
+ * One-shot helper used by {@link Message.awaitReactions}.
2652
+ * Resolves with the collected reactions when the collector ends.
2653
+ * Rejects if `options.errors` includes the end reason.
2654
+ */
2655
+ static awaitReactions(client: Client, messageId: string, channelId: string, options?: ReactionCollectorOptions & {
2656
+ errors?: ReactionCollectorEndReason[];
2657
+ }): Promise<Collection<string, CollectedReaction>>;
2658
+ on<K extends keyof ReactionCollectorEvents>(event: K, listener: (...args: ReactionCollectorEvents[K]) => void): this;
2659
+ emit<K extends keyof ReactionCollectorEvents>(event: K, ...args: ReactionCollectorEvents[K]): boolean;
2503
2660
  }
2504
- declare const VoiceChannel_base: (abstract new (...args: any[]) => {
2505
- send(options: MessagePrepareInput): Promise<Message>;
2506
- fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
2507
- fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
2508
- "__#private@#messages": MessageManager | undefined;
2661
+
2662
+ type EmojiInput = string | {
2663
+ name: string;
2664
+ id?: string;
2665
+ animated?: boolean;
2666
+ };
2667
+ /** A message in a channel. */
2668
+ declare class Message extends Base {
2669
+ /** Discriminant vs {@link PartialMessage}: always `false` on a hydrated Message. */
2670
+ readonly partial: false;
2671
+ /** The {@link Client} that instantiated this message. */
2509
2672
  readonly client: Client;
2673
+ /** Snowflake ID of this message. */
2510
2674
  readonly id: string;
2511
- type: _fluxerjs_types.ChannelType;
2512
- name: string | null;
2513
- icon: string | null;
2514
- lastPinTimestamp: string | null;
2515
- get createdTimestamp(): number;
2516
- get createdAt(): Date;
2517
- _patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
2518
- isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
2519
- isGuild(): this is GuildChannel;
2520
- isText(): this is TextChannel;
2521
- isAnnouncement(): this is AnnouncementChannel;
2522
- isCategory(): this is CategoryChannel;
2523
- isDM(): this is DMChannel;
2524
- isPersonalNotes(): boolean;
2525
- isVoice(): this is VoiceChannel;
2526
- isLink(): this is LinkChannel;
2527
- bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
2528
- bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
2529
- acknowledgePins(): Promise<void>;
2530
- clearReadState(): Promise<void>;
2531
- requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
2532
- completeAttachmentUploads(uploads: AttachmentUploadCompleteItem[]): Promise<AttachmentUploadCompleteResponse>;
2533
- uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
2534
- sendTyping(): Promise<void>;
2535
- fetchRtcRegions(): Promise<RtcRegionPayload[]>;
2536
- fetchSlowmode(): Promise<ChannelSlowmodePayload>;
2537
- canSendMessage(): boolean;
2538
- get messages(): MessageManager;
2539
- createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2540
- awaitMessages(options?: MessageCollectorOptions & {
2541
- errors?: MessageCollectorEndReason[];
2542
- }): Promise<_fluxerjs_collection.Collection<string, Message>>;
2543
- delete(options?: SudoVerificationOptions & {
2544
- silent?: boolean;
2545
- deleteMessages?: boolean;
2546
- reason?: string;
2547
- }): Promise<void>;
2548
- toString(): string;
2549
- }) & typeof GuildChannel;
2550
- /** A voice channel in a guild. Voice is text-capable on Fluxer. */
2551
- declare class VoiceChannel extends VoiceChannel_base {
2552
- /** Guild ID. Voice channels always belong to a guild. */
2553
- readonly guildId: string;
2554
- /** Channel topic. */
2555
- topic?: string | null;
2556
- /** Whether this channel is marked as NSFW. */
2557
- nsfw?: boolean;
2558
- /** Per-channel NSFW override (`null` inherits). */
2559
- nsfwOverride?: boolean | null;
2560
- /** Slowmode rate limit in seconds. */
2561
- rateLimitPerUser?: number;
2562
- /** ID of the last message sent in this channel. */
2563
- lastMessageId?: string | null;
2564
- /** Content warning level. */
2565
- contentWarningLevel?: number | null;
2566
- /** Custom content warning text. */
2567
- contentWarningText?: string | null;
2568
- /** Voice bitrate. */
2569
- bitrate?: number | null;
2570
- /** Maximum number of users allowed. */
2571
- userLimit?: number | null;
2572
- /** Max active voice connections per user. */
2573
- voiceConnectionLimit?: number | null;
2574
- /** RTC region override for this channel. */
2575
- rtcRegion?: string | null;
2576
- constructor(client: Client, data: APIChannel);
2675
+ /** Channel ID where this message was sent. */
2676
+ readonly channelId: string;
2677
+ /** Guild ID if in a guild channel, null for DMs. */
2678
+ readonly guildId: string | null;
2679
+ /** The user who sent this message. */
2680
+ readonly author: User;
2681
+ /** Text content of the message. */
2682
+ content: string;
2683
+ /** When the message was created. */
2684
+ readonly createdAt: Date;
2685
+ /** When the message was last edited, or null if never edited. */
2686
+ editedAt: Date | null;
2687
+ /** Whether the message is pinned. */
2688
+ pinned: boolean;
2689
+ /** Attached files (images, videos, etc.). */
2690
+ readonly attachments: Collection<string, MessageAttachment>;
2691
+ /** Message type (Default, Reply, etc.). */
2692
+ readonly type: MessageType;
2693
+ /** Message flags bitfield. */
2694
+ flags: MessageFlagsBitField;
2695
+ /** Whether `@everyone` or `@here` was mentioned. */
2696
+ mentionEveryone: boolean;
2697
+ /** Whether this is a text-to-speech message. */
2698
+ tts: boolean;
2699
+ /** Embedded content (camelCase read view; send with {@link EmbedBuilder}). */
2700
+ embeds: MessageEmbed[];
2701
+ /** Stickers sent with the message. */
2702
+ stickers: MessageSticker[];
2703
+ /** Reactions on the message. */
2704
+ readonly reactions: MessageReactionManager;
2705
+ /** Reference to a replied-to message, if any. */
2706
+ messageReference: MessageReference | null;
2707
+ /** Message snapshots for forwarded messages. */
2708
+ messageSnapshots: MessageSnapshot[];
2709
+ /** Call data if this message represents a call event. */
2710
+ call: MessageCall | null;
2711
+ /** The full referenced (replied-to) message, or null. */
2712
+ referencedMessage: Message | null;
2713
+ /** Webhook ID if sent by a webhook. */
2714
+ webhookId: string | null;
2715
+ /** Users mentioned in the message. */
2716
+ mentions: User[];
2717
+ /** Role IDs mentioned in the message. */
2718
+ mentionRoles: string[];
2719
+ /** Client-side nonce for deduplication. */
2720
+ nonce: string | null;
2721
+ /** IDs of custom emojis in the message classified as explicit. */
2722
+ nsfwEmojis: string[];
2723
+ /** Thread started from this message, when the payload included one. */
2724
+ thread: ThreadChannel | null;
2577
2725
  /**
2578
- * Set slowmode (seconds between messages). Pass `0` to disable.
2579
- * Requires Manage Channels. Calls {@link GuildChannel.edit} with `rateLimitPerUser`.
2726
+ * Cached text-capable channel (guild text, guild voice, or DM), or null if uncached / not text-based.
2727
+ * Narrowed type has {@link Channel.send} and {@link Channel.delete}.
2580
2728
  */
2581
- setSlowmode(seconds: number): Promise<this>;
2582
- protected applyEditPatch(data: APIChannel): void;
2583
- }
2584
- /** A link channel (redirects to an external URL). */
2585
- declare class LinkChannel extends GuildChannel {
2586
- /** External URL this channel links to. */
2587
- url: string | null;
2588
- constructor(client: Client, data: APIChannel);
2589
- protected applyEditPatch(data: APIChannel): void;
2590
- }
2591
-
2592
- declare const DMChannel_base: (abstract new (...args: any[]) => {
2593
- send(options: MessagePrepareInput): Promise<Message>;
2594
- fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
2595
- fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
2596
- "__#private@#messages": MessageManager | undefined;
2597
- readonly client: Client;
2598
- readonly id: string;
2599
- type: ChannelType;
2600
- name: string | null;
2601
- icon: string | null;
2602
- lastPinTimestamp: string | null;
2603
- get createdTimestamp(): number;
2604
- get createdAt(): Date;
2605
- _patch(data: APIChannelPartial | APIChannel): void;
2606
- isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
2607
- isGuild(): this is GuildChannel;
2608
- isText(): this is TextChannel;
2609
- isAnnouncement(): this is AnnouncementChannel;
2610
- isCategory(): this is CategoryChannel;
2611
- isDM(): this is DMChannel;
2612
- isPersonalNotes(): boolean;
2613
- isVoice(): this is VoiceChannel;
2614
- isLink(): this is LinkChannel;
2615
- bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
2616
- bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
2617
- acknowledgePins(): Promise<void>;
2618
- clearReadState(): Promise<void>;
2619
- requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
2620
- completeAttachmentUploads(uploads: AttachmentUploadCompleteItem[]): Promise<AttachmentUploadCompleteResponse>;
2621
- uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
2622
- sendTyping(): Promise<void>;
2623
- fetchRtcRegions(): Promise<RtcRegionPayload[]>;
2624
- fetchSlowmode(): Promise<ChannelSlowmodePayload>;
2625
- canSendMessage(): boolean;
2626
- get messages(): MessageManager;
2627
- createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2628
- awaitMessages(options?: MessageCollectorOptions & {
2629
- errors?: MessageCollectorEndReason[];
2630
- }): Promise<_fluxerjs_collection.Collection<string, Message>>;
2631
- delete(options?: SudoVerificationOptions & {
2632
- silent?: boolean;
2633
- deleteMessages?: boolean;
2634
- reason?: string;
2635
- }): Promise<void>;
2636
- toString(): string;
2637
- }) & typeof Channel;
2638
- /** DM / Group DM / personal notes channel. */
2639
- declare class DMChannel extends DMChannel_base {
2640
- /** ID of the last message sent in this channel. */
2641
- lastMessageId?: string | null;
2642
- /** Owner ID for group DMs. */
2643
- ownerId: string | null;
2644
- /** Recipients in this DM (includes the bot). */
2645
- recipients: User[];
2646
- /** Custom nicknames for users in a group DM. */
2647
- nicks: Record<string, string>;
2648
- constructor(client: Client, data: APIChannelPartial | APIChannel);
2729
+ get channel(): TextBasedChannel | null;
2730
+ /** Cached guild, or null for DMs / uncached. */
2731
+ get guild(): Guild | null;
2732
+ /** Cached guild member for the author, or null in DMs / if uncached. */
2733
+ get member(): GuildMember | null;
2649
2734
  /**
2650
- * Apply DM/group-DM fields in place.
2735
+ * Fetch this message's channel (cache first). The returned {@link Channel}
2736
+ * has {@link Channel.delete} and {@link Channel.send}.
2737
+ * @example
2738
+ * const channel = await message.resolveChannel();
2739
+ * await channel.delete();
2740
+ */
2741
+ resolveChannel(): Promise<Channel>;
2742
+ /**
2743
+ * Fetch and resolve the guild, or null if a DM.
2744
+ * Propagates network/auth errors; only returns null when there is no guildId.
2745
+ * @example
2746
+ * const guild = await message.resolveGuild();
2747
+ */
2748
+ resolveGuild(): Promise<Guild | null>;
2749
+ /**
2750
+ * Construct a message from API data.
2751
+ * @param data - API message from REST or MESSAGE_CREATE
2752
+ */
2753
+ constructor(client: Client, data: APIMessage);
2754
+ /**
2755
+ * Apply an API message payload in place (cache identity / MESSAGE_UPDATE).
2651
2756
  * @internal
2652
2757
  */
2653
- _patch(data: APIChannelPartial | APIChannel): void;
2758
+ _patch(data: APIMessage): void;
2654
2759
  /**
2655
- * Edit this group DM (name, icon, nicks).
2656
- * Transferring ownership to a bot fails (`CannotTransferOwnershipToBotError`).
2760
+ * Send a standalone message in this channel (not a reply).
2761
+ * Prefer {@link Channel.send} or {@link reply} when you already have the channel or are answering.
2657
2762
  */
2658
- edit(options: GroupDmEditOptions): Promise<this>;
2763
+ send(options: MessagePrepareInput): Promise<Message>;
2659
2764
  /**
2660
- * Purge all messages from personal notes. Only works on personal notes channels.
2661
- * Notes-only; bots usually skip this.
2765
+ * Send a message to another channel by ID.
2766
+ * Prefer `client.channels.fetch(channelId)` then {@link Channel.send}.
2662
2767
  */
2663
- purgeMessages(): Promise<number>;
2768
+ sendTo(channelId: string, options: MessagePrepareInput): Promise<Message>;
2664
2769
  /**
2665
- * Pin this DM channel to the top of the DM list.
2666
- * Session-token helper; bots usually skip this.
2770
+ * Reply to this message.
2771
+ * @example
2772
+ * await message.reply('Pong!');
2773
+ * await message.reply('No ping!', { ping: false });
2774
+ * await message.reply({ content: 'Silent', allowedMentions: AllowedMentions.suppressReplyPing });
2667
2775
  */
2668
- pinInList(): Promise<void>;
2776
+ reply(options: string | (MessageSendOptions & ReplyOptions), replyOptions?: ReplyOptions): Promise<Message>;
2669
2777
  /**
2670
- * Unpin this DM channel from the DM list.
2671
- * Session-token helper; bots usually skip this.
2778
+ * Hydrate a partial message, or return the message as-is.
2779
+ * @example
2780
+ * client.on(Events.MessageUpdate, async (_old, msg) => {
2781
+ * const message = await Message.resolve(msg);
2782
+ * });
2672
2783
  */
2673
- unpinFromList(): Promise<void>;
2784
+ static resolve(message: Message | PartialMessage): Promise<Message>;
2785
+ /** Test helper — prefer {@link reply} / `prepareMessagePostPayload()`. */
2786
+ static _createMessageBody(content: string | MessageSendOptions, referenced_message?: {
2787
+ channel_id: string;
2788
+ message_id: string;
2789
+ guild_id?: string;
2790
+ }, ping?: boolean): Promise<PreparedMessagePost>;
2791
+ /** Send a prepared payload (internal helper). */
2792
+ _send(payload: PreparedMessagePost): Promise<Message>;
2793
+ /** Edit this message (requires author or admin permissions). */
2794
+ edit(options: MessageEditOptions): Promise<Message>;
2795
+ /** Create a {@link ReactionCollector} for this message. */
2796
+ createReactionCollector(options?: ReactionCollectorOptions): ReactionCollector;
2674
2797
  /**
2675
- * Add a user to this group DM.
2676
- * Captcha-gated when captcha is enabled; bots are not exempt (`CaptchaRequiredError`).
2798
+ * Wait for reactions matching the filter, then resolve the collected set.
2799
+ * Pass `errors: ['time']` to reject when the timer fires instead of resolving.
2677
2800
  */
2678
- addRecipient(userId: string): Promise<void>;
2679
- /** Remove a user from this group DM. */
2680
- removeRecipient(userId: string, options?: {
2681
- silent?: boolean;
2682
- }): Promise<void>;
2801
+ awaitReactions(options?: ReactionCollectorOptions & {
2802
+ errors?: ReactionCollectorEndReason[];
2803
+ }): Promise<Collection<string, CollectedReaction>>;
2804
+ /**
2805
+ * Start a thread from this message.
2806
+ * Fluxer chooses a public or announcement thread from the parent channel.
2807
+ */
2808
+ startThread(options: StartThreadFromMessageOptions): Promise<ThreadChannel>;
2809
+ /** Fetch the latest version of this message from the API. */
2810
+ fetch(): Promise<Message>;
2811
+ /** Delete this message. */
2812
+ delete(reason?: string): Promise<void>;
2813
+ /** Delete a specific attachment from this message. */
2814
+ deleteAttachment(attachmentId: string): Promise<void>;
2815
+ /** Pin this message in the channel. */
2816
+ pin(): Promise<void>;
2817
+ /** Unpin this message from the channel. */
2818
+ unpin(): Promise<void>;
2819
+ /** React to this message with an emoji. */
2820
+ react(emoji: EmojiInput): Promise<void>;
2821
+ /** Remove a reaction (bot's own or a user's if ID is provided). */
2822
+ removeReaction(emoji: EmojiInput, userId?: string): Promise<void>;
2823
+ /** Remove all reactions from this message. */
2824
+ removeAllReactions(): Promise<void>;
2825
+ /** Remove all reactions of a specific emoji. */
2826
+ removeReactionEmoji(emoji: EmojiInput): Promise<void>;
2827
+ /** Fetch users who reacted with a specific emoji. */
2828
+ fetchReactionUsers(emoji: EmojiInput, options?: {
2829
+ limit?: number;
2830
+ after?: string;
2831
+ }): Promise<User[]>;
2832
+ /** Fetch reaction users with pagination metadata. */
2833
+ fetchReactionUsersPage(emoji: EmojiInput, options?: {
2834
+ limit?: number;
2835
+ after?: string;
2836
+ }): Promise<{
2837
+ users: User[];
2838
+ hasMore: boolean;
2839
+ nextAfter: string | null;
2840
+ }>;
2841
+ }
2842
+
2843
+ /** Options for GET /channels/{id}/messages. */
2844
+ interface FetchMessagesOptions {
2845
+ limit?: number;
2846
+ before?: string;
2847
+ after?: string;
2848
+ around?: string;
2849
+ }
2850
+ /** Options for {@link Client.bulkFetchMessages} (user-account only). */
2851
+ interface BulkFetchMessagesOptions {
2852
+ /** When true (default), hydrate {@link Message}s and update the cache. */
2853
+ hydrate?: boolean;
2854
+ }
2855
+ /** One channel's slice of a bulk message fetch. */
2856
+ interface BulkFetchMessagesChannelResult {
2857
+ channelId: string;
2858
+ messages: Collection<string, Message>;
2859
+ }
2860
+ /** Result of {@link MessageManager.bulkFetch}: per-channel message collections. */
2861
+ interface BulkFetchMessagesResult {
2862
+ channels: BulkFetchMessagesChannelResult[];
2863
+ }
2864
+ /**
2865
+ * Per-channel message cache + fetch. Access via `channel.messages`.
2866
+ *
2867
+ * `get` returns the same {@link Message} instance for a cached id (identity).
2868
+ * `fetch` always writes through the client message cache (when enabled).
2869
+ */
2870
+ declare class MessageManager {
2871
+ private readonly client;
2872
+ private readonly channelId;
2873
+ /** Structure cache keyed by message id (identity for {@link get}). */
2874
+ private readonly _structures;
2875
+ constructor(client: Client, channelId: string);
2876
+ /** Retrieve a cached message by ID, or `undefined` if missing / caching disabled. */
2877
+ get(messageId: string): Message | undefined;
2878
+ /** Retrieve from cache, otherwise {@link fetch}. */
2879
+ resolve(messageId: string): Promise<Message>;
2880
+ /** Fetch a single message by ID. */
2881
+ fetch(messageId: string): Promise<Message>;
2882
+ /** Fetch multiple messages with query options (limit, before, after, around). */
2883
+ fetch(options: FetchMessagesOptions): Promise<Collection<string, Message>>;
2884
+ /** Cache API data and return a {@link Message} (reusing identity when present). */
2885
+ private wrap;
2886
+ /** Fetch a single message from the API. */
2887
+ private fetchOne;
2888
+ /** Fetch multiple messages from the API with pagination/filtering. */
2889
+ private fetchMany;
2683
2890
  }
2684
2891
 
2685
2892
  /**
@@ -2719,12 +2926,19 @@ declare abstract class Channel extends Base {
2719
2926
  /** @internal Factory wired after subclasses load. */
2720
2927
  static createDM(_c: Client, _d: APIChannelPartial): DMChannel;
2721
2928
  /**
2722
- * Whether this channel type can carry messages (text, announcement, voice, DM, group DM, notes).
2929
+ * Whether this channel type can carry messages (text, announcement, voice, threads, DM, group DM, notes).
2930
+ * Forum and media channels contain threads and do not accept `send`.
2723
2931
  * Checks {@link ChannelType}, not whether `send` exists on the instance.
2724
2932
  */
2725
- isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
2726
- /** Check if this is a guild channel (text, announcement, voice, category, or link). */
2933
+ isTextBased(): this is TextChannel | VoiceChannel | DMChannel | ThreadChannel;
2934
+ /** Check if this is a guild channel, including threads, forums, and media channels. */
2727
2935
  isGuild(): this is GuildChannel;
2936
+ /** Check if this is a thread (public, private, or announcement). */
2937
+ isThread(): this is ThreadChannel;
2938
+ /** Check if this is a forum channel. */
2939
+ isForum(): this is ForumChannel;
2940
+ /** Check if this is a media channel. */
2941
+ isMedia(): this is MediaChannel;
2728
2942
  /** Check if this is a guild text channel. */
2729
2943
  isText(): this is TextChannel;
2730
2944
  /** Check if this is a guild announcement channel. */
@@ -2804,8 +3018,8 @@ declare abstract class Channel extends Base {
2804
3018
  toString(): string;
2805
3019
  }
2806
3020
 
2807
- /** Channel types that can carry messages (guild text, announcement, guild voice, DMs). */
2808
- type TextBasedChannel = TextChannel | VoiceChannel | DMChannel;
3021
+ /** Channel types that can carry messages (guild text, announcement, threads, guild voice, DMs). */
3022
+ type TextBasedChannel = TextChannel | VoiceChannel | DMChannel | ThreadChannel;
2809
3023
 
2810
3024
  /** Member payload plus fields that exist on update/edit but not always on GET. */
2811
3025
  type GuildMemberData = APIGuildMember & {
@@ -2955,6 +3169,16 @@ interface ClientEvents {
2955
3169
  [Events.ChannelCreate]: [channel: Channel];
2956
3170
  [Events.ChannelUpdate]: [oldChannel: Channel, newChannel: Channel];
2957
3171
  [Events.ChannelDelete]: [channel: Channel];
3172
+ /** Emitted when a thread is created, including when it arrives as CHANNEL_CREATE. */
3173
+ [Events.ThreadCreate]: [thread: ThreadChannel];
3174
+ /** `oldThread` is the cached thread from before the update. */
3175
+ [Events.ThreadUpdate]: [oldThread: Channel, newThread: ThreadChannel];
3176
+ [Events.ThreadDelete]: [thread: Channel];
3177
+ [Events.ThreadListSync]: [payload: ThreadListSyncPayload];
3178
+ [Events.ThreadMemberUpdate]: [member: ThreadMember];
3179
+ [Events.ThreadMembersUpdate]: [payload: ThreadMembersUpdatePayload];
3180
+ [Events.ThreadMemberListUpdate]: [payload: ThreadMemberListUpdatePayload];
3181
+ [Events.ForumUnreads]: [payload: ForumUnreadsPayload];
2958
3182
  [Events.GuildMemberAdd]: [member: GuildMember];
2959
3183
  [Events.GuildMemberUpdate]: [oldMember: GuildMember | null, newMember: GuildMember];
2960
3184
  [Events.GuildMemberRemove]: [member: GuildMember | PartialGuildMember];
@@ -3251,6 +3475,28 @@ declare class Client extends EventEmitter {
3251
3475
  channelIds?: string[];
3252
3476
  nonce?: string;
3253
3477
  }): void;
3478
+ /**
3479
+ * Request unread counts for posts in one forum or media channel (opcode 28).
3480
+ * Listen for `forumUnreads`. The gateway keeps at most 40 posts and ignores a channel the session cannot view.
3481
+ */
3482
+ requestForumUnreads(options: {
3483
+ guildId: string;
3484
+ channelId: string;
3485
+ threads: Array<{
3486
+ threadId: string;
3487
+ ackMessageId?: string;
3488
+ }>;
3489
+ }): void;
3490
+ /**
3491
+ * Subscribe to thread traffic in a guild (opcode 14).
3492
+ * `threads: true` receives every thread event in the guild.
3493
+ * `threadIds` (at most 10) subscribes to those member lists. Each one arrives as `threadMemberListUpdate`.
3494
+ */
3495
+ subscribeThreads(options: {
3496
+ guildId: string;
3497
+ threads?: boolean;
3498
+ threadIds?: string[];
3499
+ }): void;
3254
3500
  /**
3255
3501
  * Broadcast a gateway payload to all shards.
3256
3502
  * @param payload - Gateway send payload
@@ -3311,4 +3557,4 @@ declare class Client extends EventEmitter {
3311
3557
  static get Routes(): typeof Routes;
3312
3558
  }
3313
3559
 
3314
- export { INSTANCE_DISCOVERY_PATH as $, AllowedMentions as A, Base as B, CacheController as C, DEFAULT_CACHE_LIMITS as D, type DiscoveryOrigin as E, Events as F, type FetchMessagesOptions as G, type FetchPinnedMessagesOptions as H, type FetchedUserWithProfile as I, Guild as J, GuildBan as K, GuildChannel as L, type GuildCountsUpdatePayload as M, GuildEmoji as N, type GuildEmojisUpdatePayload as O, GuildManager as P, GuildMember as Q, GuildMemberManager as R, GuildMemberRoleManager as S, type GuildMemberSearchHit as T, type GuildMemberSearchPayload as U, type GuildMembersChunkPayload as V, type GuildRoleDeletePayload as W, GuildRoleManager as X, type GuildRoleUpdatePayload as Y, GuildSticker as Z, type GuildStickersUpdatePayload as _, type AllowedMentionsOptions as a, type WebhooksUpdatePayload as a$, Invite as a0, type InviteChannelSnapshot as a1, type InviteDeletePayload as a2, type InviteGuildSnapshot as a3, LinkChannel as a4, Message as a5, type MessageAttachment as a6, type MessageCall as a7, MessageCollector as a8, type MessageCollectorEndReason as a9, type PermissionOverwriteEditOptions as aA, PermissionOverwriteManager as aB, type PinnedMessagesPage as aC, type PresenceActivity as aD, type PresenceUpdateBulkPayload as aE, type PresenceUpdatePayload as aF, ReactionCollector as aG, type ReactionCollectorEndReason as aH, type ReactionCollectorOptions as aI, type ReactionEmojiPayload as aJ, type ReplyOptions as aK, type ResolvedCacheLimits as aL, type ResolvedInstance as aM, Role as aN, type RoleResolvable as aO, type TextBasedChannel as aP, TextChannel as aQ, type TypingStartPayload as aR, type UploadFileForSend as aS, User as aT, UserManager as aU, type VanityURLPayload as aV, VoiceChannel as aW, Webhook as aX, type WebhookEditOptions as aY, type WebhookMessageEditOptions as aZ, type WebhookSendOptions as a_, type MessageCollectorOptions as aa, type MessageDeleteBulkPayload as ab, type MessageEditOptions as ac, type MessageEmbed as ad, type MessageEmbedAuthor as ae, type MessageEmbedField as af, type MessageEmbedFooter as ag, type MessageEmbedMedia as ah, MessageManager as ai, type MessagePrepareInput as aj, MessageReaction as ak, type MessageReactionAddManyEntry as al, type MessageReactionAddManyPayload as am, MessageReactionManager as an, type MessageReactionPayload as ao, type MessageReactionRemoveAllPayload as ap, type MessageReactionRemoveEmojiPayload as aq, type MessageReference as ar, type MessageReplyTarget as as, type MessageSendOptions as at, type MessageSnapshot as au, MessageSticker as av, PartialGuildMember as aw, PartialMessage as ax, type PartialUserGuildPayload as ay, PermissionOverwrite as az, AnnouncementChannel as b, instanceDiscoveryUrl as b0, inviteUrl as b1, normalizeApiOrigin as b2, normalizeCacheLimit as b3, parseInstanceDiscovery as b4, resolveCacheLimits as b5, resolveInstanceEndpoints as b6, type AuditLogChange as c, type AuditLogEntryPayload as d, type AuditLogFetchPayload as e, type BulkFetchMessagesChannelResult as f, type BulkFetchMessagesOptions as g, type BulkFetchMessagesResult as h, type CacheSizeLimits as i, type CacheStats as j, CategoryChannel as k, Channel as l, ChannelManager as m, type ChannelMemberCountsUpdatePayload as n, type ChannelPinsUpdatePayload as o, type ChannelRecipientPayload as p, Client as q, type ClientEventListener as r, type ClientEventMethods as s, type ClientEventName as t, type ClientEvents as u, type ClientOptions as v, ClientUser as w, type CollectedReaction as x, DEFAULT_INSTANCE_ENDPOINTS as y, DMChannel as z };
3560
+ export { GuildSticker as $, AnnouncementChannel as A, Base as B, CacheController as C, DEFAULT_CACHE_LIMITS as D, Events as E, type FetchMessagesOptions as F, type FetchedThreads as G, type FetchedUserWithProfile as H, ForumChannel as I, type ForumUnreadEntry as J, type ForumUnreadsPayload as K, Guild as L, GuildBan as M, GuildChannel as N, type GuildCountsUpdatePayload as O, GuildEmoji as P, type GuildEmojisUpdatePayload as Q, GuildManager as R, GuildMember as S, GuildMemberManager as T, GuildMemberRoleManager as U, type GuildMemberSearchHit as V, type GuildMemberSearchPayload as W, type GuildMembersChunkPayload as X, type GuildRoleDeletePayload as Y, GuildRoleManager as Z, type GuildRoleUpdatePayload as _, type AuditLogChange as a, type UploadFileForSend as a$, type GuildStickersUpdatePayload as a0, INSTANCE_DISCOVERY_PATH as a1, Invite as a2, type InviteChannelSnapshot as a3, type InviteDeletePayload as a4, type InviteGuildSnapshot as a5, LinkChannel as a6, MediaChannel as a7, Message as a8, type MessageAttachment as a9, type PermissionOverwriteEditOptions as aA, PermissionOverwriteManager as aB, type PinnedMessagesPage as aC, type PresenceActivity as aD, type PresenceUpdateBulkPayload as aE, type PresenceUpdatePayload as aF, ReactionCollector as aG, type ReactionCollectorEndReason as aH, type ReactionCollectorOptions as aI, type ReactionEmojiPayload as aJ, type ReplyOptions as aK, type ResolvedCacheLimits as aL, type ResolvedInstance as aM, Role as aN, type RoleResolvable as aO, type TextBasedChannel as aP, TextChannel as aQ, ThreadChannel as aR, type ThreadListSyncPayload as aS, ThreadManager as aT, ThreadMember as aU, type ThreadMemberListEntry as aV, type ThreadMemberListUpdatePayload as aW, ThreadMemberManager as aX, type ThreadMembersUpdatePayload as aY, type ThreadSearchPage as aZ, type TypingStartPayload as a_, type MessageCall as aa, MessageCollector as ab, type MessageCollectorEndReason as ac, type MessageCollectorOptions as ad, type MessageDeleteBulkPayload as ae, type MessageEditOptions as af, type MessageEmbed as ag, type MessageEmbedAuthor as ah, type MessageEmbedField as ai, type MessageEmbedFooter as aj, type MessageEmbedMedia as ak, MessageManager as al, MessageReaction as am, type MessageReactionAddManyEntry as an, type MessageReactionAddManyPayload as ao, MessageReactionManager as ap, type MessageReactionPayload as aq, type MessageReactionRemoveAllPayload as ar, type MessageReactionRemoveEmojiPayload as as, type MessageReference as at, type MessageSnapshot as au, MessageSticker as av, PartialGuildMember as aw, PartialMessage as ax, type PartialUserGuildPayload as ay, PermissionOverwrite as az, type AuditLogEntryPayload as b, User as b0, UserManager as b1, type VanityURLPayload as b2, VoiceChannel as b3, Webhook as b4, type WebhookEditOptions as b5, type WebhookMessageEditOptions as b6, type WebhookSendOptions as b7, type WebhooksUpdatePayload as b8, fetchActiveThreads as b9, instanceDiscoveryUrl as ba, inviteUrl as bb, normalizeApiOrigin as bc, normalizeCacheLimit as bd, parseInstanceDiscovery as be, resolveCacheLimits as bf, resolveInstanceEndpoints as bg, type AuditLogFetchPayload as c, type BulkFetchMessagesChannelResult as d, type BulkFetchMessagesOptions as e, type BulkFetchMessagesResult as f, type CacheSizeLimits as g, type CacheStats as h, CategoryChannel as i, Channel as j, ChannelManager as k, type ChannelMemberCountsUpdatePayload as l, type ChannelPinsUpdatePayload as m, type ChannelRecipientPayload as n, Client as o, type ClientEventListener as p, type ClientEventMethods as q, type ClientEventName as r, type ClientEvents as s, type ClientOptions as t, ClientUser as u, type CollectedReaction as v, DEFAULT_INSTANCE_ENDPOINTS as w, DMChannel as x, type DiscoveryOrigin as y, type FetchPinnedMessagesOptions as z };