@fluxerjs/core 2.2.0 → 3.0.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.
- package/README.md +21 -9
- package/dist/Expressions-Bdgo72qI.d.mts +34 -0
- package/dist/Expressions-Bdgo72qI.d.ts +34 -0
- package/dist/{SubpathMessage-D70lAT7N.d.mts → SubpathMessage-CjQBbVmb.d.mts} +1390 -1104
- package/dist/{SubpathMessage-D70lAT7N.d.ts → SubpathMessage-DNlKq2Nj.d.ts} +1390 -1104
- package/dist/Sudo-CFfbmis3.d.mts +453 -0
- package/dist/Sudo-CFfbmis3.d.ts +453 -0
- package/dist/client.d.mts +4 -3
- package/dist/client.d.ts +4 -3
- package/dist/client.js +1976 -1001
- package/dist/client.mjs +1768 -796
- package/dist/cluster.d.mts +4 -3
- package/dist/cluster.d.ts +4 -3
- package/dist/cluster.js +1898 -923
- package/dist/cluster.mjs +1770 -798
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1957 -1008
- package/dist/index.mjs +1797 -834
- package/dist/internal.d.mts +12 -0
- package/dist/internal.d.ts +12 -0
- package/dist/internal.js +449 -0
- package/dist/internal.mjs +398 -0
- package/dist/message.d.mts +4 -3
- package/dist/message.d.ts +4 -3
- package/dist/message.js +446 -93
- package/dist/message.mjs +446 -94
- package/package.json +13 -9
|
@@ -1,252 +1,14 @@
|
|
|
1
|
-
import { Collection, LimitedCollection } from '@fluxerjs/collection';
|
|
2
1
|
import * as _fluxerjs_types from '@fluxerjs/types';
|
|
3
|
-
import {
|
|
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
|
|
8
|
+
import * as _fluxerjs_ws from '@fluxerjs/ws';
|
|
7
9
|
import { WebSocketManager } from '@fluxerjs/ws';
|
|
8
|
-
import {
|
|
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-CFfbmis3.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
|
-
/**
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
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
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
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
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
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
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
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
|
|
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,147 @@ type MessagePrepareInput = string | MessageSendOptions | MessagePayload;
|
|
|
771
295
|
*/
|
|
772
296
|
declare function prepareMessagePostPayload(options: MessagePrepareInput, defaults?: MessagePrepareDefaults): Promise<MessagePostPayload>;
|
|
773
297
|
|
|
774
|
-
/**
|
|
775
|
-
|
|
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
|
|
808
|
-
readonly
|
|
809
|
-
|
|
810
|
-
readonly
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
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(): Promise<void>;
|
|
327
|
+
/**
|
|
328
|
+
* Edit this emoji's name.
|
|
329
|
+
* Requires Manage Emojis and Stickers permission.
|
|
330
|
+
*/
|
|
331
|
+
edit(options: {
|
|
332
|
+
name: string;
|
|
333
|
+
}): Promise<GuildEmoji>;
|
|
838
334
|
}
|
|
839
335
|
|
|
840
|
-
|
|
336
|
+
/** Represents a custom sticker in a guild. */
|
|
337
|
+
declare class GuildSticker extends Base {
|
|
338
|
+
readonly client: Client;
|
|
339
|
+
readonly id: string;
|
|
340
|
+
readonly guildId: string;
|
|
841
341
|
name: string;
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
|
|
847
|
-
/**
|
|
342
|
+
description: string;
|
|
343
|
+
tags: string[];
|
|
344
|
+
readonly animated: boolean;
|
|
345
|
+
/** Whether this sticker is classified as NSFW */
|
|
346
|
+
nsfw: boolean;
|
|
347
|
+
/** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
|
|
348
|
+
constructor(client: Client, data: APISticker & {
|
|
349
|
+
guild_id?: string;
|
|
350
|
+
}, guildId: string);
|
|
351
|
+
/**
|
|
352
|
+
* Patch mutable fields in place. Does not change `id` or `animated`
|
|
353
|
+
* (callers should replace the instance when `animated` changes).
|
|
354
|
+
* @internal
|
|
355
|
+
*/
|
|
356
|
+
_patch(data: APISticker): void;
|
|
357
|
+
/** CDN URL for this sticker image. */
|
|
358
|
+
get url(): string;
|
|
359
|
+
/** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
|
|
360
|
+
get createdTimestamp(): number;
|
|
361
|
+
/** Date when this sticker was created, derived from its snowflake ID. */
|
|
362
|
+
get createdAt(): Date;
|
|
363
|
+
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
364
|
+
delete(): Promise<void>;
|
|
365
|
+
/**
|
|
366
|
+
* Edit this sticker's name and/or description.
|
|
367
|
+
* Requires Manage Emojis and Stickers permission.
|
|
368
|
+
*/
|
|
369
|
+
edit(options: {
|
|
370
|
+
name?: string;
|
|
371
|
+
description?: string;
|
|
372
|
+
}): Promise<GuildSticker>;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Guild role.
|
|
377
|
+
* Cached in {@link Guild.roles}; permissions computed via {@link GuildMember.permissions}.
|
|
378
|
+
*/
|
|
379
|
+
declare class Role extends Base {
|
|
380
|
+
/** Parent client instance. */
|
|
848
381
|
readonly client: Client;
|
|
849
|
-
/**
|
|
382
|
+
/** Role snowflake ID. */
|
|
850
383
|
readonly id: string;
|
|
851
|
-
/**
|
|
852
|
-
readonly
|
|
853
|
-
/**
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
|
|
857
|
-
/**
|
|
858
|
-
|
|
859
|
-
/**
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
|
|
863
|
-
/** Whether
|
|
864
|
-
|
|
865
|
-
/**
|
|
866
|
-
|
|
867
|
-
/**
|
|
868
|
-
|
|
869
|
-
|
|
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>;
|
|
384
|
+
/** Guild this role belongs to. */
|
|
385
|
+
readonly guildId: string;
|
|
386
|
+
/** Role name. */
|
|
387
|
+
name: string;
|
|
388
|
+
/** Role color (24-bit RGB). */
|
|
389
|
+
color: number;
|
|
390
|
+
/** Role position (higher = above). */
|
|
391
|
+
position: number;
|
|
392
|
+
/** @internal Raw permissions bitfield string. */
|
|
393
|
+
_permissions: string;
|
|
394
|
+
/** Whether this role is hoisted (shown separately in member list). */
|
|
395
|
+
hoist: boolean;
|
|
396
|
+
/** Whether this role is mentionable. */
|
|
397
|
+
mentionable: boolean;
|
|
398
|
+
/** Unicode emoji for this role (null = none). */
|
|
399
|
+
unicodeEmoji: string | null;
|
|
400
|
+
/** Hoist position (null = not hoisted). */
|
|
401
|
+
hoistPosition: number | null;
|
|
402
|
+
constructor(client: Client, data: APIRole, guildId: string);
|
|
905
403
|
/**
|
|
906
|
-
*
|
|
907
|
-
* @param data - API message from REST or MESSAGE_CREATE
|
|
404
|
+
* Permissions bitfield (Administrator grants all permissions).
|
|
908
405
|
*/
|
|
909
|
-
|
|
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>;
|
|
406
|
+
get permissions(): PermissionsBitField;
|
|
914
407
|
/**
|
|
915
|
-
*
|
|
408
|
+
* Alias of {@link permissions}.has for discord.js-style checks.
|
|
916
409
|
* @example
|
|
917
|
-
*
|
|
918
|
-
|
|
919
|
-
|
|
410
|
+
* if (role.has(PermissionFlags.BanMembers)) { ... }
|
|
411
|
+
*/
|
|
412
|
+
has(permission: Parameters<PermissionsBitField['has']>[0]): boolean;
|
|
413
|
+
/**
|
|
414
|
+
* Format as a mention string (`<@&id>`).
|
|
415
|
+
* @returns Mention syntax
|
|
416
|
+
*/
|
|
417
|
+
/** Unix timestamp (ms) when this role was created, derived from its snowflake ID. */
|
|
418
|
+
get createdTimestamp(): number;
|
|
419
|
+
/** Date when this role was created, derived from its snowflake ID. */
|
|
420
|
+
get createdAt(): Date;
|
|
421
|
+
toString(): string;
|
|
422
|
+
/** @internal */
|
|
423
|
+
_patch(data: APIRole): void;
|
|
424
|
+
/**
|
|
425
|
+
* Snapshot for role-update events (before in-place patch).
|
|
426
|
+
* @internal
|
|
427
|
+
*/
|
|
428
|
+
_clone(): Role;
|
|
429
|
+
/**
|
|
430
|
+
* PATCH role. Requires Manage Roles.
|
|
431
|
+
* @param options - CamelCase fields to update
|
|
432
|
+
* @returns This role instance (updated in-place)
|
|
433
|
+
*/
|
|
434
|
+
edit(options: RoleEditOptions): Promise<Role>;
|
|
435
|
+
/**
|
|
436
|
+
* DELETE role. Requires Manage Roles.
|
|
920
437
|
*/
|
|
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
438
|
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
|
-
}>;
|
|
966
|
-
}
|
|
967
|
-
|
|
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;
|
|
977
439
|
}
|
|
978
440
|
|
|
979
441
|
/**
|
|
@@ -1060,66 +522,51 @@ declare class User extends Base {
|
|
|
1060
522
|
send(options: MessagePrepareInput): Promise<Message>;
|
|
1061
523
|
}
|
|
1062
524
|
|
|
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
525
|
/**
|
|
1085
|
-
*
|
|
1086
|
-
*
|
|
526
|
+
* Uncached or incomplete message (`MessageDelete`, uncached `MessageUpdate`,
|
|
527
|
+
* `MessageDeleteBulk` entries). Not a {@link Message}: no `edit()` / `reply()`.
|
|
528
|
+
* Call {@link fetch} to hydrate, or narrow with `message.partial`.
|
|
1087
529
|
*/
|
|
1088
|
-
declare class
|
|
1089
|
-
|
|
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 {
|
|
530
|
+
declare class PartialMessage {
|
|
531
|
+
readonly partial: true;
|
|
1105
532
|
readonly client: Client;
|
|
1106
|
-
readonly
|
|
533
|
+
readonly id: string;
|
|
1107
534
|
readonly channelId: string;
|
|
1108
535
|
readonly guildId: string | null;
|
|
1109
|
-
readonly
|
|
1110
|
-
|
|
1111
|
-
readonly
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
536
|
+
readonly content: string | null;
|
|
537
|
+
readonly authorId: string | null;
|
|
538
|
+
readonly author: User | null;
|
|
539
|
+
readonly createdAt: Date | null;
|
|
540
|
+
constructor(client: Client, data: {
|
|
541
|
+
id: string;
|
|
542
|
+
channelId: string;
|
|
543
|
+
guildId?: string | null;
|
|
544
|
+
channel?: TextBasedChannel | null;
|
|
545
|
+
content?: string | null;
|
|
546
|
+
authorId?: string | null;
|
|
547
|
+
author?: User | null;
|
|
548
|
+
createdAt?: Date | null;
|
|
549
|
+
});
|
|
1117
550
|
/**
|
|
1118
|
-
*
|
|
1119
|
-
*
|
|
1120
|
-
* @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
|
|
551
|
+
* Live text-capable channel from cache, or null if uncached / not text-based.
|
|
552
|
+
* Same contract as {@link Message.channel}.
|
|
1121
553
|
*/
|
|
1122
|
-
|
|
554
|
+
get channel(): TextBasedChannel | null;
|
|
555
|
+
/**
|
|
556
|
+
* Fetch this message's channel (cache first). The returned {@link Channel}
|
|
557
|
+
* has {@link Channel.delete} and {@link Channel.send}.
|
|
558
|
+
* @example
|
|
559
|
+
* const channel = await message.resolveChannel();
|
|
560
|
+
* await channel.delete();
|
|
561
|
+
*/
|
|
562
|
+
resolveChannel(): Promise<Channel>;
|
|
563
|
+
/**
|
|
564
|
+
* Fetch the full message from the API.
|
|
565
|
+
* @example
|
|
566
|
+
* const message = await partial.fetch();
|
|
567
|
+
* await message.reply('Pong!');
|
|
568
|
+
*/
|
|
569
|
+
fetch(): Promise<Message>;
|
|
1123
570
|
}
|
|
1124
571
|
|
|
1125
572
|
/** CamelCase emoji on reaction events. */
|
|
@@ -1134,6 +581,12 @@ interface ReactionEmojiPayload {
|
|
|
1134
581
|
interface MessageReactionPayload {
|
|
1135
582
|
reaction: MessageReaction;
|
|
1136
583
|
user: User;
|
|
584
|
+
/** Cached message, or null if it was not in the message cache. Use `reaction.fetchMessage()` otherwise. */
|
|
585
|
+
message: Message | null;
|
|
586
|
+
/** Cached text-capable channel, or null if uncached / not text-based. */
|
|
587
|
+
channel: TextBasedChannel | null;
|
|
588
|
+
/** Cached reacting member when the gateway included one, otherwise null. */
|
|
589
|
+
member: GuildMember | null;
|
|
1137
590
|
messageId: string;
|
|
1138
591
|
channelId: string;
|
|
1139
592
|
emoji: ReactionEmojiPayload;
|
|
@@ -1158,6 +611,13 @@ interface MessageDeleteBulkPayload {
|
|
|
1158
611
|
channelId: string;
|
|
1159
612
|
/** Guild the channel belongs to, or `null` for DMs. */
|
|
1160
613
|
guildId: string | null;
|
|
614
|
+
/** Cached text-capable channel, or null if uncached / not text-based. */
|
|
615
|
+
channel: TextBasedChannel | null;
|
|
616
|
+
/**
|
|
617
|
+
* One {@link PartialMessage} per id. Cached fields (content, author, createdAt) are
|
|
618
|
+
* filled when the message was in cache; otherwise those fields are null.
|
|
619
|
+
*/
|
|
620
|
+
messages: PartialMessage[];
|
|
1161
621
|
}
|
|
1162
622
|
/**
|
|
1163
623
|
* Payload emitted for {@link Events.InviteDelete}.
|
|
@@ -1210,6 +670,8 @@ interface MessageReactionRemoveAllPayload {
|
|
|
1210
670
|
messageId: string;
|
|
1211
671
|
channelId: string;
|
|
1212
672
|
guildId: string | null;
|
|
673
|
+
message: Message | null;
|
|
674
|
+
channel: TextBasedChannel | null;
|
|
1213
675
|
}
|
|
1214
676
|
/** Payload for {@link Events.MessageReactionRemoveEmoji}. */
|
|
1215
677
|
interface MessageReactionRemoveEmojiPayload {
|
|
@@ -1217,6 +679,8 @@ interface MessageReactionRemoveEmojiPayload {
|
|
|
1217
679
|
channelId: string;
|
|
1218
680
|
guildId: string | null;
|
|
1219
681
|
emoji: ReactionEmojiPayload;
|
|
682
|
+
message: Message | null;
|
|
683
|
+
channel: TextBasedChannel | null;
|
|
1220
684
|
}
|
|
1221
685
|
/** Single entry in {@link MessageReactionAddManyPayload}. */
|
|
1222
686
|
interface MessageReactionAddManyEntry {
|
|
@@ -1229,6 +693,8 @@ interface MessageReactionAddManyPayload {
|
|
|
1229
693
|
channelId: string;
|
|
1230
694
|
messageId: string;
|
|
1231
695
|
guildId: string | null;
|
|
696
|
+
message: Message | null;
|
|
697
|
+
channel: TextBasedChannel | null;
|
|
1232
698
|
reactions: MessageReactionAddManyEntry[];
|
|
1233
699
|
}
|
|
1234
700
|
/** Payload for {@link Events.ChannelPinsUpdate}. */
|
|
@@ -1350,19 +816,6 @@ interface GuildMemberSearchPayload {
|
|
|
1350
816
|
/** Search index still building. */
|
|
1351
817
|
indexing?: boolean;
|
|
1352
818
|
}
|
|
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;
|
|
1365
|
-
}
|
|
1366
819
|
/** Partial guild from GET /users/@me/guilds. */
|
|
1367
820
|
interface PartialUserGuildPayload {
|
|
1368
821
|
id: string;
|
|
@@ -1382,6 +835,18 @@ interface ChannelRecipientPayload {
|
|
|
1382
835
|
user: User;
|
|
1383
836
|
}
|
|
1384
837
|
|
|
838
|
+
/** Options for single-member {@link GuildMemberManager.fetch}. */
|
|
839
|
+
interface FetchGuildMemberOptions {
|
|
840
|
+
/** When true, always hit REST even if the member is cached. */
|
|
841
|
+
force?: boolean;
|
|
842
|
+
}
|
|
843
|
+
/** Options for list {@link GuildMemberManager.fetch}. */
|
|
844
|
+
interface FetchGuildMembersOptions {
|
|
845
|
+
/** Max members to return (1-1000). */
|
|
846
|
+
limit?: number;
|
|
847
|
+
/** User ID cursor for pagination. */
|
|
848
|
+
after?: string;
|
|
849
|
+
}
|
|
1385
850
|
/**
|
|
1386
851
|
* Manages guild members with a Collection-like API.
|
|
1387
852
|
* Extends LimitedCollection so you can use .get(), .set(), .filter(), etc.
|
|
@@ -1420,15 +885,19 @@ declare class GuildMemberManager extends LimitedCollection<string, GuildMember>
|
|
|
1420
885
|
* console.log(me.displayName);
|
|
1421
886
|
*/
|
|
1422
887
|
fetchMe(): Promise<GuildMember>;
|
|
888
|
+
/**
|
|
889
|
+
* Fetch a single guild member by user ID.
|
|
890
|
+
* Returns the cached member unless `force` is set.
|
|
891
|
+
* @throws FluxerError with MEMBER_NOT_FOUND if missing
|
|
892
|
+
*/
|
|
893
|
+
fetch(userId: string, options?: FetchGuildMemberOptions): Promise<GuildMember>;
|
|
1423
894
|
/**
|
|
1424
895
|
* Fetch guild members with pagination. GET /guilds/{id}/members.
|
|
1425
896
|
* @param options - limit (1-1000), after (user ID for pagination)
|
|
1426
897
|
* @returns Array of GuildMember objects (cached in guild.members)
|
|
1427
898
|
*/
|
|
1428
|
-
fetch(options?:
|
|
1429
|
-
|
|
1430
|
-
after?: string;
|
|
1431
|
-
}): Promise<GuildMember[]>;
|
|
899
|
+
fetch(options?: FetchGuildMembersOptions): Promise<GuildMember[]>;
|
|
900
|
+
private fetchMany;
|
|
1432
901
|
/**
|
|
1433
902
|
* Search guild members. POST /guilds/{id}/members-search.
|
|
1434
903
|
* @param options - CamelCase search query, filters, and pagination
|
|
@@ -1439,34 +908,59 @@ declare class GuildMemberManager extends LimitedCollection<string, GuildMember>
|
|
|
1439
908
|
search(options?: GuildMemberSearchOptions): Promise<GuildMemberSearchPayload>;
|
|
1440
909
|
}
|
|
1441
910
|
|
|
911
|
+
/** CamelCase guild metadata embedded on a guild invite (not a cached {@link Guild}). */
|
|
912
|
+
interface InviteGuildSnapshot {
|
|
913
|
+
id: string;
|
|
914
|
+
name: string;
|
|
915
|
+
icon: string | null;
|
|
916
|
+
banner: string | null;
|
|
917
|
+
splash: string | null;
|
|
918
|
+
features: string[];
|
|
919
|
+
}
|
|
920
|
+
/** CamelCase channel metadata embedded on a guild or group-DM invite. */
|
|
921
|
+
interface InviteChannelSnapshot {
|
|
922
|
+
id: string;
|
|
923
|
+
name: string | null;
|
|
924
|
+
type: ChannelType;
|
|
925
|
+
icon: string | null;
|
|
926
|
+
parentId: string | null;
|
|
927
|
+
}
|
|
1442
928
|
/**
|
|
1443
|
-
* Invite to a guild channel
|
|
1444
|
-
* Discriminate with `type` / `isGuild()` / `isGroupDM()
|
|
929
|
+
* Invite to a guild channel or group DM.
|
|
930
|
+
* Discriminate with `type` / `isGuild()` / `isGroupDM()`.
|
|
931
|
+
* `guildSnapshot` / `channelSnapshot` are camelCase metadata, not cached structures.
|
|
932
|
+
* Use {@link resolveGuild} / {@link resolveChannel} for live structures.
|
|
1445
933
|
*/
|
|
1446
934
|
declare class Invite extends Base {
|
|
1447
935
|
readonly client: Client;
|
|
1448
936
|
readonly code: string;
|
|
1449
937
|
readonly type: InviteType;
|
|
1450
|
-
readonly
|
|
1451
|
-
readonly
|
|
1452
|
-
readonly pack: APIPackInviteInfo | null;
|
|
938
|
+
readonly guildSnapshot: InviteGuildSnapshot | null;
|
|
939
|
+
readonly channelSnapshot: InviteChannelSnapshot | null;
|
|
1453
940
|
readonly inviter: User | null;
|
|
1454
941
|
readonly memberCount: number | null;
|
|
1455
942
|
readonly presenceCount: number | null;
|
|
1456
|
-
readonly expiresAt:
|
|
943
|
+
readonly expiresAt: Date | null;
|
|
1457
944
|
readonly temporary: boolean | null;
|
|
1458
|
-
readonly createdAt:
|
|
945
|
+
readonly createdAt: Date | null;
|
|
1459
946
|
readonly uses: number | null;
|
|
1460
947
|
readonly maxUses: number | null;
|
|
1461
948
|
readonly maxAge: number | null;
|
|
1462
949
|
constructor(client: Client, data: APIInvite);
|
|
1463
950
|
isGuild(): boolean;
|
|
1464
951
|
isGroupDM(): boolean;
|
|
1465
|
-
isPack(): boolean;
|
|
1466
952
|
/** Full invite URL (uses this client's instance invite base). */
|
|
1467
953
|
get url(): string;
|
|
1468
|
-
/**
|
|
1469
|
-
|
|
954
|
+
/**
|
|
955
|
+
* Resolve the cached/fetched {@link Guild} for this invite, or null.
|
|
956
|
+
* `guildSnapshot` is metadata only.
|
|
957
|
+
*/
|
|
958
|
+
resolveGuild(): Promise<Guild | null>;
|
|
959
|
+
/**
|
|
960
|
+
* Resolve the cached/fetched {@link Channel} for this invite, or null.
|
|
961
|
+
* `channelSnapshot` is metadata only.
|
|
962
|
+
*/
|
|
963
|
+
resolveChannel(): Promise<Channel | null>;
|
|
1470
964
|
/** Fetch invite metadata by code or URL (does not join). */
|
|
1471
965
|
static fetch(client: Client, codeOrUrl: string): Promise<Invite>;
|
|
1472
966
|
/** Delete this invite. Requires Manage Guild or Create Instant Invite. */
|
|
@@ -1549,6 +1043,36 @@ declare class Webhook extends Base {
|
|
|
1549
1043
|
private messageRoute;
|
|
1550
1044
|
}
|
|
1551
1045
|
|
|
1046
|
+
/** Represents a ban in a guild. */
|
|
1047
|
+
declare class GuildBan extends Base {
|
|
1048
|
+
readonly client: Client;
|
|
1049
|
+
readonly guildId: string;
|
|
1050
|
+
readonly user: User;
|
|
1051
|
+
readonly reason: string | null;
|
|
1052
|
+
/** When a temporary ban expires. Null for permanent bans. */
|
|
1053
|
+
readonly expiresAt: Date | null;
|
|
1054
|
+
/** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
|
|
1055
|
+
constructor(client: Client, data: APIBan & {
|
|
1056
|
+
guild_id?: string;
|
|
1057
|
+
}, guildId: string);
|
|
1058
|
+
/**
|
|
1059
|
+
* Remove this ban (unban the user).
|
|
1060
|
+
* Requires Ban Members permission.
|
|
1061
|
+
*/
|
|
1062
|
+
unban(): Promise<void>;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* Guild role cache. Extends {@link LimitedCollection} (`.get()`, `.set()`, `.filter()`, …).
|
|
1067
|
+
* Access via {@link Guild.roles}.
|
|
1068
|
+
*/
|
|
1069
|
+
declare class GuildRoleManager extends LimitedCollection<string, Role> {
|
|
1070
|
+
private readonly guildId;
|
|
1071
|
+
constructor(guildId: string, options?: ConstructorParameters<typeof LimitedCollection<string, Role>>[0]);
|
|
1072
|
+
/** The @everyone role (`id === guild.id`), or undefined if uncached. */
|
|
1073
|
+
get everyone(): Role | undefined;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1552
1076
|
/** Represents a Fluxer guild (server). */
|
|
1553
1077
|
declare class Guild extends Base {
|
|
1554
1078
|
/** The {@link Client} that instantiated this guild. */
|
|
@@ -1585,8 +1109,26 @@ declare class Guild extends Base {
|
|
|
1585
1109
|
systemChannelId: string | null;
|
|
1586
1110
|
/** Rules channel ID (for Community guilds), or null if none. */
|
|
1587
1111
|
rulesChannelId: string | null;
|
|
1112
|
+
/** {@link SystemChannelFlags} bitfield. */
|
|
1113
|
+
systemChannelFlags: number;
|
|
1114
|
+
/** Splash card alignment. */
|
|
1115
|
+
splashCardAlignment: SplashCardAlignment;
|
|
1116
|
+
/** Embed splash hash. */
|
|
1117
|
+
embedSplash: string | null;
|
|
1588
1118
|
/** NSFW level for this guild. */
|
|
1589
1119
|
nsfwLevel: GuildNSFWLevel;
|
|
1120
|
+
/** Whether the guild is marked as adult (18+) content. */
|
|
1121
|
+
nsfw: boolean;
|
|
1122
|
+
/** Content warning level. */
|
|
1123
|
+
contentWarningLevel: ContentWarningLevel;
|
|
1124
|
+
/** Custom guild-wide content warning text. */
|
|
1125
|
+
contentWarningText: string | null;
|
|
1126
|
+
/** {@link GuildOperations} bitfield of disabled operations. */
|
|
1127
|
+
disabledOperations: number;
|
|
1128
|
+
/** ISO-8601 timestamp before which message history is not available. */
|
|
1129
|
+
messageHistoryCutoff: string | null;
|
|
1130
|
+
/** Permissions for the current member in this guild (bitfield string). */
|
|
1131
|
+
permissions: string | null;
|
|
1590
1132
|
/** MFA level required for moderation actions. */
|
|
1591
1133
|
mfaLevel: GuildMFALevel;
|
|
1592
1134
|
/** Banner width in pixels. */
|
|
@@ -1606,7 +1148,7 @@ declare class Guild extends Base {
|
|
|
1606
1148
|
/** Cached channels in this guild. */
|
|
1607
1149
|
channels: LimitedCollection<string, GuildChannel>;
|
|
1608
1150
|
/** Cached roles in this guild. */
|
|
1609
|
-
roles:
|
|
1151
|
+
roles: GuildRoleManager;
|
|
1610
1152
|
/** Cached emojis in this guild. */
|
|
1611
1153
|
emojis: LimitedCollection<string, GuildEmoji>;
|
|
1612
1154
|
/** Cached stickers in this guild. */
|
|
@@ -1642,10 +1184,10 @@ declare class Guild extends Base {
|
|
|
1642
1184
|
size?: number;
|
|
1643
1185
|
}): string | null;
|
|
1644
1186
|
/**
|
|
1645
|
-
* Create a channel. `
|
|
1187
|
+
* Create a channel. `type`: 0=text, 2=voice, 4=category, 998=link (set `url`).
|
|
1646
1188
|
* Requires Manage Channels.
|
|
1647
1189
|
*/
|
|
1648
|
-
createChannel(
|
|
1190
|
+
createChannel(options: GuildChannelCreateOptions): Promise<GuildChannel>;
|
|
1649
1191
|
/** Fetch all channels in this guild from the API. */
|
|
1650
1192
|
fetchChannels(): Promise<GuildChannel[]>;
|
|
1651
1193
|
/** Update channel positions (reordering). */
|
|
@@ -1684,7 +1226,7 @@ declare class Guild extends Base {
|
|
|
1684
1226
|
}>): Promise<Role[]>;
|
|
1685
1227
|
/** Reset all role hoist positions to zero. Returns cached {@link Role} instances. */
|
|
1686
1228
|
resetRoleHoistPositions(): Promise<Role[]>;
|
|
1687
|
-
/** Ban a user from the guild. Requires Ban Members. `
|
|
1229
|
+
/** Ban a user from the guild. Requires Ban Members. `banDurationSeconds`: 0 = permanent. */
|
|
1688
1230
|
ban(userId: string, options?: GuildBanOptions): Promise<void>;
|
|
1689
1231
|
/** Fetch all bans in this guild. Requires Ban Members. */
|
|
1690
1232
|
fetchBans(): Promise<GuildBan[]>;
|
|
@@ -1743,29 +1285,514 @@ declare class Guild extends Base {
|
|
|
1743
1285
|
/** Fetch audit log entries. Requires View Audit Log. */
|
|
1744
1286
|
fetchAuditLogs(options?: {
|
|
1745
1287
|
limit?: number;
|
|
1746
|
-
before?: string;
|
|
1288
|
+
before?: string;
|
|
1289
|
+
after?: string;
|
|
1290
|
+
userId?: string;
|
|
1291
|
+
actionType?: AuditLogActionType;
|
|
1292
|
+
}): Promise<AuditLogFetchPayload>;
|
|
1293
|
+
/** Edit guild settings. Requires guild owner or Administrator. */
|
|
1294
|
+
edit(options: GuildEditOptions): Promise<this>;
|
|
1295
|
+
/** Fetch the guild's vanity invite URL (if available). */
|
|
1296
|
+
fetchVanityURL(): Promise<VanityURLPayload>;
|
|
1297
|
+
/** Edit the guild's vanity invite code. */
|
|
1298
|
+
editVanityURL(code: string | null): Promise<VanityURLPayload>;
|
|
1299
|
+
/** Fetch the guild's discovery status. */
|
|
1300
|
+
fetchDiscoveryStatus(): Promise<DiscoveryStatusPayload>;
|
|
1301
|
+
/** Apply for guild discovery. */
|
|
1302
|
+
applyForDiscovery(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
|
|
1303
|
+
/** Edit an existing discovery application. */
|
|
1304
|
+
editDiscoveryApplication(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
|
|
1305
|
+
/** Withdraw the guild's discovery application. */
|
|
1306
|
+
withdrawDiscoveryApplication(): Promise<void>;
|
|
1307
|
+
/** Delete this guild (owner only). User accounts may need sudo/MFA in `options`. */
|
|
1308
|
+
delete(options?: SudoVerificationOptions): Promise<void>;
|
|
1309
|
+
/** Transfer guild ownership to another user (owner only). */
|
|
1310
|
+
transferOwnership(newOwnerId: string, password?: string): Promise<void>;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
/** Role ID or Role object. */
|
|
1314
|
+
type RoleResolvable = string | Role;
|
|
1315
|
+
/**
|
|
1316
|
+
* Manages a guild member's roles (`add` / `remove` / `set` / `cache`).
|
|
1317
|
+
* Requires Manage Roles for mutations.
|
|
1318
|
+
*/
|
|
1319
|
+
declare class GuildMemberRoleManager {
|
|
1320
|
+
private readonly member;
|
|
1321
|
+
private ids;
|
|
1322
|
+
constructor(member: GuildMember, initial?: string[]);
|
|
1323
|
+
get roleIds(): readonly string[];
|
|
1324
|
+
has(roleOrId: RoleResolvable): boolean;
|
|
1325
|
+
/** Live Role objects from `guild.roles` for this member's role IDs. */
|
|
1326
|
+
get cache(): Collection<string, Role>;
|
|
1327
|
+
add(roleOrId: RoleResolvable): Promise<void>;
|
|
1328
|
+
remove(roleOrId: RoleResolvable): Promise<void>;
|
|
1329
|
+
set(roleIds: string[]): Promise<void>;
|
|
1330
|
+
/** @internal Sync from API member payload. */
|
|
1331
|
+
_patch(roleIds: string[]): void;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* Uncached `guildMemberRemove` payload.
|
|
1336
|
+
* Has `user` and `guild` (what leave logs need) but not `joinedAt`, roles, or member methods.
|
|
1337
|
+
* Narrow with `member.partial` (`GuildMember.partial` is `false`).
|
|
1338
|
+
* Call {@link fetch} to hydrate when the member is still in the guild.
|
|
1339
|
+
*/
|
|
1340
|
+
declare class PartialGuildMember {
|
|
1341
|
+
readonly partial: true;
|
|
1342
|
+
readonly client: Client;
|
|
1343
|
+
readonly id: string;
|
|
1344
|
+
readonly user: User;
|
|
1345
|
+
readonly guildId: string;
|
|
1346
|
+
readonly guild: Guild;
|
|
1347
|
+
constructor(data: {
|
|
1348
|
+
client: Client;
|
|
1349
|
+
id: string;
|
|
1350
|
+
user: User;
|
|
1351
|
+
guild: Guild;
|
|
1352
|
+
});
|
|
1353
|
+
/**
|
|
1354
|
+
* Fetch the full {@link GuildMember} from the API (cache-aware via `guild.members.fetch`).
|
|
1355
|
+
* @throws FluxerError with MEMBER_NOT_FOUND if the user is not in the guild
|
|
1356
|
+
*/
|
|
1357
|
+
fetch(): Promise<GuildMember>;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
type GatewayReactionData = GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData;
|
|
1361
|
+
/** Context needed to hydrate a reaction aggregate from a message payload. */
|
|
1362
|
+
type MessageReactionContext = {
|
|
1363
|
+
client: Client;
|
|
1364
|
+
id: string;
|
|
1365
|
+
channelId: string;
|
|
1366
|
+
guildId: string | null;
|
|
1367
|
+
};
|
|
1368
|
+
/** Represents a reaction on a message (gateway event or message aggregate). */
|
|
1369
|
+
declare class MessageReaction extends Base {
|
|
1370
|
+
readonly client: Client;
|
|
1371
|
+
readonly messageId: string;
|
|
1372
|
+
readonly channelId: string;
|
|
1373
|
+
readonly guildId: string | null;
|
|
1374
|
+
readonly emoji: ReactionEmojiPayload;
|
|
1375
|
+
/** Total count when hydrated from a message payload; `1` for gateway add events. */
|
|
1376
|
+
count: number;
|
|
1377
|
+
/** Whether the current user reacted (message payload); false for gateway remove. */
|
|
1378
|
+
me: boolean;
|
|
1379
|
+
/** Raw gateway payload for low-level access (null when built from a message aggregate). */
|
|
1380
|
+
readonly _data: GatewayReactionData | null;
|
|
1381
|
+
constructor(client: Client, data: GatewayReactionData);
|
|
1382
|
+
/** Build a reaction aggregate from a message's `reactions` array entry. */
|
|
1383
|
+
static fromMessage(message: MessageReactionContext, data: APIMessageReaction): MessageReaction;
|
|
1384
|
+
/** Emoji as a string for reaction routes: unicode or `name:id` (`a:name:id` when animated). */
|
|
1385
|
+
get emojiIdentifier(): string;
|
|
1386
|
+
/** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
|
|
1387
|
+
get guild(): Guild | null;
|
|
1388
|
+
/** Cached message this reaction belongs to, or null if the message was not cached. */
|
|
1389
|
+
get message(): Message | null;
|
|
1390
|
+
/** Cached text-capable channel, or null if uncached / not text-based. */
|
|
1391
|
+
get channel(): TextBasedChannel | null;
|
|
1392
|
+
/**
|
|
1393
|
+
* Fetch the message this reaction belongs to (cache first, then REST).
|
|
1394
|
+
* @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
|
|
1395
|
+
*/
|
|
1396
|
+
fetchMessage(): Promise<Message>;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
/** Options for {@link ReactionCollector} / `message.createReactionCollector()`. */
|
|
1400
|
+
interface ReactionCollectorOptions {
|
|
1401
|
+
/** Filter function. Return true to collect the reaction. */
|
|
1402
|
+
filter?: (reaction: MessageReaction, user: User) => boolean;
|
|
1403
|
+
/** Max duration in ms. Collector stops when time expires. */
|
|
1404
|
+
time?: number;
|
|
1405
|
+
/** Max reactions to collect. Collector stops when limit reached. */
|
|
1406
|
+
max?: number;
|
|
1407
|
+
}
|
|
1408
|
+
type ReactionCollectorEndReason = 'time' | 'limit' | 'user';
|
|
1409
|
+
/** A single collected reaction paired with the user who added it. */
|
|
1410
|
+
interface CollectedReaction {
|
|
1411
|
+
reaction: MessageReaction;
|
|
1412
|
+
user: User;
|
|
1413
|
+
}
|
|
1414
|
+
/** Typed event map for {@link ReactionCollector}: `collect` per reaction, `end` when it stops. */
|
|
1415
|
+
interface ReactionCollectorEvents {
|
|
1416
|
+
collect: [reaction: MessageReaction, user: User];
|
|
1417
|
+
end: [collected: Collection<string, CollectedReaction>, reason: ReactionCollectorEndReason];
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Collects reactions on a message. Use message.createReactionCollector().
|
|
1421
|
+
*
|
|
1422
|
+
* Listens to both {@link Events.MessageReactionAdd} and {@link Events.MessageReactionAddMany}
|
|
1423
|
+
* (gateway may batch rapid reactions into ADD_MANY instead of individual ADD events).
|
|
1424
|
+
*
|
|
1425
|
+
* @example
|
|
1426
|
+
* const collector = message.createReactionCollector({ filter: (r, u) => u.id === userId, time: 10000 });
|
|
1427
|
+
* collector.on('collect', (reaction, user) => console.log(user.username, 'reacted', reaction.emoji.name));
|
|
1428
|
+
* collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
|
|
1429
|
+
*/
|
|
1430
|
+
declare class ReactionCollector extends EventEmitter {
|
|
1431
|
+
readonly client: Client;
|
|
1432
|
+
readonly messageId: string;
|
|
1433
|
+
readonly channelId: string;
|
|
1434
|
+
readonly options: Required<ReactionCollectorOptions>;
|
|
1435
|
+
readonly collected: Collection<string, CollectedReaction>;
|
|
1436
|
+
private _timeout;
|
|
1437
|
+
private _ended;
|
|
1438
|
+
private readonly _onAdd;
|
|
1439
|
+
private readonly _onAddMany;
|
|
1440
|
+
constructor(client: Client, messageId: string, channelId: string, options?: ReactionCollectorOptions);
|
|
1441
|
+
private _collect;
|
|
1442
|
+
stop(reason?: ReactionCollectorEndReason): void;
|
|
1443
|
+
/**
|
|
1444
|
+
* One-shot helper used by {@link Message.awaitReactions}.
|
|
1445
|
+
* Resolves with the collected reactions when the collector ends.
|
|
1446
|
+
* Rejects if `options.errors` includes the end reason.
|
|
1447
|
+
*/
|
|
1448
|
+
static awaitReactions(client: Client, messageId: string, channelId: string, options?: ReactionCollectorOptions & {
|
|
1449
|
+
errors?: ReactionCollectorEndReason[];
|
|
1450
|
+
}): Promise<Collection<string, CollectedReaction>>;
|
|
1451
|
+
on<K extends keyof ReactionCollectorEvents>(event: K, listener: (...args: ReactionCollectorEvents[K]) => void): this;
|
|
1452
|
+
emit<K extends keyof ReactionCollectorEvents>(event: K, ...args: ReactionCollectorEvents[K]): boolean;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
/**
|
|
1456
|
+
* Cached reactions on a {@link Message}, keyed by emoji identifier.
|
|
1457
|
+
*/
|
|
1458
|
+
declare class MessageReactionManager {
|
|
1459
|
+
private readonly message;
|
|
1460
|
+
private readonly _cache;
|
|
1461
|
+
constructor(message: MessageReactionContext);
|
|
1462
|
+
/** Reactions keyed by unicode name or `name:id`. */
|
|
1463
|
+
get cache(): Collection<string, MessageReaction>;
|
|
1464
|
+
get size(): number;
|
|
1465
|
+
[Symbol.iterator](): IterableIterator<MessageReaction>;
|
|
1466
|
+
/** @internal Sync from an API message payload. */
|
|
1467
|
+
_patch(reactions: APIMessageReaction[] | null | undefined): void;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
/** Sticker attached to a message (domain view of {@link APIMessageSticker}). */
|
|
1471
|
+
declare class MessageSticker extends Base {
|
|
1472
|
+
readonly client: Client;
|
|
1473
|
+
readonly id: string;
|
|
1474
|
+
name: string;
|
|
1475
|
+
description: string;
|
|
1476
|
+
tags: string[];
|
|
1477
|
+
readonly animated: boolean;
|
|
1478
|
+
constructor(client: Client, data: APIMessageSticker);
|
|
1479
|
+
/** CDN URL for this sticker image. */
|
|
1480
|
+
get url(): string;
|
|
1481
|
+
/** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
|
|
1482
|
+
get createdTimestamp(): number;
|
|
1483
|
+
/** Date when this sticker was created, derived from its snowflake ID. */
|
|
1484
|
+
get createdAt(): Date;
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/** Options for PATCH /channels/{id}/messages/{id}. */
|
|
1488
|
+
interface MessageEditOptions {
|
|
1489
|
+
content?: string | null;
|
|
1490
|
+
embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
|
|
1491
|
+
allowedMentions?: AllowedMentionsOptions;
|
|
1492
|
+
flags?: MessageFlagsResolvable | number;
|
|
1493
|
+
/** Keep by snowflake `id`, or add via `uploadFilename` from the presigned upload flow. */
|
|
1494
|
+
attachments?: MessageAttachmentEdit[];
|
|
1495
|
+
}
|
|
1496
|
+
type PreparedMessagePost = Awaited<ReturnType<typeof prepareMessagePostPayload>>;
|
|
1497
|
+
/** CamelCase reply / forward reference on a {@link Message}. */
|
|
1498
|
+
interface MessageReference {
|
|
1499
|
+
channelId: string;
|
|
1500
|
+
messageId: string;
|
|
1501
|
+
guildId: string | null;
|
|
1502
|
+
type?: number;
|
|
1503
|
+
}
|
|
1504
|
+
/** CamelCase call metadata on a {@link Message}. */
|
|
1505
|
+
interface MessageCall {
|
|
1506
|
+
participants: string[];
|
|
1507
|
+
endedAt: Date | null;
|
|
1508
|
+
}
|
|
1509
|
+
/** CamelCase forwarded-message snapshot on a {@link Message}. */
|
|
1510
|
+
interface MessageSnapshot {
|
|
1511
|
+
content: string | null;
|
|
1512
|
+
createdAt: Date;
|
|
1513
|
+
editedAt: Date | null;
|
|
1514
|
+
/** User IDs mentioned in the original message (API snapshots only include IDs). */
|
|
1515
|
+
mentionUserIds: string[];
|
|
1516
|
+
mentionRoles: string[];
|
|
1517
|
+
embeds: MessageEmbed[];
|
|
1518
|
+
attachments: MessageAttachment[];
|
|
1519
|
+
stickers: MessageSticker[];
|
|
1520
|
+
type?: MessageType;
|
|
1521
|
+
}
|
|
1522
|
+
/** Second-arg / inline options for `message.reply()`. */
|
|
1523
|
+
interface ReplyOptions {
|
|
1524
|
+
/** `false` suppresses the replied-user ping (`allowed_mentions.replied_user`). Default: client `defaultReplyPing`. */
|
|
1525
|
+
ping?: boolean;
|
|
1526
|
+
/** Reply to a different message. Default: this message. */
|
|
1527
|
+
replyTo?: Message | MessageReplyTarget;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
type EmojiInput = string | {
|
|
1531
|
+
name: string;
|
|
1532
|
+
id?: string;
|
|
1533
|
+
animated?: boolean;
|
|
1534
|
+
};
|
|
1535
|
+
/** A message in a channel. */
|
|
1536
|
+
declare class Message extends Base {
|
|
1537
|
+
/** Discriminant vs {@link PartialMessage}: always `false` on a hydrated Message. */
|
|
1538
|
+
readonly partial: false;
|
|
1539
|
+
/** The {@link Client} that instantiated this message. */
|
|
1540
|
+
readonly client: Client;
|
|
1541
|
+
/** Snowflake ID of this message. */
|
|
1542
|
+
readonly id: string;
|
|
1543
|
+
/** Channel ID where this message was sent. */
|
|
1544
|
+
readonly channelId: string;
|
|
1545
|
+
/** Guild ID if in a guild channel, null for DMs. */
|
|
1546
|
+
readonly guildId: string | null;
|
|
1547
|
+
/** The user who sent this message. */
|
|
1548
|
+
readonly author: User;
|
|
1549
|
+
/** Text content of the message. */
|
|
1550
|
+
content: string;
|
|
1551
|
+
/** When the message was created. */
|
|
1552
|
+
readonly createdAt: Date;
|
|
1553
|
+
/** When the message was last edited, or null if never edited. */
|
|
1554
|
+
editedAt: Date | null;
|
|
1555
|
+
/** Whether the message is pinned. */
|
|
1556
|
+
pinned: boolean;
|
|
1557
|
+
/** Attached files (images, videos, etc.). */
|
|
1558
|
+
readonly attachments: Collection<string, MessageAttachment>;
|
|
1559
|
+
/** Message type (Default, Reply, etc.). */
|
|
1560
|
+
readonly type: MessageType;
|
|
1561
|
+
/** Message flags bitfield. */
|
|
1562
|
+
flags: MessageFlagsBitField;
|
|
1563
|
+
/** Whether `@everyone` or `@here` was mentioned. */
|
|
1564
|
+
mentionEveryone: boolean;
|
|
1565
|
+
/** Whether this is a text-to-speech message. */
|
|
1566
|
+
tts: boolean;
|
|
1567
|
+
/** Embedded content (camelCase read view; send with {@link EmbedBuilder}). */
|
|
1568
|
+
embeds: MessageEmbed[];
|
|
1569
|
+
/** Stickers sent with the message. */
|
|
1570
|
+
stickers: MessageSticker[];
|
|
1571
|
+
/** Reactions on the message. */
|
|
1572
|
+
readonly reactions: MessageReactionManager;
|
|
1573
|
+
/** Reference to a replied-to message, if any. */
|
|
1574
|
+
messageReference: MessageReference | null;
|
|
1575
|
+
/** Message snapshots for forwarded messages. */
|
|
1576
|
+
messageSnapshots: MessageSnapshot[];
|
|
1577
|
+
/** Call data if this message represents a call event. */
|
|
1578
|
+
call: MessageCall | null;
|
|
1579
|
+
/** The full referenced (replied-to) message, or null. */
|
|
1580
|
+
referencedMessage: Message | null;
|
|
1581
|
+
/** Webhook ID if sent by a webhook. */
|
|
1582
|
+
webhookId: string | null;
|
|
1583
|
+
/** Users mentioned in the message. */
|
|
1584
|
+
mentions: User[];
|
|
1585
|
+
/** Role IDs mentioned in the message. */
|
|
1586
|
+
mentionRoles: string[];
|
|
1587
|
+
/** Client-side nonce for deduplication. */
|
|
1588
|
+
nonce: string | null;
|
|
1589
|
+
/**
|
|
1590
|
+
* Cached text-capable channel (guild text, guild voice, or DM), or null if uncached / not text-based.
|
|
1591
|
+
* Narrowed type has {@link Channel.send} and {@link Channel.delete}.
|
|
1592
|
+
*/
|
|
1593
|
+
get channel(): TextBasedChannel | null;
|
|
1594
|
+
/** Cached guild, or null for DMs / uncached. */
|
|
1595
|
+
get guild(): Guild | null;
|
|
1596
|
+
/** Cached guild member for the author, or null in DMs / if uncached. */
|
|
1597
|
+
get member(): GuildMember | null;
|
|
1598
|
+
/**
|
|
1599
|
+
* Fetch this message's channel (cache first). The returned {@link Channel}
|
|
1600
|
+
* has {@link Channel.delete} and {@link Channel.send}.
|
|
1601
|
+
* @example
|
|
1602
|
+
* const channel = await message.resolveChannel();
|
|
1603
|
+
* await channel.delete();
|
|
1604
|
+
*/
|
|
1605
|
+
resolveChannel(): Promise<Channel>;
|
|
1606
|
+
/**
|
|
1607
|
+
* Fetch and resolve the guild, or null if a DM.
|
|
1608
|
+
* Propagates network/auth errors; only returns null when there is no guildId.
|
|
1609
|
+
* @example
|
|
1610
|
+
* const guild = await message.resolveGuild();
|
|
1611
|
+
*/
|
|
1612
|
+
resolveGuild(): Promise<Guild | null>;
|
|
1613
|
+
/**
|
|
1614
|
+
* Construct a message from API data.
|
|
1615
|
+
* @param data - API message from REST or MESSAGE_CREATE
|
|
1616
|
+
*/
|
|
1617
|
+
constructor(client: Client, data: APIMessage);
|
|
1618
|
+
/**
|
|
1619
|
+
* Apply an API message payload in place (cache identity / MESSAGE_UPDATE).
|
|
1620
|
+
* @internal
|
|
1621
|
+
*/
|
|
1622
|
+
_patch(data: APIMessage): void;
|
|
1623
|
+
/**
|
|
1624
|
+
* Send a standalone message in this channel (not a reply).
|
|
1625
|
+
* Prefer {@link Channel.send} or {@link reply} when you already have the channel or are answering.
|
|
1626
|
+
*/
|
|
1627
|
+
send(options: MessagePrepareInput): Promise<Message>;
|
|
1628
|
+
/**
|
|
1629
|
+
* Send a message to another channel by ID.
|
|
1630
|
+
* Prefer `client.channels.fetch(channelId)` then {@link Channel.send}.
|
|
1631
|
+
*/
|
|
1632
|
+
sendTo(channelId: string, options: MessagePrepareInput): Promise<Message>;
|
|
1633
|
+
/**
|
|
1634
|
+
* Reply to this message.
|
|
1635
|
+
* @example
|
|
1636
|
+
* await message.reply('Pong!');
|
|
1637
|
+
* await message.reply('No ping!', { ping: false });
|
|
1638
|
+
* await message.reply({ content: 'Silent', allowedMentions: AllowedMentions.suppressReplyPing });
|
|
1639
|
+
*/
|
|
1640
|
+
reply(options: string | (MessageSendOptions & ReplyOptions), replyOptions?: ReplyOptions): Promise<Message>;
|
|
1641
|
+
/**
|
|
1642
|
+
* Hydrate a partial message, or return the message as-is.
|
|
1643
|
+
* @example
|
|
1644
|
+
* client.on(Events.MessageUpdate, async (_old, msg) => {
|
|
1645
|
+
* const message = await Message.resolve(msg);
|
|
1646
|
+
* });
|
|
1647
|
+
*/
|
|
1648
|
+
static resolve(message: Message | PartialMessage): Promise<Message>;
|
|
1649
|
+
/** Test helper — prefer {@link reply} / `prepareMessagePostPayload()`. */
|
|
1650
|
+
static _createMessageBody(content: string | MessageSendOptions, referenced_message?: {
|
|
1651
|
+
channel_id: string;
|
|
1652
|
+
message_id: string;
|
|
1653
|
+
guild_id?: string;
|
|
1654
|
+
}, ping?: boolean): Promise<PreparedMessagePost>;
|
|
1655
|
+
/** Send a prepared payload (internal helper). */
|
|
1656
|
+
_send(payload: PreparedMessagePost): Promise<Message>;
|
|
1657
|
+
/** Edit this message (requires author or admin permissions). */
|
|
1658
|
+
edit(options: MessageEditOptions): Promise<Message>;
|
|
1659
|
+
/** Create a {@link ReactionCollector} for this message. */
|
|
1660
|
+
createReactionCollector(options?: ReactionCollectorOptions): ReactionCollector;
|
|
1661
|
+
/**
|
|
1662
|
+
* Wait for reactions matching the filter, then resolve the collected set.
|
|
1663
|
+
* Pass `errors: ['time']` to reject when the timer fires instead of resolving.
|
|
1664
|
+
*/
|
|
1665
|
+
awaitReactions(options?: ReactionCollectorOptions & {
|
|
1666
|
+
errors?: ReactionCollectorEndReason[];
|
|
1667
|
+
}): Promise<Collection<string, CollectedReaction>>;
|
|
1668
|
+
/** Fetch the latest version of this message from the API. */
|
|
1669
|
+
fetch(): Promise<Message>;
|
|
1670
|
+
/** Delete this message. */
|
|
1671
|
+
delete(): Promise<void>;
|
|
1672
|
+
/** Delete a specific attachment from this message. */
|
|
1673
|
+
deleteAttachment(attachmentId: string): Promise<void>;
|
|
1674
|
+
/** Pin this message in the channel. */
|
|
1675
|
+
pin(): Promise<void>;
|
|
1676
|
+
/** Unpin this message from the channel. */
|
|
1677
|
+
unpin(): Promise<void>;
|
|
1678
|
+
/** React to this message with an emoji. */
|
|
1679
|
+
react(emoji: EmojiInput): Promise<void>;
|
|
1680
|
+
/** Remove a reaction (bot's own or a user's if ID is provided). */
|
|
1681
|
+
removeReaction(emoji: EmojiInput, userId?: string): Promise<void>;
|
|
1682
|
+
/** Remove all reactions from this message. */
|
|
1683
|
+
removeAllReactions(): Promise<void>;
|
|
1684
|
+
/** Remove all reactions of a specific emoji. */
|
|
1685
|
+
removeReactionEmoji(emoji: EmojiInput): Promise<void>;
|
|
1686
|
+
/** Fetch users who reacted with a specific emoji. */
|
|
1687
|
+
fetchReactionUsers(emoji: EmojiInput, options?: {
|
|
1688
|
+
limit?: number;
|
|
1747
1689
|
after?: string;
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1690
|
+
}): Promise<User[]>;
|
|
1691
|
+
/** Fetch reaction users with pagination metadata. */
|
|
1692
|
+
fetchReactionUsersPage(emoji: EmojiInput, options?: {
|
|
1693
|
+
limit?: number;
|
|
1694
|
+
after?: string;
|
|
1695
|
+
}): Promise<{
|
|
1696
|
+
users: User[];
|
|
1697
|
+
hasMore: boolean;
|
|
1698
|
+
nextAfter: string | null;
|
|
1699
|
+
}>;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
/** Options for GET /channels/{id}/messages. */
|
|
1703
|
+
interface FetchMessagesOptions {
|
|
1704
|
+
limit?: number;
|
|
1705
|
+
before?: string;
|
|
1706
|
+
after?: string;
|
|
1707
|
+
around?: string;
|
|
1708
|
+
}
|
|
1709
|
+
/** Options for {@link Client.bulkFetchMessages} (user-account only). */
|
|
1710
|
+
interface BulkFetchMessagesOptions {
|
|
1711
|
+
/** When true (default), hydrate {@link Message}s and update the cache. */
|
|
1712
|
+
hydrate?: boolean;
|
|
1713
|
+
}
|
|
1714
|
+
/** One channel's slice of a bulk message fetch. */
|
|
1715
|
+
interface BulkFetchMessagesChannelResult {
|
|
1716
|
+
channelId: string;
|
|
1717
|
+
messages: Collection<string, Message>;
|
|
1718
|
+
}
|
|
1719
|
+
/** Result of {@link MessageManager.bulkFetch}: per-channel message collections. */
|
|
1720
|
+
interface BulkFetchMessagesResult {
|
|
1721
|
+
channels: BulkFetchMessagesChannelResult[];
|
|
1722
|
+
}
|
|
1723
|
+
/**
|
|
1724
|
+
* Per-channel message cache + fetch. Access via `channel.messages`.
|
|
1725
|
+
*
|
|
1726
|
+
* `get` returns the same {@link Message} instance for a cached id (identity).
|
|
1727
|
+
* `fetch` always writes through the client message cache (when enabled).
|
|
1728
|
+
*/
|
|
1729
|
+
declare class MessageManager {
|
|
1730
|
+
private readonly client;
|
|
1731
|
+
private readonly channelId;
|
|
1732
|
+
/** Structure cache keyed by message id (identity for {@link get}). */
|
|
1733
|
+
private readonly _structures;
|
|
1734
|
+
constructor(client: Client, channelId: string);
|
|
1735
|
+
/** Retrieve a cached message by ID, or `undefined` if missing / caching disabled. */
|
|
1736
|
+
get(messageId: string): Message | undefined;
|
|
1737
|
+
/** Retrieve from cache, otherwise {@link fetch}. */
|
|
1738
|
+
resolve(messageId: string): Promise<Message>;
|
|
1739
|
+
/** Fetch a single message by ID. */
|
|
1740
|
+
fetch(messageId: string): Promise<Message>;
|
|
1741
|
+
/** Fetch multiple messages with query options (limit, before, after, around). */
|
|
1742
|
+
fetch(options: FetchMessagesOptions): Promise<Collection<string, Message>>;
|
|
1743
|
+
/** Cache API data and return a {@link Message} (reusing identity when present). */
|
|
1744
|
+
private wrap;
|
|
1745
|
+
/** Fetch a single message from the API. */
|
|
1746
|
+
private fetchOne;
|
|
1747
|
+
/** Fetch multiple messages from the API with pagination/filtering. */
|
|
1748
|
+
private fetchMany;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
/** Options for {@link MessageCollector} / `channel.createMessageCollector()`. */
|
|
1752
|
+
interface MessageCollectorOptions {
|
|
1753
|
+
/** Filter function. Return true to collect the message. */
|
|
1754
|
+
filter?: (message: Message) => boolean;
|
|
1755
|
+
/** Max duration in ms. Collector stops when time expires. Required unless `max` is set. */
|
|
1756
|
+
time?: number;
|
|
1757
|
+
/** Max messages to collect. Collector stops when limit reached. Required unless `time` is set. */
|
|
1758
|
+
max?: number;
|
|
1759
|
+
}
|
|
1760
|
+
type MessageCollectorEndReason = 'time' | 'limit' | 'user';
|
|
1761
|
+
/** Typed event map for {@link MessageCollector}: `collect` per message, `end` when it stops. */
|
|
1762
|
+
interface MessageCollectorEvents {
|
|
1763
|
+
collect: [message: Message];
|
|
1764
|
+
end: [collected: Collection<string, Message>, reason: MessageCollectorEndReason];
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Collects messages in a channel. Use channel.createMessageCollector().
|
|
1768
|
+
* Requires `time` and/or `max`.
|
|
1769
|
+
* @example
|
|
1770
|
+
* const collector = channel.createMessageCollector({ filter: m => m.author.id === userId, time: 10000 });
|
|
1771
|
+
* collector.on('collect', m => console.log(m.content));
|
|
1772
|
+
* collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
|
|
1773
|
+
*/
|
|
1774
|
+
declare class MessageCollector extends EventEmitter {
|
|
1775
|
+
readonly client: Client;
|
|
1776
|
+
readonly channelId: string;
|
|
1777
|
+
readonly options: Required<MessageCollectorOptions>;
|
|
1778
|
+
readonly collected: Collection<string, Message>;
|
|
1779
|
+
private _timeout;
|
|
1780
|
+
private _ended;
|
|
1781
|
+
private _listener;
|
|
1782
|
+
constructor(client: Client, channelId: string, options?: MessageCollectorOptions);
|
|
1783
|
+
stop(reason?: MessageCollectorEndReason): void;
|
|
1784
|
+
/**
|
|
1785
|
+
* One-shot helper used by {@link Channel.awaitMessages}.
|
|
1786
|
+
* Resolves with the collected messages when the collector ends for `user` (or when
|
|
1787
|
+
* the end reason is not listed in `errors`).
|
|
1788
|
+
* By default, `time` and `limit` reject with {@link FluxerError}
|
|
1789
|
+
* (`CollectorIdle` / `CollectorMax`).
|
|
1790
|
+
*/
|
|
1791
|
+
static awaitMessages(client: Client, channelId: string, options?: MessageCollectorOptions & {
|
|
1792
|
+
errors?: MessageCollectorEndReason[];
|
|
1793
|
+
}): Promise<Collection<string, Message>>;
|
|
1794
|
+
on<K extends keyof MessageCollectorEvents>(event: K, listener: (...args: MessageCollectorEvents[K]) => void): this;
|
|
1795
|
+
emit<K extends keyof MessageCollectorEvents>(event: K, ...args: MessageCollectorEvents[K]): boolean;
|
|
1769
1796
|
}
|
|
1770
1797
|
|
|
1771
1798
|
/**
|
|
@@ -1867,11 +1894,12 @@ interface ClientOptions {
|
|
|
1867
1894
|
*/
|
|
1868
1895
|
rest?: Partial<ConstructorParameters<typeof REST>[0]>;
|
|
1869
1896
|
/**
|
|
1870
|
-
*
|
|
1871
|
-
* Reserved for future use.
|
|
1897
|
+
* @deprecated Fluxer has no intents. Prefer {@link ignoredEvents}. Kept only for migration; identify always sends `0`.
|
|
1872
1898
|
*/
|
|
1873
1899
|
intents?: number;
|
|
1874
|
-
/**
|
|
1900
|
+
/**
|
|
1901
|
+
* @deprecated No-op. Fluxer has no intents warning to suppress.
|
|
1902
|
+
*/
|
|
1875
1903
|
suppressIntentWarning?: boolean;
|
|
1876
1904
|
/** {@link GatewayIdentifyFlags} bitfield sent as Identify `flags`. */
|
|
1877
1905
|
identifyFlags?: number;
|
|
@@ -1917,13 +1945,51 @@ interface ClientOptions {
|
|
|
1917
1945
|
defaultReplyPing?: boolean;
|
|
1918
1946
|
/**
|
|
1919
1947
|
* Initial presence on identify (also updatable via `client.user.setPresence`).
|
|
1948
|
+
* CamelCase only; mapped to gateway wire internally.
|
|
1920
1949
|
*/
|
|
1921
|
-
presence?:
|
|
1950
|
+
presence?: PresenceUpdateOptions;
|
|
1922
1951
|
/**
|
|
1923
1952
|
* Emit gateway debug strings.
|
|
1924
1953
|
* @default true
|
|
1925
1954
|
*/
|
|
1926
1955
|
gatewayDebug?: boolean;
|
|
1956
|
+
/**
|
|
1957
|
+
* Total gateway shard count, or `'auto'` to derive from guild count.
|
|
1958
|
+
* Fluxer's `/gateway/bot` currently stubs `shards: 1`, so prefer `'auto'` or an explicit count
|
|
1959
|
+
* for large bots (max 2500 guilds per shard).
|
|
1960
|
+
* Alias: `totalShards`.
|
|
1961
|
+
*/
|
|
1962
|
+
shardCount?: number | 'auto';
|
|
1963
|
+
/**
|
|
1964
|
+
* Alias of {@link shardCount} (matches {@link import('@fluxerjs/sharding').ShardingManager} vocabulary).
|
|
1965
|
+
* @deprecated Prefer {@link shardCount}.
|
|
1966
|
+
*/
|
|
1967
|
+
totalShards?: number | 'auto';
|
|
1968
|
+
/** Explicit shard ids this client should connect (defaults to `0..shardCount-1`). Alias: `shardList`. */
|
|
1969
|
+
shardIds?: number[];
|
|
1970
|
+
/**
|
|
1971
|
+
* Alias of {@link shardIds}.
|
|
1972
|
+
* @deprecated Prefer {@link shardIds}.
|
|
1973
|
+
*/
|
|
1974
|
+
shardList?: number[];
|
|
1975
|
+
/**
|
|
1976
|
+
* Guilds per shard when {@link shardCount} is `'auto'`.
|
|
1977
|
+
* @default 1500
|
|
1978
|
+
*/
|
|
1979
|
+
guildsPerShard?: number;
|
|
1980
|
+
/**
|
|
1981
|
+
* Custom WebSocket sharding strategy builder (e.g. WorkerShardingStrategy).
|
|
1982
|
+
* @see {@link import('@fluxerjs/ws').WorkerShardingStrategy}
|
|
1983
|
+
*/
|
|
1984
|
+
buildStrategy?: _fluxerjs_ws.BuildShardingStrategyFn;
|
|
1985
|
+
/**
|
|
1986
|
+
* Optional session store for RESUME across restarts (defaults to in-memory).
|
|
1987
|
+
*/
|
|
1988
|
+
sessionStore?: _fluxerjs_ws.ISessionStore;
|
|
1989
|
+
/**
|
|
1990
|
+
* Optional identify throttler (e.g. parent-backed when under ShardingManager).
|
|
1991
|
+
*/
|
|
1992
|
+
identifyThrottler?: _fluxerjs_ws.IIdentifyThrottler;
|
|
1927
1993
|
/** Minimum log level for {@link Client.logger}. Default: `warn`. */
|
|
1928
1994
|
logLevel?: LogLevel;
|
|
1929
1995
|
/** Custom logger instance (overrides {@link logLevel} sink defaults). */
|
|
@@ -1973,7 +2039,10 @@ declare class CacheController {
|
|
|
1973
2039
|
get cascading(): boolean;
|
|
1974
2040
|
/** Current sizes for each cache bucket. */
|
|
1975
2041
|
stats(): CacheStats;
|
|
1976
|
-
|
|
2042
|
+
/**
|
|
2043
|
+
* Sweep cached messages. Filter receives a hydrated {@link Message} (`createdAt`).
|
|
2044
|
+
*/
|
|
2045
|
+
sweepMessages(filter?: (message: Message, channelId: string) => boolean, channelId?: string): number;
|
|
1977
2046
|
sweepMembers(filter?: (member: GuildMember, guildId: string) => boolean): number;
|
|
1978
2047
|
sweepUsers(filter?: (user: User, id: string) => boolean): number;
|
|
1979
2048
|
/**
|
|
@@ -2007,15 +2076,24 @@ declare class CacheController {
|
|
|
2007
2076
|
* Extends {@link LimitedCollection} (`.get()`, `.set()`, `.filter()`, …).
|
|
2008
2077
|
* FIFO-evicts (and keeps guild indexes / message caches aligned) at `cache.channels`.
|
|
2009
2078
|
*/
|
|
2010
|
-
declare class ChannelManager extends LimitedCollection<string, Channel
|
|
2079
|
+
declare class ChannelManager extends LimitedCollection<string, Channel> {
|
|
2011
2080
|
private readonly client;
|
|
2012
2081
|
constructor(client: Client);
|
|
2082
|
+
/**
|
|
2083
|
+
* Remove a channel from cache. Does not delete it on the API.
|
|
2084
|
+
* Use {@link Channel.delete} after {@link fetch} to delete the channel.
|
|
2085
|
+
*/
|
|
2013
2086
|
delete(key: string): boolean;
|
|
2014
2087
|
/** Retrieve from cache, otherwise {@link fetch}. */
|
|
2015
2088
|
resolve(channelId: string): Promise<Channel>;
|
|
2016
2089
|
/**
|
|
2017
|
-
* Fetch a channel by ID.
|
|
2018
|
-
*
|
|
2090
|
+
* Fetch a channel by ID. The returned {@link Channel} has {@link Channel.delete}
|
|
2091
|
+
* and {@link Channel.send} (send throws if the type is not text-based).
|
|
2092
|
+
* Returns the cached channel unless `force` is set.
|
|
2093
|
+
* @example
|
|
2094
|
+
* const channel = await client.channels.fetch(channelId);
|
|
2095
|
+
* await channel.delete();
|
|
2096
|
+
* await channel.send('hi');
|
|
2019
2097
|
* @throws {@link FluxerError} with CHANNEL_NOT_FOUND if missing
|
|
2020
2098
|
*/
|
|
2021
2099
|
fetch(channelId: string, options?: {
|
|
@@ -2028,6 +2106,7 @@ declare class ChannelManager extends LimitedCollection<string, Channel | GuildCh
|
|
|
2028
2106
|
fetchMessage(channelId: string, messageId: string): Promise<Message>;
|
|
2029
2107
|
/**
|
|
2030
2108
|
* Send to a channel by ID without resolving it first.
|
|
2109
|
+
* Prefer {@link Channel.send} after {@link fetch} when you want the channel object.
|
|
2031
2110
|
* @example
|
|
2032
2111
|
* await client.channels.send(logChannelId, 'User joined!');
|
|
2033
2112
|
*/
|
|
@@ -2045,111 +2124,48 @@ declare class ClientUser extends User {
|
|
|
2045
2124
|
fetchGuilds(options?: {
|
|
2046
2125
|
withCounts?: boolean;
|
|
2047
2126
|
}): Promise<PartialUserGuildPayload[]>;
|
|
2048
|
-
/**
|
|
2127
|
+
/**
|
|
2128
|
+
* Leave a guild (`client.user.leaveGuild`).
|
|
2129
|
+
* DELETE /users/@me/guilds/{guild_id}.
|
|
2130
|
+
*
|
|
2131
|
+
* @param guildId - Guild to leave
|
|
2132
|
+
* @param options - Optional sudo / MFA body for user accounts
|
|
2133
|
+
* @example
|
|
2134
|
+
* await client.user.leaveGuild(guildId);
|
|
2135
|
+
*/
|
|
2049
2136
|
leaveGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
|
|
2050
2137
|
/** Delete every message authored by the caller across a guild (sudo). */
|
|
2051
2138
|
bulkDeleteMyMessagesInGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
|
|
2052
2139
|
}
|
|
2053
2140
|
|
|
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
2141
|
/**
|
|
2076
|
-
*
|
|
2077
|
-
*
|
|
2078
|
-
*
|
|
2079
|
-
|
|
2080
|
-
|
|
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 {
|
|
2142
|
+
* Guild cache and manager with fetch.
|
|
2143
|
+
* Extends {@link LimitedCollection} so you can use `.get()`, `.set()`, `.filter()`, etc.
|
|
2144
|
+
* FIFO-evicts (and cascades nested caches) when at the resolved `cache.guilds` limit.
|
|
2145
|
+
*/
|
|
2146
|
+
declare class GuildManager extends LimitedCollection<string, Guild> {
|
|
2115
2147
|
private readonly client;
|
|
2116
2148
|
constructor(client: Client);
|
|
2117
|
-
/**
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
/**
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
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>;
|
|
2149
|
+
/**
|
|
2150
|
+
* Remove a guild from cache and cascade its channels / message caches.
|
|
2151
|
+
* Does not leave the guild. Use {@link ClientUser.leaveGuild} for that.
|
|
2152
|
+
*/
|
|
2153
|
+
delete(key: string): boolean;
|
|
2154
|
+
/**
|
|
2155
|
+
* Get a guild from cache or fetch from the API if not present.
|
|
2156
|
+
* @param guildId - Snowflake of the guild
|
|
2157
|
+
* @returns The guild
|
|
2158
|
+
* @throws FluxerError with GUILD_NOT_FOUND if missing
|
|
2159
|
+
*/
|
|
2160
|
+
resolve(guildId: string): Promise<Guild>;
|
|
2161
|
+
/**
|
|
2162
|
+
* Fetch a guild by ID.
|
|
2163
|
+
* Returns the cached guild unless `force` is set, in which case REST metadata is applied via `_patch`.
|
|
2164
|
+
* @throws FluxerError with GUILD_NOT_FOUND if missing
|
|
2165
|
+
*/
|
|
2166
|
+
fetch(guildId: string, options?: {
|
|
2167
|
+
force?: boolean;
|
|
2168
|
+
}): Promise<Guild>;
|
|
2153
2169
|
}
|
|
2154
2170
|
|
|
2155
2171
|
type MemberPayload = APIGuildMember & {
|
|
@@ -2176,8 +2192,12 @@ declare class UserManager extends LimitedCollection<string, User> {
|
|
|
2176
2192
|
constructor(client: Client);
|
|
2177
2193
|
/** Remove matching users (skips `client.user`). Returns count removed. */
|
|
2178
2194
|
sweep(filter?: (user: User, id: string) => boolean): number;
|
|
2179
|
-
/** Fetch a user by ID and update cache. */
|
|
2180
|
-
fetch(userId: string
|
|
2195
|
+
/** Fetch a user by ID and update cache. Returns cache unless `force` is set. */
|
|
2196
|
+
fetch(userId: string, options?: {
|
|
2197
|
+
force?: boolean;
|
|
2198
|
+
}): Promise<User>;
|
|
2199
|
+
/** Return a cached user, otherwise {@link fetch}. */
|
|
2200
|
+
resolve(userId: string): Promise<User>;
|
|
2181
2201
|
/**
|
|
2182
2202
|
* Fetch user + profiles (+ optional guild member). Ideal for userinfo commands.
|
|
2183
2203
|
* @example
|
|
@@ -2245,6 +2265,12 @@ declare const Events: {
|
|
|
2245
2265
|
readonly Resumed: "resumed";
|
|
2246
2266
|
readonly Error: "error";
|
|
2247
2267
|
readonly Debug: "debug";
|
|
2268
|
+
readonly ShardReady: "shardReady";
|
|
2269
|
+
readonly ShardResumed: "shardResumed";
|
|
2270
|
+
readonly ShardDisconnect: "shardDisconnect";
|
|
2271
|
+
readonly ShardReconnecting: "shardReconnecting";
|
|
2272
|
+
readonly ShardError: "shardError";
|
|
2273
|
+
readonly ShardingRequired: "shardingRequired";
|
|
2248
2274
|
};
|
|
2249
2275
|
|
|
2250
2276
|
/** Hosted Fluxer production endpoints (default when no instance is configured). */
|
|
@@ -2270,42 +2296,6 @@ declare function resolveInstanceEndpoints(input?: Partial<APIInstanceEndpoints>
|
|
|
2270
2296
|
/** Build an invite URL for a code using the instance invite base. */
|
|
2271
2297
|
declare function inviteUrl(inviteBase: string, code: string): string;
|
|
2272
2298
|
|
|
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
2299
|
type FetchPinnedMessagesOptions = {
|
|
2310
2300
|
limit?: number;
|
|
2311
2301
|
before?: string;
|
|
@@ -2316,17 +2306,62 @@ type PinnedMessagesPage = {
|
|
|
2316
2306
|
hasMore: boolean;
|
|
2317
2307
|
};
|
|
2318
2308
|
|
|
2309
|
+
/** CamelCase permission overwrite on a guild channel. */
|
|
2310
|
+
declare class PermissionOverwrite {
|
|
2311
|
+
readonly id: string;
|
|
2312
|
+
readonly type: OverwriteType;
|
|
2313
|
+
/** @internal Raw allow bitfield string. */
|
|
2314
|
+
_allow: string;
|
|
2315
|
+
/** @internal Raw deny bitfield string. */
|
|
2316
|
+
_deny: string;
|
|
2317
|
+
constructor(data: APIChannelOverwrite);
|
|
2318
|
+
/** Allowed permissions for this overwrite. */
|
|
2319
|
+
get allow(): PermissionsBitField;
|
|
2320
|
+
/** Denied permissions for this overwrite. */
|
|
2321
|
+
get deny(): PermissionsBitField;
|
|
2322
|
+
/** Wire shape for permission computation / REST. */
|
|
2323
|
+
toJSON(): APIChannelOverwrite;
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
/** Options for {@link PermissionOverwriteManager.edit}. */
|
|
2327
|
+
interface PermissionOverwriteEditOptions {
|
|
2328
|
+
type: OverwriteType;
|
|
2329
|
+
allow?: PermissionResolvable;
|
|
2330
|
+
deny?: PermissionResolvable;
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* Manages channel permission overwrites (`edit` / `delete` / `cache`).
|
|
2334
|
+
* Requires Manage Roles for mutations.
|
|
2335
|
+
*/
|
|
2336
|
+
declare class PermissionOverwriteManager {
|
|
2337
|
+
private readonly channel;
|
|
2338
|
+
private readonly _cache;
|
|
2339
|
+
constructor(channel: GuildChannel, initial?: APIChannelOverwrite[]);
|
|
2340
|
+
/** Cached overwrites keyed by role/member ID. */
|
|
2341
|
+
get cache(): Collection<string, PermissionOverwrite>;
|
|
2342
|
+
get size(): number;
|
|
2343
|
+
[Symbol.iterator](): IterableIterator<PermissionOverwrite>;
|
|
2344
|
+
/** Wire-shaped overwrites for permission computation. */
|
|
2345
|
+
toJSON(): APIChannelOverwrite[];
|
|
2346
|
+
/** Edit or create a permission overwrite. */
|
|
2347
|
+
edit(overwriteId: string, options: PermissionOverwriteEditOptions): Promise<void>;
|
|
2348
|
+
/** Delete a permission overwrite. */
|
|
2349
|
+
delete(overwriteId: string): Promise<void>;
|
|
2350
|
+
/** @internal Sync from an API channel payload. */
|
|
2351
|
+
_patch(overwrites: APIChannelOverwrite[] | null | undefined): void;
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2319
2354
|
/** A channel in a guild (text, voice, category, etc.). */
|
|
2320
2355
|
declare class GuildChannel extends Channel {
|
|
2321
|
-
/** Guild ID this channel belongs to. */
|
|
2322
|
-
readonly guildId: string;
|
|
2356
|
+
/** Guild ID this channel belongs to, or null if missing from the payload. */
|
|
2357
|
+
readonly guildId: string | null;
|
|
2323
2358
|
name: string | null;
|
|
2324
2359
|
/** Position in the channel list. */
|
|
2325
2360
|
position?: number;
|
|
2326
2361
|
/** Parent category ID, or null if none. */
|
|
2327
2362
|
parentId: string | null;
|
|
2328
2363
|
/** Permission overwrites for roles/members. */
|
|
2329
|
-
permissionOverwrites:
|
|
2364
|
+
readonly permissionOverwrites: PermissionOverwriteManager;
|
|
2330
2365
|
constructor(client: Client, data: APIChannel);
|
|
2331
2366
|
/**
|
|
2332
2367
|
* Apply guild-channel fields in place.
|
|
@@ -2344,32 +2379,22 @@ declare class GuildChannel extends Channel {
|
|
|
2344
2379
|
createInvite(options?: ChannelInviteCreateOptions): Promise<Invite>;
|
|
2345
2380
|
/** Fetch all invites for this channel. Requires Manage Channels. */
|
|
2346
2381
|
fetchInvites(): Promise<Invite[]>;
|
|
2347
|
-
/**
|
|
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). */
|
|
2382
|
+
/** Check if the bot can send messages in this channel (cache-only; needs `members.me`). */
|
|
2356
2383
|
canSendMessage(): boolean;
|
|
2384
|
+
/**
|
|
2385
|
+
* Like {@link canSendMessage}, but hydrates `members.me` via REST when missing.
|
|
2386
|
+
* Returns false when the channel has no guildId.
|
|
2387
|
+
*/
|
|
2388
|
+
canSend(): Promise<boolean>;
|
|
2357
2389
|
/** Edit this channel's settings. Requires Manage Channels. */
|
|
2358
2390
|
edit(options: ChannelEditOptions): Promise<this>;
|
|
2359
2391
|
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
2392
|
}
|
|
2366
2393
|
declare const TextChannel_base: (abstract new (...args: any[]) => {
|
|
2367
|
-
"__#private@#messages": MessageManager | undefined;
|
|
2368
2394
|
send(options: MessagePrepareInput): Promise<Message>;
|
|
2369
|
-
get messages(): MessageManager;
|
|
2370
|
-
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
|
2371
2395
|
fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
|
|
2372
2396
|
fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
|
|
2397
|
+
"__#private@#messages": MessageManager | undefined;
|
|
2373
2398
|
readonly client: Client;
|
|
2374
2399
|
readonly id: string;
|
|
2375
2400
|
type: _fluxerjs_types.ChannelType;
|
|
@@ -2379,7 +2404,10 @@ declare const TextChannel_base: (abstract new (...args: any[]) => {
|
|
|
2379
2404
|
get createdTimestamp(): number;
|
|
2380
2405
|
get createdAt(): Date;
|
|
2381
2406
|
_patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
|
|
2382
|
-
isTextBased(): this is TextChannel | DMChannel;
|
|
2407
|
+
isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
|
|
2408
|
+
isGuild(): this is GuildChannel;
|
|
2409
|
+
isText(): this is TextChannel;
|
|
2410
|
+
isCategory(): this is CategoryChannel;
|
|
2383
2411
|
isDM(): this is DMChannel;
|
|
2384
2412
|
isPersonalNotes(): boolean;
|
|
2385
2413
|
isVoice(): this is VoiceChannel;
|
|
@@ -2395,6 +2423,16 @@ declare const TextChannel_base: (abstract new (...args: any[]) => {
|
|
|
2395
2423
|
fetchRtcRegions(): Promise<RtcRegionPayload[]>;
|
|
2396
2424
|
fetchSlowmode(): Promise<ChannelSlowmodePayload>;
|
|
2397
2425
|
canSendMessage(): boolean;
|
|
2426
|
+
get messages(): MessageManager;
|
|
2427
|
+
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
|
2428
|
+
awaitMessages(options?: MessageCollectorOptions & {
|
|
2429
|
+
errors?: MessageCollectorEndReason[];
|
|
2430
|
+
}): Promise<_fluxerjs_collection.Collection<string, Message>>;
|
|
2431
|
+
delete(options?: SudoVerificationOptions & {
|
|
2432
|
+
silent?: boolean;
|
|
2433
|
+
deleteMessages?: boolean;
|
|
2434
|
+
}): Promise<void>;
|
|
2435
|
+
toString(): string;
|
|
2398
2436
|
}) & typeof GuildChannel;
|
|
2399
2437
|
/** A text channel in a guild (supports sending messages). */
|
|
2400
2438
|
declare class TextChannel extends TextChannel_base {
|
|
@@ -2402,25 +2440,103 @@ declare class TextChannel extends TextChannel_base {
|
|
|
2402
2440
|
topic?: string | null;
|
|
2403
2441
|
/** Whether this channel is marked as NSFW. */
|
|
2404
2442
|
nsfw?: boolean;
|
|
2443
|
+
/** Per-channel NSFW override (`null` inherits). */
|
|
2444
|
+
nsfwOverride?: boolean | null;
|
|
2405
2445
|
/** Slowmode rate limit in seconds. */
|
|
2406
2446
|
rateLimitPerUser?: number;
|
|
2407
2447
|
/** ID of the last message sent in this channel. */
|
|
2408
2448
|
lastMessageId?: string | null;
|
|
2449
|
+
/** Content warning level. */
|
|
2450
|
+
contentWarningLevel?: number | null;
|
|
2451
|
+
/** Custom content warning text. */
|
|
2452
|
+
contentWarningText?: string | null;
|
|
2409
2453
|
constructor(client: Client, data: APIChannel);
|
|
2454
|
+
/**
|
|
2455
|
+
* Set slowmode (seconds between messages). Pass `0` to disable.
|
|
2456
|
+
* Requires Manage Channels. Calls {@link GuildChannel.edit} with `rateLimitPerUser`.
|
|
2457
|
+
*/
|
|
2458
|
+
setSlowmode(seconds: number): Promise<this>;
|
|
2410
2459
|
protected applyEditPatch(data: APIChannel): void;
|
|
2411
2460
|
}
|
|
2412
2461
|
/** A category channel (container for organizing channels). */
|
|
2413
2462
|
declare class CategoryChannel extends GuildChannel {
|
|
2414
2463
|
}
|
|
2415
|
-
|
|
2416
|
-
|
|
2464
|
+
declare const VoiceChannel_base: (abstract new (...args: any[]) => {
|
|
2465
|
+
send(options: MessagePrepareInput): Promise<Message>;
|
|
2466
|
+
fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
|
|
2467
|
+
fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
|
|
2468
|
+
"__#private@#messages": MessageManager | undefined;
|
|
2469
|
+
readonly client: Client;
|
|
2470
|
+
readonly id: string;
|
|
2471
|
+
type: _fluxerjs_types.ChannelType;
|
|
2472
|
+
name: string | null;
|
|
2473
|
+
icon: string | null;
|
|
2474
|
+
lastPinTimestamp: string | null;
|
|
2475
|
+
get createdTimestamp(): number;
|
|
2476
|
+
get createdAt(): Date;
|
|
2477
|
+
_patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
|
|
2478
|
+
isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
|
|
2479
|
+
isGuild(): this is GuildChannel;
|
|
2480
|
+
isText(): this is TextChannel;
|
|
2481
|
+
isCategory(): this is CategoryChannel;
|
|
2482
|
+
isDM(): this is DMChannel;
|
|
2483
|
+
isPersonalNotes(): boolean;
|
|
2484
|
+
isVoice(): this is VoiceChannel;
|
|
2485
|
+
isLink(): this is LinkChannel;
|
|
2486
|
+
bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
|
|
2487
|
+
bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
|
|
2488
|
+
acknowledgePins(): Promise<void>;
|
|
2489
|
+
clearReadState(): Promise<void>;
|
|
2490
|
+
requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
|
|
2491
|
+
completeAttachmentUploads(uploads: AttachmentUploadCompleteItem[]): Promise<AttachmentUploadCompleteResponse>;
|
|
2492
|
+
uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
|
|
2493
|
+
sendTyping(): Promise<void>;
|
|
2494
|
+
fetchRtcRegions(): Promise<RtcRegionPayload[]>;
|
|
2495
|
+
fetchSlowmode(): Promise<ChannelSlowmodePayload>;
|
|
2496
|
+
canSendMessage(): boolean;
|
|
2497
|
+
get messages(): MessageManager;
|
|
2498
|
+
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
|
2499
|
+
awaitMessages(options?: MessageCollectorOptions & {
|
|
2500
|
+
errors?: MessageCollectorEndReason[];
|
|
2501
|
+
}): Promise<_fluxerjs_collection.Collection<string, Message>>;
|
|
2502
|
+
delete(options?: SudoVerificationOptions & {
|
|
2503
|
+
silent?: boolean;
|
|
2504
|
+
deleteMessages?: boolean;
|
|
2505
|
+
}): Promise<void>;
|
|
2506
|
+
toString(): string;
|
|
2507
|
+
}) & typeof GuildChannel;
|
|
2508
|
+
/** A voice channel in a guild. Voice is text-capable on Fluxer. */
|
|
2509
|
+
declare class VoiceChannel extends VoiceChannel_base {
|
|
2510
|
+
/** Guild ID. Voice channels always belong to a guild. */
|
|
2511
|
+
readonly guildId: string;
|
|
2512
|
+
/** Channel topic. */
|
|
2513
|
+
topic?: string | null;
|
|
2514
|
+
/** Whether this channel is marked as NSFW. */
|
|
2515
|
+
nsfw?: boolean;
|
|
2516
|
+
/** Per-channel NSFW override (`null` inherits). */
|
|
2517
|
+
nsfwOverride?: boolean | null;
|
|
2518
|
+
/** Slowmode rate limit in seconds. */
|
|
2519
|
+
rateLimitPerUser?: number;
|
|
2520
|
+
/** ID of the last message sent in this channel. */
|
|
2521
|
+
lastMessageId?: string | null;
|
|
2522
|
+
/** Content warning level. */
|
|
2523
|
+
contentWarningLevel?: number | null;
|
|
2524
|
+
/** Custom content warning text. */
|
|
2525
|
+
contentWarningText?: string | null;
|
|
2417
2526
|
/** Voice bitrate. */
|
|
2418
2527
|
bitrate?: number | null;
|
|
2419
2528
|
/** Maximum number of users allowed. */
|
|
2420
2529
|
userLimit?: number | null;
|
|
2530
|
+
/** Max active voice connections per user. */
|
|
2531
|
+
voiceConnectionLimit?: number | null;
|
|
2421
2532
|
/** RTC region override for this channel. */
|
|
2422
2533
|
rtcRegion?: string | null;
|
|
2423
2534
|
constructor(client: Client, data: APIChannel);
|
|
2535
|
+
/**
|
|
2536
|
+
* Set slowmode (seconds between messages). Pass `0` to disable.
|
|
2537
|
+
* Requires Manage Channels. Calls {@link GuildChannel.edit} with `rateLimitPerUser`.
|
|
2538
|
+
*/
|
|
2539
|
+
setSlowmode(seconds: number): Promise<this>;
|
|
2424
2540
|
protected applyEditPatch(data: APIChannel): void;
|
|
2425
2541
|
}
|
|
2426
2542
|
/** A link channel (redirects to an external URL). */
|
|
@@ -2428,15 +2544,14 @@ declare class LinkChannel extends GuildChannel {
|
|
|
2428
2544
|
/** External URL this channel links to. */
|
|
2429
2545
|
url: string | null;
|
|
2430
2546
|
constructor(client: Client, data: APIChannel);
|
|
2547
|
+
protected applyEditPatch(data: APIChannel): void;
|
|
2431
2548
|
}
|
|
2432
2549
|
|
|
2433
2550
|
declare const DMChannel_base: (abstract new (...args: any[]) => {
|
|
2434
|
-
"__#private@#messages": MessageManager | undefined;
|
|
2435
2551
|
send(options: MessagePrepareInput): Promise<Message>;
|
|
2436
|
-
get messages(): MessageManager;
|
|
2437
|
-
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
|
2438
2552
|
fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
|
|
2439
2553
|
fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
|
|
2554
|
+
"__#private@#messages": MessageManager | undefined;
|
|
2440
2555
|
readonly client: Client;
|
|
2441
2556
|
readonly id: string;
|
|
2442
2557
|
type: ChannelType;
|
|
@@ -2446,7 +2561,10 @@ declare const DMChannel_base: (abstract new (...args: any[]) => {
|
|
|
2446
2561
|
get createdTimestamp(): number;
|
|
2447
2562
|
get createdAt(): Date;
|
|
2448
2563
|
_patch(data: APIChannelPartial | APIChannel): void;
|
|
2449
|
-
isTextBased(): this is TextChannel | DMChannel;
|
|
2564
|
+
isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
|
|
2565
|
+
isGuild(): this is GuildChannel;
|
|
2566
|
+
isText(): this is TextChannel;
|
|
2567
|
+
isCategory(): this is CategoryChannel;
|
|
2450
2568
|
isDM(): this is DMChannel;
|
|
2451
2569
|
isPersonalNotes(): boolean;
|
|
2452
2570
|
isVoice(): this is VoiceChannel;
|
|
@@ -2462,6 +2580,16 @@ declare const DMChannel_base: (abstract new (...args: any[]) => {
|
|
|
2462
2580
|
fetchRtcRegions(): Promise<RtcRegionPayload[]>;
|
|
2463
2581
|
fetchSlowmode(): Promise<ChannelSlowmodePayload>;
|
|
2464
2582
|
canSendMessage(): boolean;
|
|
2583
|
+
get messages(): MessageManager;
|
|
2584
|
+
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
|
2585
|
+
awaitMessages(options?: MessageCollectorOptions & {
|
|
2586
|
+
errors?: MessageCollectorEndReason[];
|
|
2587
|
+
}): Promise<_fluxerjs_collection.Collection<string, Message>>;
|
|
2588
|
+
delete(options?: SudoVerificationOptions & {
|
|
2589
|
+
silent?: boolean;
|
|
2590
|
+
deleteMessages?: boolean;
|
|
2591
|
+
}): Promise<void>;
|
|
2592
|
+
toString(): string;
|
|
2465
2593
|
}) & typeof Channel;
|
|
2466
2594
|
/** DM / Group DM / personal notes channel. */
|
|
2467
2595
|
declare class DMChannel extends DMChannel_base {
|
|
@@ -2474,13 +2602,35 @@ declare class DMChannel extends DMChannel_base {
|
|
|
2474
2602
|
/** Custom nicknames for users in a group DM. */
|
|
2475
2603
|
nicks: Record<string, string>;
|
|
2476
2604
|
constructor(client: Client, data: APIChannelPartial | APIChannel);
|
|
2477
|
-
/**
|
|
2605
|
+
/**
|
|
2606
|
+
* Apply DM/group-DM fields in place.
|
|
2607
|
+
* @internal
|
|
2608
|
+
*/
|
|
2609
|
+
_patch(data: APIChannelPartial | APIChannel): void;
|
|
2610
|
+
/**
|
|
2611
|
+
* Edit this group DM (name, icon, nicks).
|
|
2612
|
+
* Transferring ownership to a bot fails (`CannotTransferOwnershipToBotError`).
|
|
2613
|
+
*/
|
|
2614
|
+
edit(options: GroupDmEditOptions): Promise<this>;
|
|
2615
|
+
/**
|
|
2616
|
+
* Purge all messages from personal notes. Only works on personal notes channels.
|
|
2617
|
+
* Notes-only; bots usually skip this.
|
|
2618
|
+
*/
|
|
2478
2619
|
purgeMessages(): Promise<number>;
|
|
2479
|
-
/**
|
|
2620
|
+
/**
|
|
2621
|
+
* Pin this DM channel to the top of the DM list.
|
|
2622
|
+
* Session-token helper; bots usually skip this.
|
|
2623
|
+
*/
|
|
2480
2624
|
pinInList(): Promise<void>;
|
|
2481
|
-
/**
|
|
2625
|
+
/**
|
|
2626
|
+
* Unpin this DM channel from the DM list.
|
|
2627
|
+
* Session-token helper; bots usually skip this.
|
|
2628
|
+
*/
|
|
2482
2629
|
unpinFromList(): Promise<void>;
|
|
2483
|
-
/**
|
|
2630
|
+
/**
|
|
2631
|
+
* Add a user to this group DM.
|
|
2632
|
+
* Captcha-gated when captcha is enabled; bots are not exempt (`CaptchaRequiredError`).
|
|
2633
|
+
*/
|
|
2484
2634
|
addRecipient(userId: string): Promise<void>;
|
|
2485
2635
|
/** Remove a user from this group DM. */
|
|
2486
2636
|
removeRecipient(userId: string, options?: {
|
|
@@ -2488,8 +2638,14 @@ declare class DMChannel extends DMChannel_base {
|
|
|
2488
2638
|
}): Promise<void>;
|
|
2489
2639
|
}
|
|
2490
2640
|
|
|
2491
|
-
/**
|
|
2641
|
+
/**
|
|
2642
|
+
* Base class for all channel types.
|
|
2643
|
+
* `client.channels.fetch` and `message.resolveChannel` return this type; call `delete` on it.
|
|
2644
|
+
* Text-capable channels (`isTextBased`) also have `send`.
|
|
2645
|
+
* Narrow with `isTextBased` / `isGuild`.
|
|
2646
|
+
*/
|
|
2492
2647
|
declare abstract class Channel extends Base {
|
|
2648
|
+
#private;
|
|
2493
2649
|
/** The {@link Client} that instantiated this channel. */
|
|
2494
2650
|
readonly client: Client;
|
|
2495
2651
|
/** Snowflake ID of this channel. */
|
|
@@ -2512,12 +2668,23 @@ declare abstract class Channel extends Base {
|
|
|
2512
2668
|
* @internal
|
|
2513
2669
|
*/
|
|
2514
2670
|
_patch(data: APIChannelPartial | APIChannel): void;
|
|
2515
|
-
/**
|
|
2671
|
+
/** @internal Factory wired after subclasses load. */
|
|
2516
2672
|
static from(_c: Client, _d: APIChannel | APIChannelPartial): GuildChannel | TextChannel;
|
|
2673
|
+
/** @internal Factory wired after subclasses load. */
|
|
2517
2674
|
static fromOrCreate(_c: Client, _d: APIChannel | APIChannelPartial): TextChannel | DMChannel | GuildChannel;
|
|
2675
|
+
/** @internal Factory wired after subclasses load. */
|
|
2518
2676
|
static createDM(_c: Client, _d: APIChannelPartial): DMChannel;
|
|
2519
|
-
/**
|
|
2520
|
-
|
|
2677
|
+
/**
|
|
2678
|
+
* Whether this channel type can carry messages (text, voice, DM, group DM, notes).
|
|
2679
|
+
* Checks {@link ChannelType}, not whether `send` exists on the instance.
|
|
2680
|
+
*/
|
|
2681
|
+
isTextBased(): this is TextChannel | VoiceChannel | DMChannel;
|
|
2682
|
+
/** Check if this is a guild channel (text, voice, category, or link). */
|
|
2683
|
+
isGuild(): this is GuildChannel;
|
|
2684
|
+
/** Check if this is a guild text channel. */
|
|
2685
|
+
isText(): this is TextChannel;
|
|
2686
|
+
/** Check if this is a category channel. */
|
|
2687
|
+
isCategory(): this is CategoryChannel;
|
|
2521
2688
|
/** Check if this is a DM, group DM, or personal notes channel. */
|
|
2522
2689
|
isDM(): this is DMChannel;
|
|
2523
2690
|
/** Check if this is a personal notes channel. */
|
|
@@ -2532,11 +2699,17 @@ declare abstract class Channel extends Base {
|
|
|
2532
2699
|
* - `bulkDelete(['id1'])` — single DELETE; 2–100 uses bulk-delete route
|
|
2533
2700
|
*/
|
|
2534
2701
|
bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
|
|
2535
|
-
/** Delete all messages sent by the bot in this channel
|
|
2702
|
+
/** Delete all messages sent by the bot in this channel. Sudo auto-passes for bots. */
|
|
2536
2703
|
bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
|
|
2537
|
-
/**
|
|
2704
|
+
/**
|
|
2705
|
+
* Mark all pinned messages as read in this channel.
|
|
2706
|
+
* Session-token helper; bots usually skip this.
|
|
2707
|
+
*/
|
|
2538
2708
|
acknowledgePins(): Promise<void>;
|
|
2539
|
-
/**
|
|
2709
|
+
/**
|
|
2710
|
+
* Clear the read state for this channel.
|
|
2711
|
+
* Session-token helper; bots usually skip this.
|
|
2712
|
+
*/
|
|
2540
2713
|
clearReadState(): Promise<void>;
|
|
2541
2714
|
/** Request upload URLs for attachments before sending a message. */
|
|
2542
2715
|
requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
|
|
@@ -2546,19 +2719,60 @@ declare abstract class Channel extends Base {
|
|
|
2546
2719
|
uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
|
|
2547
2720
|
/** Trigger the typing indicator in this channel. */
|
|
2548
2721
|
sendTyping(): Promise<void>;
|
|
2549
|
-
/**
|
|
2722
|
+
/**
|
|
2723
|
+
* Fetch available RTC regions for voice channels.
|
|
2724
|
+
* User-account only (`DefaultUserOnly`); bots receive `AccessDeniedError`.
|
|
2725
|
+
* Bots should skip this and join voice with `@fluxerjs/voice` instead.
|
|
2726
|
+
*/
|
|
2550
2727
|
fetchRtcRegions(): Promise<RtcRegionPayload[]>;
|
|
2551
2728
|
/** Fetch slowmode state for this channel. */
|
|
2552
2729
|
fetchSlowmode(): Promise<ChannelSlowmodePayload>;
|
|
2553
|
-
/**
|
|
2730
|
+
/** Whether this channel type can carry messages (does not check permissions). */
|
|
2554
2731
|
canSendMessage(): boolean;
|
|
2732
|
+
/** Per-channel message cache + fetch. */
|
|
2733
|
+
get messages(): MessageManager;
|
|
2734
|
+
/** Collect messages in this channel until time/max/stop. */
|
|
2735
|
+
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
|
2736
|
+
/**
|
|
2737
|
+
* Wait for messages matching the filter, then resolve the collected set.
|
|
2738
|
+
* Pass `errors: ['time']` to reject when the timer fires instead of resolving.
|
|
2739
|
+
* @example
|
|
2740
|
+
* const collected = await channel.awaitMessages({ max: 1, time: 15_000 });
|
|
2741
|
+
*/
|
|
2742
|
+
awaitMessages(options?: MessageCollectorOptions & {
|
|
2743
|
+
errors?: MessageCollectorEndReason[];
|
|
2744
|
+
}): Promise<Collection<string, Message>>;
|
|
2745
|
+
/**
|
|
2746
|
+
* Delete this channel (or close it if it is a DM).
|
|
2747
|
+
* Guild channels require Manage Channels. `silent` / `deleteMessages` are Fluxer query params.
|
|
2748
|
+
* @example
|
|
2749
|
+
* const channel = await client.channels.fetch(channelId);
|
|
2750
|
+
* await channel.delete();
|
|
2751
|
+
*/
|
|
2752
|
+
delete(options?: SudoVerificationOptions & {
|
|
2753
|
+
silent?: boolean;
|
|
2754
|
+
deleteMessages?: boolean;
|
|
2755
|
+
}): Promise<void>;
|
|
2756
|
+
/** Channel mention (`<#id>`). */
|
|
2757
|
+
toString(): string;
|
|
2555
2758
|
}
|
|
2556
2759
|
|
|
2760
|
+
/** Channel types that can carry messages (guild text, guild voice, DMs). */
|
|
2761
|
+
type TextBasedChannel = TextChannel | VoiceChannel | DMChannel;
|
|
2762
|
+
|
|
2763
|
+
/** Member payload plus fields that exist on update/edit but not always on GET. */
|
|
2764
|
+
type GuildMemberData = APIGuildMember & {
|
|
2765
|
+
guild_id?: string;
|
|
2766
|
+
bio?: string | null;
|
|
2767
|
+
pronouns?: string | null;
|
|
2768
|
+
};
|
|
2557
2769
|
/**
|
|
2558
2770
|
* Guild member — roles via {@link GuildMember.roles}, permissions via {@link permissions} / {@link permissionsIn}.
|
|
2559
2771
|
* Cached per guild in {@link Guild.members}.
|
|
2560
2772
|
*/
|
|
2561
2773
|
declare class GuildMember extends Base {
|
|
2774
|
+
/** Discriminant vs {@link PartialGuildMember}: always `false` on a hydrated member. */
|
|
2775
|
+
readonly partial: false;
|
|
2562
2776
|
/** Parent client instance. */
|
|
2563
2777
|
readonly client: Client;
|
|
2564
2778
|
/** User ID (same as `user.id`). */
|
|
@@ -2587,14 +2801,18 @@ declare class GuildMember extends Base {
|
|
|
2587
2801
|
accentColor: number | null;
|
|
2588
2802
|
/** Guild-specific profile flags. */
|
|
2589
2803
|
profileFlags: number | null;
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2804
|
+
/** Per-guild reply mention preference override. */
|
|
2805
|
+
mentionFlags: number | null;
|
|
2806
|
+
/** Guild-specific bio (set from member edit; not always on GET member). */
|
|
2807
|
+
bio: string | null;
|
|
2808
|
+
/** Guild-specific pronouns (set from member edit; not always on GET member). */
|
|
2809
|
+
pronouns: string | null;
|
|
2810
|
+
constructor(client: Client, data: GuildMemberData, guild: Guild);
|
|
2593
2811
|
/**
|
|
2594
2812
|
* Apply an API member payload in place (gateway GUILD_MEMBER_UPDATE / REST edit).
|
|
2595
2813
|
* @internal
|
|
2596
2814
|
*/
|
|
2597
|
-
_patch(data:
|
|
2815
|
+
_patch(data: GuildMemberData): void;
|
|
2598
2816
|
/**
|
|
2599
2817
|
* Snapshot for `guildMemberUpdate` old-member arg (before in-place patch).
|
|
2600
2818
|
* @internal
|
|
@@ -2615,7 +2833,11 @@ declare class GuildMember extends Base {
|
|
|
2615
2833
|
size?: number;
|
|
2616
2834
|
extension?: string;
|
|
2617
2835
|
}): string | null;
|
|
2618
|
-
/**
|
|
2836
|
+
/**
|
|
2837
|
+
* PATCH member (`/members/@me` when editing the bot).
|
|
2838
|
+
* @example
|
|
2839
|
+
* await member.edit({ nick: 'Ada' });
|
|
2840
|
+
*/
|
|
2619
2841
|
edit(options: GuildMemberEditOptions): Promise<this>;
|
|
2620
2842
|
/**
|
|
2621
2843
|
* Guild-level permissions (roles only, no channel overwrites).
|
|
@@ -2634,6 +2856,31 @@ declare class GuildMember extends Base {
|
|
|
2634
2856
|
* @param connectionId - Optional connection ID for multi-session scenarios
|
|
2635
2857
|
*/
|
|
2636
2858
|
move(channelId: string | null, connectionId?: string | null): Promise<void>;
|
|
2859
|
+
/** Kick this member. Requires Kick Members. */
|
|
2860
|
+
kick(): Promise<void>;
|
|
2861
|
+
/** Ban this member. Requires Ban Members. */
|
|
2862
|
+
ban(options?: GuildBanOptions): Promise<void>;
|
|
2863
|
+
/**
|
|
2864
|
+
* Whether the bot can kick this member (cache-only; needs `members.me`).
|
|
2865
|
+
* False for the guild owner, self, or when the bot lacks Kick Members / role hierarchy.
|
|
2866
|
+
*/
|
|
2867
|
+
get kickable(): boolean;
|
|
2868
|
+
/**
|
|
2869
|
+
* Whether the bot can ban this member (cache-only; needs `members.me`).
|
|
2870
|
+
*/
|
|
2871
|
+
get bannable(): boolean;
|
|
2872
|
+
/**
|
|
2873
|
+
* Whether the bot can timeout this member (cache-only; needs `members.me`).
|
|
2874
|
+
*/
|
|
2875
|
+
get moderatable(): boolean;
|
|
2876
|
+
private _moderatableWith;
|
|
2877
|
+
/** Negative when this member's highest role is below `other`'s. */
|
|
2878
|
+
private _compareRolePosition;
|
|
2879
|
+
/**
|
|
2880
|
+
* Timeout this member for `durationMs` milliseconds, or pass `null` to clear.
|
|
2881
|
+
* Requires Moderate Members.
|
|
2882
|
+
*/
|
|
2883
|
+
timeout(durationMs: number | null, reason?: string): Promise<this>;
|
|
2637
2884
|
private _effectivePermissions;
|
|
2638
2885
|
private _basePermissions;
|
|
2639
2886
|
}
|
|
@@ -2645,7 +2892,7 @@ declare class GuildMember extends Base {
|
|
|
2645
2892
|
interface ClientEvents {
|
|
2646
2893
|
[Events.Ready]: [];
|
|
2647
2894
|
[Events.MessageCreate]: [message: Message];
|
|
2648
|
-
[Events.MessageUpdate]: [oldMessage: Message | null, newMessage: Message];
|
|
2895
|
+
[Events.MessageUpdate]: [oldMessage: Message | null, newMessage: Message | PartialMessage];
|
|
2649
2896
|
[Events.MessageDelete]: [message: PartialMessage];
|
|
2650
2897
|
[Events.MessageReactionAdd]: [payload: MessageReactionPayload];
|
|
2651
2898
|
[Events.MessageReactionAddMany]: [payload: MessageReactionAddManyPayload];
|
|
@@ -2663,7 +2910,7 @@ interface ClientEvents {
|
|
|
2663
2910
|
[Events.ChannelDelete]: [channel: Channel];
|
|
2664
2911
|
[Events.GuildMemberAdd]: [member: GuildMember];
|
|
2665
2912
|
[Events.GuildMemberUpdate]: [oldMember: GuildMember | null, newMember: GuildMember];
|
|
2666
|
-
[Events.GuildMemberRemove]: [member: GuildMember];
|
|
2913
|
+
[Events.GuildMemberRemove]: [member: GuildMember | PartialGuildMember];
|
|
2667
2914
|
[Events.GuildMembersChunk]: [payload: GuildMembersChunkPayload];
|
|
2668
2915
|
[Events.GuildCountsUpdate]: [payload: GuildCountsUpdatePayload];
|
|
2669
2916
|
[Events.ChannelMemberCountsUpdate]: [payload: ChannelMemberCountsUpdatePayload];
|
|
@@ -2680,8 +2927,10 @@ interface ClientEvents {
|
|
|
2680
2927
|
[Events.GuildEmojisUpdate]: [payload: GuildEmojisUpdatePayload];
|
|
2681
2928
|
[Events.GuildStickersUpdate]: [payload: GuildStickersUpdatePayload];
|
|
2682
2929
|
[Events.GuildRoleCreate]: [role: Role];
|
|
2683
|
-
|
|
2684
|
-
[Events.
|
|
2930
|
+
/** `oldRole` is null when the role was not cached before the update. */
|
|
2931
|
+
[Events.GuildRoleUpdate]: [oldRole: Role | null, role: Role];
|
|
2932
|
+
/** `role` is null when the role was not cached before delete. */
|
|
2933
|
+
[Events.GuildRoleDelete]: [role: Role | null, guildId: string, roleId: string];
|
|
2685
2934
|
[Events.ChannelPinsUpdate]: [payload: ChannelPinsUpdatePayload];
|
|
2686
2935
|
[Events.ChannelRecipientAdd]: [payload: ChannelRecipientPayload];
|
|
2687
2936
|
[Events.ChannelRecipientRemove]: [payload: ChannelRecipientPayload];
|
|
@@ -2697,6 +2946,24 @@ interface ClientEvents {
|
|
|
2697
2946
|
[Events.Resumed]: [];
|
|
2698
2947
|
[Events.Error]: [error: Error];
|
|
2699
2948
|
[Events.Debug]: [message: string];
|
|
2949
|
+
/** A single gateway shard completed READY. */
|
|
2950
|
+
[Events.ShardReady]: [shardId: number];
|
|
2951
|
+
/** A single gateway shard successfully resumed. */
|
|
2952
|
+
[Events.ShardResumed]: [shardId: number];
|
|
2953
|
+
/** A gateway shard closed. */
|
|
2954
|
+
[Events.ShardDisconnect]: [shardId: number, code: number];
|
|
2955
|
+
/** A gateway shard is reconnecting. */
|
|
2956
|
+
[Events.ShardReconnecting]: [shardId: number];
|
|
2957
|
+
/** A gateway shard emitted an error. */
|
|
2958
|
+
[Events.ShardError]: [shardId: number, error: Error];
|
|
2959
|
+
/**
|
|
2960
|
+
* The gateway closed with 4011 — this bot needs more shards.
|
|
2961
|
+
* Non-zero shards drop guild-less events; DMs only reach shard 0.
|
|
2962
|
+
*/
|
|
2963
|
+
[Events.ShardingRequired]: [payload: {
|
|
2964
|
+
shardId: number;
|
|
2965
|
+
numShards: number;
|
|
2966
|
+
}];
|
|
2700
2967
|
}
|
|
2701
2968
|
type ClientEventName = keyof ClientEvents;
|
|
2702
2969
|
type ClientEventListener<K extends ClientEventName> = (...args: ClientEvents[K]) => void;
|
|
@@ -2705,36 +2972,6 @@ type ClientEventMethods = {
|
|
|
2705
2972
|
[K in keyof typeof Events]: (cb: (...args: ClientEvents[(typeof Events)[K]]) => void) => Client;
|
|
2706
2973
|
};
|
|
2707
2974
|
|
|
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
2975
|
/** Bootstrap origin for {@link Client.fromDiscovery}. */
|
|
2739
2976
|
type DiscoveryOrigin = string | {
|
|
2740
2977
|
api: string;
|
|
@@ -2757,14 +2994,20 @@ declare class Client extends EventEmitter {
|
|
|
2757
2994
|
readonly users: UserManager;
|
|
2758
2995
|
/** Cache limits, stats, sweeps, and cascade entry points. */
|
|
2759
2996
|
readonly cache: CacheController;
|
|
2760
|
-
/**
|
|
2761
|
-
readonly packs: PackManager;
|
|
2762
|
-
/** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
|
|
2997
|
+
/** Typed event handlers. Prefer `client.on(Events.*, ...)`. */
|
|
2763
2998
|
readonly events: ClientEventMethods;
|
|
2764
2999
|
/** The authenticated bot user. Null until READY is received. */
|
|
2765
3000
|
user: ClientUser | null;
|
|
2766
3001
|
/** Timestamp when the client became ready. Null until READY is received. */
|
|
2767
3002
|
readyAt: Date | null;
|
|
3003
|
+
/**
|
|
3004
|
+
* Milliseconds since {@link readyAt}, or `null` if the client is not ready.
|
|
3005
|
+
* @example
|
|
3006
|
+
* client.on(Events.Ready, () => {
|
|
3007
|
+
* console.log(client.uptime);
|
|
3008
|
+
* });
|
|
3009
|
+
*/
|
|
3010
|
+
get uptime(): number | null;
|
|
2768
3011
|
/** @internal WebSocket manager. */
|
|
2769
3012
|
_ws: WebSocketManager | null;
|
|
2770
3013
|
/** When waitForGuilds, guild IDs still expected via GUILD_CREATE. */
|
|
@@ -2841,35 +3084,38 @@ declare class Client extends EventEmitter {
|
|
|
2841
3084
|
*/
|
|
2842
3085
|
fetchApplication(): Promise<APIApplicationMe>;
|
|
2843
3086
|
/**
|
|
2844
|
-
* Fetch OAuth2 applications
|
|
2845
|
-
*
|
|
3087
|
+
* Fetch OAuth2 applications (`GET /oauth2/applications/@me`).
|
|
3088
|
+
* A bot token returns the bot application object (normalized to a one-element array).
|
|
3089
|
+
* A user token returns the owner's application list.
|
|
2846
3090
|
*/
|
|
2847
3091
|
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
3092
|
/**
|
|
2856
3093
|
* Preload recent messages for multiple channels (batch endpoint).
|
|
2857
|
-
* @
|
|
2858
|
-
* @returns Preload response with message counts/timestamps
|
|
3094
|
+
* Prefer this over {@link bulkFetchMessages} for bots (`bulkFetchMessages` is user-account only).
|
|
2859
3095
|
*/
|
|
2860
3096
|
preloadMessages(channelIds: string[]): Promise<APIPreloadMessagesResponse>;
|
|
2861
3097
|
/**
|
|
2862
3098
|
* Preload recent messages (alternate endpoint).
|
|
2863
|
-
*
|
|
2864
|
-
* @returns Preload response with message counts/timestamps
|
|
3099
|
+
* Prefer this over {@link bulkFetchMessages} for bots.
|
|
2865
3100
|
*/
|
|
2866
3101
|
preloadMessagesAlt(channelIds: string[]): Promise<APIPreloadMessagesResponse>;
|
|
3102
|
+
/**
|
|
3103
|
+
* Multi-channel message fetch (`POST /channels/messages/bulk`).
|
|
3104
|
+
* User-account only (`DefaultUserOnly`); bots receive `AccessDeniedError`.
|
|
3105
|
+
* Bots should use {@link preloadMessages} or `channel.messages.fetch` instead.
|
|
3106
|
+
*/
|
|
2867
3107
|
bulkFetchMessages(requests: BulkFetchMessagesRequest[], options?: BulkFetchMessagesOptions & {
|
|
2868
3108
|
hydrate?: true;
|
|
2869
3109
|
}): Promise<BulkFetchMessagesResult>;
|
|
2870
3110
|
bulkFetchMessages(requests: BulkFetchMessagesRequest[], options: BulkFetchMessagesOptions & {
|
|
2871
3111
|
hydrate: false;
|
|
2872
3112
|
}): Promise<APIBulkMessageFetchResponse>;
|
|
3113
|
+
/**
|
|
3114
|
+
* Search messages in the current bot scope (`POST /search/messages`, `scope: current`).
|
|
3115
|
+
* Other scopes are denied for bots (`BOT_SEARCH_SCOPE_UNAVAILABLE`).
|
|
3116
|
+
* Returns camelCase results (`hitsPerPage`) or `{ indexing: true }` while channels are indexed.
|
|
3117
|
+
*/
|
|
3118
|
+
searchMessages(options?: MessageSearchOptions): Promise<MessageSearchResponse>;
|
|
2873
3119
|
/** @internal */
|
|
2874
3120
|
_getMessageCache(channelId: string): Map<string, APIMessage> | null;
|
|
2875
3121
|
/** @internal */
|
|
@@ -2886,11 +3132,12 @@ declare class Client extends EventEmitter {
|
|
|
2886
3132
|
/**
|
|
2887
3133
|
* Sweep cached messages (remove entries matching filter).
|
|
2888
3134
|
* Prefer {@link CacheController.sweepMessages} (`client.cache.sweepMessages`).
|
|
3135
|
+
* The filter receives a hydrated {@link Message} (`createdAt`), not the stored wire payload.
|
|
2889
3136
|
* @param filter - Predicate to test each message (return true to remove)
|
|
2890
3137
|
* @param channelId - Optional channel ID to scope sweep
|
|
2891
3138
|
* @returns Count of messages removed
|
|
2892
3139
|
*/
|
|
2893
|
-
sweepMessages(filter?: (message:
|
|
3140
|
+
sweepMessages(filter?: (message: Message, channelId: string) => boolean, channelId?: string): number;
|
|
2894
3141
|
/**
|
|
2895
3142
|
* Sweep cached members across all guilds (remove entries matching filter).
|
|
2896
3143
|
* Prefer {@link CacheController.sweepMembers} (`client.cache.sweepMembers`).
|
|
@@ -2907,6 +3154,9 @@ declare class Client extends EventEmitter {
|
|
|
2907
3154
|
getOrCreateUser(data: APIUserPartial): User;
|
|
2908
3155
|
/**
|
|
2909
3156
|
* The underlying {@link WebSocketManager} (throws if not logged in).
|
|
3157
|
+
* Gateway heartbeat ACK latency: `client.ws.ping` (ms, or `-1` before the first ACK).
|
|
3158
|
+
* @example
|
|
3159
|
+
* console.log(client.ws.ping);
|
|
2910
3160
|
* @throws {@link FluxerError} with {@link ErrorCodes.NotLoggedIn}
|
|
2911
3161
|
*/
|
|
2912
3162
|
get ws(): WebSocketManager;
|
|
@@ -2929,6 +3179,24 @@ declare class Client extends EventEmitter {
|
|
|
2929
3179
|
presences?: boolean;
|
|
2930
3180
|
nonce?: string;
|
|
2931
3181
|
}): void;
|
|
3182
|
+
/**
|
|
3183
|
+
* Request guild member/online counts via gateway opcode 15.
|
|
3184
|
+
* Listen for `guildCountsUpdate`. Cached `guild.memberCount` / `guild.onlineCount` update when that event arrives.
|
|
3185
|
+
*/
|
|
3186
|
+
requestGuildCounts(options: {
|
|
3187
|
+
guildIds: string[];
|
|
3188
|
+
nonce?: string;
|
|
3189
|
+
}): void;
|
|
3190
|
+
/**
|
|
3191
|
+
* Request per-channel member counts via gateway opcode 16.
|
|
3192
|
+
* Event-only: listen for `channelMemberCountsUpdate`. There is no `channel.memberCount` field.
|
|
3193
|
+
*/
|
|
3194
|
+
requestChannelMemberCounts(options: {
|
|
3195
|
+
guildId: string;
|
|
3196
|
+
channelId?: string;
|
|
3197
|
+
channelIds?: string[];
|
|
3198
|
+
nonce?: string;
|
|
3199
|
+
}): void;
|
|
2932
3200
|
/**
|
|
2933
3201
|
* Broadcast a gateway payload to all shards.
|
|
2934
3202
|
* @param payload - Gateway send payload
|
|
@@ -2937,14 +3205,18 @@ declare class Client extends EventEmitter {
|
|
|
2937
3205
|
_sendToAllShards(payload: GatewaySendPayload): void;
|
|
2938
3206
|
/**
|
|
2939
3207
|
* Connect to the gateway with a bot token.
|
|
3208
|
+
* @example
|
|
3209
|
+
* const client = new Client();
|
|
3210
|
+
* client.on(Events.Ready, () => console.log('Ready!'));
|
|
3211
|
+
* await client.login(process.env.FLUXER_BOT_TOKEN);
|
|
2940
3212
|
* @param token - Bot token from the developer portal
|
|
2941
3213
|
* @param options - Optional abort signal for cancellation
|
|
2942
|
-
* @returns
|
|
3214
|
+
* @returns This client (for chaining)
|
|
2943
3215
|
* @throws {@link FluxerError} if already logged in or token is invalid
|
|
2944
3216
|
*/
|
|
2945
3217
|
login(token: string, options?: {
|
|
2946
3218
|
signal?: AbortSignal;
|
|
2947
|
-
}): Promise<
|
|
3219
|
+
}): Promise<this>;
|
|
2948
3220
|
/** @internal Finalize the READY event emission. */
|
|
2949
3221
|
_finalizeReady(): void;
|
|
2950
3222
|
/** @internal Mark a guild as received during startup. */
|
|
@@ -2968,7 +3240,21 @@ declare class Client extends EventEmitter {
|
|
|
2968
3240
|
assertReady(): asserts this is Client & {
|
|
2969
3241
|
user: NonNullable<Client['user']>;
|
|
2970
3242
|
};
|
|
3243
|
+
/**
|
|
3244
|
+
* REST path helpers ({@link Routes}). Pass the path to {@link REST client.rest}.
|
|
3245
|
+
* Prefer high-level helpers (`channel.send()`, `guild.members.fetch()`) when they exist.
|
|
3246
|
+
*
|
|
3247
|
+
* @example
|
|
3248
|
+
* const channel = await client.rest.get(Client.Routes.channel(channelId));
|
|
3249
|
+
*
|
|
3250
|
+
* @example
|
|
3251
|
+
* await client.rest.post(Client.Routes.channelMessages(channelId), {
|
|
3252
|
+
* body: { content: 'hello' },
|
|
3253
|
+
* });
|
|
3254
|
+
*
|
|
3255
|
+
* @see {@link Routes}
|
|
3256
|
+
*/
|
|
2971
3257
|
static get Routes(): typeof Routes;
|
|
2972
3258
|
}
|
|
2973
3259
|
|
|
2974
|
-
export {
|
|
3260
|
+
export { type InviteChannelSnapshot 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, Invite as _, type AllowedMentionsOptions as a, normalizeApiOrigin as a$, type InviteDeletePayload as a0, type InviteGuildSnapshot as a1, LinkChannel as a2, Message as a3, type MessageAttachment as a4, type MessageCall as a5, MessageCollector as a6, type MessageCollectorEndReason as a7, type MessageCollectorOptions as a8, type MessageDeleteBulkPayload as a9, type PinnedMessagesPage as aA, type PresenceActivity as aB, type PresenceUpdateBulkPayload as aC, type PresenceUpdatePayload as aD, ReactionCollector as aE, type ReactionCollectorEndReason as aF, type ReactionCollectorOptions as aG, type ReactionEmojiPayload as aH, type ReplyOptions as aI, type ResolvedCacheLimits as aJ, type ResolvedInstance as aK, Role as aL, type RoleResolvable as aM, type TextBasedChannel as aN, TextChannel as aO, type TypingStartPayload as aP, type UploadFileForSend as aQ, User as aR, UserManager as aS, type VanityURLPayload as aT, VoiceChannel as aU, Webhook as aV, type WebhookEditOptions as aW, type WebhookMessageEditOptions as aX, type WebhookSendOptions as aY, type WebhooksUpdatePayload as aZ, inviteUrl as a_, type MessageEditOptions as aa, type MessageEmbed as ab, type MessageEmbedAuthor as ac, type MessageEmbedField as ad, type MessageEmbedFooter as ae, type MessageEmbedMedia as af, MessageManager as ag, type MessagePrepareInput as ah, MessageReaction as ai, type MessageReactionAddManyEntry as aj, type MessageReactionAddManyPayload as ak, MessageReactionManager as al, type MessageReactionPayload as am, type MessageReactionRemoveAllPayload as an, type MessageReactionRemoveEmojiPayload as ao, type MessageReference as ap, type MessageReplyTarget as aq, type MessageSendOptions as ar, type MessageSnapshot as as, MessageSticker as at, PartialGuildMember as au, PartialMessage as av, type PartialUserGuildPayload as aw, PermissionOverwrite as ax, type PermissionOverwriteEditOptions as ay, PermissionOverwriteManager as az, type AuditLogChange as b, normalizeCacheLimit as b0, parseInstanceDiscovery as b1, resolveCacheLimits as b2, resolveInstanceEndpoints as b3, 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 };
|