@fluxerjs/core 2.2.0 → 3.1.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,252 +1,14 @@
1
- import { Collection, LimitedCollection } from '@fluxerjs/collection';
2
1
  import * as _fluxerjs_types from '@fluxerjs/types';
3
- import { OverwriteType, APIGuild, APIRole, SystemChannelFlagsValue, DefaultMessageNotifications, GuildVerificationLevel, GuildMFALevel, GuildExplicitContentFilter, SplashCardAlignment, GuildNSFWLevel, GuildFeature, APIEmoji, APISticker, RESTPostAPIEmbed, RESTPostAPIMessageUploadedAttachment, APIAllowedMentions, MessageReferenceType, APIMessageReference, APIMessageAttachment, MessageType, APIEmbed, APIMessageSticker, APIMessageReaction, APIMessageSnapshot, APIMessageCall, APIMessage, APIUserPartial, APIBan, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, InviteType, APIGuildPartial, APIChannelPartial, APIPackInviteInfo, APIInvite, APIWebhook, ChannelCreateRequest, AuditLogActionType, APIInstanceEndpoints, APIInstance, GatewayPresenceUpdateData, PackType, APIPackSummary, APIGuildMember, APIChannel, APIChannelOverwrite, ChannelType, GatewayVoiceStateUpdateDispatchData, GatewayVoiceStateAckDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayEntranceSoundPlayDispatchData, GatewayVoiceStatesSyncData, GatewayUserConnectionsUpdateDispatchData, GatewayWebAuthnCredentialsUpdateDispatchData, GatewayReceivePayload, APIGatewayBotResponse, APIEmojiMetadata, APIStickerMetadata, APIApplicationMe, APIOAuthApplication, APIUserTagCheck, APIPreloadMessagesResponse, APIBulkMessageFetchResponse, GatewaySendPayload, Routes } 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';
3
+ import * as _fluxerjs_collection from '@fluxerjs/collection';
4
+ import { LimitedCollection, Collection } from '@fluxerjs/collection';
5
+ import { PermissionsBitField, MessageFlagsResolvable, MessageFlagsBitField, LogLevel, Logger, PermissionResolvable } from '@fluxerjs/util';
4
6
  import { EventEmitter } from 'node:events';
5
7
  import { REST } from '@fluxerjs/rest';
6
- import { PermissionResolvable, PermissionsBitField, LogLevel, Logger } from '@fluxerjs/util';
8
+ import * as _fluxerjs_ws from '@fluxerjs/ws';
7
9
  import { WebSocketManager } from '@fluxerjs/ws';
8
- import { EmbedBuilder, MessagePayload } from '@fluxerjs/builders';
9
-
10
- /** Attachment upload / message attachment SDK options. */
11
- /** Edits to an existing message attachment (by `id`) when editing a message. */
12
- interface MessageAttachmentEdit {
13
- id: number | string;
14
- filename?: string;
15
- uploadFilename?: string;
16
- fileSize?: number;
17
- contentType?: string;
18
- title?: string | null;
19
- description?: string | null;
20
- flags?: number;
21
- }
22
- /** Convert {@link MessageAttachmentEdit} entries to wire attachment objects. */
23
- declare function toMessageAttachmentEditWire(attachments: readonly MessageAttachmentEdit[]): Array<Record<string, unknown>>;
24
- /** Plan item for {@link Channel.requestAttachmentUploads}. */
25
- interface AttachmentUploadPlanItem {
26
- id: number;
27
- filename: string;
28
- fileSize: number;
29
- contentType: string;
30
- }
31
- /** Convert plan items to the attachments request wire body. */
32
- declare function toAttachmentUploadPlanBody(attachments: readonly AttachmentUploadPlanItem[]): {
33
- attachments: Array<Record<string, unknown>>;
34
- };
35
- /** Multipart complete item for {@link Channel.completeAttachmentUploads}. */
36
- interface AttachmentUploadCompleteItem {
37
- uploadFilename: string;
38
- uploadId: string;
39
- }
40
- /** Convert complete items to the attachments/complete wire body. */
41
- declare function toAttachmentUploadCompleteBody(uploads: readonly AttachmentUploadCompleteItem[]): {
42
- uploads: Array<{
43
- upload_filename: string;
44
- upload_id: string;
45
- }>;
46
- };
47
- /** Part in a multipart upload plan response. */
48
- interface AttachmentUploadPartPayload {
49
- partNumber: number;
50
- uploadUrl: string;
51
- }
52
- /** Singlepart plan response item. */
53
- interface AttachmentUploadSinglepartPayload {
54
- id: number;
55
- filename: string;
56
- uploadFilename: string;
57
- fileSize: number;
58
- contentType: string;
59
- uploadMode: 'singlepart';
60
- uploadUrl: string;
61
- }
62
- /** Multipart plan response item. */
63
- interface AttachmentUploadMultipartPayload {
64
- id: number;
65
- filename: string;
66
- uploadFilename: string;
67
- fileSize: number;
68
- contentType: string;
69
- uploadMode: 'multipart';
70
- uploadId: string;
71
- partSize: number;
72
- parts: AttachmentUploadPartPayload[];
73
- }
74
- type AttachmentUploadPlanResponseItem = AttachmentUploadSinglepartPayload | AttachmentUploadMultipartPayload;
75
- /** CamelCase response from {@link Channel.requestAttachmentUploads}. */
76
- interface AttachmentUploadPlanResponse {
77
- attachments: AttachmentUploadPlanResponseItem[];
78
- }
79
- /** CamelCase response from {@link Channel.completeAttachmentUploads}. */
80
- interface AttachmentUploadCompleteResponse {
81
- uploads: Array<{
82
- uploadFilename: string;
83
- }>;
84
- }
85
-
86
- /** Channel edit / invite / RTC / slowmode SDK options. */
87
-
88
- /** A single permission overwrite (`allow`/`deny` bitfield strings) for a channel edit. */
89
- interface ChannelPermissionOverwriteOptions {
90
- id: string;
91
- type: OverwriteType;
92
- allow?: string;
93
- deny?: string;
94
- }
95
- /** Options for {@link GuildChannel.edit}. */
96
- interface ChannelEditOptions {
97
- name?: string | null;
98
- topic?: string | null;
99
- parentId?: string | null;
100
- bitrate?: number | null;
101
- userLimit?: number | null;
102
- nsfw?: boolean;
103
- rateLimitPerUser?: number;
104
- rtcRegion?: string | null;
105
- permissionOverwrites?: ChannelPermissionOverwriteOptions[];
106
- }
107
- /** Convert {@link ChannelEditOptions} to the channel PATCH wire body. */
108
- declare function toChannelEditBody(options: ChannelEditOptions): Record<string, unknown>;
109
- /** Options for {@link GuildChannel.createInvite}. */
110
- interface ChannelInviteCreateOptions {
111
- maxUses?: number;
112
- maxAge?: number;
113
- unique?: boolean;
114
- temporary?: boolean;
115
- }
116
- /** Convert {@link ChannelInviteCreateOptions} to the invite create wire body. */
117
- declare function toChannelInviteBody(options: ChannelInviteCreateOptions): Record<string, unknown>;
118
- interface RtcRegionPayload {
119
- id: string;
120
- name: string;
121
- emoji: string;
122
- }
123
- /** CamelCase slowmode state from {@link Channel.fetchSlowmode}. */
124
- interface ChannelSlowmodePayload {
125
- rateLimitPerUser: number;
126
- retryAfterMs: number;
127
- nextSendAllowedAt: string | null;
128
- }
129
-
130
- /** Guild discovery SDK options and payloads. */
131
- /** Options for applying a guild to discovery. */
132
- interface DiscoveryApplicationOptions {
133
- description?: string;
134
- /** Discovery category (`category_type` on the wire). */
135
- primaryCategoryId?: number | string;
136
- /** Custom search tags (`custom_tags` on the wire). */
137
- keywords?: string[];
138
- /** Primary language code (`primary_language` on the wire). */
139
- primaryLanguage?: string;
140
- }
141
- /** Convert {@link DiscoveryApplicationOptions} to the discovery wire body. */
142
- declare function toDiscoveryBody(options: DiscoveryApplicationOptions): Record<string, unknown>;
143
- /** CamelCase view of a guild's discovery application record. */
144
- interface DiscoveryApplicationPayload {
145
- guildId: string;
146
- guildNsfwLevel?: number | null;
147
- status: string;
148
- description: string;
149
- categoryType: number;
150
- primaryLanguage?: string | null;
151
- customTags?: string[];
152
- appliedAt?: string;
153
- reviewedAt?: string | null;
154
- }
155
- /** CamelCase discovery status. */
156
- interface DiscoveryStatusPayload {
157
- application?: DiscoveryApplicationPayload | null;
158
- eligible: boolean;
159
- minMemberCount: number;
160
- }
161
- /** Map wire discovery application → camelCase. */
162
- declare function toDiscoveryApplicationPayload(data: {
163
- guild_id: string;
164
- guild_nsfw_level?: number | null;
165
- status: string;
166
- description: string;
167
- category_type: number;
168
- primary_language?: string | null;
169
- custom_tags?: string[];
170
- applied_at?: string;
171
- reviewed_at?: string | null;
172
- }): DiscoveryApplicationPayload;
173
- /** Map wire discovery status → camelCase. */
174
- declare function toDiscoveryStatusPayload(data: {
175
- application?: {
176
- guild_id: string;
177
- guild_nsfw_level?: number | null;
178
- status: string;
179
- description: string;
180
- category_type: number;
181
- primary_language?: string | null;
182
- custom_tags?: string[];
183
- applied_at?: string;
184
- reviewed_at?: string | null;
185
- } | null;
186
- eligible: boolean;
187
- min_member_count: number;
188
- }): DiscoveryStatusPayload;
189
-
190
- /** Emoji / sticker SDK options. */
191
- /** Options for creating a guild/pack emoji (`name` + base64 `image`). */
192
- interface ExpressionCreateOptions {
193
- name: string;
194
- image: string;
195
- }
196
- /** Convert {@link ExpressionCreateOptions} to the emoji create wire body. */
197
- declare function toEmojiCreateBody(options: ExpressionCreateOptions): Record<string, unknown>;
198
- /** Options for editing a pack/guild emoji. */
199
- interface ExpressionEditOptions {
200
- name: string;
201
- }
202
- /** Convert {@link ExpressionEditOptions} to the emoji edit wire body. */
203
- declare function toEmojiEditBody(options: ExpressionEditOptions): Record<string, unknown>;
204
- /** Options for creating a pack/guild sticker. */
205
- interface StickerCreateOptions {
206
- name: string;
207
- /** Base64 image data (`image` on the wire). */
208
- file: string;
209
- description?: string | null;
210
- tags?: string[];
211
- }
212
- /** Options for editing a pack/guild sticker. */
213
- interface StickerEditOptions {
214
- name?: string;
215
- description?: string | null;
216
- tags?: string[];
217
- }
218
- /** Convert {@link StickerCreateOptions} to the sticker create wire body. */
219
- declare function toStickerCreateBody(options: StickerCreateOptions): Record<string, unknown>;
220
- /** Convert {@link StickerEditOptions} to the sticker edit wire body. */
221
- declare function toStickerEditBody(options: StickerEditOptions): Record<string, unknown>;
222
-
223
- /**
224
- * CamelCase options for creating a guild role.
225
- * Serialized to snake_case wire fields before REST via {@link toRoleRequestBody}.
226
- */
227
- interface RoleCreateOptions {
228
- /** Role name. */
229
- name?: string;
230
- /** Permissions bitfield string or {@link PermissionResolvable}. */
231
- permissions?: string | PermissionResolvable;
232
- /** Role color as 24-bit RGB. */
233
- color?: number;
234
- /** Whether the role is displayed separately in the member list. */
235
- hoist?: boolean;
236
- /** Whether the role can be @mentioned. */
237
- mentionable?: boolean;
238
- /** Unicode emoji for the role. */
239
- unicodeEmoji?: string | null;
240
- /** Sort position in the role list. */
241
- position?: number;
242
- /** Hoisted position (visual separator group). */
243
- hoistPosition?: number | null;
244
- }
245
- /**
246
- * CamelCase options for editing a guild role.
247
- * Serialized to snake_case wire fields before REST.
248
- */
249
- type RoleEditOptions = RoleCreateOptions;
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-fOKSPbxN.mjs';
11
+ import { EmbedBuilder, AttachmentBuilder, MessagePayload } from '@fluxerjs/builders';
250
12
 
251
13
  type GuildData = Partial<APIGuild> & {
252
14
  id: string;
@@ -270,12 +32,19 @@ type GuildEditOptions = {
270
32
  embedSplash?: string | null;
271
33
  splashCardAlignment?: SplashCardAlignment;
272
34
  nsfwLevel?: GuildNSFWLevel;
35
+ /** Distinct from {@link nsfwLevel}: adult (18+) flag. */
36
+ nsfw?: boolean;
37
+ contentWarningLevel?: ContentWarningLevel;
38
+ contentWarningText?: string | null;
39
+ messageHistoryCutoff?: string | null;
273
40
  features?: GuildFeature[];
274
41
  };
275
42
  type GuildBanOptions = {
276
43
  reason?: string;
277
- /** Delete message history for this many days (0–7). */
44
+ /** Delete message history for this many days (0–7). Deprecated in favor of deleteMessageSeconds. */
278
45
  deleteMessageDays?: number;
46
+ /** Delete message history for this many seconds (0–604800). */
47
+ deleteMessageSeconds?: number;
279
48
  /** Temporary ban duration in seconds. */
280
49
  banDurationSeconds?: number;
281
50
  };
@@ -286,191 +55,6 @@ type ChannelPositionUpdate = {
286
55
  lockPermissions?: boolean;
287
56
  };
288
57
 
289
- /** Guild member search / edit SDK options. */
290
- /** Filters and paging for {@link Guild.searchMembers}. */
291
- interface GuildMemberSearchOptions {
292
- query?: string;
293
- limit?: number;
294
- offset?: number;
295
- roleIds?: string[];
296
- joinedAtGte?: number;
297
- joinedAtLte?: number;
298
- isBot?: boolean;
299
- userCreatedAtGte?: number;
300
- userCreatedAtLte?: number;
301
- sortBy?: 'joinedAt' | 'relevance';
302
- sortOrder?: 'asc' | 'desc';
303
- }
304
- /** Convert {@link GuildMemberSearchOptions} to the wire search body. */
305
- declare function toMemberSearchBody(options: GuildMemberSearchOptions): Record<string, unknown>;
306
- /** Fields to update on a guild member (nick, roles, profile, voice/timeout state). */
307
- interface GuildMemberEditOptions {
308
- nick?: string | null;
309
- roles?: string[];
310
- avatar?: string | null;
311
- banner?: string | null;
312
- bio?: string | null;
313
- pronouns?: string | null;
314
- accentColor?: number | null;
315
- profileFlags?: number | null;
316
- mute?: boolean;
317
- deaf?: boolean;
318
- communicationDisabledUntil?: string | null;
319
- timeoutReason?: string | null;
320
- channelId?: string | null;
321
- connectionId?: string | null;
322
- }
323
- /** Convert {@link GuildMemberEditOptions} to the member PATCH wire body. */
324
- declare function toMemberEditBody(options: GuildMemberEditOptions): Record<string, unknown>;
325
-
326
- /** Message bulk-fetch SDK options. */
327
- /** A single channel's request within a bulk message fetch. */
328
- interface BulkFetchMessagesRequest {
329
- channelId: string;
330
- limit: number;
331
- before?: string;
332
- after?: string;
333
- around?: string;
334
- }
335
- /** Convert bulk-fetch requests to wire items. */
336
- declare function toBulkFetchWire(requests: readonly BulkFetchMessagesRequest[]): Array<{
337
- channel_id: string;
338
- limit: number;
339
- before?: string;
340
- after?: string;
341
- around?: string;
342
- }>;
343
-
344
- /** Pack create/edit/invite + pack payload types. */
345
- /** Options for creating an expression pack. */
346
- interface PackCreateOptions {
347
- name: string;
348
- description?: string | null;
349
- }
350
- /** Fields to update on an expression pack. */
351
- interface PackEditOptions {
352
- name?: string;
353
- description?: string | null;
354
- }
355
- /** Options for creating a pack invite. */
356
- interface PackInviteCreateOptions {
357
- maxUses?: number;
358
- maxAge?: number;
359
- unique?: boolean;
360
- }
361
- /** Convert {@link PackInviteCreateOptions} to the pack invite wire body. */
362
- declare function toPackInviteBody(options: PackInviteCreateOptions): Record<string, unknown>;
363
- /** Small emoji payload returned from pack list/create. */
364
- interface PackEmojiPayload {
365
- id: string;
366
- name: string;
367
- animated?: boolean;
368
- }
369
- /** Small sticker payload from pack list/create. */
370
- interface PackStickerPayload {
371
- id: string;
372
- name: string;
373
- description: string;
374
- tags: string[];
375
- animated: boolean;
376
- nsfw: boolean;
377
- }
378
- /** Invite metadata payload (camelCase). */
379
- interface PackInvitePayload {
380
- code: string;
381
- maxUses?: number;
382
- maxAge?: number;
383
- uses?: number;
384
- temporary?: boolean;
385
- unique?: boolean;
386
- createdAt?: string;
387
- expiresAt?: string | null;
388
- }
389
- /** Bulk create result (camelCase). */
390
- interface PackBulkCreatePayload<T> {
391
- success: T[];
392
- failed: Array<{
393
- name: string;
394
- error: string;
395
- }>;
396
- }
397
-
398
- /** Presence update SDK options. */
399
- /** Options for `client.user.setPresence()` (status, activities, custom status). */
400
- interface PresenceUpdateOptions {
401
- status: 'online' | 'idle' | 'dnd' | 'invisible';
402
- since?: number | null;
403
- afk?: boolean;
404
- activities?: Array<{
405
- name: string;
406
- type: number;
407
- url?: string | null;
408
- }>;
409
- customStatus?: {
410
- text?: string | null;
411
- emojiName?: string | null;
412
- emojiId?: string | null;
413
- } | null;
414
- }
415
- /** Convert presence options to gateway opcode 3 payload. */
416
- declare function toPresenceWire(options: PresenceUpdateOptions): Record<string, unknown>;
417
-
418
- /** User profile SDK payloads. */
419
- /** CamelCase user profile fields (pronouns, bio, banner, colors, theme). */
420
- interface UserProfilePayload {
421
- pronouns?: string | null;
422
- bio?: string | null;
423
- banner?: string | null;
424
- accentColor?: number | null;
425
- bannerColor?: number | null;
426
- theme?: string | null;
427
- }
428
- /** CamelCase connected account. */
429
- interface ConnectedAccountPayload {
430
- name?: string | null;
431
- type?: string | null;
432
- }
433
- /** CamelCase profile response from {@link UserManager.fetchWithProfile}. */
434
- interface ProfilePayload {
435
- userProfile?: UserProfilePayload | null;
436
- mutualGuilds?: Array<{
437
- id: string;
438
- }> | null;
439
- mutualGuildIds?: string[] | null;
440
- connectedAccounts?: ConnectedAccountPayload[] | null;
441
- }
442
- /** Map wire profile → camelCase. */
443
- declare function toProfilePayload(data: {
444
- user_profile?: {
445
- pronouns?: string | null;
446
- bio?: string | null;
447
- banner?: string | null;
448
- accent_color?: number | null;
449
- banner_color?: number | null;
450
- theme?: string | null;
451
- } | null;
452
- mutual_guilds?: Array<{
453
- id: string;
454
- }> | null;
455
- mutual_guild_ids?: string[] | null;
456
- connected_accounts?: Array<{
457
- name?: string | null;
458
- type?: string | null;
459
- }> | null;
460
- }): ProfilePayload;
461
-
462
- /** Sudo verification SDK options. */
463
- /** Credentials for a sudo (elevated-action) verification: password and/or MFA. */
464
- interface SudoVerificationOptions {
465
- password?: string;
466
- mfaMethod?: 'totp' | 'webauthn';
467
- mfaCode?: string;
468
- webauthnResponse?: Record<string, unknown>;
469
- webauthnChallenge?: string;
470
- }
471
- /** Convert {@link SudoVerificationOptions} to the wire sudo body. */
472
- declare function toSudoBody(options: SudoVerificationOptions): Record<string, unknown>;
473
-
474
58
  /** Webhook SDK options. */
475
59
  /** Fields to update on a webhook (name, avatar, or move channel). */
476
60
  interface WebhookEditOptions {
@@ -494,141 +78,81 @@ type UploadFileForSend = {
494
78
  contentType: string;
495
79
  };
496
80
 
497
- /** Represents a custom emoji in a guild. */
498
- declare class GuildEmoji extends Base {
499
- readonly client: Client;
500
- readonly id: string;
501
- readonly guildId: string;
502
- name: string;
503
- readonly animated: boolean;
504
- /** @param data - API emoji from GET /guilds/{id}/emojis or guild emoji events */
505
- constructor(client: Client, data: APIEmoji & {
506
- guild_id?: string;
507
- }, guildId: string);
508
- /**
509
- * Patch mutable fields in place. Does not change `id` or `animated`
510
- * (callers should replace the instance when `animated` changes).
511
- * @internal
512
- */
513
- _patch(data: APIEmoji): void;
514
- /** CDN URL for this emoji image. */
515
- get url(): string;
516
- /** Emoji identifier for use in reactions: `name:id` (or `a:name:id` when animated). */
517
- get identifier(): string;
518
- /** Unix timestamp (ms) when this emoji was created, derived from its snowflake ID. */
519
- get createdTimestamp(): number;
520
- /** Date when this emoji was created, derived from its snowflake ID. */
521
- get createdAt(): Date;
522
- /** Renders this emoji for use in message content: `<:name:id>` (or `<a:name:id>` when animated). */
523
- toString(): string;
524
- /** Delete this emoji. Requires Manage Emojis and Stickers permission. */
525
- delete(): Promise<void>;
526
- /**
527
- * Edit this emoji's name.
528
- * Requires Manage Emojis and Stickers permission.
529
- */
530
- edit(options: {
531
- name: string;
532
- }): Promise<GuildEmoji>;
533
- }
534
-
535
- /** Represents a custom sticker in a guild. */
536
- declare class GuildSticker extends Base {
537
- readonly client: Client;
538
- readonly id: string;
539
- readonly guildId: string;
540
- name: string;
541
- description: string;
542
- tags: string[];
543
- readonly animated: boolean;
544
- /** Whether this sticker is classified as NSFW */
81
+ /** CamelCase attachment on a {@link Message}. */
82
+ interface MessageAttachment {
83
+ id: string;
84
+ filename: string;
85
+ title: string | null;
86
+ description: string | null;
87
+ contentType: string | null;
88
+ contentHash: string | null;
89
+ size: number;
90
+ url: string | null;
91
+ proxyUrl: string | null;
92
+ width: number | null;
93
+ height: number | null;
94
+ placeholder: string | null;
95
+ flags: number;
545
96
  nsfw: boolean;
546
- /** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
547
- constructor(client: Client, data: APISticker & {
548
- guild_id?: string;
549
- }, guildId: string);
550
- /**
551
- * Patch mutable fields in place. Does not change `id` or `animated`
552
- * (callers should replace the instance when `animated` changes).
553
- * @internal
554
- */
555
- _patch(data: APISticker): void;
556
- /** CDN URL for this sticker image. */
557
- get url(): string;
558
- /** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
559
- get createdTimestamp(): number;
560
- /** Date when this sticker was created, derived from its snowflake ID. */
561
- get createdAt(): Date;
562
- /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
563
- delete(): Promise<void>;
564
- /**
565
- * Edit this sticker's name and/or description.
566
- * Requires Manage Emojis and Stickers permission.
567
- */
568
- edit(options: {
569
- name?: string;
570
- description?: string;
571
- }): Promise<GuildSticker>;
97
+ duration: number | null;
98
+ waveform: string | null;
99
+ expiresAt: Date | null;
100
+ expired: boolean;
572
101
  }
573
102
 
574
- /**
575
- * Guild role.
576
- * Cached in {@link Guild.roles}; permissions computed via {@link GuildMember.permissions}.
577
- */
578
- declare class Role extends Base {
579
- /** Parent client instance. */
580
- readonly client: Client;
581
- /** Role snowflake ID. */
582
- readonly id: string;
583
- /** Guild this role belongs to. */
584
- readonly guildId: string;
585
- /** Role name. */
103
+ /** CamelCase author / provider block on a {@link MessageEmbed}. */
104
+ interface MessageEmbedAuthor {
105
+ name: string | null;
106
+ url: string | null;
107
+ iconUrl: string | null;
108
+ proxyIconUrl: string | null;
109
+ }
110
+ /** CamelCase footer on a {@link MessageEmbed}. */
111
+ interface MessageEmbedFooter {
112
+ text: string;
113
+ iconUrl: string | null;
114
+ proxyIconUrl: string | null;
115
+ }
116
+ /** CamelCase image / thumbnail / video / audio on a {@link MessageEmbed}. */
117
+ interface MessageEmbedMedia {
118
+ url: string;
119
+ proxyUrl: string | null;
120
+ contentType: string | null;
121
+ contentHash: string | null;
122
+ width: number | null;
123
+ height: number | null;
124
+ description: string | null;
125
+ placeholder: string | null;
126
+ duration: number | null;
127
+ flags: number | null;
128
+ }
129
+ /** Named field row on a {@link MessageEmbed}. */
130
+ interface MessageEmbedField {
586
131
  name: string;
587
- /** Role color (24-bit RGB). */
588
- color: number;
589
- /** Role position (higher = above). */
590
- position: number;
591
- /** @internal Raw permissions bitfield string. */
592
- _permissions: string;
593
- /** Whether this role is hoisted (shown separately in member list). */
594
- hoist: boolean;
595
- /** Whether this role is mentionable. */
596
- mentionable: boolean;
597
- /** Unicode emoji for this role (null = none). */
598
- unicodeEmoji: string | null;
599
- /** Hoist position (null = not hoisted). */
600
- hoistPosition: number | null;
601
- constructor(client: Client, data: APIRole, guildId: string);
602
- /**
603
- * Permissions bitfield (Administrator grants all permissions).
604
- */
605
- get permissions(): PermissionsBitField;
606
- /**
607
- * Format as a mention string (`<@&id>`).
608
- * @returns Mention syntax
609
- */
610
- /** Unix timestamp (ms) when this role was created, derived from its snowflake ID. */
611
- get createdTimestamp(): number;
612
- /** Date when this role was created, derived from its snowflake ID. */
613
- get createdAt(): Date;
614
- toString(): string;
615
- /** @internal */
616
- _patch(data: APIRole): void;
617
- /**
618
- * Snapshot for role-update events (before in-place patch).
619
- * @internal
620
- */
621
- _clone(): Role;
622
- /**
623
- * PATCH role. Requires Manage Roles.
624
- * @param options - CamelCase fields to update
625
- * @returns This role instance (updated in-place)
626
- */
627
- edit(options: RoleEditOptions): Promise<Role>;
628
- /**
629
- * DELETE role. Requires Manage Roles.
630
- */
631
- delete(): Promise<void>;
132
+ value: string;
133
+ inline: boolean;
134
+ }
135
+ /** CamelCase embed on a received {@link Message}. Send via EmbedBuilder.toJSON() (wire). */
136
+ interface MessageEmbed {
137
+ type: EmbedType;
138
+ url: string | null;
139
+ title: string | null;
140
+ color: number | null;
141
+ timestamp: Date | null;
142
+ description: string | null;
143
+ author: MessageEmbedAuthor | null;
144
+ image: MessageEmbedMedia | null;
145
+ thumbnail: MessageEmbedMedia | null;
146
+ footer: MessageEmbedFooter | null;
147
+ fields: MessageEmbedField[];
148
+ provider: MessageEmbedAuthor | null;
149
+ video: MessageEmbedMedia | null;
150
+ audio: MessageEmbedMedia | null;
151
+ nsfw: boolean;
152
+ children: MessageEmbed[];
153
+ html: string | null;
154
+ htmlWidth: number | null;
155
+ htmlHeight: number | null;
632
156
  }
633
157
 
634
158
  /** Resolved file data (after URL fetch). Used internally by REST layer. */
@@ -705,9 +229,9 @@ type MessageSendOptions = {
705
229
  content?: string;
706
230
  /** Embed payloads or {@link EmbedBuilder} instances. */
707
231
  embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
708
- /** Local files or remote URLs to upload with the message. */
709
- files?: MessageFileData[];
710
- /** Attachment metadata aligned with uploaded `files` indices. */
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}). */
711
235
  attachments?: MessageAttachmentMeta[];
712
236
  /** Already-uploaded CDN attachments (skip multipart). */
713
237
  uploadedAttachments?: RESTPostAPIMessageUploadedAttachment[];
@@ -771,209 +295,150 @@ type MessagePrepareInput = string | MessageSendOptions | MessagePayload;
771
295
  */
772
296
  declare function prepareMessagePostPayload(options: MessagePrepareInput, defaults?: MessagePrepareDefaults): Promise<MessagePostPayload>;
773
297
 
774
- /** Options for {@link ReactionCollector} / `message.createReactionCollector()`. */
775
- interface ReactionCollectorOptions {
776
- /** Filter function. Return true to collect the reaction. */
777
- filter?: (reaction: MessageReaction, user: User) => boolean;
778
- /** Max duration in ms. Collector stops when time expires. */
779
- time?: number;
780
- /** Max reactions to collect. Collector stops when limit reached. */
781
- max?: number;
782
- }
783
- type ReactionCollectorEndReason = 'time' | 'limit' | 'user';
784
- /** A single collected reaction paired with the user who added it. */
785
- interface CollectedReaction {
786
- reaction: MessageReaction;
787
- user: User;
788
- }
789
- /** Typed event map for {@link ReactionCollector}: `collect` per reaction, `end` when it stops. */
790
- interface ReactionCollectorEvents {
791
- collect: [reaction: MessageReaction, user: User];
792
- end: [collected: Collection<string, CollectedReaction>, reason: ReactionCollectorEndReason];
793
- }
794
- /**
795
- * Collects reactions on a message. Use message.createReactionCollector().
796
- *
797
- * Listens to both {@link Events.MessageReactionAdd} and {@link Events.MessageReactionAddMany}
798
- * (gateway may batch rapid reactions into ADD_MANY instead of individual ADD events).
799
- *
800
- * @example
801
- * const collector = message.createReactionCollector({ filter: (r, u) => u.id === userId, time: 10000 });
802
- * collector.on('collect', (reaction, user) => console.log(user.username, 'reacted', reaction.emoji.name));
803
- * collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
804
- */
805
- declare class ReactionCollector extends EventEmitter {
298
+ /** Represents a custom emoji in a guild. */
299
+ declare class GuildEmoji extends Base {
806
300
  readonly client: Client;
807
- readonly messageId: string;
808
- readonly channelId: string;
809
- readonly options: Required<ReactionCollectorOptions>;
810
- readonly collected: Collection<string, CollectedReaction>;
811
- private _timeout;
812
- private _ended;
813
- private readonly _onAdd;
814
- private readonly _onAddMany;
815
- constructor(client: Client, messageId: string, channelId: string, options?: ReactionCollectorOptions);
816
- private _collect;
817
- stop(reason?: ReactionCollectorEndReason): void;
818
- on<K extends keyof ReactionCollectorEvents>(event: K, listener: (...args: ReactionCollectorEvents[K]) => void): this;
819
- emit<K extends keyof ReactionCollectorEvents>(event: K, ...args: ReactionCollectorEvents[K]): boolean;
820
- }
821
-
822
- /** Options for PATCH /channels/{id}/messages/{id}. */
823
- interface MessageEditOptions {
824
- content?: string | null;
825
- embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
826
- allowedMentions?: AllowedMentionsOptions;
827
- flags?: number;
828
- /** Keep by snowflake `id`, or add via `uploadFilename` from the presigned upload flow. */
829
- attachments?: MessageAttachmentEdit[];
830
- }
831
- type PreparedMessagePost = Awaited<ReturnType<typeof prepareMessagePostPayload>>;
832
- /** Second-arg / inline options for `message.reply()`. */
833
- interface ReplyOptions {
834
- /** `false` suppresses the replied-user ping (`allowed_mentions.replied_user`). Default: client `defaultReplyPing`. */
835
- ping?: boolean;
836
- /** Reply to a different message. Default: this message. */
837
- replyTo?: Message | MessageReplyTarget;
301
+ readonly id: string;
302
+ readonly guildId: string;
303
+ name: string;
304
+ readonly animated: boolean;
305
+ /** @param data - API emoji from GET /guilds/{id}/emojis or guild emoji events */
306
+ constructor(client: Client, data: APIEmoji & {
307
+ guild_id?: string;
308
+ }, guildId: string);
309
+ /**
310
+ * Patch mutable fields in place. Does not change `id` or `animated`
311
+ * (callers should replace the instance when `animated` changes).
312
+ * @internal
313
+ */
314
+ _patch(data: APIEmoji): void;
315
+ /** CDN URL for this emoji image. */
316
+ get url(): string;
317
+ /** Emoji identifier for use in reactions: `name:id` (or `a:name:id` when animated). */
318
+ get identifier(): string;
319
+ /** Unix timestamp (ms) when this emoji was created, derived from its snowflake ID. */
320
+ get createdTimestamp(): number;
321
+ /** Date when this emoji was created, derived from its snowflake ID. */
322
+ get createdAt(): Date;
323
+ /** Renders this emoji for use in message content: `<:name:id>` (or `<a:name:id>` when animated). */
324
+ toString(): string;
325
+ /** Delete this emoji. Requires Manage Emojis and Stickers permission. */
326
+ delete(reason?: string): Promise<void>;
327
+ /**
328
+ * Edit this emoji's name.
329
+ * Requires Manage Emojis and Stickers permission.
330
+ */
331
+ edit(options: {
332
+ name: string;
333
+ reason?: string;
334
+ }): Promise<GuildEmoji>;
838
335
  }
839
336
 
840
- type EmojiInput = string | {
841
- name: string;
842
- id?: string;
843
- animated?: boolean;
844
- };
845
- /** A message in a channel. */
846
- declare class Message extends Base {
847
- /** The {@link Client} that instantiated this message. */
337
+ /** Represents a custom sticker in a guild. */
338
+ declare class GuildSticker extends Base {
848
339
  readonly client: Client;
849
- /** Snowflake ID of this message. */
850
340
  readonly id: string;
851
- /** Channel ID where this message was sent. */
852
- readonly channelId: string;
853
- /** Guild ID if in a guild channel, null for DMs. */
854
- readonly guildId: string | null;
855
- /** The user who sent this message. */
856
- readonly author: User;
857
- /** Text content of the message. */
858
- content: string;
859
- /** When the message was created. */
860
- readonly createdAt: Date;
861
- /** When the message was last edited, or null if never edited. */
862
- readonly editedAt: Date | null;
863
- /** Whether the message is pinned. */
864
- pinned: boolean;
865
- /** Attached files (images, videos, etc.). */
866
- readonly attachments: Collection<string, APIMessageAttachment>;
867
- /** Message type (Default, Reply, etc.). */
868
- readonly type: MessageType;
869
- /** Message flags bitfield. */
870
- readonly flags: number;
871
- /** Whether `@everyone` or `@here` was mentioned. */
872
- readonly mentionEveryone: boolean;
873
- /** Whether this is a text-to-speech message. */
874
- readonly tts: boolean;
875
- /** Embedded content (rich previews, etc.). */
876
- readonly embeds: APIEmbed[];
877
- /** Stickers sent with the message. */
878
- readonly stickers: APIMessageSticker[];
879
- /** Reactions on the message. */
880
- readonly reactions: APIMessageReaction[];
881
- /** Reference to a replied-to message, if any. */
882
- readonly messageReference: APIMessageReference | null;
883
- /** Message snapshots for forwarded messages. */
884
- readonly messageSnapshots: APIMessageSnapshot[];
885
- /** Call data if this message represents a call event. */
886
- readonly call: APIMessageCall | null;
887
- /** The full referenced (replied-to) message, or null. */
888
- readonly referencedMessage: Message | null;
889
- /** Webhook ID if sent by a webhook. */
890
- readonly webhookId: string | null;
891
- /** Users mentioned in the message. */
892
- readonly mentions: User[];
893
- /** Role IDs mentioned in the message. */
894
- readonly mentionRoles: string[];
895
- /** Client-side nonce for deduplication. */
896
- readonly nonce: string | null;
897
- /** Cached text/DM/guild channel, or null if uncached. */
898
- get channel(): (TextChannel | DMChannel | GuildChannel) | null;
899
- /** Cached guild, or null for DMs / uncached. */
900
- get guild(): Guild | null;
901
- /** Fetch and resolve the channel this message is in. */
902
- resolveChannel(): Promise<Channel>;
903
- /** Fetch and resolve the guild, or null if a DM. */
904
- resolveGuild(): Promise<Guild | null>;
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);
905
352
  /**
906
- * Construct a message from API data.
907
- * @param data - API message from REST or MESSAGE_CREATE
353
+ * Patch mutable fields in place. Does not change `id` or `animated`
354
+ * (callers should replace the instance when `animated` changes).
355
+ * @internal
908
356
  */
909
- constructor(client: Client, data: APIMessage);
910
- /** Send a message in this channel without replying. */
911
- send(options: MessagePrepareInput): Promise<Message>;
912
- /** Send a message to another channel by ID. */
913
- sendTo(channelId: string, options: MessagePrepareInput): Promise<Message>;
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>;
914
366
  /**
915
- * Reply to this message.
916
- * @example
917
- * await message.reply('Pong!');
918
- * await message.reply('No ping!', { ping: false });
919
- * await message.reply({ content: 'Silent', allowedMentions: AllowedMentions.suppressReplyPing });
367
+ * Edit this sticker's name and/or description.
368
+ * Requires Manage Emojis and Stickers permission.
920
369
  */
921
- reply(options: string | (MessageSendOptions & ReplyOptions), replyOptions?: ReplyOptions): Promise<Message>;
922
- /** Test helper — prefer {@link reply} / `prepareMessagePostPayload()`. */
923
- static _createMessageBody(content: string | MessageSendOptions, referenced_message?: {
924
- channel_id: string;
925
- message_id: string;
926
- guild_id?: string;
927
- }, ping?: boolean): Promise<PreparedMessagePost>;
928
- /** Send a prepared payload (internal helper). */
929
- _send(payload: PreparedMessagePost): Promise<Message>;
930
- /** Edit this message (requires author or admin permissions). */
931
- edit(options: MessageEditOptions): Promise<Message>;
932
- /** Create a {@link ReactionCollector} for this message. */
933
- createReactionCollector(options?: ReactionCollectorOptions): ReactionCollector;
934
- /** Fetch the latest version of this message from the API. */
935
- fetch(): Promise<Message>;
936
- /** Delete this message. */
937
- delete(): Promise<void>;
938
- /** Delete a specific attachment from this message. */
939
- deleteAttachment(attachmentId: string): Promise<void>;
940
- /** Pin this message in the channel. */
941
- pin(): Promise<void>;
942
- /** Unpin this message from the channel. */
943
- unpin(): Promise<void>;
944
- /** React to this message with an emoji. */
945
- react(emoji: EmojiInput): Promise<void>;
946
- /** Remove a reaction (bot's own or a user's if ID is provided). */
947
- removeReaction(emoji: EmojiInput, userId?: string): Promise<void>;
948
- /** Remove all reactions from this message. */
949
- removeAllReactions(): Promise<void>;
950
- /** Remove all reactions of a specific emoji. */
951
- removeReactionEmoji(emoji: EmojiInput): Promise<void>;
952
- /** Fetch users who reacted with a specific emoji. */
953
- fetchReactionUsers(emoji: EmojiInput, options?: {
954
- limit?: number;
955
- after?: string;
956
- }): Promise<User[]>;
957
- /** Fetch reaction users with pagination metadata. */
958
- fetchReactionUsersPage(emoji: EmojiInput, options?: {
959
- limit?: number;
960
- after?: string;
961
- }): Promise<{
962
- users: User[];
963
- hasMore: boolean;
964
- nextAfter: string | null;
965
- }>;
370
+ edit(options: {
371
+ name?: string;
372
+ description?: string;
373
+ reason?: string;
374
+ }): Promise<GuildSticker>;
966
375
  }
967
376
 
968
- /** Minimal message data for MessageDelete when the full message is not available. */
969
- interface PartialMessage {
970
- id: string;
971
- channelId: string;
972
- channel?: Channel | null;
973
- /** Message content, when provided by the gateway (e.g. Fluxer). */
974
- content?: string | null;
975
- /** Author user ID, when provided by the gateway (e.g. Fluxer). */
976
- authorId?: string | null;
377
+ /**
378
+ * Guild role.
379
+ * Cached in {@link Guild.roles}; permissions computed via {@link GuildMember.permissions}.
380
+ */
381
+ declare class Role extends Base {
382
+ /** Parent client instance. */
383
+ readonly client: Client;
384
+ /** Role snowflake ID. */
385
+ readonly id: string;
386
+ /** Guild this role belongs to. */
387
+ readonly guildId: string;
388
+ /** Role name. */
389
+ name: string;
390
+ /** Role color (24-bit RGB). */
391
+ color: number;
392
+ /** Role position (higher = above). */
393
+ position: number;
394
+ /** @internal Raw permissions bitfield string. */
395
+ _permissions: string;
396
+ /** Whether this role is hoisted (shown separately in member list). */
397
+ hoist: boolean;
398
+ /** Whether this role is mentionable. */
399
+ mentionable: boolean;
400
+ /** Unicode emoji for this role (null = none). */
401
+ unicodeEmoji: string | null;
402
+ /** Hoist position (null = not hoisted). */
403
+ hoistPosition: number | null;
404
+ constructor(client: Client, data: APIRole, guildId: string);
405
+ /**
406
+ * Permissions bitfield (Administrator grants all permissions).
407
+ */
408
+ get permissions(): PermissionsBitField;
409
+ /**
410
+ * Alias of {@link permissions}.has for discord.js-style checks.
411
+ * @example
412
+ * if (role.has(PermissionFlags.BanMembers)) { ... }
413
+ */
414
+ has(permission: Parameters<PermissionsBitField['has']>[0]): boolean;
415
+ /**
416
+ * Format as a mention string (`<@&id>`).
417
+ * @returns Mention syntax
418
+ */
419
+ /** Unix timestamp (ms) when this role was created, derived from its snowflake ID. */
420
+ get createdTimestamp(): number;
421
+ /** Date when this role was created, derived from its snowflake ID. */
422
+ get createdAt(): Date;
423
+ toString(): string;
424
+ /** @internal */
425
+ _patch(data: APIRole): void;
426
+ /**
427
+ * Snapshot for role-update events (before in-place patch).
428
+ * @internal
429
+ */
430
+ _clone(): Role;
431
+ /**
432
+ * PATCH role. Requires Manage Roles.
433
+ * @param options - CamelCase fields to update
434
+ * @returns This role instance (updated in-place)
435
+ */
436
+ edit(options: RoleEditOptions): Promise<Role>;
437
+ /**
438
+ * DELETE role. Requires Manage Roles.
439
+ * @param reason - Audit log reason (`X-Audit-Log-Reason`)
440
+ */
441
+ delete(reason?: string): Promise<void>;
977
442
  }
978
443
 
979
444
  /**
@@ -1060,66 +525,51 @@ declare class User extends Base {
1060
525
  send(options: MessagePrepareInput): Promise<Message>;
1061
526
  }
1062
527
 
1063
- /** Represents a ban in a guild. */
1064
- declare class GuildBan extends Base {
1065
- readonly client: Client;
1066
- readonly guildId: string;
1067
- readonly user: User;
1068
- readonly reason: string | null;
1069
- /** ISO timestamp when a temporary ban expires. Null for permanent bans. */
1070
- readonly expiresAt: string | null;
1071
- /** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
1072
- constructor(client: Client, data: APIBan & {
1073
- guild_id?: string;
1074
- }, guildId: string);
1075
- /**
1076
- * Remove this ban (unban the user).
1077
- * Requires Ban Members permission.
1078
- */
1079
- unban(): Promise<void>;
1080
- }
1081
-
1082
- /** Role ID or Role object. */
1083
- type RoleResolvable = string | Role;
1084
528
  /**
1085
- * Manages a guild member's roles (`add` / `remove` / `set` / `cache`).
1086
- * Requires Manage Roles for mutations.
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`.
1087
532
  */
1088
- declare class GuildMemberRoleManager {
1089
- private readonly member;
1090
- private ids;
1091
- constructor(member: GuildMember, initial?: string[]);
1092
- get roleIds(): readonly string[];
1093
- has(roleOrId: RoleResolvable): boolean;
1094
- /** Live Role objects from `guild.roles` for this member's role IDs. */
1095
- get cache(): Collection<string, Role>;
1096
- add(roleOrId: RoleResolvable): Promise<void>;
1097
- remove(roleOrId: RoleResolvable): Promise<void>;
1098
- set(roleIds: string[]): Promise<void>;
1099
- /** @internal Sync from API member payload. */
1100
- _patch(roleIds: string[]): void;
1101
- }
1102
-
1103
- /** Represents a reaction added to or removed from a message. */
1104
- declare class MessageReaction extends Base {
533
+ declare class PartialMessage {
534
+ readonly partial: true;
1105
535
  readonly client: Client;
1106
- readonly messageId: string;
536
+ readonly id: string;
1107
537
  readonly channelId: string;
1108
538
  readonly guildId: string | null;
1109
- readonly emoji: ReactionEmojiPayload;
1110
- /** Raw gateway payload for low-level access. */
1111
- readonly _data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData;
1112
- constructor(client: Client, data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData);
1113
- /** Emoji as a string for reaction routes: unicode or `name:id` (`a:name:id` when animated). */
1114
- get emojiIdentifier(): string;
1115
- /** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
1116
- get guild(): Guild | 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: {
544
+ 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;
552
+ });
1117
553
  /**
1118
- * Fetch the message this reaction belongs to.
1119
- * Use when you need to edit, delete, or otherwise interact with the message.
1120
- * @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
554
+ * Live text-capable channel from cache, or null if uncached / not text-based.
555
+ * Same contract as {@link Message.channel}.
1121
556
  */
1122
- fetchMessage(): Promise<Message>;
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!');
571
+ */
572
+ fetch(): Promise<Message>;
1123
573
  }
1124
574
 
1125
575
  /** CamelCase emoji on reaction events. */
@@ -1134,6 +584,12 @@ interface ReactionEmojiPayload {
1134
584
  interface MessageReactionPayload {
1135
585
  reaction: MessageReaction;
1136
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;
1137
593
  messageId: string;
1138
594
  channelId: string;
1139
595
  emoji: ReactionEmojiPayload;
@@ -1158,6 +614,13 @@ interface MessageDeleteBulkPayload {
1158
614
  channelId: string;
1159
615
  /** Guild the channel belongs to, or `null` for DMs. */
1160
616
  guildId: string | null;
617
+ /** Cached text-capable channel, or null if uncached / not text-based. */
618
+ channel: TextBasedChannel | null;
619
+ /**
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[];
1161
624
  }
1162
625
  /**
1163
626
  * Payload emitted for {@link Events.InviteDelete}.
@@ -1210,6 +673,8 @@ interface MessageReactionRemoveAllPayload {
1210
673
  messageId: string;
1211
674
  channelId: string;
1212
675
  guildId: string | null;
676
+ message: Message | null;
677
+ channel: TextBasedChannel | null;
1213
678
  }
1214
679
  /** Payload for {@link Events.MessageReactionRemoveEmoji}. */
1215
680
  interface MessageReactionRemoveEmojiPayload {
@@ -1217,6 +682,8 @@ interface MessageReactionRemoveEmojiPayload {
1217
682
  channelId: string;
1218
683
  guildId: string | null;
1219
684
  emoji: ReactionEmojiPayload;
685
+ message: Message | null;
686
+ channel: TextBasedChannel | null;
1220
687
  }
1221
688
  /** Single entry in {@link MessageReactionAddManyPayload}. */
1222
689
  interface MessageReactionAddManyEntry {
@@ -1229,6 +696,8 @@ interface MessageReactionAddManyPayload {
1229
696
  channelId: string;
1230
697
  messageId: string;
1231
698
  guildId: string | null;
699
+ message: Message | null;
700
+ channel: TextBasedChannel | null;
1232
701
  reactions: MessageReactionAddManyEntry[];
1233
702
  }
1234
703
  /** Payload for {@link Events.ChannelPinsUpdate}. */
@@ -1348,20 +817,7 @@ interface GuildMemberSearchPayload {
1348
817
  /** Whether more pages exist after this offset. */
1349
818
  hasMore?: boolean;
1350
819
  /** Search index still building. */
1351
- indexing?: boolean;
1352
- }
1353
- /** Pack summary (camelCase view of {@link APIPackSummary}). */
1354
- interface PackSummaryPayload {
1355
- id: string;
1356
- name: string;
1357
- description: string | null;
1358
- type: string;
1359
- creatorId: string;
1360
- createdAt: string;
1361
- updatedAt: string;
1362
- installedAt?: string;
1363
- /** Original wire object when useful for debugging. */
1364
- raw?: unknown;
820
+ indexing?: boolean;
1365
821
  }
1366
822
  /** Partial guild from GET /users/@me/guilds. */
1367
823
  interface PartialUserGuildPayload {
@@ -1382,6 +838,18 @@ interface ChannelRecipientPayload {
1382
838
  user: User;
1383
839
  }
1384
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
+ }
1385
853
  /**
1386
854
  * Manages guild members with a Collection-like API.
1387
855
  * Extends LimitedCollection so you can use .get(), .set(), .filter(), etc.
@@ -1420,15 +888,19 @@ declare class GuildMemberManager extends LimitedCollection<string, GuildMember>
1420
888
  * console.log(me.displayName);
1421
889
  */
1422
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>;
1423
897
  /**
1424
898
  * Fetch guild members with pagination. GET /guilds/{id}/members.
1425
899
  * @param options - limit (1-1000), after (user ID for pagination)
1426
900
  * @returns Array of GuildMember objects (cached in guild.members)
1427
901
  */
1428
- fetch(options?: {
1429
- limit?: number;
1430
- after?: string;
1431
- }): Promise<GuildMember[]>;
902
+ fetch(options?: FetchGuildMembersOptions): Promise<GuildMember[]>;
903
+ private fetchMany;
1432
904
  /**
1433
905
  * Search guild members. POST /guilds/{id}/members-search.
1434
906
  * @param options - CamelCase search query, filters, and pagination
@@ -1439,34 +911,59 @@ declare class GuildMemberManager extends LimitedCollection<string, GuildMember>
1439
911
  search(options?: GuildMemberSearchOptions): Promise<GuildMemberSearchPayload>;
1440
912
  }
1441
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
+ }
1442
931
  /**
1443
- * Invite to a guild channel, group DM, or emoji/sticker pack.
1444
- * Discriminate with `type` / `isGuild()` / `isGroupDM()` / `isPack()`.
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.
1445
936
  */
1446
937
  declare class Invite extends Base {
1447
938
  readonly client: Client;
1448
939
  readonly code: string;
1449
940
  readonly type: InviteType;
1450
- readonly guild: APIGuildPartial | null;
1451
- readonly channel: APIChannelPartial | null;
1452
- readonly pack: APIPackInviteInfo | null;
941
+ readonly guildSnapshot: InviteGuildSnapshot | null;
942
+ readonly channelSnapshot: InviteChannelSnapshot | null;
1453
943
  readonly inviter: User | null;
1454
944
  readonly memberCount: number | null;
1455
945
  readonly presenceCount: number | null;
1456
- readonly expiresAt: string | null;
946
+ readonly expiresAt: Date | null;
1457
947
  readonly temporary: boolean | null;
1458
- readonly createdAt: string | null;
948
+ readonly createdAt: Date | null;
1459
949
  readonly uses: number | null;
1460
950
  readonly maxUses: number | null;
1461
951
  readonly maxAge: number | null;
1462
952
  constructor(client: Client, data: APIInvite);
1463
953
  isGuild(): boolean;
1464
954
  isGroupDM(): boolean;
1465
- isPack(): boolean;
1466
955
  /** Full invite URL (uses this client's instance invite base). */
1467
956
  get url(): string;
1468
- /** Cached guild for guild invites, else null. */
1469
- getGuild(): Guild | null;
957
+ /**
958
+ * Resolve the cached/fetched {@link Guild} for this invite, or null.
959
+ * `guildSnapshot` is metadata only.
960
+ */
961
+ resolveGuild(): Promise<Guild | null>;
962
+ /**
963
+ * Resolve the cached/fetched {@link Channel} for this invite, or null.
964
+ * `channelSnapshot` is metadata only.
965
+ */
966
+ resolveChannel(): Promise<Channel | null>;
1470
967
  /** Fetch invite metadata by code or URL (does not join). */
1471
968
  static fetch(client: Client, codeOrUrl: string): Promise<Invite>;
1472
969
  /** Delete this invite. Requires Manage Guild or Create Instant Invite. */
@@ -1549,6 +1046,36 @@ declare class Webhook extends Base {
1549
1046
  private messageRoute;
1550
1047
  }
1551
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;
1077
+ }
1078
+
1552
1079
  /** Represents a Fluxer guild (server). */
1553
1080
  declare class Guild extends Base {
1554
1081
  /** The {@link Client} that instantiated this guild. */
@@ -1585,8 +1112,26 @@ declare class Guild extends Base {
1585
1112
  systemChannelId: string | null;
1586
1113
  /** Rules channel ID (for Community guilds), or null if none. */
1587
1114
  rulesChannelId: string | null;
1115
+ /** {@link SystemChannelFlags} bitfield. */
1116
+ systemChannelFlags: number;
1117
+ /** Splash card alignment. */
1118
+ splashCardAlignment: SplashCardAlignment;
1119
+ /** Embed splash hash. */
1120
+ embedSplash: string | null;
1588
1121
  /** NSFW level for this guild. */
1589
1122
  nsfwLevel: GuildNSFWLevel;
1123
+ /** Whether the guild is marked as adult (18+) content. */
1124
+ nsfw: boolean;
1125
+ /** Content warning level. */
1126
+ contentWarningLevel: ContentWarningLevel;
1127
+ /** Custom guild-wide content warning text. */
1128
+ contentWarningText: string | null;
1129
+ /** {@link GuildOperations} bitfield of disabled operations. */
1130
+ disabledOperations: number;
1131
+ /** ISO-8601 timestamp before which message history is not available. */
1132
+ messageHistoryCutoff: string | null;
1133
+ /** Permissions for the current member in this guild (bitfield string). */
1134
+ permissions: string | null;
1590
1135
  /** MFA level required for moderation actions. */
1591
1136
  mfaLevel: GuildMFALevel;
1592
1137
  /** Banner width in pixels. */
@@ -1606,7 +1151,7 @@ declare class Guild extends Base {
1606
1151
  /** Cached channels in this guild. */
1607
1152
  channels: LimitedCollection<string, GuildChannel>;
1608
1153
  /** Cached roles in this guild. */
1609
- roles: LimitedCollection<string, Role>;
1154
+ roles: GuildRoleManager;
1610
1155
  /** Cached emojis in this guild. */
1611
1156
  emojis: LimitedCollection<string, GuildEmoji>;
1612
1157
  /** Cached stickers in this guild. */
@@ -1642,10 +1187,10 @@ declare class Guild extends Base {
1642
1187
  size?: number;
1643
1188
  }): string | null;
1644
1189
  /**
1645
- * Create a channel. `data.type`: 0=text, 2=voice, 4=category, 998=link (set `url`).
1190
+ * Create a channel. `type`: 0=text, 2=voice, 4=category, 998=link (set `url`).
1646
1191
  * Requires Manage Channels.
1647
1192
  */
1648
- createChannel(data: ChannelCreateRequest): Promise<GuildChannel>;
1193
+ createChannel(options: GuildChannelCreateOptions): Promise<GuildChannel>;
1649
1194
  /** Fetch all channels in this guild from the API. */
1650
1195
  fetchChannels(): Promise<GuildChannel[]>;
1651
1196
  /** Update channel positions (reordering). */
@@ -1684,14 +1229,14 @@ declare class Guild extends Base {
1684
1229
  }>): Promise<Role[]>;
1685
1230
  /** Reset all role hoist positions to zero. Returns cached {@link Role} instances. */
1686
1231
  resetRoleHoistPositions(): Promise<Role[]>;
1687
- /** Ban a user from the guild. Requires Ban Members. `ban_duration_seconds`: 0 = permanent. */
1232
+ /** Ban a user from the guild. Requires Ban Members. `banDurationSeconds`: 0 = permanent. */
1688
1233
  ban(userId: string, options?: GuildBanOptions): Promise<void>;
1689
1234
  /** Fetch all bans in this guild. Requires Ban Members. */
1690
1235
  fetchBans(): Promise<GuildBan[]>;
1691
1236
  /** Unban a user from the guild. Requires Ban Members. */
1692
- unban(userId: string): Promise<void>;
1237
+ unban(userId: string, reason?: string): Promise<void>;
1693
1238
  /** Kick a user from the guild. Requires Kick Members. */
1694
- kick(userId: string): Promise<void>;
1239
+ kick(userId: string, reason?: string): Promise<void>;
1695
1240
  /** Fetch all emojis in this guild from the API. */
1696
1241
  fetchEmojis(): Promise<GuildEmoji[]>;
1697
1242
  /** Fetch a specific emoji by ID. */
@@ -1700,6 +1245,7 @@ declare class Guild extends Base {
1700
1245
  createEmoji(options: {
1701
1246
  name: string;
1702
1247
  image: string;
1248
+ reason?: string;
1703
1249
  }): Promise<GuildEmoji>;
1704
1250
  /** Clone an emoji from another guild. Requires Manage Emojis and Stickers. */
1705
1251
  cloneEmoji(sourceEmojiId: string): Promise<GuildEmoji>;
@@ -1720,6 +1266,7 @@ declare class Guild extends Base {
1720
1266
  image: string;
1721
1267
  description?: string | null;
1722
1268
  tags?: string[];
1269
+ reason?: string;
1723
1270
  }): Promise<GuildSticker>;
1724
1271
  /** Clone a sticker from another guild. Requires Manage Emojis and Stickers. */
1725
1272
  cloneSticker(sourceStickerId: string): Promise<GuildSticker>;
@@ -1743,29 +1290,516 @@ declare class Guild extends Base {
1743
1290
  /** Fetch audit log entries. Requires View Audit Log. */
1744
1291
  fetchAuditLogs(options?: {
1745
1292
  limit?: number;
1746
- before?: string;
1293
+ before?: string;
1294
+ after?: string;
1295
+ userId?: string;
1296
+ actionType?: AuditLogActionType;
1297
+ }): Promise<AuditLogFetchPayload>;
1298
+ /** Edit guild settings. Requires guild owner or Administrator. */
1299
+ edit(options: GuildEditOptions): Promise<this>;
1300
+ /** Fetch the guild's vanity invite URL (if available). */
1301
+ fetchVanityURL(): Promise<VanityURLPayload>;
1302
+ /** Edit the guild's vanity invite code. */
1303
+ editVanityURL(code: string | null): Promise<VanityURLPayload>;
1304
+ /** Fetch the guild's discovery status. */
1305
+ fetchDiscoveryStatus(): Promise<DiscoveryStatusPayload>;
1306
+ /** Apply for guild discovery. */
1307
+ applyForDiscovery(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
1308
+ /** Edit an existing discovery application. */
1309
+ editDiscoveryApplication(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
1310
+ /** Withdraw the guild's discovery application. */
1311
+ withdrawDiscoveryApplication(): Promise<void>;
1312
+ /** Delete this guild (owner only). User accounts may need sudo/MFA in `options`. */
1313
+ delete(options?: SudoVerificationOptions): Promise<void>;
1314
+ /** Transfer guild ownership to another user (owner only). */
1315
+ transferOwnership(newOwnerId: string, password?: string): Promise<void>;
1316
+ }
1317
+
1318
+ /** Role ID or Role object. */
1319
+ type RoleResolvable = string | Role;
1320
+ /**
1321
+ * Manages a guild member's roles (`add` / `remove` / `set` / `cache`).
1322
+ * Requires Manage Roles for mutations.
1323
+ */
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;
1337
+ }
1338
+
1339
+ /**
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.
1344
+ */
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
+ });
1358
+ /**
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
1361
+ */
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;
1397
+ /**
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
1400
+ */
1401
+ fetchMessage(): Promise<Message>;
1402
+ }
1403
+
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;
1458
+ }
1459
+
1460
+ /**
1461
+ * Cached reactions on a {@link Message}, keyed by emoji identifier.
1462
+ */
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[];
1596
+ /**
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}.
1599
+ */
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;
1605
+ /**
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();
1611
+ */
1612
+ resolveChannel(): Promise<Channel>;
1613
+ /**
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();
1618
+ */
1619
+ resolveGuild(): Promise<Guild | null>;
1620
+ /**
1621
+ * Construct a message from API data.
1622
+ * @param data - API message from REST or MESSAGE_CREATE
1623
+ */
1624
+ constructor(client: Client, data: APIMessage);
1625
+ /**
1626
+ * Apply an API message payload in place (cache identity / MESSAGE_UPDATE).
1627
+ * @internal
1628
+ */
1629
+ _patch(data: APIMessage): void;
1630
+ /**
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.
1633
+ */
1634
+ send(options: MessagePrepareInput): Promise<Message>;
1635
+ /**
1636
+ * Send a message to another channel by ID.
1637
+ * Prefer `client.channels.fetch(channelId)` then {@link Channel.send}.
1638
+ */
1639
+ sendTo(channelId: string, options: MessagePrepareInput): Promise<Message>;
1640
+ /**
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 });
1646
+ */
1647
+ reply(options: string | (MessageSendOptions & ReplyOptions), replyOptions?: ReplyOptions): Promise<Message>;
1648
+ /**
1649
+ * Hydrate a partial message, or return the message as-is.
1650
+ * @example
1651
+ * client.on(Events.MessageUpdate, async (_old, msg) => {
1652
+ * const message = await Message.resolve(msg);
1653
+ * });
1654
+ */
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;
1668
+ /**
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.
1671
+ */
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;
1747
1696
  after?: string;
1748
- userId?: string;
1749
- actionType?: AuditLogActionType;
1750
- }): Promise<AuditLogFetchPayload>;
1751
- /** Edit guild settings. Requires guild owner or Administrator. */
1752
- edit(options: GuildEditOptions): Promise<this>;
1753
- /** Fetch the guild's vanity invite URL (if available). */
1754
- fetchVanityURL(): Promise<VanityURLPayload>;
1755
- /** Edit the guild's vanity invite code. */
1756
- editVanityURL(code: string | null): Promise<VanityURLPayload>;
1757
- /** Fetch the guild's discovery status. */
1758
- fetchDiscoveryStatus(): Promise<DiscoveryStatusPayload>;
1759
- /** Apply for guild discovery. */
1760
- applyForDiscovery(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
1761
- /** Edit an existing discovery application. */
1762
- editDiscoveryApplication(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
1763
- /** Withdraw the guild's discovery application. */
1764
- withdrawDiscoveryApplication(): Promise<void>;
1765
- /** Delete this guild (owner only). User accounts may need sudo/MFA in `options`. */
1766
- delete(options?: SudoVerificationOptions): Promise<void>;
1767
- /** Transfer guild ownership to another user (owner only). */
1768
- transferOwnership(newOwnerId: string, password?: string): Promise<void>;
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
+ }>;
1707
+ }
1708
+
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;
1720
+ }
1721
+ /** One channel's slice of a bulk message fetch. */
1722
+ interface BulkFetchMessagesChannelResult {
1723
+ channelId: string;
1724
+ messages: Collection<string, Message>;
1725
+ }
1726
+ /** Result of {@link MessageManager.bulkFetch}: per-channel message collections. */
1727
+ interface BulkFetchMessagesResult {
1728
+ channels: BulkFetchMessagesChannelResult[];
1729
+ }
1730
+ /**
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).
1735
+ */
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;
1756
+ }
1757
+
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];
1772
+ }
1773
+ /**
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}`));
1780
+ */
1781
+ declare class MessageCollector extends EventEmitter {
1782
+ readonly client: Client;
1783
+ 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;
1791
+ /**
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`).
1797
+ */
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;
1769
1803
  }
1770
1804
 
1771
1805
  /**
@@ -1847,7 +1881,7 @@ declare function resolveCacheLimits(input?: CacheSizeLimits): ResolvedCacheOptio
1847
1881
  * @example
1848
1882
  * ```ts
1849
1883
  * const client = new Client({
1850
- * instance: { api: 'https://api.example.com' },
1884
+ * instance: { api_public: 'https://api.example.com' },
1851
1885
  * cache: { guilds: 100, messages: 20 },
1852
1886
  * waitForGuilds: true,
1853
1887
  * });
@@ -1858,32 +1892,51 @@ interface ClientOptions {
1858
1892
  * Instance endpoints for this client (API, CDN, invite, etc.).
1859
1893
  * Pass a partial map to override hosted defaults, or a full discovery document.
1860
1894
  * Prefer this over `rest.api` for multi-instance / self-hosted bots.
1895
+ * REST uses `api_public`; `api` / `api_client` are kept for inspection.
1861
1896
  * @see {@link Client.fromDiscovery}
1862
1897
  */
1863
1898
  instance?: Partial<APIInstanceEndpoints> | APIInstance;
1864
1899
  /**
1865
1900
  * REST options. Prefer {@link ClientOptions.instance} for the API host.
1866
- * If both `instance.api` (or resolved default) and `rest.api` are set and differ, construction throws.
1901
+ * If both `instance.api_public` (or resolved default) and `rest.api` are set and differ, construction throws.
1867
1902
  */
1868
1903
  rest?: Partial<ConstructorParameters<typeof REST>[0]>;
1869
1904
  /**
1870
- * Gateway intents (Fluxer currently always sends `0`).
1871
- * Reserved for future use.
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`.
1872
1912
  */
1873
1913
  intents?: number;
1874
- /** Silence the intents-not-supported warning. */
1914
+ /**
1915
+ * @deprecated No-op. Fluxer has no intents warning to suppress.
1916
+ */
1875
1917
  suppressIntentWarning?: boolean;
1876
- /** {@link GatewayIdentifyFlags} bitfield sent as Identify `flags`. */
1918
+ /** {@link import('@fluxerjs/types').GatewayIdentifyFlags} bitfield sent as Identify `flags`. */
1877
1919
  identifyFlags?: number;
1878
1920
  /** Dispatch event names to suppress for this session (`ignored_events`). */
1879
1921
  ignoredEvents?: string[];
1880
1922
  /** Prefer hydrating this guild first after READY (`initial_guild_id`). */
1881
1923
  initialGuildId?: string;
1882
1924
  /**
1883
- * Delay Ready until all READY guilds arrive via GUILD_CREATE; queue other dispatches until then.
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.
1884
1928
  * @default false
1929
+ * @see {@link ClientOptions.emitGuildCreateOnStartup}
1885
1930
  */
1886
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;
1887
1940
  /**
1888
1941
  * Cache size limits per bucket. Defaults to {@link DEFAULT_CACHE_LIMITS}.
1889
1942
  * Pass `0` / `Infinity` per numeric field for unbounded; `messages: false` to disable message caching.
@@ -1917,13 +1970,51 @@ interface ClientOptions {
1917
1970
  defaultReplyPing?: boolean;
1918
1971
  /**
1919
1972
  * Initial presence on identify (also updatable via `client.user.setPresence`).
1973
+ * CamelCase only; mapped to gateway wire internally.
1920
1974
  */
1921
- presence?: GatewayPresenceUpdateData;
1975
+ presence?: PresenceUpdateOptions;
1922
1976
  /**
1923
1977
  * Emit gateway debug strings.
1924
1978
  * @default true
1925
1979
  */
1926
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[];
1995
+ /**
1996
+ * Alias of {@link shardIds}.
1997
+ * @deprecated Prefer {@link shardIds}.
1998
+ */
1999
+ shardList?: number[];
2000
+ /**
2001
+ * Guilds per shard when {@link shardCount} is `'auto'`.
2002
+ * @default 1500
2003
+ */
2004
+ guildsPerShard?: number;
2005
+ /**
2006
+ * Custom WebSocket sharding strategy builder (e.g. WorkerShardingStrategy).
2007
+ * @see {@link import('@fluxerjs/ws').WorkerShardingStrategy}
2008
+ */
2009
+ buildStrategy?: _fluxerjs_ws.BuildShardingStrategyFn;
2010
+ /**
2011
+ * Optional session store for RESUME across restarts (defaults to in-memory).
2012
+ */
2013
+ sessionStore?: _fluxerjs_ws.ISessionStore;
2014
+ /**
2015
+ * Optional identify throttler (e.g. parent-backed when under ShardingManager).
2016
+ */
2017
+ identifyThrottler?: _fluxerjs_ws.IIdentifyThrottler;
1927
2018
  /** Minimum log level for {@link Client.logger}. Default: `warn`. */
1928
2019
  logLevel?: LogLevel;
1929
2020
  /** Custom logger instance (overrides {@link logLevel} sink defaults). */
@@ -1973,7 +2064,10 @@ declare class CacheController {
1973
2064
  get cascading(): boolean;
1974
2065
  /** Current sizes for each cache bucket. */
1975
2066
  stats(): CacheStats;
1976
- sweepMessages(filter?: (message: APIMessage, channelId: string) => boolean, channelId?: string): number;
2067
+ /**
2068
+ * Sweep cached messages. Filter receives a hydrated {@link Message} (`createdAt`).
2069
+ */
2070
+ sweepMessages(filter?: (message: Message, channelId: string) => boolean, channelId?: string): number;
1977
2071
  sweepMembers(filter?: (member: GuildMember, guildId: string) => boolean): number;
1978
2072
  sweepUsers(filter?: (user: User, id: string) => boolean): number;
1979
2073
  /**
@@ -2007,15 +2101,24 @@ declare class CacheController {
2007
2101
  * Extends {@link LimitedCollection} (`.get()`, `.set()`, `.filter()`, …).
2008
2102
  * FIFO-evicts (and keeps guild indexes / message caches aligned) at `cache.channels`.
2009
2103
  */
2010
- declare class ChannelManager extends LimitedCollection<string, Channel | GuildChannel> {
2104
+ declare class ChannelManager extends LimitedCollection<string, Channel> {
2011
2105
  private readonly client;
2012
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
+ */
2013
2111
  delete(key: string): boolean;
2014
2112
  /** Retrieve from cache, otherwise {@link fetch}. */
2015
2113
  resolve(channelId: string): Promise<Channel>;
2016
2114
  /**
2017
- * Fetch a channel by ID.
2018
- * Returns the cached channel unless `force` is set, in which case REST metadata is applied.
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');
2019
2122
  * @throws {@link FluxerError} with CHANNEL_NOT_FOUND if missing
2020
2123
  */
2021
2124
  fetch(channelId: string, options?: {
@@ -2028,6 +2131,7 @@ declare class ChannelManager extends LimitedCollection<string, Channel | GuildCh
2028
2131
  fetchMessage(channelId: string, messageId: string): Promise<Message>;
2029
2132
  /**
2030
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.
2031
2135
  * @example
2032
2136
  * await client.channels.send(logChannelId, 'User joined!');
2033
2137
  */
@@ -2045,111 +2149,48 @@ declare class ClientUser extends User {
2045
2149
  fetchGuilds(options?: {
2046
2150
  withCounts?: boolean;
2047
2151
  }): Promise<PartialUserGuildPayload[]>;
2048
- /** DELETE /users/@me/guilds/{guild_id} */
2152
+ /**
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
+ */
2049
2161
  leaveGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
2050
2162
  /** Delete every message authored by the caller across a guild (sudo). */
2051
2163
  bulkDeleteMyMessagesInGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
2052
2164
  }
2053
2165
 
2054
- /** Options for GET /channels/{id}/messages. */
2055
- interface FetchMessagesOptions {
2056
- limit?: number;
2057
- before?: string;
2058
- after?: string;
2059
- around?: string;
2060
- }
2061
- /** Options for {@link Client.bulkFetchMessages}. */
2062
- interface BulkFetchMessagesOptions {
2063
- /** When true (default), hydrate {@link Message}s and update the cache. */
2064
- hydrate?: boolean;
2065
- }
2066
- /** One channel's slice of a bulk message fetch. */
2067
- interface BulkFetchMessagesChannelResult {
2068
- channelId: string;
2069
- messages: Collection<string, Message>;
2070
- }
2071
- /** Result of {@link MessageManager.bulkFetch}: per-channel message collections. */
2072
- interface BulkFetchMessagesResult {
2073
- channels: BulkFetchMessagesChannelResult[];
2074
- }
2075
2166
  /**
2076
- * Per-channel message cache + fetch. Access via `channel.messages`.
2077
- *
2078
- * `fetch` always writes through the client message cache (when enabled) and
2079
- * constructs {@link Message} from the cached payload so `get` stays coherent.
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.
2080
2170
  */
2081
- declare class MessageManager {
2082
- private readonly client;
2083
- private readonly channelId;
2084
- constructor(client: Client, channelId: string);
2085
- /** Retrieve a cached message by ID, or `undefined` if missing / caching disabled. */
2086
- get(messageId: string): Message | undefined;
2087
- /** Fetch a single message by ID. */
2088
- fetch(messageId: string): Promise<Message>;
2089
- /** Fetch multiple messages with query options (limit, before, after, around). */
2090
- fetch(options: FetchMessagesOptions): Promise<Collection<string, Message>>;
2091
- /** Cache API data and return a {@link Message} built from the cached entry when present. */
2092
- private wrap;
2093
- /** Fetch a single message from the API. */
2094
- private fetchOne;
2095
- /** Fetch multiple messages from the API with pagination/filtering. */
2096
- private fetchMany;
2097
- }
2098
-
2099
- /** Map a wire pack summary to camelCase. */
2100
- declare function toPackSummaryPayload(data: APIPackSummary): PackSummaryPayload;
2101
- /** CamelCase pack dashboard section. */
2102
- interface PackDashboardSectionPayload {
2103
- installedLimit: number;
2104
- createdLimit: number;
2105
- installed: PackSummaryPayload[];
2106
- created: PackSummaryPayload[];
2107
- }
2108
- /** CamelCase pack dashboard. */
2109
- interface PackDashboardPayload {
2110
- emoji: PackDashboardSectionPayload;
2111
- sticker: PackDashboardSectionPayload;
2112
- }
2113
- /** REST wrappers for `/packs/*`. Access via `client.packs`. */
2114
- declare class PackManager {
2171
+ declare class GuildManager extends LimitedCollection<string, Guild> {
2115
2172
  private readonly client;
2116
2173
  constructor(client: Client);
2117
- /** Fetch the current user's pack dashboard (camelCase summaries). */
2118
- fetchDashboard(): Promise<PackDashboardPayload>;
2119
- /** Create a pack. */
2120
- create(packType: PackType, body: PackCreateOptions): Promise<PackSummaryPayload>;
2121
- /** Edit a pack. */
2122
- edit(packId: string, body: PackEditOptions): Promise<PackSummaryPayload>;
2123
- /** Delete a pack. */
2124
- delete(packId: string): Promise<void>;
2125
- /** Install a pack for the current user. */
2126
- install(packId: string): Promise<void>;
2127
- /** Uninstall a pack for the current user. */
2128
- uninstall(packId: string): Promise<void>;
2129
- /** List invites for a pack. */
2130
- listInvites(packId: string): Promise<PackInvitePayload[]>;
2131
- /** Create an invite for a pack. */
2132
- createInvite(packId: string, options?: PackInviteCreateOptions): Promise<PackInvitePayload>;
2133
- /** List emojis in a pack. */
2134
- listEmojis(packId: string): Promise<PackEmojiPayload[]>;
2135
- /** Create an emoji in a pack. */
2136
- createEmoji(packId: string, options: ExpressionCreateOptions): Promise<PackEmojiPayload>;
2137
- /** Bulk-create emojis in a pack. */
2138
- createEmojisBulk(packId: string, emojis: ExpressionCreateOptions[]): Promise<PackBulkCreatePayload<PackEmojiPayload>>;
2139
- /** Edit an emoji in a pack. */
2140
- editEmoji(packId: string, emojiId: string, options: ExpressionEditOptions): Promise<PackEmojiPayload>;
2141
- /** Delete an emoji from a pack. */
2142
- deleteEmoji(packId: string, emojiId: string): Promise<void>;
2143
- /** List stickers in a pack. */
2144
- listStickers(packId: string): Promise<PackStickerPayload[]>;
2145
- /** Create a sticker in a pack. */
2146
- createSticker(packId: string, options: StickerCreateOptions): Promise<PackStickerPayload>;
2147
- /** Bulk-create stickers in a pack. */
2148
- createStickersBulk(packId: string, stickers: StickerCreateOptions[]): Promise<PackBulkCreatePayload<PackStickerPayload>>;
2149
- /** Edit a sticker in a pack. */
2150
- editSticker(packId: string, stickerId: string, options: StickerEditOptions): Promise<PackStickerPayload>;
2151
- /** Delete a sticker from a pack. */
2152
- deleteSticker(packId: string, stickerId: string): Promise<void>;
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>;
2186
+ /**
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
2190
+ */
2191
+ fetch(guildId: string, options?: {
2192
+ force?: boolean;
2193
+ }): Promise<Guild>;
2153
2194
  }
2154
2195
 
2155
2196
  type MemberPayload = APIGuildMember & {
@@ -2176,8 +2217,12 @@ declare class UserManager extends LimitedCollection<string, User> {
2176
2217
  constructor(client: Client);
2177
2218
  /** Remove matching users (skips `client.user`). Returns count removed. */
2178
2219
  sweep(filter?: (user: User, id: string) => boolean): number;
2179
- /** Fetch a user by ID and update cache. */
2180
- fetch(userId: string): Promise<User>;
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>;
2181
2226
  /**
2182
2227
  * Fetch user + profiles (+ optional guild member). Ideal for userinfo commands.
2183
2228
  * @example
@@ -2245,6 +2290,12 @@ declare const Events: {
2245
2290
  readonly Resumed: "resumed";
2246
2291
  readonly Error: "error";
2247
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";
2248
2299
  };
2249
2300
 
2250
2301
  /** Hosted Fluxer production endpoints (default when no instance is configured). */
@@ -2255,6 +2306,13 @@ interface ResolvedInstance {
2255
2306
  /** Full discovery document when available (fromDiscovery / fetchInstance). */
2256
2307
  readonly discovery: Readonly<APIInstance> | null;
2257
2308
  }
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;
2258
2316
  /** Strip trailing `/vN` and trailing slash from an API origin. */
2259
2317
  declare function normalizeApiOrigin(api: string): string;
2260
2318
  /**
@@ -2270,42 +2328,6 @@ declare function resolveInstanceEndpoints(input?: Partial<APIInstanceEndpoints>
2270
2328
  /** Build an invite URL for a code using the instance invite base. */
2271
2329
  declare function inviteUrl(inviteBase: string, code: string): string;
2272
2330
 
2273
- /** Options for {@link MessageCollector} / `channel.createMessageCollector()`. */
2274
- interface MessageCollectorOptions {
2275
- /** Filter function. Return true to collect the message. */
2276
- filter?: (message: Message) => boolean;
2277
- /** Max duration in ms. Collector stops when time expires. */
2278
- time?: number;
2279
- /** Max messages to collect. Collector stops when limit reached. */
2280
- max?: number;
2281
- }
2282
- type MessageCollectorEndReason = 'time' | 'limit' | 'user';
2283
- /** Typed event map for {@link MessageCollector}: `collect` per message, `end` when it stops. */
2284
- interface MessageCollectorEvents {
2285
- collect: [message: Message];
2286
- end: [collected: Collection<string, Message>, reason: MessageCollectorEndReason];
2287
- }
2288
- /**
2289
- * Collects messages in a channel. Use channel.createMessageCollector().
2290
- * @example
2291
- * const collector = channel.createMessageCollector({ filter: m => m.author.id === userId, time: 10000 });
2292
- * collector.on('collect', m => console.log(m.content));
2293
- * collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
2294
- */
2295
- declare class MessageCollector extends EventEmitter {
2296
- readonly client: Client;
2297
- readonly channelId: string;
2298
- readonly options: Required<MessageCollectorOptions>;
2299
- readonly collected: Collection<string, Message>;
2300
- private _timeout;
2301
- private _ended;
2302
- private _listener;
2303
- constructor(client: Client, channelId: string, options?: MessageCollectorOptions);
2304
- stop(reason?: MessageCollectorEndReason): void;
2305
- on<K extends keyof MessageCollectorEvents>(event: K, listener: (...args: MessageCollectorEvents[K]) => void): this;
2306
- emit<K extends keyof MessageCollectorEvents>(event: K, ...args: MessageCollectorEvents[K]): boolean;
2307
- }
2308
-
2309
2331
  type FetchPinnedMessagesOptions = {
2310
2332
  limit?: number;
2311
2333
  before?: string;
@@ -2316,17 +2338,62 @@ type PinnedMessagesPage = {
2316
2338
  hasMore: boolean;
2317
2339
  };
2318
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;
2356
+ }
2357
+
2358
+ /** Options for {@link PermissionOverwriteManager.edit}. */
2359
+ interface PermissionOverwriteEditOptions {
2360
+ type: OverwriteType;
2361
+ allow?: PermissionResolvable;
2362
+ deny?: PermissionResolvable;
2363
+ }
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;
2384
+ }
2385
+
2319
2386
  /** A channel in a guild (text, voice, category, etc.). */
2320
2387
  declare class GuildChannel extends Channel {
2321
- /** Guild ID this channel belongs to. */
2322
- readonly guildId: string;
2388
+ /** Guild ID this channel belongs to, or null if missing from the payload. */
2389
+ readonly guildId: string | null;
2323
2390
  name: string | null;
2324
2391
  /** Position in the channel list. */
2325
2392
  position?: number;
2326
2393
  /** Parent category ID, or null if none. */
2327
2394
  parentId: string | null;
2328
2395
  /** Permission overwrites for roles/members. */
2329
- permissionOverwrites: APIChannelOverwrite[];
2396
+ readonly permissionOverwrites: PermissionOverwriteManager;
2330
2397
  constructor(client: Client, data: APIChannel);
2331
2398
  /**
2332
2399
  * Apply guild-channel fields in place.
@@ -2344,32 +2411,22 @@ declare class GuildChannel extends Channel {
2344
2411
  createInvite(options?: ChannelInviteCreateOptions): Promise<Invite>;
2345
2412
  /** Fetch all invites for this channel. Requires Manage Channels. */
2346
2413
  fetchInvites(): Promise<Invite[]>;
2347
- /** Edit or create a permission overwrite. Requires Manage Roles. */
2348
- editPermission(overwriteId: string, options: {
2349
- type: OverwriteType;
2350
- allow?: string;
2351
- deny?: string;
2352
- }): Promise<void>;
2353
- /** Delete a permission overwrite. Requires Manage Roles. */
2354
- deletePermission(overwriteId: string): Promise<void>;
2355
- /** Check if the bot can send messages in this channel (with permissions). */
2414
+ /** Check if the bot can send messages in this channel (cache-only; needs `members.me`). */
2356
2415
  canSendMessage(): boolean;
2416
+ /**
2417
+ * Like {@link canSendMessage}, but hydrates `members.me` via REST when missing.
2418
+ * Returns false when the channel has no guildId.
2419
+ */
2420
+ canSend(): Promise<boolean>;
2357
2421
  /** Edit this channel's settings. Requires Manage Channels. */
2358
2422
  edit(options: ChannelEditOptions): Promise<this>;
2359
2423
  protected applyEditPatch(_data: APIChannel): void;
2360
- /** Delete this channel. Requires Manage Channels or channel ownership. */
2361
- delete(options?: SudoVerificationOptions & {
2362
- silent?: boolean;
2363
- deleteMessages?: boolean;
2364
- }): Promise<void>;
2365
2424
  }
2366
2425
  declare const TextChannel_base: (abstract new (...args: any[]) => {
2367
- "__#private@#messages": MessageManager | undefined;
2368
2426
  send(options: MessagePrepareInput): Promise<Message>;
2369
- get messages(): MessageManager;
2370
- createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2371
2427
  fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
2372
2428
  fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
2429
+ "__#private@#messages": MessageManager | undefined;
2373
2430
  readonly client: Client;
2374
2431
  readonly id: string;
2375
2432
  type: _fluxerjs_types.ChannelType;
@@ -2379,7 +2436,10 @@ declare const TextChannel_base: (abstract new (...args: any[]) => {
2379
2436
  get createdTimestamp(): number;
2380
2437
  get createdAt(): Date;
2381
2438
  _patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
2382
- isTextBased(): this is TextChannel | DMChannel;
2439
+ isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
2440
+ isGuild(): this is GuildChannel;
2441
+ isText(): this is TextChannel;
2442
+ isCategory(): this is CategoryChannel;
2383
2443
  isDM(): this is DMChannel;
2384
2444
  isPersonalNotes(): boolean;
2385
2445
  isVoice(): this is VoiceChannel;
@@ -2395,6 +2455,17 @@ declare const TextChannel_base: (abstract new (...args: any[]) => {
2395
2455
  fetchRtcRegions(): Promise<RtcRegionPayload[]>;
2396
2456
  fetchSlowmode(): Promise<ChannelSlowmodePayload>;
2397
2457
  canSendMessage(): boolean;
2458
+ get messages(): MessageManager;
2459
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2460
+ awaitMessages(options?: MessageCollectorOptions & {
2461
+ errors?: MessageCollectorEndReason[];
2462
+ }): Promise<_fluxerjs_collection.Collection<string, Message>>;
2463
+ delete(options?: SudoVerificationOptions & {
2464
+ silent?: boolean;
2465
+ deleteMessages?: boolean;
2466
+ reason?: string;
2467
+ }): Promise<void>;
2468
+ toString(): string;
2398
2469
  }) & typeof GuildChannel;
2399
2470
  /** A text channel in a guild (supports sending messages). */
2400
2471
  declare class TextChannel extends TextChannel_base {
@@ -2402,25 +2473,104 @@ declare class TextChannel extends TextChannel_base {
2402
2473
  topic?: string | null;
2403
2474
  /** Whether this channel is marked as NSFW. */
2404
2475
  nsfw?: boolean;
2476
+ /** Per-channel NSFW override (`null` inherits). */
2477
+ nsfwOverride?: boolean | null;
2405
2478
  /** Slowmode rate limit in seconds. */
2406
2479
  rateLimitPerUser?: number;
2407
2480
  /** ID of the last message sent in this channel. */
2408
2481
  lastMessageId?: string | null;
2482
+ /** Content warning level. */
2483
+ contentWarningLevel?: number | null;
2484
+ /** Custom content warning text. */
2485
+ contentWarningText?: string | null;
2409
2486
  constructor(client: Client, data: APIChannel);
2487
+ /**
2488
+ * Set slowmode (seconds between messages). Pass `0` to disable.
2489
+ * Requires Manage Channels. Calls {@link GuildChannel.edit} with `rateLimitPerUser`.
2490
+ */
2491
+ setSlowmode(seconds: number): Promise<this>;
2410
2492
  protected applyEditPatch(data: APIChannel): void;
2411
2493
  }
2412
2494
  /** A category channel (container for organizing channels). */
2413
2495
  declare class CategoryChannel extends GuildChannel {
2414
2496
  }
2415
- /** A voice channel in a guild. */
2416
- declare class VoiceChannel extends GuildChannel {
2497
+ declare const VoiceChannel_base: (abstract new (...args: any[]) => {
2498
+ send(options: MessagePrepareInput): Promise<Message>;
2499
+ fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
2500
+ fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
2501
+ "__#private@#messages": MessageManager | undefined;
2502
+ readonly client: Client;
2503
+ readonly id: string;
2504
+ type: _fluxerjs_types.ChannelType;
2505
+ name: string | null;
2506
+ icon: string | null;
2507
+ lastPinTimestamp: string | null;
2508
+ get createdTimestamp(): number;
2509
+ get createdAt(): Date;
2510
+ _patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
2511
+ isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
2512
+ isGuild(): this is GuildChannel;
2513
+ isText(): this is TextChannel;
2514
+ isCategory(): this is CategoryChannel;
2515
+ isDM(): this is DMChannel;
2516
+ isPersonalNotes(): boolean;
2517
+ isVoice(): this is VoiceChannel;
2518
+ isLink(): this is LinkChannel;
2519
+ bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
2520
+ bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
2521
+ acknowledgePins(): Promise<void>;
2522
+ clearReadState(): Promise<void>;
2523
+ requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
2524
+ completeAttachmentUploads(uploads: AttachmentUploadCompleteItem[]): Promise<AttachmentUploadCompleteResponse>;
2525
+ uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
2526
+ sendTyping(): Promise<void>;
2527
+ fetchRtcRegions(): Promise<RtcRegionPayload[]>;
2528
+ fetchSlowmode(): Promise<ChannelSlowmodePayload>;
2529
+ canSendMessage(): boolean;
2530
+ get messages(): MessageManager;
2531
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2532
+ awaitMessages(options?: MessageCollectorOptions & {
2533
+ errors?: MessageCollectorEndReason[];
2534
+ }): Promise<_fluxerjs_collection.Collection<string, Message>>;
2535
+ delete(options?: SudoVerificationOptions & {
2536
+ silent?: boolean;
2537
+ deleteMessages?: boolean;
2538
+ reason?: string;
2539
+ }): Promise<void>;
2540
+ toString(): string;
2541
+ }) & typeof GuildChannel;
2542
+ /** A voice channel in a guild. Voice is text-capable on Fluxer. */
2543
+ declare class VoiceChannel extends VoiceChannel_base {
2544
+ /** Guild ID. Voice channels always belong to a guild. */
2545
+ readonly guildId: string;
2546
+ /** Channel topic. */
2547
+ topic?: string | null;
2548
+ /** Whether this channel is marked as NSFW. */
2549
+ nsfw?: boolean;
2550
+ /** Per-channel NSFW override (`null` inherits). */
2551
+ nsfwOverride?: boolean | null;
2552
+ /** Slowmode rate limit in seconds. */
2553
+ rateLimitPerUser?: number;
2554
+ /** ID of the last message sent in this channel. */
2555
+ lastMessageId?: string | null;
2556
+ /** Content warning level. */
2557
+ contentWarningLevel?: number | null;
2558
+ /** Custom content warning text. */
2559
+ contentWarningText?: string | null;
2417
2560
  /** Voice bitrate. */
2418
2561
  bitrate?: number | null;
2419
2562
  /** Maximum number of users allowed. */
2420
2563
  userLimit?: number | null;
2564
+ /** Max active voice connections per user. */
2565
+ voiceConnectionLimit?: number | null;
2421
2566
  /** RTC region override for this channel. */
2422
2567
  rtcRegion?: string | null;
2423
2568
  constructor(client: Client, data: APIChannel);
2569
+ /**
2570
+ * Set slowmode (seconds between messages). Pass `0` to disable.
2571
+ * Requires Manage Channels. Calls {@link GuildChannel.edit} with `rateLimitPerUser`.
2572
+ */
2573
+ setSlowmode(seconds: number): Promise<this>;
2424
2574
  protected applyEditPatch(data: APIChannel): void;
2425
2575
  }
2426
2576
  /** A link channel (redirects to an external URL). */
@@ -2428,15 +2578,14 @@ declare class LinkChannel extends GuildChannel {
2428
2578
  /** External URL this channel links to. */
2429
2579
  url: string | null;
2430
2580
  constructor(client: Client, data: APIChannel);
2581
+ protected applyEditPatch(data: APIChannel): void;
2431
2582
  }
2432
2583
 
2433
2584
  declare const DMChannel_base: (abstract new (...args: any[]) => {
2434
- "__#private@#messages": MessageManager | undefined;
2435
2585
  send(options: MessagePrepareInput): Promise<Message>;
2436
- get messages(): MessageManager;
2437
- createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2438
2586
  fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
2439
2587
  fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
2588
+ "__#private@#messages": MessageManager | undefined;
2440
2589
  readonly client: Client;
2441
2590
  readonly id: string;
2442
2591
  type: ChannelType;
@@ -2446,7 +2595,10 @@ declare const DMChannel_base: (abstract new (...args: any[]) => {
2446
2595
  get createdTimestamp(): number;
2447
2596
  get createdAt(): Date;
2448
2597
  _patch(data: APIChannelPartial | APIChannel): void;
2449
- isTextBased(): this is TextChannel | DMChannel;
2598
+ isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
2599
+ isGuild(): this is GuildChannel;
2600
+ isText(): this is TextChannel;
2601
+ isCategory(): this is CategoryChannel;
2450
2602
  isDM(): this is DMChannel;
2451
2603
  isPersonalNotes(): boolean;
2452
2604
  isVoice(): this is VoiceChannel;
@@ -2462,6 +2614,17 @@ declare const DMChannel_base: (abstract new (...args: any[]) => {
2462
2614
  fetchRtcRegions(): Promise<RtcRegionPayload[]>;
2463
2615
  fetchSlowmode(): Promise<ChannelSlowmodePayload>;
2464
2616
  canSendMessage(): boolean;
2617
+ get messages(): MessageManager;
2618
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2619
+ awaitMessages(options?: MessageCollectorOptions & {
2620
+ errors?: MessageCollectorEndReason[];
2621
+ }): Promise<_fluxerjs_collection.Collection<string, Message>>;
2622
+ delete(options?: SudoVerificationOptions & {
2623
+ silent?: boolean;
2624
+ deleteMessages?: boolean;
2625
+ reason?: string;
2626
+ }): Promise<void>;
2627
+ toString(): string;
2465
2628
  }) & typeof Channel;
2466
2629
  /** DM / Group DM / personal notes channel. */
2467
2630
  declare class DMChannel extends DMChannel_base {
@@ -2474,13 +2637,35 @@ declare class DMChannel extends DMChannel_base {
2474
2637
  /** Custom nicknames for users in a group DM. */
2475
2638
  nicks: Record<string, string>;
2476
2639
  constructor(client: Client, data: APIChannelPartial | APIChannel);
2477
- /** Purge all messages from personal notes. Only works on personal notes channels. */
2640
+ /**
2641
+ * Apply DM/group-DM fields in place.
2642
+ * @internal
2643
+ */
2644
+ _patch(data: APIChannelPartial | APIChannel): void;
2645
+ /**
2646
+ * Edit this group DM (name, icon, nicks).
2647
+ * Transferring ownership to a bot fails (`CannotTransferOwnershipToBotError`).
2648
+ */
2649
+ edit(options: GroupDmEditOptions): Promise<this>;
2650
+ /**
2651
+ * Purge all messages from personal notes. Only works on personal notes channels.
2652
+ * Notes-only; bots usually skip this.
2653
+ */
2478
2654
  purgeMessages(): Promise<number>;
2479
- /** Pin this DM channel to the top of the DM list. */
2655
+ /**
2656
+ * Pin this DM channel to the top of the DM list.
2657
+ * Session-token helper; bots usually skip this.
2658
+ */
2480
2659
  pinInList(): Promise<void>;
2481
- /** Unpin this DM channel from the DM list. */
2660
+ /**
2661
+ * Unpin this DM channel from the DM list.
2662
+ * Session-token helper; bots usually skip this.
2663
+ */
2482
2664
  unpinFromList(): Promise<void>;
2483
- /** Add a user to this group DM. */
2665
+ /**
2666
+ * Add a user to this group DM.
2667
+ * Captcha-gated when captcha is enabled; bots are not exempt (`CaptchaRequiredError`).
2668
+ */
2484
2669
  addRecipient(userId: string): Promise<void>;
2485
2670
  /** Remove a user from this group DM. */
2486
2671
  removeRecipient(userId: string, options?: {
@@ -2488,8 +2673,14 @@ declare class DMChannel extends DMChannel_base {
2488
2673
  }): Promise<void>;
2489
2674
  }
2490
2675
 
2491
- /** Base class for all channel types. */
2676
+ /**
2677
+ * Base class for all channel types.
2678
+ * `client.channels.fetch` and `message.resolveChannel` return this type; call `delete` on it.
2679
+ * Text-capable channels (`isTextBased`) also have `send`.
2680
+ * Narrow with `isTextBased` / `isGuild`.
2681
+ */
2492
2682
  declare abstract class Channel extends Base {
2683
+ #private;
2493
2684
  /** The {@link Client} that instantiated this channel. */
2494
2685
  readonly client: Client;
2495
2686
  /** Snowflake ID of this channel. */
@@ -2512,12 +2703,23 @@ declare abstract class Channel extends Base {
2512
2703
  * @internal
2513
2704
  */
2514
2705
  _patch(data: APIChannelPartial | APIChannel): void;
2515
- /** Wired in `structures/channel/index.ts` after subclasses load. */
2706
+ /** @internal Factory wired after subclasses load. */
2516
2707
  static from(_c: Client, _d: APIChannel | APIChannelPartial): GuildChannel | TextChannel;
2708
+ /** @internal Factory wired after subclasses load. */
2517
2709
  static fromOrCreate(_c: Client, _d: APIChannel | APIChannelPartial): TextChannel | DMChannel | GuildChannel;
2710
+ /** @internal Factory wired after subclasses load. */
2518
2711
  static createDM(_c: Client, _d: APIChannelPartial): DMChannel;
2519
- /** Check if this channel supports sending messages (text/DM). */
2520
- isTextBased(): this is TextChannel | DMChannel;
2712
+ /**
2713
+ * Whether this channel type can carry messages (text, voice, DM, group DM, notes).
2714
+ * Checks {@link ChannelType}, not whether `send` exists on the instance.
2715
+ */
2716
+ isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
2717
+ /** Check if this is a guild channel (text, voice, category, or link). */
2718
+ isGuild(): this is GuildChannel;
2719
+ /** Check if this is a guild text channel. */
2720
+ isText(): this is TextChannel;
2721
+ /** Check if this is a category channel. */
2722
+ isCategory(): this is CategoryChannel;
2521
2723
  /** Check if this is a DM, group DM, or personal notes channel. */
2522
2724
  isDM(): this is DMChannel;
2523
2725
  /** Check if this is a personal notes channel. */
@@ -2532,11 +2734,17 @@ declare abstract class Channel extends Base {
2532
2734
  * - `bulkDelete(['id1'])` — single DELETE; 2–100 uses bulk-delete route
2533
2735
  */
2534
2736
  bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
2535
- /** Delete all messages sent by the bot in this channel (user account feature). */
2737
+ /** Delete all messages sent by the bot in this channel. Sudo auto-passes for bots. */
2536
2738
  bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
2537
- /** Mark all pinned messages as read in this channel. */
2739
+ /**
2740
+ * Mark all pinned messages as read in this channel.
2741
+ * Session-token helper; bots usually skip this.
2742
+ */
2538
2743
  acknowledgePins(): Promise<void>;
2539
- /** Clear the read state for this channel. */
2744
+ /**
2745
+ * Clear the read state for this channel.
2746
+ * Session-token helper; bots usually skip this.
2747
+ */
2540
2748
  clearReadState(): Promise<void>;
2541
2749
  /** Request upload URLs for attachments before sending a message. */
2542
2750
  requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
@@ -2546,19 +2754,61 @@ declare abstract class Channel extends Base {
2546
2754
  uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
2547
2755
  /** Trigger the typing indicator in this channel. */
2548
2756
  sendTyping(): Promise<void>;
2549
- /** Fetch available RTC regions for voice channels. */
2757
+ /**
2758
+ * Fetch available RTC regions for voice channels.
2759
+ * User-account only (`DefaultUserOnly`); bots receive `AccessDeniedError`.
2760
+ * Bots should skip this and join voice with `@fluxerjs/voice` instead.
2761
+ */
2550
2762
  fetchRtcRegions(): Promise<RtcRegionPayload[]>;
2551
2763
  /** Fetch slowmode state for this channel. */
2552
2764
  fetchSlowmode(): Promise<ChannelSlowmodePayload>;
2553
- /** Check if the bot can send messages in this channel. */
2765
+ /** Whether this channel type can carry messages (does not check permissions). */
2554
2766
  canSendMessage(): boolean;
2767
+ /** Per-channel message cache + fetch. */
2768
+ get messages(): MessageManager;
2769
+ /** Collect messages in this channel until time/max/stop. */
2770
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
2771
+ /**
2772
+ * Wait for messages matching the filter, then resolve the collected set.
2773
+ * Pass `errors: ['time']` to reject when the timer fires instead of resolving.
2774
+ * @example
2775
+ * const collected = await channel.awaitMessages({ max: 1, time: 15_000 });
2776
+ */
2777
+ awaitMessages(options?: MessageCollectorOptions & {
2778
+ errors?: MessageCollectorEndReason[];
2779
+ }): Promise<Collection<string, Message>>;
2780
+ /**
2781
+ * Delete this channel (or close it if it is a DM).
2782
+ * Guild channels require Manage Channels. `silent` / `deleteMessages` are Fluxer query params.
2783
+ * @example
2784
+ * const channel = await client.channels.fetch(channelId);
2785
+ * await channel.delete();
2786
+ */
2787
+ delete(options?: SudoVerificationOptions & {
2788
+ silent?: boolean;
2789
+ deleteMessages?: boolean;
2790
+ reason?: string;
2791
+ }): Promise<void>;
2792
+ /** Channel mention (`<#id>`). */
2793
+ toString(): string;
2555
2794
  }
2556
2795
 
2796
+ /** Channel types that can carry messages (guild text, guild voice, DMs). */
2797
+ type TextBasedChannel = TextChannel | VoiceChannel | DMChannel;
2798
+
2799
+ /** Member payload plus fields that exist on update/edit but not always on GET. */
2800
+ type GuildMemberData = APIGuildMember & {
2801
+ guild_id?: string;
2802
+ bio?: string | null;
2803
+ pronouns?: string | null;
2804
+ };
2557
2805
  /**
2558
2806
  * Guild member — roles via {@link GuildMember.roles}, permissions via {@link permissions} / {@link permissionsIn}.
2559
2807
  * Cached per guild in {@link Guild.members}.
2560
2808
  */
2561
2809
  declare class GuildMember extends Base {
2810
+ /** Discriminant vs {@link PartialGuildMember}: always `false` on a hydrated member. */
2811
+ readonly partial: false;
2562
2812
  /** Parent client instance. */
2563
2813
  readonly client: Client;
2564
2814
  /** User ID (same as `user.id`). */
@@ -2587,14 +2837,18 @@ declare class GuildMember extends Base {
2587
2837
  accentColor: number | null;
2588
2838
  /** Guild-specific profile flags. */
2589
2839
  profileFlags: number | null;
2590
- constructor(client: Client, data: APIGuildMember & {
2591
- guild_id?: string;
2592
- }, guild: Guild);
2840
+ /** Per-guild reply mention preference override. */
2841
+ mentionFlags: number | null;
2842
+ /** Guild-specific bio (set from member edit; not always on GET member). */
2843
+ bio: string | null;
2844
+ /** Guild-specific pronouns (set from member edit; not always on GET member). */
2845
+ pronouns: string | null;
2846
+ constructor(client: Client, data: GuildMemberData, guild: Guild);
2593
2847
  /**
2594
2848
  * Apply an API member payload in place (gateway GUILD_MEMBER_UPDATE / REST edit).
2595
2849
  * @internal
2596
2850
  */
2597
- _patch(data: APIGuildMember): void;
2851
+ _patch(data: GuildMemberData): void;
2598
2852
  /**
2599
2853
  * Snapshot for `guildMemberUpdate` old-member arg (before in-place patch).
2600
2854
  * @internal
@@ -2615,7 +2869,11 @@ declare class GuildMember extends Base {
2615
2869
  size?: number;
2616
2870
  extension?: string;
2617
2871
  }): string | null;
2618
- /** PATCH member (`/members/@me` when editing the bot). */
2872
+ /**
2873
+ * PATCH member (`/members/@me` when editing the bot).
2874
+ * @example
2875
+ * await member.edit({ nick: 'Ada' });
2876
+ */
2619
2877
  edit(options: GuildMemberEditOptions): Promise<this>;
2620
2878
  /**
2621
2879
  * Guild-level permissions (roles only, no channel overwrites).
@@ -2634,6 +2892,31 @@ declare class GuildMember extends Base {
2634
2892
  * @param connectionId - Optional connection ID for multi-session scenarios
2635
2893
  */
2636
2894
  move(channelId: string | null, connectionId?: string | null): Promise<void>;
2895
+ /** Kick this member. Requires Kick Members. */
2896
+ kick(reason?: string): Promise<void>;
2897
+ /** Ban this member. Requires Ban Members. */
2898
+ ban(options?: GuildBanOptions): Promise<void>;
2899
+ /**
2900
+ * Whether the bot can kick this member (cache-only; needs `members.me`).
2901
+ * False for the guild owner, self, or when the bot lacks Kick Members / role hierarchy.
2902
+ */
2903
+ get kickable(): boolean;
2904
+ /**
2905
+ * Whether the bot can ban this member (cache-only; needs `members.me`).
2906
+ */
2907
+ get bannable(): boolean;
2908
+ /**
2909
+ * Whether the bot can timeout this member (cache-only; needs `members.me`).
2910
+ */
2911
+ get moderatable(): boolean;
2912
+ private _moderatableWith;
2913
+ /** Negative when this member's highest role is below `other`'s. */
2914
+ private _compareRolePosition;
2915
+ /**
2916
+ * Timeout this member for `durationMs` milliseconds, or pass `null` to clear.
2917
+ * Requires Moderate Members.
2918
+ */
2919
+ timeout(durationMs: number | null, reason?: string): Promise<this>;
2637
2920
  private _effectivePermissions;
2638
2921
  private _basePermissions;
2639
2922
  }
@@ -2645,7 +2928,7 @@ declare class GuildMember extends Base {
2645
2928
  interface ClientEvents {
2646
2929
  [Events.Ready]: [];
2647
2930
  [Events.MessageCreate]: [message: Message];
2648
- [Events.MessageUpdate]: [oldMessage: Message | null, newMessage: Message];
2931
+ [Events.MessageUpdate]: [oldMessage: Message | null, newMessage: Message | PartialMessage];
2649
2932
  [Events.MessageDelete]: [message: PartialMessage];
2650
2933
  [Events.MessageReactionAdd]: [payload: MessageReactionPayload];
2651
2934
  [Events.MessageReactionAddMany]: [payload: MessageReactionAddManyPayload];
@@ -2663,7 +2946,7 @@ interface ClientEvents {
2663
2946
  [Events.ChannelDelete]: [channel: Channel];
2664
2947
  [Events.GuildMemberAdd]: [member: GuildMember];
2665
2948
  [Events.GuildMemberUpdate]: [oldMember: GuildMember | null, newMember: GuildMember];
2666
- [Events.GuildMemberRemove]: [member: GuildMember];
2949
+ [Events.GuildMemberRemove]: [member: GuildMember | PartialGuildMember];
2667
2950
  [Events.GuildMembersChunk]: [payload: GuildMembersChunkPayload];
2668
2951
  [Events.GuildCountsUpdate]: [payload: GuildCountsUpdatePayload];
2669
2952
  [Events.ChannelMemberCountsUpdate]: [payload: ChannelMemberCountsUpdatePayload];
@@ -2680,8 +2963,10 @@ interface ClientEvents {
2680
2963
  [Events.GuildEmojisUpdate]: [payload: GuildEmojisUpdatePayload];
2681
2964
  [Events.GuildStickersUpdate]: [payload: GuildStickersUpdatePayload];
2682
2965
  [Events.GuildRoleCreate]: [role: Role];
2683
- [Events.GuildRoleUpdate]: [payload: GuildRoleUpdatePayload];
2684
- [Events.GuildRoleDelete]: [payload: GuildRoleDeletePayload];
2966
+ /** `oldRole` is null when the role was not cached before the update. */
2967
+ [Events.GuildRoleUpdate]: [oldRole: Role | null, role: Role];
2968
+ /** `role` is null when the role was not cached before delete. */
2969
+ [Events.GuildRoleDelete]: [role: Role | null, guildId: string, roleId: string];
2685
2970
  [Events.ChannelPinsUpdate]: [payload: ChannelPinsUpdatePayload];
2686
2971
  [Events.ChannelRecipientAdd]: [payload: ChannelRecipientPayload];
2687
2972
  [Events.ChannelRecipientRemove]: [payload: ChannelRecipientPayload];
@@ -2697,6 +2982,24 @@ interface ClientEvents {
2697
2982
  [Events.Resumed]: [];
2698
2983
  [Events.Error]: [error: Error];
2699
2984
  [Events.Debug]: [message: string];
2985
+ /** A single gateway shard completed READY. */
2986
+ [Events.ShardReady]: [shardId: number];
2987
+ /** A single gateway shard successfully resumed. */
2988
+ [Events.ShardResumed]: [shardId: number];
2989
+ /** A gateway shard closed. */
2990
+ [Events.ShardDisconnect]: [shardId: number, code: number];
2991
+ /** A gateway shard is reconnecting. */
2992
+ [Events.ShardReconnecting]: [shardId: number];
2993
+ /** A gateway shard emitted an error. */
2994
+ [Events.ShardError]: [shardId: number, error: Error];
2995
+ /**
2996
+ * The gateway closed with 4011 — this bot needs more shards.
2997
+ * Non-zero shards drop guild-less events; DMs only reach shard 0.
2998
+ */
2999
+ [Events.ShardingRequired]: [payload: {
3000
+ shardId: number;
3001
+ numShards: number;
3002
+ }];
2700
3003
  }
2701
3004
  type ClientEventName = keyof ClientEvents;
2702
3005
  type ClientEventListener<K extends ClientEventName> = (...args: ClientEvents[K]) => void;
@@ -2705,37 +3008,7 @@ type ClientEventMethods = {
2705
3008
  [K in keyof typeof Events]: (cb: (...args: ClientEvents[(typeof Events)[K]]) => void) => Client;
2706
3009
  };
2707
3010
 
2708
- /**
2709
- * Guild cache and manager with fetch.
2710
- * Extends {@link LimitedCollection} so you can use `.get()`, `.set()`, `.filter()`, etc.
2711
- * FIFO-evicts (and cascades nested caches) when at the resolved `cache.guilds` limit.
2712
- */
2713
- declare class GuildManager extends LimitedCollection<string, Guild> {
2714
- private readonly client;
2715
- constructor(client: Client);
2716
- /**
2717
- * Remove a guild and cascade its channels / message caches.
2718
- * FIFO eviction uses `onEvict` instead (via `super.delete` in LimitedCollection).
2719
- */
2720
- delete(key: string): boolean;
2721
- /**
2722
- * Get a guild from cache or fetch from the API if not present.
2723
- * @param guildId - Snowflake of the guild
2724
- * @returns The guild
2725
- * @throws FluxerError with GUILD_NOT_FOUND if missing
2726
- */
2727
- resolve(guildId: string): Promise<Guild>;
2728
- /**
2729
- * Fetch a guild by ID.
2730
- * Returns the cached guild unless `force` is set, in which case REST metadata is applied via `_patch`.
2731
- * @throws FluxerError with GUILD_NOT_FOUND if missing
2732
- */
2733
- fetch(guildId: string, options?: {
2734
- force?: boolean;
2735
- }): Promise<Guild>;
2736
- }
2737
-
2738
- /** Bootstrap origin for {@link Client.fromDiscovery}. */
3011
+ /** Bootstrap origin for {@link Client.fromDiscovery} (`GET {origin}/.well-known/fluxer`, unversioned). */
2739
3012
  type DiscoveryOrigin = string | {
2740
3013
  api: string;
2741
3014
  version?: string;
@@ -2757,19 +3030,30 @@ declare class Client extends EventEmitter {
2757
3030
  readonly users: UserManager;
2758
3031
  /** Cache limits, stats, sweeps, and cascade entry points. */
2759
3032
  readonly cache: CacheController;
2760
- /** Emoji/sticker pack REST wrappers (`/packs/*`). */
2761
- readonly packs: PackManager;
2762
- /** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
3033
+ /** Typed event handlers. Prefer `client.on(Events.*, ...)`. */
2763
3034
  readonly events: ClientEventMethods;
2764
3035
  /** The authenticated bot user. Null until READY is received. */
2765
3036
  user: ClientUser | null;
2766
3037
  /** Timestamp when the client became ready. Null until READY is received. */
2767
3038
  readyAt: Date | null;
3039
+ /**
3040
+ * Milliseconds since {@link readyAt}, or `null` if the client is not ready.
3041
+ * @example
3042
+ * client.on(Events.Ready, () => {
3043
+ * console.log(client.uptime);
3044
+ * });
3045
+ */
3046
+ get uptime(): number | null;
2768
3047
  /** @internal WebSocket manager. */
2769
3048
  _ws: WebSocketManager | null;
2770
3049
  /** When waitForGuilds, guild IDs still expected via GUILD_CREATE. */
2771
3050
  _pendingGuildIds: Set<string> | null;
2772
- /** @internal Timeout when READY has no guilds but waitForGuilds is set. */
3051
+ /** Guild IDs inserted as unavailable stubs from READY (startup / reconnect backfill). */
3052
+ _readyStubGuildIds: Set<string>;
3053
+ /**
3054
+ * @internal Empty-READY guild stream window.
3055
+ * Classifies incoming GUILD_CREATE as startup hydration. Also delays Ready when waitForGuilds.
3056
+ */
2773
3057
  _guildStreamSettleTimeout: ReturnType<typeof setTimeout> | null;
2774
3058
  /** @internal Dispatches queued until Ready when waitForGuilds delays Ready. */
2775
3059
  _deferredGatewayDispatches: GatewayReceivePayload[];
@@ -2781,10 +3065,12 @@ declare class Client extends EventEmitter {
2781
3065
  constructor(options?: ClientOptions);
2782
3066
  /**
2783
3067
  * Create a client from instance discovery (`GET /.well-known/fluxer`).
2784
- * Does not log in — call {@link login} with a token afterward.
3068
+ * Fetches the unversioned well-known document from the given origin (not `{api}/v1/.well-known/fluxer`).
3069
+ * Wires REST from `endpoints.api_public`. `endpoints.api` / `api_client` stay on the instance for inspection.
3070
+ * Does not log in. Call {@link login} with a token afterward.
2785
3071
  *
2786
- * @param origin - API origin used only to fetch discovery (e.g. `https://api.example.com`)
2787
- * @param options - Client options (must not conflict with discovered `endpoints.api`)
3072
+ * @param origin - Origin used only to fetch discovery (e.g. `https://fluxer.app` or `https://my.instance`)
3073
+ * @param options - Client options (must not conflict with discovered `endpoints.api_public`)
2788
3074
  * @param connectOptions - Optional abort signal for the discovery request
2789
3075
  */
2790
3076
  static fromDiscovery(origin: DiscoveryOrigin, options?: Omit<ClientOptions, 'instance'>, connectOptions?: {
@@ -2814,7 +3100,7 @@ declare class Client extends EventEmitter {
2814
3100
  animated?: boolean;
2815
3101
  }, guildId?: string | null): Promise<string>;
2816
3102
  /**
2817
- * Fetch instance discovery document (`/.well-known/fluxer`).
3103
+ * Fetch instance discovery document (unversioned `GET /.well-known/fluxer` on the REST host).
2818
3104
  * @returns Instance configuration (endpoints, features, metadata)
2819
3105
  */
2820
3106
  fetchInstance(): Promise<APIInstance>;
@@ -2841,35 +3127,38 @@ declare class Client extends EventEmitter {
2841
3127
  */
2842
3128
  fetchApplication(): Promise<APIApplicationMe>;
2843
3129
  /**
2844
- * Fetch OAuth2 applications owned by this bot.
2845
- * @returns Array of OAuth application objects
3130
+ * Fetch OAuth2 applications (`GET /oauth2/applications/@me`).
3131
+ * A bot token returns the bot application object (normalized to a one-element array).
3132
+ * A user token returns the owner's application list.
2846
3133
  */
2847
3134
  fetchOAuthApplications(): Promise<APIOAuthApplication[]>;
2848
- /**
2849
- * Check username#discriminator availability.
2850
- * @param username - Username to check
2851
- * @param discriminator - Discriminator to check
2852
- * @returns Availability result
2853
- */
2854
- checkUsernameTag(username: string, discriminator: string): Promise<APIUserTagCheck>;
2855
3135
  /**
2856
3136
  * Preload recent messages for multiple channels (batch endpoint).
2857
- * @param channelIds - Array of channel IDs to preload
2858
- * @returns Preload response with message counts/timestamps
3137
+ * Prefer this over {@link bulkFetchMessages} for bots (`bulkFetchMessages` is user-account only).
2859
3138
  */
2860
3139
  preloadMessages(channelIds: string[]): Promise<APIPreloadMessagesResponse>;
2861
3140
  /**
2862
3141
  * Preload recent messages (alternate endpoint).
2863
- * @param channelIds - Array of channel IDs to preload
2864
- * @returns Preload response with message counts/timestamps
3142
+ * Prefer this over {@link bulkFetchMessages} for bots.
2865
3143
  */
2866
3144
  preloadMessagesAlt(channelIds: string[]): Promise<APIPreloadMessagesResponse>;
3145
+ /**
3146
+ * Multi-channel message fetch (`POST /channels/messages/bulk`).
3147
+ * User-account only (`DefaultUserOnly`); bots receive `AccessDeniedError`.
3148
+ * Bots should use {@link preloadMessages} or `channel.messages.fetch` instead.
3149
+ */
2867
3150
  bulkFetchMessages(requests: BulkFetchMessagesRequest[], options?: BulkFetchMessagesOptions & {
2868
3151
  hydrate?: true;
2869
3152
  }): Promise<BulkFetchMessagesResult>;
2870
3153
  bulkFetchMessages(requests: BulkFetchMessagesRequest[], options: BulkFetchMessagesOptions & {
2871
3154
  hydrate: false;
2872
3155
  }): Promise<APIBulkMessageFetchResponse>;
3156
+ /**
3157
+ * Search messages in the current bot scope (`POST /search/messages`, `scope: current`).
3158
+ * Other scopes are denied for bots (`BOT_SEARCH_SCOPE_UNAVAILABLE`).
3159
+ * Returns camelCase results (`hitsPerPage`) or `{ indexing: true }` while channels are indexed.
3160
+ */
3161
+ searchMessages(options?: MessageSearchOptions): Promise<MessageSearchResponse>;
2873
3162
  /** @internal */
2874
3163
  _getMessageCache(channelId: string): Map<string, APIMessage> | null;
2875
3164
  /** @internal */
@@ -2886,11 +3175,12 @@ declare class Client extends EventEmitter {
2886
3175
  /**
2887
3176
  * Sweep cached messages (remove entries matching filter).
2888
3177
  * Prefer {@link CacheController.sweepMessages} (`client.cache.sweepMessages`).
3178
+ * The filter receives a hydrated {@link Message} (`createdAt`), not the stored wire payload.
2889
3179
  * @param filter - Predicate to test each message (return true to remove)
2890
3180
  * @param channelId - Optional channel ID to scope sweep
2891
3181
  * @returns Count of messages removed
2892
3182
  */
2893
- sweepMessages(filter?: (message: APIMessage, channelId: string) => boolean, channelId?: string): number;
3183
+ sweepMessages(filter?: (message: Message, channelId: string) => boolean, channelId?: string): number;
2894
3184
  /**
2895
3185
  * Sweep cached members across all guilds (remove entries matching filter).
2896
3186
  * Prefer {@link CacheController.sweepMembers} (`client.cache.sweepMembers`).
@@ -2907,6 +3197,9 @@ declare class Client extends EventEmitter {
2907
3197
  getOrCreateUser(data: APIUserPartial): User;
2908
3198
  /**
2909
3199
  * The underlying {@link WebSocketManager} (throws if not logged in).
3200
+ * Gateway heartbeat ACK latency: `client.ws.ping` (ms, or `-1` before the first ACK).
3201
+ * @example
3202
+ * console.log(client.ws.ping);
2910
3203
  * @throws {@link FluxerError} with {@link ErrorCodes.NotLoggedIn}
2911
3204
  */
2912
3205
  get ws(): WebSocketManager;
@@ -2929,6 +3222,24 @@ declare class Client extends EventEmitter {
2929
3222
  presences?: boolean;
2930
3223
  nonce?: string;
2931
3224
  }): void;
3225
+ /**
3226
+ * Request guild member/online counts via gateway opcode 15.
3227
+ * Listen for `guildCountsUpdate`. Cached `guild.memberCount` / `guild.onlineCount` update when that event arrives.
3228
+ */
3229
+ requestGuildCounts(options: {
3230
+ guildIds: string[];
3231
+ nonce?: string;
3232
+ }): void;
3233
+ /**
3234
+ * Request per-channel member counts via gateway opcode 16.
3235
+ * Event-only: listen for `channelMemberCountsUpdate`. There is no `channel.memberCount` field.
3236
+ */
3237
+ requestChannelMemberCounts(options: {
3238
+ guildId: string;
3239
+ channelId?: string;
3240
+ channelIds?: string[];
3241
+ nonce?: string;
3242
+ }): void;
2932
3243
  /**
2933
3244
  * Broadcast a gateway payload to all shards.
2934
3245
  * @param payload - Gateway send payload
@@ -2937,14 +3248,18 @@ declare class Client extends EventEmitter {
2937
3248
  _sendToAllShards(payload: GatewaySendPayload): void;
2938
3249
  /**
2939
3250
  * Connect to the gateway with a bot token.
3251
+ * @example
3252
+ * const client = new Client();
3253
+ * client.on(Events.Ready, () => console.log('Ready!'));
3254
+ * await client.login(process.env.FLUXER_BOT_TOKEN);
2940
3255
  * @param token - Bot token from the developer portal
2941
3256
  * @param options - Optional abort signal for cancellation
2942
- * @returns The token that was used (echo)
3257
+ * @returns This client (for chaining)
2943
3258
  * @throws {@link FluxerError} if already logged in or token is invalid
2944
3259
  */
2945
3260
  login(token: string, options?: {
2946
3261
  signal?: AbortSignal;
2947
- }): Promise<string>;
3262
+ }): Promise<this>;
2948
3263
  /** @internal Finalize the READY event emission. */
2949
3264
  _finalizeReady(): void;
2950
3265
  /** @internal Mark a guild as received during startup. */
@@ -2968,7 +3283,21 @@ declare class Client extends EventEmitter {
2968
3283
  assertReady(): asserts this is Client & {
2969
3284
  user: NonNullable<Client['user']>;
2970
3285
  };
3286
+ /**
3287
+ * REST path helpers ({@link Routes}). Pass the path to {@link REST client.rest}.
3288
+ * Prefer high-level helpers (`channel.send()`, `guild.members.fetch()`) when they exist.
3289
+ *
3290
+ * @example
3291
+ * const channel = await client.rest.get(Client.Routes.channel(channelId));
3292
+ *
3293
+ * @example
3294
+ * await client.rest.post(Client.Routes.channelMessages(channelId), {
3295
+ * body: { content: 'hello' },
3296
+ * });
3297
+ *
3298
+ * @see {@link Routes}
3299
+ */
2971
3300
  static get Routes(): typeof Routes;
2972
3301
  }
2973
3302
 
2974
- export { GuildMember as $, AllowedMentions as A, Base as B, CacheController as C, type ClientEventName as D, type ClientEvents as E, type ClientOptions as F, ClientUser as G, type CollectedReaction as H, DEFAULT_CACHE_LIMITS as I, DEFAULT_INSTANCE_ENDPOINTS as J, DMChannel as K, type DiscoveryApplicationOptions as L, type DiscoveryApplicationPayload as M, type DiscoveryOrigin as N, type DiscoveryStatusPayload as O, Events as P, type ExpressionCreateOptions as Q, type ExpressionEditOptions as R, type FetchMessagesOptions as S, type FetchPinnedMessagesOptions as T, type FetchedUserWithProfile as U, Guild as V, GuildBan as W, GuildChannel as X, type GuildCountsUpdatePayload as Y, GuildEmoji as Z, type GuildEmojisUpdatePayload as _, type AllowedMentionsOptions as a, type SudoVerificationOptions as a$, type GuildMemberEditOptions as a0, GuildMemberManager as a1, GuildMemberRoleManager as a2, type GuildMemberSearchHit as a3, type GuildMemberSearchOptions as a4, type GuildMemberSearchPayload as a5, type GuildMembersChunkPayload as a6, type GuildRoleDeletePayload as a7, type GuildRoleUpdatePayload as a8, GuildSticker as a9, type PackInviteCreateOptions as aA, type PackInvitePayload as aB, PackManager as aC, type PackStickerPayload as aD, type PackSummaryPayload as aE, type PartialMessage as aF, type PartialUserGuildPayload as aG, type PinnedMessagesPage as aH, type PresenceActivity as aI, type PresenceUpdateBulkPayload as aJ, type PresenceUpdateOptions as aK, type PresenceUpdatePayload as aL, type ProfilePayload as aM, ReactionCollector as aN, type ReactionCollectorEndReason as aO, type ReactionCollectorOptions as aP, type ReactionEmojiPayload as aQ, type ReplyOptions as aR, type ResolvedCacheLimits as aS, type ResolvedInstance as aT, Role as aU, type RoleCreateOptions as aV, type RoleEditOptions as aW, type RoleResolvable as aX, type RtcRegionPayload as aY, type StickerCreateOptions as aZ, type StickerEditOptions as a_, type GuildStickersUpdatePayload as aa, Invite as ab, type InviteDeletePayload as ac, LinkChannel as ad, Message as ae, type MessageAttachmentEdit as af, MessageCollector as ag, type MessageCollectorEndReason as ah, type MessageCollectorOptions as ai, type MessageDeleteBulkPayload as aj, type MessageEditOptions as ak, MessageManager as al, MessageReaction as am, type MessageReactionAddManyEntry as an, type MessageReactionAddManyPayload as ao, type MessageReactionPayload as ap, type MessageReactionRemoveAllPayload as aq, type MessageReactionRemoveEmojiPayload as ar, type MessageReplyTarget as as, type MessageSendOptions as at, type PackBulkCreatePayload as au, type PackCreateOptions as av, type PackDashboardPayload as aw, type PackDashboardSectionPayload as ax, type PackEditOptions as ay, type PackEmojiPayload as az, type AttachmentUploadCompleteItem as b, TextChannel as b0, type TypingStartPayload as b1, type UploadFileForSend as b2, User as b3, UserManager as b4, type VanityURLPayload as b5, VoiceChannel as b6, Webhook as b7, type WebhookEditOptions as b8, type WebhookMessageEditOptions as b9, toStickerEditBody as bA, toSudoBody as bB, type WebhookSendOptions as ba, type WebhooksUpdatePayload as bb, inviteUrl as bc, normalizeApiOrigin as bd, normalizeCacheLimit as be, parseInstanceDiscovery as bf, resolveCacheLimits as bg, resolveInstanceEndpoints as bh, toAttachmentUploadCompleteBody as bi, toAttachmentUploadPlanBody as bj, toBulkFetchWire as bk, toChannelEditBody as bl, toChannelInviteBody as bm, toDiscoveryApplicationPayload as bn, toDiscoveryBody as bo, toDiscoveryStatusPayload as bp, toEmojiCreateBody as bq, toEmojiEditBody as br, toMemberEditBody as bs, toMemberSearchBody as bt, toMessageAttachmentEditWire as bu, toPackInviteBody as bv, toPackSummaryPayload as bw, toPresenceWire as bx, toProfilePayload as by, toStickerCreateBody as bz, type AttachmentUploadCompleteResponse as c, type AttachmentUploadPlanItem as d, type AttachmentUploadPlanResponse as e, type AuditLogChange as f, type AuditLogEntryPayload as g, type AuditLogFetchPayload as h, type BulkFetchMessagesChannelResult as i, type BulkFetchMessagesOptions as j, type BulkFetchMessagesRequest as k, type BulkFetchMessagesResult as l, type CacheSizeLimits as m, type CacheStats as n, CategoryChannel as o, Channel as p, type ChannelEditOptions as q, type ChannelInviteCreateOptions as r, ChannelManager as s, type ChannelMemberCountsUpdatePayload as t, type ChannelPinsUpdatePayload as u, type ChannelRecipientPayload as v, type ChannelSlowmodePayload as w, Client as x, type ClientEventListener as y, type ClientEventMethods as z };
3303
+ export { Invite as $, AllowedMentions as A, Base as B, CacheController as C, DEFAULT_CACHE_LIMITS as D, Events as E, type FetchMessagesOptions as F, type FetchPinnedMessagesOptions as G, type FetchedUserWithProfile as H, Guild as I, GuildBan as J, GuildChannel as K, type GuildCountsUpdatePayload as L, GuildEmoji as M, type GuildEmojisUpdatePayload as N, GuildManager as O, GuildMember as P, GuildMemberManager as Q, GuildMemberRoleManager as R, type GuildMemberSearchHit as S, type GuildMemberSearchPayload as T, type GuildMembersChunkPayload as U, type GuildRoleDeletePayload as V, GuildRoleManager as W, type GuildRoleUpdatePayload as X, GuildSticker as Y, type GuildStickersUpdatePayload as Z, INSTANCE_DISCOVERY_PATH as _, type AllowedMentionsOptions as a, instanceDiscoveryUrl as a$, type InviteChannelSnapshot as a0, type InviteDeletePayload as a1, type InviteGuildSnapshot as a2, LinkChannel as a3, Message as a4, type MessageAttachment as a5, type MessageCall as a6, MessageCollector as a7, type MessageCollectorEndReason as a8, type MessageCollectorOptions as a9, PermissionOverwriteManager as aA, type PinnedMessagesPage as aB, type PresenceActivity as aC, type PresenceUpdateBulkPayload as aD, type PresenceUpdatePayload as aE, ReactionCollector as aF, type ReactionCollectorEndReason as aG, type ReactionCollectorOptions as aH, type ReactionEmojiPayload as aI, type ReplyOptions as aJ, type ResolvedCacheLimits as aK, type ResolvedInstance as aL, Role as aM, type RoleResolvable as aN, type TextBasedChannel as aO, TextChannel as aP, type TypingStartPayload as aQ, type UploadFileForSend as aR, User as aS, UserManager as aT, type VanityURLPayload as aU, VoiceChannel as aV, Webhook as aW, type WebhookEditOptions as aX, type WebhookMessageEditOptions as aY, type WebhookSendOptions as aZ, type WebhooksUpdatePayload as a_, type MessageDeleteBulkPayload as aa, type MessageEditOptions as ab, type MessageEmbed as ac, type MessageEmbedAuthor as ad, type MessageEmbedField as ae, type MessageEmbedFooter as af, type MessageEmbedMedia as ag, MessageManager as ah, type MessagePrepareInput as ai, MessageReaction as aj, type MessageReactionAddManyEntry as ak, type MessageReactionAddManyPayload as al, MessageReactionManager as am, type MessageReactionPayload as an, type MessageReactionRemoveAllPayload as ao, type MessageReactionRemoveEmojiPayload as ap, type MessageReference as aq, type MessageReplyTarget as ar, type MessageSendOptions as as, type MessageSnapshot as at, MessageSticker as au, PartialGuildMember as av, PartialMessage as aw, type PartialUserGuildPayload as ax, PermissionOverwrite as ay, type PermissionOverwriteEditOptions as az, type AuditLogChange as b, inviteUrl as b0, normalizeApiOrigin as b1, normalizeCacheLimit as b2, parseInstanceDiscovery as b3, resolveCacheLimits as b4, resolveInstanceEndpoints as b5, type AuditLogEntryPayload as c, type AuditLogFetchPayload as d, type BulkFetchMessagesChannelResult as e, type BulkFetchMessagesOptions as f, type BulkFetchMessagesResult as g, type CacheSizeLimits as h, type CacheStats as i, CategoryChannel as j, Channel as k, ChannelManager as l, type ChannelMemberCountsUpdatePayload as m, type ChannelPinsUpdatePayload as n, type ChannelRecipientPayload as o, Client as p, type ClientEventListener as q, type ClientEventMethods as r, type ClientEventName as s, type ClientEvents as t, type ClientOptions as u, ClientUser as v, type CollectedReaction as w, DEFAULT_INSTANCE_ENDPOINTS as x, DMChannel as y, type DiscoveryOrigin as z };