@fluxerjs/core 2.1.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 +32 -7
- package/dist/Expressions-Bdgo72qI.d.mts +34 -0
- package/dist/Expressions-Bdgo72qI.d.ts +34 -0
- package/dist/{subpath-message-CWiBEUUV.d.mts → SubpathMessage-CjQBbVmb.d.mts} +2236 -1713
- package/dist/{subpath-message-CWiBEUUV.d.ts → SubpathMessage-DNlKq2Nj.d.ts} +2236 -1713
- package/dist/Sudo-CFfbmis3.d.mts +453 -0
- package/dist/Sudo-CFfbmis3.d.ts +453 -0
- package/dist/client.d.mts +5 -4
- package/dist/client.d.ts +5 -4
- package/dist/client.js +4500 -2940
- package/dist/client.mjs +4355 -2793
- package/dist/cluster.d.mts +5 -4
- package/dist/cluster.d.ts +5 -4
- package/dist/cluster.js +4435 -2875
- package/dist/cluster.mjs +4200 -2638
- package/dist/errors.js +8 -8
- package/dist/errors.mjs +4 -4
- package/dist/index.d.mts +11 -9
- package/dist/index.d.ts +11 -9
- package/dist/index.js +5739 -4201
- package/dist/index.mjs +5379 -3820
- 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 +5 -4
- package/dist/message.d.ts +5 -4
- package/dist/message.js +533 -87
- package/dist/message.mjs +510 -65
- package/package.json +14 -9
|
@@ -1,11 +1,159 @@
|
|
|
1
|
-
import { Collection } from '@fluxerjs/collection';
|
|
2
1
|
import * as _fluxerjs_types from '@fluxerjs/types';
|
|
3
|
-
import {
|
|
4
|
-
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';
|
|
6
|
+
import { EventEmitter } from 'node:events';
|
|
5
7
|
import { REST } from '@fluxerjs/rest';
|
|
8
|
+
import * as _fluxerjs_ws from '@fluxerjs/ws';
|
|
6
9
|
import { WebSocketManager } from '@fluxerjs/ws';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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';
|
|
12
|
+
|
|
13
|
+
type GuildData = Partial<APIGuild> & {
|
|
14
|
+
id: string;
|
|
15
|
+
roles?: APIRole[];
|
|
16
|
+
ownerId?: string;
|
|
17
|
+
};
|
|
18
|
+
/** CamelCase SDK options for PATCH /guilds/{id}. */
|
|
19
|
+
type GuildEditOptions = {
|
|
20
|
+
name?: string;
|
|
21
|
+
icon?: string | null;
|
|
22
|
+
systemChannelId?: string | null;
|
|
23
|
+
systemChannelFlags?: number | SystemChannelFlagsValue;
|
|
24
|
+
afkChannelId?: string | null;
|
|
25
|
+
afkTimeout?: number;
|
|
26
|
+
defaultMessageNotifications?: DefaultMessageNotifications;
|
|
27
|
+
verificationLevel?: GuildVerificationLevel;
|
|
28
|
+
mfaLevel?: GuildMFALevel;
|
|
29
|
+
explicitContentFilter?: GuildExplicitContentFilter;
|
|
30
|
+
banner?: string | null;
|
|
31
|
+
splash?: string | null;
|
|
32
|
+
embedSplash?: string | null;
|
|
33
|
+
splashCardAlignment?: SplashCardAlignment;
|
|
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;
|
|
40
|
+
features?: GuildFeature[];
|
|
41
|
+
};
|
|
42
|
+
type GuildBanOptions = {
|
|
43
|
+
reason?: string;
|
|
44
|
+
/** Delete message history for this many days (0–7). Deprecated in favor of deleteMessageSeconds. */
|
|
45
|
+
deleteMessageDays?: number;
|
|
46
|
+
/** Delete message history for this many seconds (0–604800). */
|
|
47
|
+
deleteMessageSeconds?: number;
|
|
48
|
+
/** Temporary ban duration in seconds. */
|
|
49
|
+
banDurationSeconds?: number;
|
|
50
|
+
};
|
|
51
|
+
type ChannelPositionUpdate = {
|
|
52
|
+
id: string;
|
|
53
|
+
position?: number;
|
|
54
|
+
parentId?: string | null;
|
|
55
|
+
lockPermissions?: boolean;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Webhook SDK options. */
|
|
59
|
+
/** Fields to update on a webhook (name, avatar, or move channel). */
|
|
60
|
+
interface WebhookEditOptions {
|
|
61
|
+
name?: string;
|
|
62
|
+
avatar?: string | null;
|
|
63
|
+
/** Move webhook to another channel (bot auth only). */
|
|
64
|
+
channelId?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Base class for all Fluxer structures. Provides the client reference. */
|
|
68
|
+
declare abstract class Base {
|
|
69
|
+
/** The client instance this structure belongs to. */
|
|
70
|
+
abstract readonly client: Client;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type UploadFileForSend = {
|
|
74
|
+
id: number;
|
|
75
|
+
filename: string;
|
|
76
|
+
data: ArrayBuffer | Uint8Array | Buffer;
|
|
77
|
+
/** MIME type sent on the plan request and used for singlepart PUT. */
|
|
78
|
+
contentType: string;
|
|
79
|
+
};
|
|
80
|
+
|
|
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;
|
|
96
|
+
nsfw: boolean;
|
|
97
|
+
duration: number | null;
|
|
98
|
+
waveform: string | null;
|
|
99
|
+
expiresAt: Date | null;
|
|
100
|
+
expired: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
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 {
|
|
131
|
+
name: string;
|
|
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;
|
|
156
|
+
}
|
|
9
157
|
|
|
10
158
|
/** Resolved file data (after URL fetch). Used internally by REST layer. */
|
|
11
159
|
interface ResolvedMessageFile {
|
|
@@ -57,7 +205,7 @@ declare const AllowedMentions: {
|
|
|
57
205
|
parse: never[];
|
|
58
206
|
};
|
|
59
207
|
readonly all: {
|
|
60
|
-
parse: ("
|
|
208
|
+
parse: ("roles" | "users" | "everyone")[];
|
|
61
209
|
};
|
|
62
210
|
};
|
|
63
211
|
/** Target message for `replyTo` / `forward` on send options. */
|
|
@@ -81,9 +229,9 @@ type MessageSendOptions = {
|
|
|
81
229
|
content?: string;
|
|
82
230
|
/** Embed payloads or {@link EmbedBuilder} instances. */
|
|
83
231
|
embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
|
|
84
|
-
/** Local files
|
|
85
|
-
files?: MessageFileData
|
|
86
|
-
/** 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}). */
|
|
87
235
|
attachments?: MessageAttachmentMeta[];
|
|
88
236
|
/** Already-uploaded CDN attachments (skip multipart). */
|
|
89
237
|
uploadedAttachments?: RESTPostAPIMessageUploadedAttachment[];
|
|
@@ -139,7 +287,7 @@ type MessagePrepareDefaults = {
|
|
|
139
287
|
defaultAllowedMentions?: AllowedMentionsOptions;
|
|
140
288
|
};
|
|
141
289
|
/** Input accepted by {@link prepareMessagePostPayload} and channel send helpers. */
|
|
142
|
-
type MessagePrepareInput = string | MessageSendOptions | MessagePayload
|
|
290
|
+
type MessagePrepareInput = string | MessageSendOptions | MessagePayload;
|
|
143
291
|
/**
|
|
144
292
|
* Build a full message POST payload (body + optional files) from send options
|
|
145
293
|
* or a builders {@link MessagePayload}.
|
|
@@ -147,412 +295,6 @@ type MessagePrepareInput = string | MessageSendOptions | MessagePayload$1;
|
|
|
147
295
|
*/
|
|
148
296
|
declare function prepareMessagePostPayload(options: MessagePrepareInput, defaults?: MessagePrepareDefaults): Promise<MessagePostPayload>;
|
|
149
297
|
|
|
150
|
-
/**
|
|
151
|
-
* CamelCase SDK option types that serialize to OpenAPI wire bodies.
|
|
152
|
-
*/
|
|
153
|
-
|
|
154
|
-
/** Options for {@link GuildMemberManager.search}. */
|
|
155
|
-
interface GuildMemberSearchOptions {
|
|
156
|
-
query?: string;
|
|
157
|
-
limit?: number;
|
|
158
|
-
offset?: number;
|
|
159
|
-
roleIds?: string[];
|
|
160
|
-
joinedAtGte?: number;
|
|
161
|
-
joinedAtLte?: number;
|
|
162
|
-
isBot?: boolean;
|
|
163
|
-
userCreatedAtGte?: number;
|
|
164
|
-
userCreatedAtLte?: number;
|
|
165
|
-
sortBy?: 'joinedAt' | 'relevance';
|
|
166
|
-
sortOrder?: 'asc' | 'desc';
|
|
167
|
-
}
|
|
168
|
-
/** Convert {@link GuildMemberSearchOptions} to the wire search body. */
|
|
169
|
-
declare function toMemberSearchBody(options: GuildMemberSearchOptions): Record<string, unknown>;
|
|
170
|
-
/** Single channel window for {@link Client.bulkFetchMessages}. */
|
|
171
|
-
interface BulkFetchMessagesRequest {
|
|
172
|
-
channelId: string;
|
|
173
|
-
limit: number;
|
|
174
|
-
before?: string;
|
|
175
|
-
after?: string;
|
|
176
|
-
around?: string;
|
|
177
|
-
}
|
|
178
|
-
/** Convert bulk-fetch requests to wire items. */
|
|
179
|
-
declare function toBulkFetchWire(requests: readonly BulkFetchMessagesRequest[]): Array<{
|
|
180
|
-
channel_id: string;
|
|
181
|
-
limit: number;
|
|
182
|
-
before?: string;
|
|
183
|
-
after?: string;
|
|
184
|
-
around?: string;
|
|
185
|
-
}>;
|
|
186
|
-
/** Options for {@link Webhook.edit}. */
|
|
187
|
-
interface WebhookEditOptions {
|
|
188
|
-
name?: string;
|
|
189
|
-
avatar?: string | null;
|
|
190
|
-
/** Move webhook to another channel (bot auth only). */
|
|
191
|
-
channelId?: string;
|
|
192
|
-
}
|
|
193
|
-
/** Options for creating/editing packs. */
|
|
194
|
-
interface PackCreateOptions {
|
|
195
|
-
name: string;
|
|
196
|
-
description?: string | null;
|
|
197
|
-
}
|
|
198
|
-
interface PackEditOptions {
|
|
199
|
-
name?: string;
|
|
200
|
-
description?: string | null;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Options for guild discovery apply/edit.
|
|
204
|
-
* Maps to OpenAPI: `description`, `category_type`, `custom_tags`.
|
|
205
|
-
*/
|
|
206
|
-
interface DiscoveryApplicationOptions {
|
|
207
|
-
description?: string;
|
|
208
|
-
/** Discovery category (`category_type` on the wire). */
|
|
209
|
-
primaryCategoryId?: number | string;
|
|
210
|
-
/** Custom search tags (`custom_tags` on the wire). */
|
|
211
|
-
keywords?: string[];
|
|
212
|
-
/** Primary language code (`primary_language` on the wire). */
|
|
213
|
-
primaryLanguage?: string;
|
|
214
|
-
}
|
|
215
|
-
/** Convert {@link DiscoveryApplicationOptions} to the discovery wire body. */
|
|
216
|
-
declare function toDiscoveryBody(options: DiscoveryApplicationOptions): Record<string, unknown>;
|
|
217
|
-
/** CamelCase presence for {@link ClientUser.setPresence}. */
|
|
218
|
-
interface PresenceUpdateOptions {
|
|
219
|
-
status: 'online' | 'idle' | 'dnd' | 'invisible';
|
|
220
|
-
since?: number | null;
|
|
221
|
-
afk?: boolean;
|
|
222
|
-
activities?: Array<{
|
|
223
|
-
name: string;
|
|
224
|
-
type: number;
|
|
225
|
-
url?: string | null;
|
|
226
|
-
}>;
|
|
227
|
-
customStatus?: {
|
|
228
|
-
text?: string | null;
|
|
229
|
-
emojiName?: string | null;
|
|
230
|
-
emojiId?: string | null;
|
|
231
|
-
} | null;
|
|
232
|
-
}
|
|
233
|
-
/** Convert presence options to gateway opcode 3 payload. */
|
|
234
|
-
declare function toPresenceWire(options: PresenceUpdateOptions): Record<string, unknown>;
|
|
235
|
-
/** Sudo / MFA verification for sensitive operations. */
|
|
236
|
-
interface SudoVerificationOptions {
|
|
237
|
-
password?: string;
|
|
238
|
-
mfaMethod?: 'totp' | 'webauthn';
|
|
239
|
-
mfaCode?: string;
|
|
240
|
-
webauthnResponse?: Record<string, unknown>;
|
|
241
|
-
webauthnChallenge?: string;
|
|
242
|
-
}
|
|
243
|
-
/** Convert {@link SudoVerificationOptions} to the wire sudo body. */
|
|
244
|
-
declare function toSudoBody(options: SudoVerificationOptions): Record<string, unknown>;
|
|
245
|
-
/** Options for creating a pack invite. */
|
|
246
|
-
interface PackInviteCreateOptions {
|
|
247
|
-
maxUses?: number;
|
|
248
|
-
maxAge?: number;
|
|
249
|
-
unique?: boolean;
|
|
250
|
-
}
|
|
251
|
-
/** Convert {@link PackInviteCreateOptions} to the pack invite wire body. */
|
|
252
|
-
declare function toPackInviteBody(options: PackInviteCreateOptions): Record<string, unknown>;
|
|
253
|
-
/** Options for creating a pack/guild emoji. */
|
|
254
|
-
interface ExpressionCreateOptions {
|
|
255
|
-
name: string;
|
|
256
|
-
image: string;
|
|
257
|
-
}
|
|
258
|
-
/** Convert {@link ExpressionCreateOptions} to the emoji create wire body. */
|
|
259
|
-
declare function toEmojiCreateBody(options: ExpressionCreateOptions): Record<string, unknown>;
|
|
260
|
-
/** Options for editing a pack/guild emoji. */
|
|
261
|
-
interface ExpressionEditOptions {
|
|
262
|
-
name: string;
|
|
263
|
-
}
|
|
264
|
-
/** Convert {@link ExpressionEditOptions} to the emoji edit wire body. */
|
|
265
|
-
declare function toEmojiEditBody(options: ExpressionEditOptions): Record<string, unknown>;
|
|
266
|
-
/** Options for creating a pack/guild sticker. */
|
|
267
|
-
interface StickerCreateOptions {
|
|
268
|
-
name: string;
|
|
269
|
-
/** Base64 image data (`image` on the wire). */
|
|
270
|
-
file: string;
|
|
271
|
-
description?: string | null;
|
|
272
|
-
tags?: string[];
|
|
273
|
-
}
|
|
274
|
-
/** Options for editing a pack/guild sticker. */
|
|
275
|
-
interface StickerEditOptions {
|
|
276
|
-
name?: string;
|
|
277
|
-
description?: string | null;
|
|
278
|
-
tags?: string[];
|
|
279
|
-
}
|
|
280
|
-
/** Convert {@link StickerCreateOptions} to the sticker create wire body. */
|
|
281
|
-
declare function toStickerCreateBody(options: StickerCreateOptions): Record<string, unknown>;
|
|
282
|
-
/** Convert {@link StickerEditOptions} to the sticker edit wire body. */
|
|
283
|
-
declare function toStickerEditBody(options: StickerEditOptions): Record<string, unknown>;
|
|
284
|
-
/** Options for {@link GuildMember.edit}. */
|
|
285
|
-
interface GuildMemberEditOptions {
|
|
286
|
-
nick?: string | null;
|
|
287
|
-
roles?: string[];
|
|
288
|
-
avatar?: string | null;
|
|
289
|
-
banner?: string | null;
|
|
290
|
-
bio?: string | null;
|
|
291
|
-
pronouns?: string | null;
|
|
292
|
-
accentColor?: number | null;
|
|
293
|
-
profileFlags?: number | null;
|
|
294
|
-
mute?: boolean;
|
|
295
|
-
deaf?: boolean;
|
|
296
|
-
communicationDisabledUntil?: string | null;
|
|
297
|
-
timeoutReason?: string | null;
|
|
298
|
-
channelId?: string | null;
|
|
299
|
-
connectionId?: string | null;
|
|
300
|
-
}
|
|
301
|
-
/** Convert {@link GuildMemberEditOptions} to the member PATCH wire body. */
|
|
302
|
-
declare function toMemberEditBody(options: GuildMemberEditOptions): Record<string, unknown>;
|
|
303
|
-
/** Permission overwrite in camelCase for channel edit. */
|
|
304
|
-
interface ChannelPermissionOverwriteOptions {
|
|
305
|
-
id: string;
|
|
306
|
-
type: OverwriteType;
|
|
307
|
-
allow?: string;
|
|
308
|
-
deny?: string;
|
|
309
|
-
}
|
|
310
|
-
/** Options for {@link GuildChannel.edit}. */
|
|
311
|
-
interface ChannelEditOptions {
|
|
312
|
-
name?: string | null;
|
|
313
|
-
topic?: string | null;
|
|
314
|
-
parentId?: string | null;
|
|
315
|
-
bitrate?: number | null;
|
|
316
|
-
userLimit?: number | null;
|
|
317
|
-
nsfw?: boolean;
|
|
318
|
-
rateLimitPerUser?: number;
|
|
319
|
-
rtcRegion?: string | null;
|
|
320
|
-
permissionOverwrites?: ChannelPermissionOverwriteOptions[];
|
|
321
|
-
}
|
|
322
|
-
/** Convert {@link ChannelEditOptions} to the channel PATCH wire body. */
|
|
323
|
-
declare function toChannelEditBody(options: ChannelEditOptions): Record<string, unknown>;
|
|
324
|
-
/** Options for {@link GuildChannel.createInvite}. */
|
|
325
|
-
interface ChannelInviteCreateOptions {
|
|
326
|
-
maxUses?: number;
|
|
327
|
-
maxAge?: number;
|
|
328
|
-
unique?: boolean;
|
|
329
|
-
temporary?: boolean;
|
|
330
|
-
}
|
|
331
|
-
/** Convert {@link ChannelInviteCreateOptions} to the invite create wire body. */
|
|
332
|
-
declare function toChannelInviteBody(options: ChannelInviteCreateOptions): Record<string, unknown>;
|
|
333
|
-
/** Attachment keep/add entry for message edit (camelCase). */
|
|
334
|
-
interface MessageAttachmentEdit {
|
|
335
|
-
id: number | string;
|
|
336
|
-
filename?: string;
|
|
337
|
-
uploadFilename?: string;
|
|
338
|
-
fileSize?: number;
|
|
339
|
-
contentType?: string;
|
|
340
|
-
title?: string | null;
|
|
341
|
-
description?: string | null;
|
|
342
|
-
flags?: number;
|
|
343
|
-
}
|
|
344
|
-
/** Convert {@link MessageAttachmentEdit} entries to wire attachment objects. */
|
|
345
|
-
declare function toMessageAttachmentEditWire(attachments: readonly MessageAttachmentEdit[]): Array<Record<string, unknown>>;
|
|
346
|
-
/** Plan item for {@link Channel.requestAttachmentUploads}. */
|
|
347
|
-
interface AttachmentUploadPlanItem {
|
|
348
|
-
id: number;
|
|
349
|
-
filename: string;
|
|
350
|
-
fileSize: number;
|
|
351
|
-
contentType: string;
|
|
352
|
-
}
|
|
353
|
-
/** Convert plan items to the attachments request wire body. */
|
|
354
|
-
declare function toAttachmentUploadPlanBody(attachments: readonly AttachmentUploadPlanItem[]): {
|
|
355
|
-
attachments: Array<Record<string, unknown>>;
|
|
356
|
-
};
|
|
357
|
-
/** Multipart complete item for {@link Channel.completeAttachmentUploads}. */
|
|
358
|
-
interface AttachmentUploadCompleteItem {
|
|
359
|
-
uploadFilename: string;
|
|
360
|
-
uploadId: string;
|
|
361
|
-
}
|
|
362
|
-
/** Convert complete items to the attachments/complete wire body. */
|
|
363
|
-
declare function toAttachmentUploadCompleteBody(uploads: readonly AttachmentUploadCompleteItem[]): {
|
|
364
|
-
uploads: Array<{
|
|
365
|
-
upload_filename: string;
|
|
366
|
-
upload_id: string;
|
|
367
|
-
}>;
|
|
368
|
-
};
|
|
369
|
-
/** Part in a multipart upload plan response. */
|
|
370
|
-
interface AttachmentUploadPartPayload {
|
|
371
|
-
partNumber: number;
|
|
372
|
-
uploadUrl: string;
|
|
373
|
-
}
|
|
374
|
-
/** Singlepart plan response item. */
|
|
375
|
-
interface AttachmentUploadSinglepartPayload {
|
|
376
|
-
id: number;
|
|
377
|
-
filename: string;
|
|
378
|
-
uploadFilename: string;
|
|
379
|
-
fileSize: number;
|
|
380
|
-
contentType: string;
|
|
381
|
-
uploadMode: 'singlepart';
|
|
382
|
-
uploadUrl: string;
|
|
383
|
-
}
|
|
384
|
-
/** Multipart plan response item. */
|
|
385
|
-
interface AttachmentUploadMultipartPayload {
|
|
386
|
-
id: number;
|
|
387
|
-
filename: string;
|
|
388
|
-
uploadFilename: string;
|
|
389
|
-
fileSize: number;
|
|
390
|
-
contentType: string;
|
|
391
|
-
uploadMode: 'multipart';
|
|
392
|
-
uploadId: string;
|
|
393
|
-
partSize: number;
|
|
394
|
-
parts: AttachmentUploadPartPayload[];
|
|
395
|
-
}
|
|
396
|
-
type AttachmentUploadPlanResponseItem = AttachmentUploadSinglepartPayload | AttachmentUploadMultipartPayload;
|
|
397
|
-
/** CamelCase response from {@link Channel.requestAttachmentUploads}. */
|
|
398
|
-
interface AttachmentUploadPlanResponse {
|
|
399
|
-
attachments: AttachmentUploadPlanResponseItem[];
|
|
400
|
-
}
|
|
401
|
-
/** CamelCase response from {@link Channel.completeAttachmentUploads}. */
|
|
402
|
-
interface AttachmentUploadCompleteResponse {
|
|
403
|
-
uploads: Array<{
|
|
404
|
-
uploadFilename: string;
|
|
405
|
-
}>;
|
|
406
|
-
}
|
|
407
|
-
/** CamelCase RTC region from {@link Channel.fetchRtcRegions}. */
|
|
408
|
-
interface RtcRegionPayload {
|
|
409
|
-
id: string;
|
|
410
|
-
name: string;
|
|
411
|
-
emoji: string;
|
|
412
|
-
}
|
|
413
|
-
/** CamelCase slowmode state from {@link Channel.fetchSlowmode}. */
|
|
414
|
-
interface ChannelSlowmodePayload {
|
|
415
|
-
rateLimitPerUser: number;
|
|
416
|
-
retryAfterMs: number;
|
|
417
|
-
nextSendAllowedAt: string | null;
|
|
418
|
-
}
|
|
419
|
-
/** CamelCase discovery application. */
|
|
420
|
-
interface DiscoveryApplicationPayload {
|
|
421
|
-
guildId: string;
|
|
422
|
-
guildNsfwLevel?: number | null;
|
|
423
|
-
status: string;
|
|
424
|
-
description: string;
|
|
425
|
-
categoryType: number;
|
|
426
|
-
primaryLanguage?: string | null;
|
|
427
|
-
customTags?: string[];
|
|
428
|
-
appliedAt?: string;
|
|
429
|
-
reviewedAt?: string | null;
|
|
430
|
-
}
|
|
431
|
-
/** CamelCase discovery status. */
|
|
432
|
-
interface DiscoveryStatusPayload {
|
|
433
|
-
application?: DiscoveryApplicationPayload | null;
|
|
434
|
-
eligible: boolean;
|
|
435
|
-
minMemberCount: number;
|
|
436
|
-
}
|
|
437
|
-
/** Map wire discovery application → camelCase. */
|
|
438
|
-
declare function toDiscoveryApplicationPayload(data: {
|
|
439
|
-
guild_id: string;
|
|
440
|
-
guild_nsfw_level?: number | null;
|
|
441
|
-
status: string;
|
|
442
|
-
description: string;
|
|
443
|
-
category_type: number;
|
|
444
|
-
primary_language?: string | null;
|
|
445
|
-
custom_tags?: string[];
|
|
446
|
-
applied_at?: string;
|
|
447
|
-
reviewed_at?: string | null;
|
|
448
|
-
}): DiscoveryApplicationPayload;
|
|
449
|
-
/** Map wire discovery status → camelCase. */
|
|
450
|
-
declare function toDiscoveryStatusPayload(data: {
|
|
451
|
-
application?: {
|
|
452
|
-
guild_id: string;
|
|
453
|
-
guild_nsfw_level?: number | null;
|
|
454
|
-
status: string;
|
|
455
|
-
description: string;
|
|
456
|
-
category_type: number;
|
|
457
|
-
primary_language?: string | null;
|
|
458
|
-
custom_tags?: string[];
|
|
459
|
-
applied_at?: string;
|
|
460
|
-
reviewed_at?: string | null;
|
|
461
|
-
} | null;
|
|
462
|
-
eligible: boolean;
|
|
463
|
-
min_member_count: number;
|
|
464
|
-
}): DiscoveryStatusPayload;
|
|
465
|
-
/** CamelCase user profile sub-object. */
|
|
466
|
-
interface UserProfilePayload {
|
|
467
|
-
pronouns?: string | null;
|
|
468
|
-
bio?: string | null;
|
|
469
|
-
banner?: string | null;
|
|
470
|
-
accentColor?: number | null;
|
|
471
|
-
bannerColor?: number | null;
|
|
472
|
-
theme?: string | null;
|
|
473
|
-
}
|
|
474
|
-
/** CamelCase connected account. */
|
|
475
|
-
interface ConnectedAccountPayload {
|
|
476
|
-
name?: string | null;
|
|
477
|
-
type?: string | null;
|
|
478
|
-
}
|
|
479
|
-
/** CamelCase profile response from {@link UserManager.fetchWithProfile}. */
|
|
480
|
-
interface ProfilePayload {
|
|
481
|
-
userProfile?: UserProfilePayload | null;
|
|
482
|
-
mutualGuilds?: Array<{
|
|
483
|
-
id: string;
|
|
484
|
-
}> | null;
|
|
485
|
-
mutualGuildIds?: string[] | null;
|
|
486
|
-
connectedAccounts?: ConnectedAccountPayload[] | null;
|
|
487
|
-
}
|
|
488
|
-
/** Map wire profile → camelCase. */
|
|
489
|
-
declare function toProfilePayload(data: {
|
|
490
|
-
user_profile?: {
|
|
491
|
-
pronouns?: string | null;
|
|
492
|
-
bio?: string | null;
|
|
493
|
-
banner?: string | null;
|
|
494
|
-
accent_color?: number | null;
|
|
495
|
-
banner_color?: number | null;
|
|
496
|
-
theme?: string | null;
|
|
497
|
-
} | null;
|
|
498
|
-
mutual_guilds?: Array<{
|
|
499
|
-
id: string;
|
|
500
|
-
}> | null;
|
|
501
|
-
mutual_guild_ids?: string[] | null;
|
|
502
|
-
connected_accounts?: Array<{
|
|
503
|
-
name?: string | null;
|
|
504
|
-
type?: string | null;
|
|
505
|
-
}> | null;
|
|
506
|
-
}): ProfilePayload;
|
|
507
|
-
/** Small emoji payload from pack list/create. */
|
|
508
|
-
interface PackEmojiPayload {
|
|
509
|
-
id: string;
|
|
510
|
-
name: string;
|
|
511
|
-
animated?: boolean;
|
|
512
|
-
}
|
|
513
|
-
/** Small sticker payload from pack list/create. */
|
|
514
|
-
interface PackStickerPayload {
|
|
515
|
-
id: string;
|
|
516
|
-
name: string;
|
|
517
|
-
description: string;
|
|
518
|
-
tags: string[];
|
|
519
|
-
animated: boolean;
|
|
520
|
-
nsfw: boolean;
|
|
521
|
-
}
|
|
522
|
-
/** Invite metadata payload (camelCase). */
|
|
523
|
-
interface PackInvitePayload {
|
|
524
|
-
code: string;
|
|
525
|
-
maxUses?: number;
|
|
526
|
-
maxAge?: number;
|
|
527
|
-
uses?: number;
|
|
528
|
-
temporary?: boolean;
|
|
529
|
-
unique?: boolean;
|
|
530
|
-
createdAt?: string;
|
|
531
|
-
expiresAt?: string | null;
|
|
532
|
-
}
|
|
533
|
-
/** Bulk create result (camelCase). */
|
|
534
|
-
interface PackBulkCreatePayload<T> {
|
|
535
|
-
success: T[];
|
|
536
|
-
failed: Array<{
|
|
537
|
-
name: string;
|
|
538
|
-
error: string;
|
|
539
|
-
}>;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
/** Base class for all Fluxer structures. Provides the client reference. */
|
|
543
|
-
declare abstract class Base {
|
|
544
|
-
/** The client instance this structure belongs to. */
|
|
545
|
-
abstract readonly client: Client;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
type UploadFileForSend = {
|
|
549
|
-
id: number;
|
|
550
|
-
filename: string;
|
|
551
|
-
data: ArrayBuffer | Uint8Array | Buffer;
|
|
552
|
-
/** MIME type sent on the plan request and used for singlepart PUT. */
|
|
553
|
-
contentType: string;
|
|
554
|
-
};
|
|
555
|
-
|
|
556
298
|
/** Represents a custom emoji in a guild. */
|
|
557
299
|
declare class GuildEmoji extends Base {
|
|
558
300
|
readonly client: Client;
|
|
@@ -564,10 +306,22 @@ declare class GuildEmoji extends Base {
|
|
|
564
306
|
constructor(client: Client, data: APIEmoji & {
|
|
565
307
|
guild_id?: string;
|
|
566
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;
|
|
567
315
|
/** CDN URL for this emoji image. */
|
|
568
316
|
get url(): string;
|
|
569
|
-
/** Emoji identifier for use in reactions: `name:id` */
|
|
317
|
+
/** Emoji identifier for use in reactions: `name:id` (or `a:name:id` when animated). */
|
|
570
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;
|
|
571
325
|
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
572
326
|
delete(): Promise<void>;
|
|
573
327
|
/**
|
|
@@ -579,70 +333,109 @@ declare class GuildEmoji extends Base {
|
|
|
579
333
|
}): Promise<GuildEmoji>;
|
|
580
334
|
}
|
|
581
335
|
|
|
582
|
-
/**
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
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;
|
|
341
|
+
name: string;
|
|
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);
|
|
594
351
|
/**
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
* @
|
|
598
|
-
* @returns The guild member
|
|
599
|
-
* @throws FluxerError with MEMBER_NOT_FOUND if user is not in the guild (404)
|
|
600
|
-
* @example
|
|
601
|
-
* const member = await guild.members.resolve(userId);
|
|
602
|
-
* console.log(member.displayName);
|
|
352
|
+
* Patch mutable fields in place. Does not change `id` or `animated`
|
|
353
|
+
* (callers should replace the instance when `animated` changes).
|
|
354
|
+
* @internal
|
|
603
355
|
*/
|
|
604
|
-
|
|
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>;
|
|
605
365
|
/**
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
* Use fetchMe() to load the bot's member when not cached.
|
|
609
|
-
*
|
|
610
|
-
* @example
|
|
611
|
-
* const perms = guild.members.me?.permissions;
|
|
612
|
-
* if (perms?.has(PermissionFlags.BanMembers)) { ... }
|
|
366
|
+
* Edit this sticker's name and/or description.
|
|
367
|
+
* Requires Manage Emojis and Stickers permission.
|
|
613
368
|
*/
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
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. */
|
|
381
|
+
readonly client: Client;
|
|
382
|
+
/** Role snowflake ID. */
|
|
383
|
+
readonly id: string;
|
|
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);
|
|
403
|
+
/**
|
|
404
|
+
* Permissions bitfield (Administrator grants all permissions).
|
|
405
|
+
*/
|
|
406
|
+
get permissions(): PermissionsBitField;
|
|
407
|
+
/**
|
|
408
|
+
* Alias of {@link permissions}.has for discord.js-style checks.
|
|
620
409
|
* @example
|
|
621
|
-
*
|
|
622
|
-
* console.log(me.displayName);
|
|
410
|
+
* if (role.has(PermissionFlags.BanMembers)) { ... }
|
|
623
411
|
*/
|
|
624
|
-
|
|
412
|
+
has(permission: Parameters<PermissionsBitField['has']>[0]): boolean;
|
|
625
413
|
/**
|
|
626
|
-
*
|
|
414
|
+
* Format as a mention string (`<@&id>`).
|
|
415
|
+
* @returns Mention syntax
|
|
627
416
|
*/
|
|
628
|
-
|
|
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;
|
|
629
424
|
/**
|
|
630
|
-
*
|
|
631
|
-
* @
|
|
632
|
-
* @returns Array of GuildMember objects (cached in guild.members)
|
|
425
|
+
* Snapshot for role-update events (before in-place patch).
|
|
426
|
+
* @internal
|
|
633
427
|
*/
|
|
634
|
-
|
|
635
|
-
limit?: number;
|
|
636
|
-
after?: string;
|
|
637
|
-
}): Promise<GuildMember[]>;
|
|
428
|
+
_clone(): Role;
|
|
638
429
|
/**
|
|
639
|
-
*
|
|
640
|
-
* @param options - CamelCase
|
|
641
|
-
* @returns
|
|
642
|
-
* @example
|
|
643
|
-
* const { members } = await guild.members.search({ query: 'alex', limit: 25 });
|
|
430
|
+
* PATCH role. Requires Manage Roles.
|
|
431
|
+
* @param options - CamelCase fields to update
|
|
432
|
+
* @returns This role instance (updated in-place)
|
|
644
433
|
*/
|
|
645
|
-
|
|
434
|
+
edit(options: RoleEditOptions): Promise<Role>;
|
|
435
|
+
/**
|
|
436
|
+
* DELETE role. Requires Manage Roles.
|
|
437
|
+
*/
|
|
438
|
+
delete(): Promise<void>;
|
|
646
439
|
}
|
|
647
440
|
|
|
648
441
|
/**
|
|
@@ -672,9 +465,13 @@ declare class User extends Base {
|
|
|
672
465
|
readonly system: boolean;
|
|
673
466
|
/** Banner hash for profile. */
|
|
674
467
|
banner: string | null;
|
|
675
|
-
constructor(client: Client, data: APIUserPartial
|
|
468
|
+
constructor(client: Client, data: APIUserPartial & {
|
|
469
|
+
banner?: string | null;
|
|
470
|
+
});
|
|
676
471
|
/** @internal */
|
|
677
|
-
_patch(data: APIUserPartial
|
|
472
|
+
_patch(data: APIUserPartial & {
|
|
473
|
+
banner?: string | null;
|
|
474
|
+
}): void;
|
|
678
475
|
private cdnOpts;
|
|
679
476
|
/**
|
|
680
477
|
* User avatar CDN URL (null if no custom avatar set).
|
|
@@ -707,6 +504,10 @@ declare class User extends Base {
|
|
|
707
504
|
* Format as a mention string (`<@id>`).
|
|
708
505
|
* @returns Mention syntax
|
|
709
506
|
*/
|
|
507
|
+
/** Unix timestamp (ms) when this account was created, derived from its snowflake ID. */
|
|
508
|
+
get createdTimestamp(): number;
|
|
509
|
+
/** Date when this account was created, derived from its snowflake ID. */
|
|
510
|
+
get createdAt(): Date;
|
|
710
511
|
toString(): string;
|
|
711
512
|
/**
|
|
712
513
|
* Create or fetch the DM channel with this user.
|
|
@@ -721,232 +522,515 @@ declare class User extends Base {
|
|
|
721
522
|
send(options: MessagePrepareInput): Promise<Message>;
|
|
722
523
|
}
|
|
723
524
|
|
|
724
|
-
/**
|
|
725
|
-
|
|
525
|
+
/**
|
|
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`.
|
|
529
|
+
*/
|
|
530
|
+
declare class PartialMessage {
|
|
531
|
+
readonly partial: true;
|
|
726
532
|
readonly client: Client;
|
|
727
|
-
readonly
|
|
728
|
-
readonly
|
|
729
|
-
readonly
|
|
730
|
-
|
|
731
|
-
readonly
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
533
|
+
readonly id: string;
|
|
534
|
+
readonly channelId: string;
|
|
535
|
+
readonly guildId: string | null;
|
|
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
|
+
});
|
|
736
550
|
/**
|
|
737
|
-
*
|
|
738
|
-
*
|
|
551
|
+
* Live text-capable channel from cache, or null if uncached / not text-based.
|
|
552
|
+
* Same contract as {@link Message.channel}.
|
|
739
553
|
*/
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
/** Represents a custom sticker in a guild. */
|
|
744
|
-
declare class GuildSticker extends Base {
|
|
745
|
-
readonly client: Client;
|
|
746
|
-
readonly id: string;
|
|
747
|
-
readonly guildId: string;
|
|
748
|
-
name: string;
|
|
749
|
-
description: string;
|
|
750
|
-
readonly tags: string[];
|
|
751
|
-
readonly animated: boolean;
|
|
752
|
-
/** Whether this sticker is classified as NSFW */
|
|
753
|
-
nsfw: boolean;
|
|
754
|
-
/** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
|
|
755
|
-
constructor(client: Client, data: APISticker & {
|
|
756
|
-
guild_id?: string;
|
|
757
|
-
}, guildId: string);
|
|
758
|
-
/** CDN URL for this sticker image. */
|
|
759
|
-
get url(): string;
|
|
760
|
-
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
761
|
-
delete(): Promise<void>;
|
|
554
|
+
get channel(): TextBasedChannel | null;
|
|
762
555
|
/**
|
|
763
|
-
*
|
|
764
|
-
*
|
|
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();
|
|
765
561
|
*/
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
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>;
|
|
770
570
|
}
|
|
771
571
|
|
|
772
|
-
/**
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
readonly client: Client;
|
|
778
|
-
readonly code: string;
|
|
779
|
-
readonly type: InviteType;
|
|
780
|
-
readonly guild: APIGuildPartial | null;
|
|
781
|
-
readonly channel: APIChannelPartial | null;
|
|
782
|
-
readonly pack: APIPackInviteInfo | null;
|
|
783
|
-
readonly inviter: User | null;
|
|
784
|
-
readonly memberCount: number | null;
|
|
785
|
-
readonly presenceCount: number | null;
|
|
786
|
-
readonly expiresAt: string | null;
|
|
787
|
-
readonly temporary: boolean | null;
|
|
788
|
-
readonly createdAt: string | null;
|
|
789
|
-
readonly uses: number | null;
|
|
790
|
-
readonly maxUses: number | null;
|
|
791
|
-
readonly maxAge: number | null;
|
|
792
|
-
constructor(client: Client, data: APIInvite);
|
|
793
|
-
isGuild(): boolean;
|
|
794
|
-
isGroupDM(): boolean;
|
|
795
|
-
isPack(): boolean;
|
|
796
|
-
/** Full invite URL (uses this client's instance invite base). */
|
|
797
|
-
get url(): string;
|
|
798
|
-
/** Cached guild for guild invites, else null. */
|
|
799
|
-
getGuild(): Guild | null;
|
|
800
|
-
/** Fetch invite metadata by code or URL (does not join). */
|
|
801
|
-
static fetch(client: Client, codeOrUrl: string): Promise<Invite>;
|
|
802
|
-
/** Delete this invite. Requires Manage Guild or Create Instant Invite. */
|
|
803
|
-
delete(): Promise<void>;
|
|
572
|
+
/** CamelCase emoji on reaction events. */
|
|
573
|
+
interface ReactionEmojiPayload {
|
|
574
|
+
id?: string;
|
|
575
|
+
name: string;
|
|
576
|
+
animated?: boolean;
|
|
804
577
|
}
|
|
805
|
-
|
|
806
578
|
/**
|
|
807
|
-
*
|
|
808
|
-
* Serialized to snake_case wire fields before REST.
|
|
579
|
+
* Payload emitted for {@link Events.MessageReactionAdd} / {@link Events.MessageReactionRemove}.
|
|
809
580
|
*/
|
|
810
|
-
interface
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
/**
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
|
|
817
|
-
/**
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
/** Sort position in the role list. */
|
|
824
|
-
position?: number;
|
|
825
|
-
/** Hoisted position (visual separator group). */
|
|
826
|
-
hoistPosition?: number | null;
|
|
581
|
+
interface MessageReactionPayload {
|
|
582
|
+
reaction: MessageReaction;
|
|
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;
|
|
590
|
+
messageId: string;
|
|
591
|
+
channelId: string;
|
|
592
|
+
emoji: ReactionEmojiPayload;
|
|
593
|
+
userId: string;
|
|
827
594
|
}
|
|
828
595
|
/**
|
|
829
|
-
*
|
|
830
|
-
* Serialized to snake_case wire fields before REST.
|
|
596
|
+
* Payload emitted for {@link Events.GuildRoleDelete}.
|
|
831
597
|
*/
|
|
832
|
-
|
|
833
|
-
|
|
598
|
+
interface GuildRoleDeletePayload {
|
|
599
|
+
roleId: string;
|
|
600
|
+
guildId: string;
|
|
601
|
+
role: Role | null;
|
|
602
|
+
}
|
|
834
603
|
/**
|
|
835
|
-
*
|
|
836
|
-
*
|
|
604
|
+
* Payload emitted for {@link Events.MessageDeleteBulk}.
|
|
605
|
+
* Normalized from `GatewayMessageDeleteBulkDispatchData`.
|
|
837
606
|
*/
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
|
|
843
|
-
/** Guild
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
|
|
847
|
-
/** Role color (24-bit RGB). */
|
|
848
|
-
color: number;
|
|
849
|
-
/** Role position (higher = above). */
|
|
850
|
-
position: number;
|
|
851
|
-
/** @internal Raw permissions bitfield string. */
|
|
852
|
-
_permissions: string;
|
|
853
|
-
/** Whether this role is hoisted (shown separately in member list). */
|
|
854
|
-
hoist: boolean;
|
|
855
|
-
/** Whether this role is mentionable. */
|
|
856
|
-
mentionable: boolean;
|
|
857
|
-
/** Unicode emoji for this role (null = none). */
|
|
858
|
-
unicodeEmoji: string | null;
|
|
859
|
-
/** Hoist position (null = not hoisted). */
|
|
860
|
-
hoistPosition: number | null;
|
|
861
|
-
constructor(client: Client, data: APIRole, guildId: string);
|
|
862
|
-
/**
|
|
863
|
-
* Permissions bitfield (Administrator grants all permissions).
|
|
864
|
-
*/
|
|
865
|
-
get permissions(): PermissionsBitField;
|
|
866
|
-
/**
|
|
867
|
-
* Format as a mention string (`<@&id>`).
|
|
868
|
-
* @returns Mention syntax
|
|
869
|
-
*/
|
|
870
|
-
toString(): string;
|
|
871
|
-
/** @internal */
|
|
872
|
-
_patch(data: APIRole): void;
|
|
873
|
-
/**
|
|
874
|
-
* Snapshot for role-update events (before in-place patch).
|
|
875
|
-
* @internal
|
|
876
|
-
*/
|
|
877
|
-
_clone(): Role;
|
|
878
|
-
/**
|
|
879
|
-
* PATCH role. Requires Manage Roles.
|
|
880
|
-
* @param options - CamelCase fields to update
|
|
881
|
-
* @returns This role instance (updated in-place)
|
|
882
|
-
*/
|
|
883
|
-
edit(options: RoleEditOptions): Promise<Role>;
|
|
607
|
+
interface MessageDeleteBulkPayload {
|
|
608
|
+
/** IDs of the deleted messages. */
|
|
609
|
+
ids: string[];
|
|
610
|
+
/** Channel from which the messages were deleted. */
|
|
611
|
+
channelId: string;
|
|
612
|
+
/** Guild the channel belongs to, or `null` for DMs. */
|
|
613
|
+
guildId: string | null;
|
|
614
|
+
/** Cached text-capable channel, or null if uncached / not text-based. */
|
|
615
|
+
channel: TextBasedChannel | null;
|
|
884
616
|
/**
|
|
885
|
-
*
|
|
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.
|
|
886
619
|
*/
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
/** Execute-webhook options: shared message fields plus username/avatar overrides. */
|
|
891
|
-
type WebhookSendOptions = Pick<MessageSendOptions, 'content' | 'embeds' | 'tts' | 'allowedMentions' | 'files' | 'attachments'> & {
|
|
892
|
-
username?: string;
|
|
893
|
-
avatarUrl?: string;
|
|
894
|
-
};
|
|
895
|
-
/** Edit a previously sent webhook message (`EmbedBuilder` values are serialized). */
|
|
896
|
-
interface WebhookMessageEditOptions {
|
|
897
|
-
content?: string | null;
|
|
898
|
-
embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
|
|
899
|
-
attachments?: MessageAttachmentEdit[];
|
|
900
|
-
flags?: number;
|
|
901
|
-
allowedMentions?: AllowedMentionsOptions;
|
|
620
|
+
messages: PartialMessage[];
|
|
902
621
|
}
|
|
903
622
|
/**
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* @see {@link Webhook.fromToken} to construct from URL
|
|
907
|
-
* @see {@link Webhook.fetch} to fetch by ID with bot auth
|
|
623
|
+
* Payload emitted for {@link Events.InviteDelete}.
|
|
624
|
+
* Normalized from `GatewayInviteDeleteDispatchData`.
|
|
908
625
|
*/
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
|
|
912
|
-
/**
|
|
913
|
-
|
|
914
|
-
/**
|
|
915
|
-
|
|
916
|
-
|
|
626
|
+
interface InviteDeletePayload {
|
|
627
|
+
/** Invite code that was deleted. */
|
|
628
|
+
code: string;
|
|
629
|
+
/** Guild the invite belonged to, or `null` for DMs / group DMs. */
|
|
630
|
+
guildId: string | null;
|
|
631
|
+
/** Channel the invite pointed to, or `null` if unknown. */
|
|
632
|
+
channelId: string | null;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Payload emitted for {@link Events.TypingStart}.
|
|
636
|
+
* Normalized from `GatewayTypingStartDispatchData`.
|
|
637
|
+
*/
|
|
638
|
+
interface TypingStartPayload {
|
|
639
|
+
/** Channel where the user started typing. */
|
|
917
640
|
channelId: string;
|
|
918
|
-
/**
|
|
641
|
+
/** Guild the channel belongs to, or `null` for DMs. */
|
|
642
|
+
guildId: string | null;
|
|
643
|
+
/** ID of the user who started typing. */
|
|
644
|
+
userId: string;
|
|
645
|
+
/** Unix timestamp (seconds) when typing began. */
|
|
646
|
+
timestamp: number;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Payload emitted for {@link Events.GuildEmojisUpdate}.
|
|
650
|
+
* Contains the fully-cached {@link GuildEmoji} instances after the update.
|
|
651
|
+
*/
|
|
652
|
+
interface GuildEmojisUpdatePayload {
|
|
653
|
+
/** Guild whose emoji list changed. */
|
|
654
|
+
guildId: string;
|
|
655
|
+
/** Updated list of {@link GuildEmoji} instances (from cache). */
|
|
656
|
+
emojis: GuildEmoji[];
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Payload emitted for {@link Events.GuildStickersUpdate}.
|
|
660
|
+
* Contains cached {@link GuildSticker} instances after the update.
|
|
661
|
+
*/
|
|
662
|
+
interface GuildStickersUpdatePayload {
|
|
663
|
+
/** Guild whose sticker list changed. */
|
|
664
|
+
guildId: string;
|
|
665
|
+
/** Updated list of {@link GuildSticker} instances (from cache). */
|
|
666
|
+
stickers: GuildSticker[];
|
|
667
|
+
}
|
|
668
|
+
/** Payload for {@link Events.MessageReactionRemoveAll}. */
|
|
669
|
+
interface MessageReactionRemoveAllPayload {
|
|
670
|
+
messageId: string;
|
|
671
|
+
channelId: string;
|
|
672
|
+
guildId: string | null;
|
|
673
|
+
message: Message | null;
|
|
674
|
+
channel: TextBasedChannel | null;
|
|
675
|
+
}
|
|
676
|
+
/** Payload for {@link Events.MessageReactionRemoveEmoji}. */
|
|
677
|
+
interface MessageReactionRemoveEmojiPayload {
|
|
678
|
+
messageId: string;
|
|
679
|
+
channelId: string;
|
|
680
|
+
guildId: string | null;
|
|
681
|
+
emoji: ReactionEmojiPayload;
|
|
682
|
+
message: Message | null;
|
|
683
|
+
channel: TextBasedChannel | null;
|
|
684
|
+
}
|
|
685
|
+
/** Single entry in {@link MessageReactionAddManyPayload}. */
|
|
686
|
+
interface MessageReactionAddManyEntry {
|
|
687
|
+
userId: string;
|
|
688
|
+
emoji: ReactionEmojiPayload;
|
|
689
|
+
member: GuildMember | null;
|
|
690
|
+
}
|
|
691
|
+
/** Payload for {@link Events.MessageReactionAddMany}. */
|
|
692
|
+
interface MessageReactionAddManyPayload {
|
|
693
|
+
channelId: string;
|
|
694
|
+
messageId: string;
|
|
695
|
+
guildId: string | null;
|
|
696
|
+
message: Message | null;
|
|
697
|
+
channel: TextBasedChannel | null;
|
|
698
|
+
reactions: MessageReactionAddManyEntry[];
|
|
699
|
+
}
|
|
700
|
+
/** Payload for {@link Events.ChannelPinsUpdate}. */
|
|
701
|
+
interface ChannelPinsUpdatePayload {
|
|
702
|
+
channelId: string;
|
|
703
|
+
guildId: string | null;
|
|
704
|
+
lastPinTimestamp: string | null;
|
|
705
|
+
}
|
|
706
|
+
/** Presence activity (camelCase). */
|
|
707
|
+
interface PresenceActivity {
|
|
919
708
|
name: string;
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
709
|
+
type: number;
|
|
710
|
+
url?: string | null;
|
|
711
|
+
}
|
|
712
|
+
/** Payload for {@link Events.PresenceUpdate}. */
|
|
713
|
+
interface PresenceUpdatePayload {
|
|
714
|
+
userId: string;
|
|
715
|
+
guildId: string | null;
|
|
716
|
+
status: string | null;
|
|
717
|
+
activities: PresenceActivity[];
|
|
718
|
+
customStatus: {
|
|
719
|
+
text?: string | null;
|
|
720
|
+
emojiId?: string | null;
|
|
721
|
+
emojiName?: string | null;
|
|
722
|
+
} | null;
|
|
723
|
+
}
|
|
724
|
+
/** Payload for {@link Events.PresenceUpdateBulk}. */
|
|
725
|
+
interface PresenceUpdateBulkPayload {
|
|
726
|
+
guildId: string | null;
|
|
727
|
+
presences: PresenceUpdatePayload[];
|
|
728
|
+
}
|
|
729
|
+
/** Payload for {@link Events.WebhooksUpdate}. */
|
|
730
|
+
interface WebhooksUpdatePayload {
|
|
731
|
+
channelId: string;
|
|
732
|
+
guildId: string;
|
|
733
|
+
}
|
|
734
|
+
/** Payload for {@link Events.GuildMembersChunk}. */
|
|
735
|
+
interface GuildMembersChunkPayload {
|
|
736
|
+
guildId: string;
|
|
737
|
+
members: GuildMember[];
|
|
738
|
+
chunkIndex: number;
|
|
739
|
+
chunkCount: number;
|
|
740
|
+
notFound: string[];
|
|
741
|
+
nonce: string | null;
|
|
742
|
+
}
|
|
743
|
+
/** Audit log change (camelCase). */
|
|
744
|
+
interface AuditLogChange {
|
|
745
|
+
key: string;
|
|
746
|
+
oldValue?: string | number | boolean | null;
|
|
747
|
+
newValue?: string | number | boolean | null;
|
|
748
|
+
}
|
|
749
|
+
/** Payload for {@link Events.GuildAuditLogEntryCreate} and audit fetch entries. */
|
|
750
|
+
interface AuditLogEntryPayload {
|
|
751
|
+
id: string;
|
|
752
|
+
actionType: number;
|
|
753
|
+
userId: string | null;
|
|
754
|
+
targetId: string | null;
|
|
755
|
+
reason: string | null;
|
|
756
|
+
options: Record<string, string> | null;
|
|
757
|
+
changes: AuditLogChange[];
|
|
758
|
+
guildId: string | null;
|
|
759
|
+
}
|
|
760
|
+
/** Payload for {@link Events.GuildCountsUpdate}. */
|
|
761
|
+
interface GuildCountsUpdatePayload {
|
|
762
|
+
counts: Array<{
|
|
763
|
+
guildId: string;
|
|
764
|
+
memberCount: number;
|
|
765
|
+
onlineCount: number;
|
|
766
|
+
}>;
|
|
767
|
+
}
|
|
768
|
+
/** Payload for {@link Events.ChannelMemberCountsUpdate}. */
|
|
769
|
+
interface ChannelMemberCountsUpdatePayload {
|
|
770
|
+
counts: Array<{
|
|
771
|
+
guildId: string;
|
|
772
|
+
channelId: string;
|
|
773
|
+
memberCount: number;
|
|
774
|
+
onlineCount: number;
|
|
775
|
+
}>;
|
|
776
|
+
}
|
|
777
|
+
/** Role update with optional previous snapshot. */
|
|
778
|
+
interface GuildRoleUpdatePayload {
|
|
779
|
+
/** Role after the update (cached instance). */
|
|
780
|
+
role: Role;
|
|
781
|
+
/** Shallow previous field snapshot when the role was already cached. */
|
|
782
|
+
oldRole: Role | null;
|
|
783
|
+
}
|
|
784
|
+
/** Vanity URL result (camelCase). */
|
|
785
|
+
interface VanityURLPayload {
|
|
786
|
+
code: string | null;
|
|
787
|
+
uses: number;
|
|
788
|
+
}
|
|
789
|
+
/** Result of {@link Guild.fetchAuditLogs}. */
|
|
790
|
+
interface AuditLogFetchPayload {
|
|
791
|
+
entries: AuditLogEntryPayload[];
|
|
792
|
+
users: User[];
|
|
793
|
+
}
|
|
794
|
+
/** Guild member search result row (camelCase). */
|
|
795
|
+
interface GuildMemberSearchHit {
|
|
796
|
+
id: string;
|
|
797
|
+
guildId: string;
|
|
798
|
+
userId: string;
|
|
799
|
+
username: string;
|
|
800
|
+
discriminator: string;
|
|
801
|
+
globalName: string | null;
|
|
802
|
+
nickname: string | null;
|
|
803
|
+
/** Cached {@link GuildMember} when available after search hydration. */
|
|
804
|
+
member: GuildMember | null;
|
|
805
|
+
}
|
|
806
|
+
/** Guild member search response (camelCase). */
|
|
807
|
+
interface GuildMemberSearchPayload {
|
|
808
|
+
guildId: string;
|
|
809
|
+
members: GuildMemberSearchHit[];
|
|
810
|
+
/** Total matches across pages (`total_result_count`). */
|
|
811
|
+
total?: number;
|
|
812
|
+
/** Results on this page (`page_result_count`). */
|
|
813
|
+
pageResultCount?: number;
|
|
814
|
+
/** Whether more pages exist after this offset. */
|
|
815
|
+
hasMore?: boolean;
|
|
816
|
+
/** Search index still building. */
|
|
817
|
+
indexing?: boolean;
|
|
818
|
+
}
|
|
819
|
+
/** Partial guild from GET /users/@me/guilds. */
|
|
820
|
+
interface PartialUserGuildPayload {
|
|
821
|
+
id: string;
|
|
822
|
+
name: string;
|
|
823
|
+
icon: string | null;
|
|
824
|
+
owner?: boolean;
|
|
825
|
+
permissions?: string | null;
|
|
826
|
+
features?: string[];
|
|
827
|
+
/** Present when fetched with `{ withCounts: true }`. */
|
|
828
|
+
approximateMemberCount?: number;
|
|
829
|
+
/** Present when fetched with `{ withCounts: true }`. */
|
|
830
|
+
approximatePresenceCount?: number;
|
|
831
|
+
}
|
|
832
|
+
/** Payload for {@link Events.ChannelRecipientAdd} / {@link Events.ChannelRecipientRemove}. */
|
|
833
|
+
interface ChannelRecipientPayload {
|
|
834
|
+
channelId: string;
|
|
835
|
+
user: User;
|
|
836
|
+
}
|
|
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
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Manages guild members with a Collection-like API.
|
|
852
|
+
* Extends LimitedCollection so you can use .get(), .set(), .filter(), etc.
|
|
853
|
+
*/
|
|
854
|
+
declare class GuildMemberManager extends LimitedCollection<string, GuildMember> {
|
|
855
|
+
private readonly guild;
|
|
856
|
+
constructor(guild: Guild);
|
|
935
857
|
/**
|
|
936
|
-
*
|
|
858
|
+
* Get a guild member from cache or fetch from the API if not present.
|
|
859
|
+
* Convenience helper to avoid repeating `guild.members.get(userId) ?? (await guild.fetchMember(userId))`.
|
|
860
|
+
* @param userId - Snowflake of the user
|
|
861
|
+
* @returns The guild member
|
|
862
|
+
* @throws FluxerError with MEMBER_NOT_FOUND if user is not in the guild (404)
|
|
863
|
+
* @example
|
|
864
|
+
* const member = await guild.members.resolve(userId);
|
|
865
|
+
* console.log(member.displayName);
|
|
937
866
|
*/
|
|
938
|
-
|
|
867
|
+
resolve(userId: string): Promise<GuildMember>;
|
|
939
868
|
/**
|
|
940
|
-
*
|
|
941
|
-
*
|
|
869
|
+
* The current bot user as a GuildMember in this guild.
|
|
870
|
+
* Returns null if the bot's member is not cached or client.user is null.
|
|
871
|
+
* Use fetchMe() to load the bot's member when not cached.
|
|
872
|
+
*
|
|
873
|
+
* @example
|
|
874
|
+
* const perms = guild.members.me?.permissions;
|
|
875
|
+
* if (perms?.has(PermissionFlags.BanMembers)) { ... }
|
|
942
876
|
*/
|
|
943
|
-
|
|
944
|
-
/**
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
877
|
+
get me(): GuildMember | null;
|
|
878
|
+
/**
|
|
879
|
+
* Fetch the current bot user as a GuildMember in this guild.
|
|
880
|
+
* Caches the result in guild.members.
|
|
881
|
+
*
|
|
882
|
+
* @throws FluxerError with CLIENT_NOT_READY if client.user is null
|
|
883
|
+
* @example
|
|
884
|
+
* const me = await guild.members.fetchMe();
|
|
885
|
+
* console.log(me.displayName);
|
|
886
|
+
*/
|
|
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>;
|
|
894
|
+
/**
|
|
895
|
+
* Fetch guild members with pagination. GET /guilds/{id}/members.
|
|
896
|
+
* @param options - limit (1-1000), after (user ID for pagination)
|
|
897
|
+
* @returns Array of GuildMember objects (cached in guild.members)
|
|
898
|
+
*/
|
|
899
|
+
fetch(options?: FetchGuildMembersOptions): Promise<GuildMember[]>;
|
|
900
|
+
private fetchMany;
|
|
901
|
+
/**
|
|
902
|
+
* Search guild members. POST /guilds/{id}/members-search.
|
|
903
|
+
* @param options - CamelCase search query, filters, and pagination
|
|
904
|
+
* @returns CamelCase search results; `member` is set from cache when present
|
|
905
|
+
* @example
|
|
906
|
+
* const { members } = await guild.members.search({ query: 'alex', limit: 25 });
|
|
907
|
+
*/
|
|
908
|
+
search(options?: GuildMemberSearchOptions): Promise<GuildMemberSearchPayload>;
|
|
909
|
+
}
|
|
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
|
+
}
|
|
928
|
+
/**
|
|
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.
|
|
933
|
+
*/
|
|
934
|
+
declare class Invite extends Base {
|
|
935
|
+
readonly client: Client;
|
|
936
|
+
readonly code: string;
|
|
937
|
+
readonly type: InviteType;
|
|
938
|
+
readonly guildSnapshot: InviteGuildSnapshot | null;
|
|
939
|
+
readonly channelSnapshot: InviteChannelSnapshot | null;
|
|
940
|
+
readonly inviter: User | null;
|
|
941
|
+
readonly memberCount: number | null;
|
|
942
|
+
readonly presenceCount: number | null;
|
|
943
|
+
readonly expiresAt: Date | null;
|
|
944
|
+
readonly temporary: boolean | null;
|
|
945
|
+
readonly createdAt: Date | null;
|
|
946
|
+
readonly uses: number | null;
|
|
947
|
+
readonly maxUses: number | null;
|
|
948
|
+
readonly maxAge: number | null;
|
|
949
|
+
constructor(client: Client, data: APIInvite);
|
|
950
|
+
isGuild(): boolean;
|
|
951
|
+
isGroupDM(): boolean;
|
|
952
|
+
/** Full invite URL (uses this client's instance invite base). */
|
|
953
|
+
get url(): string;
|
|
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>;
|
|
964
|
+
/** Fetch invite metadata by code or URL (does not join). */
|
|
965
|
+
static fetch(client: Client, codeOrUrl: string): Promise<Invite>;
|
|
966
|
+
/** Delete this invite. Requires Manage Guild or Create Instant Invite. */
|
|
967
|
+
delete(): Promise<void>;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/** Execute-webhook options: shared message fields plus username/avatar overrides. */
|
|
971
|
+
type WebhookSendOptions = Pick<MessageSendOptions, 'content' | 'embeds' | 'tts' | 'allowedMentions' | 'files' | 'attachments'> & {
|
|
972
|
+
username?: string;
|
|
973
|
+
avatarUrl?: string;
|
|
974
|
+
};
|
|
975
|
+
/** Edit a previously sent webhook message (`EmbedBuilder` values are serialized). */
|
|
976
|
+
interface WebhookMessageEditOptions {
|
|
977
|
+
content?: string | null;
|
|
978
|
+
embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
|
|
979
|
+
attachments?: MessageAttachmentEdit[];
|
|
980
|
+
flags?: number;
|
|
981
|
+
allowedMentions?: AllowedMentionsOptions;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Incoming webhook. Token is only present after create / `fromToken`;
|
|
985
|
+
* fetched webhooks use bot auth and cannot execute.
|
|
986
|
+
* @see {@link Webhook.fromToken} to construct from URL
|
|
987
|
+
* @see {@link Webhook.fetch} to fetch by ID with bot auth
|
|
988
|
+
*/
|
|
989
|
+
declare class Webhook extends Base {
|
|
990
|
+
/** Parent client instance. */
|
|
991
|
+
readonly client: Client;
|
|
992
|
+
/** Webhook snowflake ID. */
|
|
993
|
+
readonly id: string;
|
|
994
|
+
/** Guild this webhook belongs to. */
|
|
995
|
+
readonly guildId: string;
|
|
996
|
+
/** Channel this webhook posts to. */
|
|
997
|
+
channelId: string;
|
|
998
|
+
/** Webhook name. */
|
|
999
|
+
name: string;
|
|
1000
|
+
/** Webhook avatar hash (null = default). */
|
|
1001
|
+
avatar: string | null;
|
|
1002
|
+
/** Present after create / `fromToken`; omitted when fetching by ID. */
|
|
1003
|
+
readonly token: string | null;
|
|
1004
|
+
/** The user that created this webhook. */
|
|
1005
|
+
readonly user: User;
|
|
1006
|
+
constructor(client: Client, data: APIWebhook & {
|
|
1007
|
+
token?: string | null;
|
|
1008
|
+
});
|
|
1009
|
+
avatarURL(options?: {
|
|
1010
|
+
size?: number;
|
|
1011
|
+
extension?: string;
|
|
1012
|
+
}): string | null;
|
|
1013
|
+
/** Unix timestamp (ms) when this webhook was created, derived from its snowflake ID. */
|
|
1014
|
+
get createdTimestamp(): number;
|
|
1015
|
+
/** Date when this webhook was created, derived from its snowflake ID. */
|
|
1016
|
+
get createdAt(): Date;
|
|
1017
|
+
/** Delete this webhook (token auth when available, otherwise bot auth). */
|
|
1018
|
+
delete(): Promise<void>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Edit name/avatar. With bot auth (no token), `channelId` may also be set.
|
|
1021
|
+
*/
|
|
1022
|
+
edit(options: WebhookEditOptions): Promise<this>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Execute the webhook. Requires token.
|
|
1025
|
+
* @param wait - When true, appends `?wait=true` and returns the created `Message`.
|
|
1026
|
+
*/
|
|
1027
|
+
send(options: string | WebhookSendOptions, wait?: boolean): Promise<Message | undefined>;
|
|
1028
|
+
/** Edit a message previously sent by this webhook. Requires token. */
|
|
1029
|
+
editMessage(messageId: string, options: WebhookMessageEditOptions): Promise<Message>;
|
|
1030
|
+
/** Fetch a message sent by this webhook. Requires token. */
|
|
1031
|
+
fetchMessage(messageId: string): Promise<Message>;
|
|
1032
|
+
/** Delete a message sent by this webhook. Requires token. */
|
|
1033
|
+
deleteMessage(messageId: string): Promise<void>;
|
|
950
1034
|
/** Fetch a webhook by ID (bot auth; no token). */
|
|
951
1035
|
static fetch(client: Client, webhookId: string): Promise<Webhook>;
|
|
952
1036
|
/** Build a webhook from a stored id + token (e.g. webhook URL). */
|
|
@@ -959,42 +1043,35 @@ declare class Webhook extends Base {
|
|
|
959
1043
|
private messageRoute;
|
|
960
1044
|
}
|
|
961
1045
|
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
};
|
|
992
|
-
type ChannelPositionUpdate = {
|
|
993
|
-
id: string;
|
|
994
|
-
position?: number;
|
|
995
|
-
parentId?: string | null;
|
|
996
|
-
lockPermissions?: boolean;
|
|
997
|
-
};
|
|
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
|
+
}
|
|
998
1075
|
|
|
999
1076
|
/** Represents a Fluxer guild (server). */
|
|
1000
1077
|
declare class Guild extends Base {
|
|
@@ -1032,8 +1109,26 @@ declare class Guild extends Base {
|
|
|
1032
1109
|
systemChannelId: string | null;
|
|
1033
1110
|
/** Rules channel ID (for Community guilds), or null if none. */
|
|
1034
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;
|
|
1035
1118
|
/** NSFW level for this guild. */
|
|
1036
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;
|
|
1037
1132
|
/** MFA level required for moderation actions. */
|
|
1038
1133
|
mfaLevel: GuildMFALevel;
|
|
1039
1134
|
/** Banner width in pixels. */
|
|
@@ -1044,16 +1139,20 @@ declare class Guild extends Base {
|
|
|
1044
1139
|
splashWidth?: number | null;
|
|
1045
1140
|
/** Splash height in pixels. */
|
|
1046
1141
|
splashHeight?: number | null;
|
|
1142
|
+
/** Last known member count, or null if none has been received. */
|
|
1143
|
+
memberCount: number | null;
|
|
1144
|
+
/** Last known online member count, or null if none has been received. */
|
|
1145
|
+
onlineCount: number | null;
|
|
1047
1146
|
/** Member manager for this guild (fetch/add/remove members). */
|
|
1048
1147
|
members: GuildMemberManager;
|
|
1049
1148
|
/** Cached channels in this guild. */
|
|
1050
|
-
channels:
|
|
1149
|
+
channels: LimitedCollection<string, GuildChannel>;
|
|
1051
1150
|
/** Cached roles in this guild. */
|
|
1052
|
-
roles:
|
|
1151
|
+
roles: GuildRoleManager;
|
|
1053
1152
|
/** Cached emojis in this guild. */
|
|
1054
|
-
emojis:
|
|
1153
|
+
emojis: LimitedCollection<string, GuildEmoji>;
|
|
1055
1154
|
/** Cached stickers in this guild. */
|
|
1056
|
-
stickers:
|
|
1155
|
+
stickers: LimitedCollection<string, GuildSticker>;
|
|
1057
1156
|
/**
|
|
1058
1157
|
* Construct a guild from API data.
|
|
1059
1158
|
* @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE
|
|
@@ -1061,6 +1160,17 @@ declare class Guild extends Base {
|
|
|
1061
1160
|
constructor(client: Client, data: GuildData);
|
|
1062
1161
|
/** Patch metadata in place; preserves members/channels/emojis/stickers caches. */
|
|
1063
1162
|
_patch(data: GuildData): void;
|
|
1163
|
+
/**
|
|
1164
|
+
* Adjust {@link memberCount} after a join/leave when a baseline is known.
|
|
1165
|
+
* No-op while the count is still unknown (`null`).
|
|
1166
|
+
*/
|
|
1167
|
+
adjustMemberCount(delta: 1 | -1): void;
|
|
1168
|
+
/** Unix timestamp (ms) when this guild was created, derived from its snowflake ID. */
|
|
1169
|
+
get createdTimestamp(): number;
|
|
1170
|
+
/** Date when this guild was created, derived from its snowflake ID. */
|
|
1171
|
+
get createdAt(): Date;
|
|
1172
|
+
/** The guild's name. */
|
|
1173
|
+
toString(): string;
|
|
1064
1174
|
/** Get the full CDN URL for the guild's icon (or null). */
|
|
1065
1175
|
iconURL(options?: {
|
|
1066
1176
|
size?: number;
|
|
@@ -1074,10 +1184,10 @@ declare class Guild extends Base {
|
|
|
1074
1184
|
size?: number;
|
|
1075
1185
|
}): string | null;
|
|
1076
1186
|
/**
|
|
1077
|
-
* Create a channel. `
|
|
1187
|
+
* Create a channel. `type`: 0=text, 2=voice, 4=category, 998=link (set `url`).
|
|
1078
1188
|
* Requires Manage Channels.
|
|
1079
1189
|
*/
|
|
1080
|
-
createChannel(
|
|
1190
|
+
createChannel(options: GuildChannelCreateOptions): Promise<GuildChannel>;
|
|
1081
1191
|
/** Fetch all channels in this guild from the API. */
|
|
1082
1192
|
fetchChannels(): Promise<GuildChannel[]>;
|
|
1083
1193
|
/** Update channel positions (reordering). */
|
|
@@ -1116,7 +1226,7 @@ declare class Guild extends Base {
|
|
|
1116
1226
|
}>): Promise<Role[]>;
|
|
1117
1227
|
/** Reset all role hoist positions to zero. Returns cached {@link Role} instances. */
|
|
1118
1228
|
resetRoleHoistPositions(): Promise<Role[]>;
|
|
1119
|
-
/** Ban a user from the guild. Requires Ban Members. `
|
|
1229
|
+
/** Ban a user from the guild. Requires Ban Members. `banDurationSeconds`: 0 = permanent. */
|
|
1120
1230
|
ban(userId: string, options?: GuildBanOptions): Promise<void>;
|
|
1121
1231
|
/** Fetch all bans in this guild. Requires Ban Members. */
|
|
1122
1232
|
fetchBans(): Promise<GuildBan[]>;
|
|
@@ -1199,650 +1309,992 @@ declare class Guild extends Base {
|
|
|
1199
1309
|
/** Transfer guild ownership to another user (owner only). */
|
|
1200
1310
|
transferOwnership(newOwnerId: string, password?: string): Promise<void>;
|
|
1201
1311
|
}
|
|
1202
|
-
|
|
1203
|
-
/** Role ID or Role object. */
|
|
1204
|
-
type RoleResolvable = string | Role;
|
|
1205
|
-
/**
|
|
1206
|
-
* Manages a guild member's roles (`add` / `remove` / `set` / `cache`).
|
|
1207
|
-
* Requires Manage Roles for mutations.
|
|
1208
|
-
*/
|
|
1209
|
-
declare class GuildMemberRoleManager {
|
|
1210
|
-
private readonly member;
|
|
1211
|
-
private ids;
|
|
1212
|
-
constructor(member: GuildMember, initial?: string[]);
|
|
1213
|
-
get roleIds(): readonly string[];
|
|
1214
|
-
has(roleOrId: RoleResolvable): boolean;
|
|
1215
|
-
/** Live Role objects from `guild.roles` for this member's role IDs. */
|
|
1216
|
-
get cache(): Collection<string, Role>;
|
|
1217
|
-
add(roleOrId: RoleResolvable): Promise<void>;
|
|
1218
|
-
remove(roleOrId: RoleResolvable): Promise<void>;
|
|
1219
|
-
set(roleIds: string[]): Promise<void>;
|
|
1220
|
-
/** @internal Sync from API member payload. */
|
|
1221
|
-
_patch(roleIds: string[]): void;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
/**
|
|
1225
|
-
* Guild member — roles via {@link GuildMember.roles}, permissions via {@link permissions} / {@link permissionsIn}.
|
|
1226
|
-
* Cached per guild in {@link Guild.members}.
|
|
1227
|
-
*/
|
|
1228
|
-
declare class GuildMember extends Base {
|
|
1229
|
-
/** Parent client instance. */
|
|
1230
|
-
readonly client: Client;
|
|
1231
|
-
/** User ID (same as `user.id`). */
|
|
1232
|
-
readonly id: string;
|
|
1233
|
-
/** The underlying {@link User}. */
|
|
1234
|
-
readonly user: User;
|
|
1235
|
-
/** The guild this member belongs to. */
|
|
1236
|
-
readonly guild: Guild;
|
|
1237
|
-
/** Guild-specific nickname (null = use global name or username). */
|
|
1238
|
-
nick: string | null;
|
|
1239
|
-
/** Role manager for this member. */
|
|
1240
|
-
readonly roles: GuildMemberRoleManager;
|
|
1241
|
-
/** When this member joined the guild. */
|
|
1242
|
-
readonly joinedAt: Date;
|
|
1243
|
-
/** Timeout end date (null = not timed out). */
|
|
1244
|
-
communicationDisabledUntil: Date | null;
|
|
1245
|
-
/** Whether this member is voice-muted. */
|
|
1246
|
-
mute: boolean;
|
|
1247
|
-
/** Whether this member is voice-deafened. */
|
|
1248
|
-
deaf: boolean;
|
|
1249
|
-
/** Guild-specific avatar hash (null = use user avatar). */
|
|
1250
|
-
avatar: string | null;
|
|
1251
|
-
/** Guild-specific banner hash. */
|
|
1252
|
-
banner: string | null;
|
|
1253
|
-
/** Guild-specific accent color (24-bit RGB). */
|
|
1254
|
-
accentColor: number | null;
|
|
1255
|
-
/** Guild-specific profile flags. */
|
|
1256
|
-
profileFlags: number | null;
|
|
1257
|
-
constructor(client: Client, data: APIGuildMember & {
|
|
1258
|
-
guild_id?: string;
|
|
1259
|
-
}, guild: Guild);
|
|
1260
|
-
/**
|
|
1261
|
-
* Apply an API member payload in place (gateway GUILD_MEMBER_UPDATE / REST edit).
|
|
1262
|
-
* @internal
|
|
1263
|
-
*/
|
|
1264
|
-
_patch(data: APIGuildMember): void;
|
|
1265
|
-
/**
|
|
1266
|
-
* Snapshot for `guildMemberUpdate` old-member arg (before in-place patch).
|
|
1267
|
-
* @internal
|
|
1268
|
-
*/
|
|
1269
|
-
_clone(): GuildMember;
|
|
1270
|
-
get displayName(): string;
|
|
1271
|
-
avatarURL(options?: {
|
|
1272
|
-
size?: number;
|
|
1273
|
-
extension?: string;
|
|
1274
|
-
}): string | null;
|
|
1275
|
-
displayAvatarURL(options?: {
|
|
1276
|
-
size?: number;
|
|
1277
|
-
extension?: string;
|
|
1278
|
-
}): string;
|
|
1279
|
-
bannerURL(options?: {
|
|
1280
|
-
size?: number;
|
|
1281
|
-
extension?: string;
|
|
1282
|
-
}): string | null;
|
|
1283
|
-
/** PATCH member (`/members/@me` when editing the bot). */
|
|
1284
|
-
edit(options: GuildMemberEditOptions): Promise<this>;
|
|
1285
|
-
/**
|
|
1286
|
-
* Guild-level permissions (roles only, no channel overwrites).
|
|
1287
|
-
* @see {@link permissionsIn} for channel-specific permissions
|
|
1288
|
-
*/
|
|
1289
|
-
get permissions(): PermissionsBitField;
|
|
1290
|
-
/**
|
|
1291
|
-
* Effective permissions in a channel (roles + overwrites).
|
|
1292
|
-
* @param channel - The guild channel
|
|
1293
|
-
* @returns Computed permissions bitfield
|
|
1294
|
-
*/
|
|
1295
|
-
permissionsIn(channel: GuildChannel): PermissionsBitField;
|
|
1296
|
-
/**
|
|
1297
|
-
* Move to a voice channel, or `null` to disconnect. Requires Move Members.
|
|
1298
|
-
* @param channelId - Voice channel ID or null to disconnect
|
|
1299
|
-
* @param connectionId - Optional connection ID for multi-session scenarios
|
|
1300
|
-
*/
|
|
1301
|
-
move(channelId: string | null, connectionId?: string | null): Promise<void>;
|
|
1302
|
-
private _effectivePermissions;
|
|
1303
|
-
private _basePermissions;
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
/** CamelCase emoji on reaction events. */
|
|
1307
|
-
interface ReactionEmojiPayload {
|
|
1308
|
-
id?: string;
|
|
1309
|
-
name: string;
|
|
1310
|
-
animated?: boolean;
|
|
1311
|
-
}
|
|
1312
|
-
/**
|
|
1313
|
-
* Payload emitted for {@link Events.MessageReactionAdd} / {@link Events.MessageReactionRemove}.
|
|
1314
|
-
*/
|
|
1315
|
-
interface MessageReactionPayload {
|
|
1316
|
-
reaction: MessageReaction;
|
|
1317
|
-
user: User;
|
|
1318
|
-
messageId: string;
|
|
1319
|
-
channelId: string;
|
|
1320
|
-
emoji: ReactionEmojiPayload;
|
|
1321
|
-
userId: string;
|
|
1322
|
-
}
|
|
1323
|
-
/**
|
|
1324
|
-
* Payload emitted for {@link Events.GuildRoleDelete}.
|
|
1325
|
-
*/
|
|
1326
|
-
interface GuildRoleDeletePayload {
|
|
1327
|
-
roleId: string;
|
|
1328
|
-
guildId: string;
|
|
1329
|
-
role: Role | null;
|
|
1330
|
-
}
|
|
1331
|
-
/**
|
|
1332
|
-
* Payload emitted for {@link Events.MessageDeleteBulk}.
|
|
1333
|
-
* Normalized from `GatewayMessageDeleteBulkDispatchData`.
|
|
1334
|
-
*/
|
|
1335
|
-
interface MessageDeleteBulkPayload {
|
|
1336
|
-
/** IDs of the deleted messages. */
|
|
1337
|
-
ids: string[];
|
|
1338
|
-
/** Channel from which the messages were deleted. */
|
|
1339
|
-
channelId: string;
|
|
1340
|
-
/** Guild the channel belongs to, or `null` for DMs. */
|
|
1341
|
-
guildId: string | null;
|
|
1342
|
-
}
|
|
1343
|
-
/**
|
|
1344
|
-
* Payload emitted for {@link Events.InviteDelete}.
|
|
1345
|
-
* Normalized from `GatewayInviteDeleteDispatchData`.
|
|
1346
|
-
*/
|
|
1347
|
-
interface InviteDeletePayload {
|
|
1348
|
-
/** Invite code that was deleted. */
|
|
1349
|
-
code: string;
|
|
1350
|
-
/** Guild the invite belonged to, or `null` for DMs / group DMs. */
|
|
1351
|
-
guildId: string | null;
|
|
1352
|
-
/** Channel the invite pointed to, or `null` if unknown. */
|
|
1353
|
-
channelId: string | null;
|
|
1354
|
-
}
|
|
1355
|
-
/**
|
|
1356
|
-
* Payload emitted for {@link Events.TypingStart}.
|
|
1357
|
-
* Normalized from `GatewayTypingStartDispatchData`.
|
|
1358
|
-
*/
|
|
1359
|
-
interface TypingStartPayload {
|
|
1360
|
-
/** Channel where the user started typing. */
|
|
1361
|
-
channelId: string;
|
|
1362
|
-
/** Guild the channel belongs to, or `null` for DMs. */
|
|
1363
|
-
guildId: string | null;
|
|
1364
|
-
/** ID of the user who started typing. */
|
|
1365
|
-
userId: string;
|
|
1366
|
-
/** Unix timestamp (seconds) when typing began. */
|
|
1367
|
-
timestamp: number;
|
|
1368
|
-
}
|
|
1369
|
-
/**
|
|
1370
|
-
* Payload emitted for {@link Events.GuildEmojisUpdate}.
|
|
1371
|
-
* Contains the fully-cached {@link GuildEmoji} instances after the update.
|
|
1372
|
-
*/
|
|
1373
|
-
interface GuildEmojisUpdatePayload {
|
|
1374
|
-
/** Guild whose emoji list changed. */
|
|
1375
|
-
guildId: string;
|
|
1376
|
-
/** Updated list of {@link GuildEmoji} instances (from cache). */
|
|
1377
|
-
emojis: GuildEmoji[];
|
|
1378
|
-
}
|
|
1379
|
-
/**
|
|
1380
|
-
* Payload emitted for {@link Events.GuildStickersUpdate}.
|
|
1381
|
-
* Contains cached {@link GuildSticker} instances after the update.
|
|
1382
|
-
*/
|
|
1383
|
-
interface GuildStickersUpdatePayload {
|
|
1384
|
-
/** Guild whose sticker list changed. */
|
|
1385
|
-
guildId: string;
|
|
1386
|
-
/** Updated list of {@link GuildSticker} instances (from cache). */
|
|
1387
|
-
stickers: GuildSticker[];
|
|
1388
|
-
}
|
|
1389
|
-
/** Payload for {@link Events.MessageReactionRemoveAll}. */
|
|
1390
|
-
interface MessageReactionRemoveAllPayload {
|
|
1391
|
-
messageId: string;
|
|
1392
|
-
channelId: string;
|
|
1393
|
-
guildId: string | null;
|
|
1394
|
-
}
|
|
1395
|
-
/** Payload for {@link Events.MessageReactionRemoveEmoji}. */
|
|
1396
|
-
interface MessageReactionRemoveEmojiPayload {
|
|
1397
|
-
messageId: string;
|
|
1398
|
-
channelId: string;
|
|
1399
|
-
guildId: string | null;
|
|
1400
|
-
emoji: ReactionEmojiPayload;
|
|
1401
|
-
}
|
|
1402
|
-
/** Single entry in {@link MessageReactionAddManyPayload}. */
|
|
1403
|
-
interface MessageReactionAddManyEntry {
|
|
1404
|
-
userId: string;
|
|
1405
|
-
emoji: ReactionEmojiPayload;
|
|
1406
|
-
member: GuildMember | null;
|
|
1407
|
-
}
|
|
1408
|
-
/** Payload for {@link Events.MessageReactionAddMany}. */
|
|
1409
|
-
interface MessageReactionAddManyPayload {
|
|
1410
|
-
channelId: string;
|
|
1411
|
-
messageId: string;
|
|
1412
|
-
guildId: string | null;
|
|
1413
|
-
reactions: MessageReactionAddManyEntry[];
|
|
1414
|
-
}
|
|
1415
|
-
/** Payload for {@link Events.ChannelPinsUpdate}. */
|
|
1416
|
-
interface ChannelPinsUpdatePayload {
|
|
1417
|
-
channelId: string;
|
|
1418
|
-
guildId: string | null;
|
|
1419
|
-
lastPinTimestamp: string | null;
|
|
1420
|
-
}
|
|
1421
|
-
/** Presence activity (camelCase). */
|
|
1422
|
-
interface PresenceActivity {
|
|
1423
|
-
name: string;
|
|
1424
|
-
type: number;
|
|
1425
|
-
url?: string | null;
|
|
1426
|
-
}
|
|
1427
|
-
/** Payload for {@link Events.PresenceUpdate}. */
|
|
1428
|
-
interface PresenceUpdatePayload {
|
|
1429
|
-
userId: string;
|
|
1430
|
-
guildId: string | null;
|
|
1431
|
-
status: string | null;
|
|
1432
|
-
activities: PresenceActivity[];
|
|
1433
|
-
customStatus: {
|
|
1434
|
-
text?: string | null;
|
|
1435
|
-
emojiId?: string | null;
|
|
1436
|
-
emojiName?: string | null;
|
|
1437
|
-
} | null;
|
|
1438
|
-
}
|
|
1439
|
-
/** Payload for {@link Events.PresenceUpdateBulk}. */
|
|
1440
|
-
interface PresenceUpdateBulkPayload {
|
|
1441
|
-
guildId: string | null;
|
|
1442
|
-
presences: PresenceUpdatePayload[];
|
|
1443
|
-
}
|
|
1444
|
-
/** Payload for {@link Events.WebhooksUpdate}. */
|
|
1445
|
-
interface WebhooksUpdatePayload {
|
|
1446
|
-
channelId: string;
|
|
1447
|
-
guildId: string;
|
|
1448
|
-
}
|
|
1449
|
-
/** Payload for {@link Events.GuildMembersChunk}. */
|
|
1450
|
-
interface GuildMembersChunkPayload {
|
|
1451
|
-
guildId: string;
|
|
1452
|
-
members: GuildMember[];
|
|
1453
|
-
chunkIndex: number;
|
|
1454
|
-
chunkCount: number;
|
|
1455
|
-
notFound: string[];
|
|
1456
|
-
nonce: string | null;
|
|
1457
|
-
}
|
|
1458
|
-
/** Audit log change (camelCase). */
|
|
1459
|
-
interface AuditLogChange {
|
|
1460
|
-
key: string;
|
|
1461
|
-
oldValue?: string | number | boolean | null;
|
|
1462
|
-
newValue?: string | number | boolean | null;
|
|
1463
|
-
}
|
|
1464
|
-
/** Payload for {@link Events.GuildAuditLogEntryCreate} and audit fetch entries. */
|
|
1465
|
-
interface AuditLogEntryPayload {
|
|
1466
|
-
id: string;
|
|
1467
|
-
actionType: number;
|
|
1468
|
-
userId: string | null;
|
|
1469
|
-
targetId: string | null;
|
|
1470
|
-
reason: string | null;
|
|
1471
|
-
options: Record<string, string> | null;
|
|
1472
|
-
changes: AuditLogChange[];
|
|
1473
|
-
guildId: string | null;
|
|
1474
|
-
}
|
|
1475
|
-
/** Payload for {@link Events.GuildCountsUpdate}. */
|
|
1476
|
-
interface GuildCountsUpdatePayload {
|
|
1477
|
-
counts: Array<{
|
|
1478
|
-
guildId: string;
|
|
1479
|
-
memberCount: number;
|
|
1480
|
-
onlineCount: number;
|
|
1481
|
-
}>;
|
|
1482
|
-
}
|
|
1483
|
-
/** Payload for {@link Events.ChannelMemberCountsUpdate}. */
|
|
1484
|
-
interface ChannelMemberCountsUpdatePayload {
|
|
1485
|
-
counts: Array<{
|
|
1486
|
-
guildId: string;
|
|
1487
|
-
channelId: string;
|
|
1488
|
-
memberCount: number;
|
|
1489
|
-
onlineCount: number;
|
|
1490
|
-
}>;
|
|
1491
|
-
}
|
|
1492
|
-
/** Role update with optional previous snapshot. */
|
|
1493
|
-
interface GuildRoleUpdatePayload {
|
|
1494
|
-
/** Role after the update (cached instance). */
|
|
1495
|
-
role: Role;
|
|
1496
|
-
/** Shallow previous field snapshot when the role was already cached. */
|
|
1497
|
-
oldRole: Role | null;
|
|
1498
|
-
}
|
|
1499
|
-
/** Vanity URL result (camelCase). */
|
|
1500
|
-
interface VanityURLPayload {
|
|
1501
|
-
code: string | null;
|
|
1502
|
-
uses: number;
|
|
1503
|
-
}
|
|
1504
|
-
/** Result of {@link Guild.fetchAuditLogs}. */
|
|
1505
|
-
interface AuditLogFetchPayload {
|
|
1506
|
-
entries: AuditLogEntryPayload[];
|
|
1507
|
-
users: User[];
|
|
1508
|
-
}
|
|
1509
|
-
/** Guild member search result row (camelCase). */
|
|
1510
|
-
interface GuildMemberSearchHit {
|
|
1511
|
-
id: string;
|
|
1512
|
-
guildId: string;
|
|
1513
|
-
userId: string;
|
|
1514
|
-
username: string;
|
|
1515
|
-
discriminator: string;
|
|
1516
|
-
globalName: string | null;
|
|
1517
|
-
nickname: string | null;
|
|
1518
|
-
/** Cached {@link GuildMember} when available after search hydration. */
|
|
1519
|
-
member: GuildMember | null;
|
|
1520
|
-
}
|
|
1521
|
-
/** Guild member search response (camelCase). */
|
|
1522
|
-
interface GuildMemberSearchPayload {
|
|
1523
|
-
guildId: string;
|
|
1524
|
-
members: GuildMemberSearchHit[];
|
|
1525
|
-
/** Total matches across pages (`total_result_count`). */
|
|
1526
|
-
total?: number;
|
|
1527
|
-
/** Results on this page (`page_result_count`). */
|
|
1528
|
-
pageResultCount?: number;
|
|
1529
|
-
/** Whether more pages exist after this offset. */
|
|
1530
|
-
hasMore?: boolean;
|
|
1531
|
-
/** Search index still building. */
|
|
1532
|
-
indexing?: boolean;
|
|
1533
|
-
}
|
|
1534
|
-
/** Pack summary (camelCase view of {@link APIPackSummary}). */
|
|
1535
|
-
interface PackSummaryPayload {
|
|
1536
|
-
id: string;
|
|
1537
|
-
name: string;
|
|
1538
|
-
description: string | null;
|
|
1539
|
-
type: string;
|
|
1540
|
-
creatorId: string;
|
|
1541
|
-
createdAt: string;
|
|
1542
|
-
updatedAt: string;
|
|
1543
|
-
installedAt?: string;
|
|
1544
|
-
/** Original wire object when useful for debugging. */
|
|
1545
|
-
raw?: unknown;
|
|
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;
|
|
1546
1332
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
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>;
|
|
1555
1358
|
}
|
|
1556
1359
|
|
|
1557
|
-
|
|
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). */
|
|
1558
1369
|
declare class MessageReaction extends Base {
|
|
1559
1370
|
readonly client: Client;
|
|
1560
1371
|
readonly messageId: string;
|
|
1561
1372
|
readonly channelId: string;
|
|
1562
1373
|
readonly guildId: string | null;
|
|
1563
1374
|
readonly emoji: ReactionEmojiPayload;
|
|
1564
|
-
/**
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
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). */
|
|
1568
1385
|
get emojiIdentifier(): string;
|
|
1569
1386
|
/** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
|
|
1570
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;
|
|
1571
1392
|
/**
|
|
1572
|
-
* Fetch the message this reaction belongs to.
|
|
1573
|
-
* Use when you need to edit, delete, or otherwise interact with the message.
|
|
1393
|
+
* Fetch the message this reaction belongs to (cache first, then REST).
|
|
1574
1394
|
* @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
|
|
1575
1395
|
*/
|
|
1576
1396
|
fetchMessage(): Promise<Message>;
|
|
1577
1397
|
}
|
|
1578
1398
|
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
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;
|
|
1689
|
+
after?: string;
|
|
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. */
|
|
1583
1756
|
time?: number;
|
|
1584
|
-
/** Max
|
|
1757
|
+
/** Max messages to collect. Collector stops when limit reached. Required unless `time` is set. */
|
|
1585
1758
|
max?: number;
|
|
1586
1759
|
}
|
|
1587
|
-
type
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
interface ReactionCollectorEvents {
|
|
1593
|
-
collect: [reaction: MessageReaction, user: User];
|
|
1594
|
-
end: [collected: Collection<string, CollectedReaction>, reason: ReactionCollectorEndReason];
|
|
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];
|
|
1595
1765
|
}
|
|
1596
1766
|
/**
|
|
1597
|
-
* Collects
|
|
1598
|
-
*
|
|
1599
|
-
* Listens to both {@link Events.MessageReactionAdd} and {@link Events.MessageReactionAddMany}
|
|
1600
|
-
* (gateway may batch rapid reactions into ADD_MANY instead of individual ADD events).
|
|
1601
|
-
*
|
|
1767
|
+
* Collects messages in a channel. Use channel.createMessageCollector().
|
|
1768
|
+
* Requires `time` and/or `max`.
|
|
1602
1769
|
* @example
|
|
1603
|
-
* const collector =
|
|
1604
|
-
* collector.on('collect',
|
|
1770
|
+
* const collector = channel.createMessageCollector({ filter: m => m.author.id === userId, time: 10000 });
|
|
1771
|
+
* collector.on('collect', m => console.log(m.content));
|
|
1605
1772
|
* collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
|
|
1606
1773
|
*/
|
|
1607
|
-
declare class
|
|
1774
|
+
declare class MessageCollector extends EventEmitter {
|
|
1608
1775
|
readonly client: Client;
|
|
1609
|
-
readonly messageId: string;
|
|
1610
1776
|
readonly channelId: string;
|
|
1611
|
-
readonly options: Required<
|
|
1612
|
-
readonly collected: Collection<string,
|
|
1777
|
+
readonly options: Required<MessageCollectorOptions>;
|
|
1778
|
+
readonly collected: Collection<string, Message>;
|
|
1613
1779
|
private _timeout;
|
|
1614
1780
|
private _ended;
|
|
1615
|
-
private
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
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;
|
|
1622
1796
|
}
|
|
1623
1797
|
|
|
1624
|
-
/**
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1798
|
+
/**
|
|
1799
|
+
* Optional cache size limits (FIFO eviction when exceeded).
|
|
1800
|
+
*
|
|
1801
|
+
* | Value | Meaning |
|
|
1802
|
+
* |-------|---------|
|
|
1803
|
+
* | positive number | Max entries |
|
|
1804
|
+
* | `0` or `Infinity` | Unbounded |
|
|
1805
|
+
* | `false` (`messages` only) | Message cache disabled |
|
|
1806
|
+
*
|
|
1807
|
+
* @see {@link DEFAULT_CACHE_LIMITS}
|
|
1808
|
+
* @see {@link resolveCacheLimits}
|
|
1809
|
+
*/
|
|
1810
|
+
interface CacheSizeLimits {
|
|
1811
|
+
/** Max channels cached globally. `0` = unbounded. */
|
|
1812
|
+
channels?: number;
|
|
1813
|
+
/** Max guilds cached. `0` = unbounded. */
|
|
1814
|
+
guilds?: number;
|
|
1815
|
+
/** Max users cached globally. `0` = unbounded. */
|
|
1816
|
+
users?: number;
|
|
1817
|
+
/**
|
|
1818
|
+
* Max messages per channel, or `false` to disable message caching.
|
|
1819
|
+
* `0` / `Infinity` = unbounded (legacy `0` previously meant off — use `false`).
|
|
1820
|
+
*/
|
|
1821
|
+
messages?: number | false;
|
|
1822
|
+
/** Max members per guild. `0` = unbounded. */
|
|
1823
|
+
members?: number;
|
|
1824
|
+
/** Max roles per guild. `0` = unbounded. @default 0 */
|
|
1825
|
+
roles?: number;
|
|
1826
|
+
/** Max emojis per guild. `0` = unbounded. @default 0 */
|
|
1827
|
+
emojis?: number;
|
|
1828
|
+
/** Max stickers per guild. `0` = unbounded. @default 0 */
|
|
1829
|
+
stickers?: number;
|
|
1640
1830
|
}
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1831
|
+
/**
|
|
1832
|
+
* Default cache policy — opt out per field with `0` (or `messages: false` to disable).
|
|
1833
|
+
* Applied when {@link ClientOptions.cache} is omitted or partial.
|
|
1834
|
+
*/
|
|
1835
|
+
declare const DEFAULT_CACHE_LIMITS: Required<Omit<CacheSizeLimits, 'messages'>> & {
|
|
1836
|
+
messages: number;
|
|
1646
1837
|
};
|
|
1647
|
-
/**
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
/**
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
/**
|
|
1706
|
-
|
|
1838
|
+
/**
|
|
1839
|
+
* Fully resolved cache limits used at runtime.
|
|
1840
|
+
* Numeric buckets use `Infinity` for unbounded; `messages` may be `false` (disabled).
|
|
1841
|
+
*/
|
|
1842
|
+
interface ResolvedCacheLimits {
|
|
1843
|
+
guilds: number;
|
|
1844
|
+
channels: number;
|
|
1845
|
+
users: number;
|
|
1846
|
+
members: number;
|
|
1847
|
+
/** Per-channel message cap, `Infinity` if unbounded, or `false` if disabled. */
|
|
1848
|
+
messages: number | false;
|
|
1849
|
+
roles: number;
|
|
1850
|
+
emojis: number;
|
|
1851
|
+
stickers: number;
|
|
1852
|
+
}
|
|
1853
|
+
/** Result of {@link resolveCacheLimits}. */
|
|
1854
|
+
interface ResolvedCacheOptions {
|
|
1855
|
+
/** Limits for LimitedCollection / MessageCache. */
|
|
1856
|
+
limits: ResolvedCacheLimits;
|
|
1857
|
+
/** Merged options object stored on `client.options.cache`. */
|
|
1858
|
+
cache: Required<Omit<CacheSizeLimits, 'messages'>> & {
|
|
1859
|
+
messages: number | false;
|
|
1860
|
+
};
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Normalize a numeric cache limit.
|
|
1864
|
+
* Positive finite → floored max; `0` / `Infinity` / NaN / negative → unbounded (`Infinity`).
|
|
1865
|
+
*/
|
|
1866
|
+
declare function normalizeCacheLimit(value: number | undefined, fallback: number): number;
|
|
1867
|
+
/**
|
|
1868
|
+
* Resolve and validate {@link ClientOptions.cache} once at Client construction.
|
|
1869
|
+
* Emits a warning when `messages: 0` is passed (legacy “off”; now unbounded — use `false`).
|
|
1870
|
+
*/
|
|
1871
|
+
declare function resolveCacheLimits(input?: CacheSizeLimits): ResolvedCacheOptions;
|
|
1872
|
+
/**
|
|
1873
|
+
* Configuration options for {@link Client}.
|
|
1874
|
+
* @example
|
|
1875
|
+
* ```ts
|
|
1876
|
+
* const client = new Client({
|
|
1877
|
+
* instance: { api: 'https://api.example.com' },
|
|
1878
|
+
* cache: { guilds: 100, messages: 20 },
|
|
1879
|
+
* waitForGuilds: true,
|
|
1880
|
+
* });
|
|
1881
|
+
* ```
|
|
1882
|
+
*/
|
|
1883
|
+
interface ClientOptions {
|
|
1884
|
+
/**
|
|
1885
|
+
* Instance endpoints for this client (API, CDN, invite, etc.).
|
|
1886
|
+
* Pass a partial map to override hosted defaults, or a full discovery document.
|
|
1887
|
+
* Prefer this over `rest.api` for multi-instance / self-hosted bots.
|
|
1888
|
+
* @see {@link Client.fromDiscovery}
|
|
1889
|
+
*/
|
|
1890
|
+
instance?: Partial<APIInstanceEndpoints> | APIInstance;
|
|
1891
|
+
/**
|
|
1892
|
+
* REST options. Prefer {@link ClientOptions.instance} for the API host.
|
|
1893
|
+
* If both `instance.api` (or resolved default) and `rest.api` are set and differ, construction throws.
|
|
1894
|
+
*/
|
|
1895
|
+
rest?: Partial<ConstructorParameters<typeof REST>[0]>;
|
|
1896
|
+
/**
|
|
1897
|
+
* @deprecated Fluxer has no intents. Prefer {@link ignoredEvents}. Kept only for migration; identify always sends `0`.
|
|
1898
|
+
*/
|
|
1899
|
+
intents?: number;
|
|
1900
|
+
/**
|
|
1901
|
+
* @deprecated No-op. Fluxer has no intents warning to suppress.
|
|
1902
|
+
*/
|
|
1903
|
+
suppressIntentWarning?: boolean;
|
|
1904
|
+
/** {@link GatewayIdentifyFlags} bitfield sent as Identify `flags`. */
|
|
1905
|
+
identifyFlags?: number;
|
|
1906
|
+
/** Dispatch event names to suppress for this session (`ignored_events`). */
|
|
1907
|
+
ignoredEvents?: string[];
|
|
1908
|
+
/** Prefer hydrating this guild first after READY (`initial_guild_id`). */
|
|
1909
|
+
initialGuildId?: string;
|
|
1910
|
+
/**
|
|
1911
|
+
* Delay Ready until all READY guilds arrive via GUILD_CREATE; queue other dispatches until then.
|
|
1912
|
+
* @default false
|
|
1913
|
+
*/
|
|
1914
|
+
waitForGuilds?: boolean;
|
|
1915
|
+
/**
|
|
1916
|
+
* Cache size limits per bucket. Defaults to {@link DEFAULT_CACHE_LIMITS}.
|
|
1917
|
+
* Pass `0` / `Infinity` per numeric field for unbounded; `messages: false` to disable message caching.
|
|
1918
|
+
* @see {@link CacheSizeLimits}
|
|
1919
|
+
*/
|
|
1920
|
+
cache?: CacheSizeLimits;
|
|
1921
|
+
/**
|
|
1922
|
+
* Default allowed mentions when a send omits them (per-call wins).
|
|
1923
|
+
* @example
|
|
1924
|
+
* ```ts
|
|
1925
|
+
* defaultAllowedMentions: {
|
|
1926
|
+
* parse: ['users'],
|
|
1927
|
+
* repliedUser: false,
|
|
1928
|
+
* }
|
|
1929
|
+
* ```
|
|
1930
|
+
*/
|
|
1931
|
+
defaultAllowedMentions?: {
|
|
1932
|
+
/** Mention types to parse (`roles`, `users`, `everyone`). */
|
|
1933
|
+
parse?: Array<'roles' | 'users' | 'everyone'>;
|
|
1934
|
+
/** Specific role IDs allowed to be mentioned. */
|
|
1935
|
+
roles?: string[];
|
|
1936
|
+
/** Specific user IDs allowed to be mentioned. */
|
|
1937
|
+
users?: string[];
|
|
1938
|
+
/** Whether to ping the user being replied to. */
|
|
1939
|
+
repliedUser?: boolean;
|
|
1940
|
+
};
|
|
1941
|
+
/**
|
|
1942
|
+
* Default reply ping for `message.reply` when `ping` is omitted.
|
|
1943
|
+
* @default true
|
|
1944
|
+
*/
|
|
1945
|
+
defaultReplyPing?: boolean;
|
|
1946
|
+
/**
|
|
1947
|
+
* Initial presence on identify (also updatable via `client.user.setPresence`).
|
|
1948
|
+
* CamelCase only; mapped to gateway wire internally.
|
|
1949
|
+
*/
|
|
1950
|
+
presence?: PresenceUpdateOptions;
|
|
1951
|
+
/**
|
|
1952
|
+
* Emit gateway debug strings.
|
|
1953
|
+
* @default true
|
|
1954
|
+
*/
|
|
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;
|
|
1993
|
+
/** Minimum log level for {@link Client.logger}. Default: `warn`. */
|
|
1994
|
+
logLevel?: LogLevel;
|
|
1995
|
+
/** Custom logger instance (overrides {@link logLevel} sink defaults). */
|
|
1996
|
+
logger?: Logger;
|
|
1707
1997
|
/**
|
|
1708
|
-
*
|
|
1709
|
-
* @
|
|
1998
|
+
* Defer dispatch handlers to the next macrotask so WS `message` stays responsive.
|
|
1999
|
+
* @default true (`false` useful in tests)
|
|
1710
2000
|
*/
|
|
1711
|
-
|
|
1712
|
-
/** Send a message in this channel without replying. */
|
|
1713
|
-
send(options: MessagePrepareInput): Promise<Message>;
|
|
1714
|
-
/** Send a message to another channel by ID. */
|
|
1715
|
-
sendTo(channelId: string, options: MessagePrepareInput): Promise<Message>;
|
|
2001
|
+
gatewayDeferHandlers?: boolean;
|
|
1716
2002
|
/**
|
|
1717
|
-
*
|
|
1718
|
-
*
|
|
1719
|
-
* await message.reply('Pong!');
|
|
1720
|
-
* await message.reply('No ping!', { ping: false });
|
|
1721
|
-
* await message.reply({ content: 'Silent', allowedMentions: AllowedMentions.suppressReplyPing });
|
|
2003
|
+
* Optional WebSocket constructor (e.g. `ws` in Node).
|
|
2004
|
+
* Provide if the runtime lacks a native WebSocket implementation.
|
|
1722
2005
|
*/
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
}
|
|
1730
|
-
/** Send a prepared payload (internal helper). */
|
|
1731
|
-
_send(payload: MessagePayload): Promise<Message>;
|
|
1732
|
-
/** Edit this message (requires author or admin permissions). */
|
|
1733
|
-
edit(options: MessageEditOptions): Promise<Message>;
|
|
1734
|
-
/** Create a {@link ReactionCollector} for this message. */
|
|
1735
|
-
createReactionCollector(options?: ReactionCollectorOptions): ReactionCollector;
|
|
1736
|
-
/** Fetch the latest version of this message from the API. */
|
|
1737
|
-
fetch(): Promise<Message>;
|
|
1738
|
-
/** Delete this message. */
|
|
1739
|
-
delete(): Promise<void>;
|
|
1740
|
-
/** Delete a specific attachment from this message. */
|
|
1741
|
-
deleteAttachment(attachmentId: string): Promise<void>;
|
|
1742
|
-
/** Pin this message in the channel. */
|
|
1743
|
-
pin(): Promise<void>;
|
|
1744
|
-
/** Unpin this message from the channel. */
|
|
1745
|
-
unpin(): Promise<void>;
|
|
1746
|
-
/** React to this message with an emoji. */
|
|
1747
|
-
react(emoji: EmojiInput): Promise<void>;
|
|
1748
|
-
/** Remove a reaction (bot's own or a user's if ID is provided). */
|
|
1749
|
-
removeReaction(emoji: EmojiInput, userId?: string): Promise<void>;
|
|
1750
|
-
/** Remove all reactions from this message. */
|
|
1751
|
-
removeAllReactions(): Promise<void>;
|
|
1752
|
-
/** Remove all reactions of a specific emoji. */
|
|
1753
|
-
removeReactionEmoji(emoji: EmojiInput): Promise<void>;
|
|
1754
|
-
/** Fetch users who reacted with a specific emoji. */
|
|
1755
|
-
fetchReactionUsers(emoji: EmojiInput, options?: {
|
|
1756
|
-
limit?: number;
|
|
1757
|
-
after?: string;
|
|
1758
|
-
}): Promise<User[]>;
|
|
1759
|
-
/** Fetch reaction users with pagination metadata. */
|
|
1760
|
-
fetchReactionUsersPage(emoji: EmojiInput, options?: {
|
|
1761
|
-
limit?: number;
|
|
1762
|
-
after?: string;
|
|
1763
|
-
}): Promise<{
|
|
1764
|
-
users: User[];
|
|
1765
|
-
hasMore: boolean;
|
|
1766
|
-
nextAfter: string | null;
|
|
1767
|
-
}>;
|
|
2006
|
+
WebSocket?: new (url: string) => {
|
|
2007
|
+
send(data: string | ArrayBufferLike): void;
|
|
2008
|
+
close(code?: number): void;
|
|
2009
|
+
readyState: number;
|
|
2010
|
+
addEventListener?(type: string, listener: (e: unknown) => void): void;
|
|
2011
|
+
on?(event: string, cb: (data?: unknown) => void): void;
|
|
2012
|
+
};
|
|
1768
2013
|
}
|
|
1769
2014
|
|
|
1770
|
-
/**
|
|
1771
|
-
interface
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
2015
|
+
/** Snapshot of current cache sizes. */
|
|
2016
|
+
interface CacheStats {
|
|
2017
|
+
guilds: number;
|
|
2018
|
+
channels: number;
|
|
2019
|
+
users: number;
|
|
2020
|
+
members: number;
|
|
2021
|
+
messages: number;
|
|
2022
|
+
messageChannels: number;
|
|
2023
|
+
roles: number;
|
|
2024
|
+
emojis: number;
|
|
2025
|
+
stickers: number;
|
|
1776
2026
|
}
|
|
1777
|
-
/**
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
2027
|
+
/**
|
|
2028
|
+
* Public cache facade: limits, stats, sweeps, and cascade teardown entry points.
|
|
2029
|
+
* Not a second source of truth — wraps managers / {@link MessageCache}.
|
|
2030
|
+
*/
|
|
2031
|
+
declare class CacheController {
|
|
2032
|
+
private readonly client;
|
|
2033
|
+
/** Resolved limits applied at Client construction. */
|
|
2034
|
+
readonly limits: ResolvedCacheLimits;
|
|
2035
|
+
/** Re-entrancy guard for dual-index / guild cascade teardown. */
|
|
2036
|
+
private _cascading;
|
|
2037
|
+
constructor(client: Client, limits: ResolvedCacheLimits);
|
|
2038
|
+
/** Whether a cascade teardown is currently in progress. */
|
|
2039
|
+
get cascading(): boolean;
|
|
2040
|
+
/** Current sizes for each cache bucket. */
|
|
2041
|
+
stats(): CacheStats;
|
|
2042
|
+
/**
|
|
2043
|
+
* Sweep cached messages. Filter receives a hydrated {@link Message} (`createdAt`).
|
|
2044
|
+
*/
|
|
2045
|
+
sweepMessages(filter?: (message: Message, channelId: string) => boolean, channelId?: string): number;
|
|
2046
|
+
sweepMembers(filter?: (member: GuildMember, guildId: string) => boolean): number;
|
|
2047
|
+
sweepUsers(filter?: (user: User, id: string) => boolean): number;
|
|
2048
|
+
/**
|
|
2049
|
+
* Sweep channels from the global index (cascades guild index + message cache).
|
|
2050
|
+
* Returns count removed.
|
|
2051
|
+
*/
|
|
2052
|
+
sweepChannels(filter?: (channel: Channel, id: string) => boolean): number;
|
|
2053
|
+
/**
|
|
2054
|
+
* Sweep guilds (cascades channels + message caches). Returns count removed.
|
|
2055
|
+
*/
|
|
2056
|
+
sweepGuilds(filter?: (guild: Guild, id: string) => boolean): number;
|
|
2057
|
+
/**
|
|
2058
|
+
* Tear down nested caches when a guild leaves `client.guilds`.
|
|
2059
|
+
* Removes channels from the global index, clears message caches, and empties guild collections.
|
|
2060
|
+
* Does not mass-delete `client.users`.
|
|
2061
|
+
* @internal
|
|
2062
|
+
*/
|
|
2063
|
+
cascadeGuild(guild: Guild): void;
|
|
2064
|
+
/**
|
|
2065
|
+
* Keep dual channel indexes + message cache aligned when a channel leaves a cache.
|
|
2066
|
+
* Uses `Map.prototype.delete` so ChannelManager/Guild channel `delete` overrides do not re-enter.
|
|
2067
|
+
* @param channel - Channel being removed
|
|
2068
|
+
* @param from - Which index initiated the removal (`global` = client.channels, `guild` = guild.channels)
|
|
2069
|
+
* @internal
|
|
2070
|
+
*/
|
|
2071
|
+
cascadeChannel(channel: Channel, from?: 'global' | 'guild' | 'both'): void;
|
|
1781
2072
|
}
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* Channel cache + fetch/send helpers.
|
|
2076
|
+
* Extends {@link LimitedCollection} (`.get()`, `.set()`, `.filter()`, …).
|
|
2077
|
+
* FIFO-evicts (and keeps guild indexes / message caches aligned) at `cache.channels`.
|
|
2078
|
+
*/
|
|
2079
|
+
declare class ChannelManager extends LimitedCollection<string, Channel> {
|
|
2080
|
+
private readonly client;
|
|
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
|
+
*/
|
|
2086
|
+
delete(key: string): boolean;
|
|
2087
|
+
/** Retrieve from cache, otherwise {@link fetch}. */
|
|
2088
|
+
resolve(channelId: string): Promise<Channel>;
|
|
2089
|
+
/**
|
|
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');
|
|
2097
|
+
* @throws {@link FluxerError} with CHANNEL_NOT_FOUND if missing
|
|
2098
|
+
*/
|
|
2099
|
+
fetch(channelId: string, options?: {
|
|
2100
|
+
force?: boolean;
|
|
2101
|
+
}): Promise<Channel>;
|
|
2102
|
+
/**
|
|
2103
|
+
* Fetch a message by channel + message ID (no channel resolve required).
|
|
2104
|
+
* Prefer `channel.messages.fetch(messageId)` when you already have a text channel.
|
|
2105
|
+
*/
|
|
2106
|
+
fetchMessage(channelId: string, messageId: string): Promise<Message>;
|
|
2107
|
+
/**
|
|
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.
|
|
2110
|
+
* @example
|
|
2111
|
+
* await client.channels.send(logChannelId, 'User joined!');
|
|
2112
|
+
*/
|
|
2113
|
+
send(channelId: string, payload: MessagePrepareInput): Promise<Message>;
|
|
1785
2114
|
}
|
|
1786
|
-
|
|
1787
|
-
|
|
2115
|
+
|
|
2116
|
+
/** The logged-in bot/user (`client.user`). */
|
|
2117
|
+
declare class ClientUser extends User {
|
|
2118
|
+
readonly client: Client;
|
|
2119
|
+
/** Broadcast presence (gateway opcode 3) on all shards. */
|
|
2120
|
+
setPresence(presence: PresenceUpdateOptions): void;
|
|
2121
|
+
/** GET /users/@me — refresh the logged-in user from REST and patch this instance. */
|
|
2122
|
+
fetch(): Promise<this>;
|
|
2123
|
+
/** GET /users/@me/guilds — returns camelCase partial guilds. */
|
|
2124
|
+
fetchGuilds(options?: {
|
|
2125
|
+
withCounts?: boolean;
|
|
2126
|
+
}): Promise<PartialUserGuildPayload[]>;
|
|
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
|
+
*/
|
|
2136
|
+
leaveGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
|
|
2137
|
+
/** Delete every message authored by the caller across a guild (sudo). */
|
|
2138
|
+
bulkDeleteMyMessagesInGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
|
|
1788
2139
|
}
|
|
2140
|
+
|
|
1789
2141
|
/**
|
|
1790
|
-
*
|
|
1791
|
-
*
|
|
1792
|
-
*
|
|
1793
|
-
* constructs {@link Message} from the cached payload so `get` stays coherent.
|
|
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.
|
|
1794
2145
|
*/
|
|
1795
|
-
declare class
|
|
2146
|
+
declare class GuildManager extends LimitedCollection<string, Guild> {
|
|
1796
2147
|
private readonly client;
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
/**
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
2148
|
+
constructor(client: Client);
|
|
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>;
|
|
1811
2169
|
}
|
|
1812
2170
|
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
2171
|
+
type MemberPayload = APIGuildMember & {
|
|
2172
|
+
user: {
|
|
2173
|
+
id: string;
|
|
2174
|
+
};
|
|
2175
|
+
};
|
|
2176
|
+
/** Result of {@link UserManager.fetchWithProfile}. */
|
|
2177
|
+
interface FetchedUserWithProfile {
|
|
2178
|
+
user: User;
|
|
2179
|
+
userData: APIUserPartial;
|
|
2180
|
+
globalProfile: ProfilePayload | null;
|
|
2181
|
+
serverProfile: ProfilePayload | null;
|
|
2182
|
+
member: GuildMember | null;
|
|
2183
|
+
memberData: MemberPayload | null;
|
|
1820
2184
|
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
2185
|
+
/**
|
|
2186
|
+
* User cache + fetch/profile helpers.
|
|
2187
|
+
* Extends LimitedCollection (`.get()`, `.set()`, `.filter()`, …).
|
|
2188
|
+
* Access via {@link Client.users}.
|
|
2189
|
+
*/
|
|
2190
|
+
declare class UserManager extends LimitedCollection<string, User> {
|
|
2191
|
+
private readonly client;
|
|
2192
|
+
constructor(client: Client);
|
|
2193
|
+
/** Remove matching users (skips `client.user`). Returns count removed. */
|
|
2194
|
+
sweep(filter?: (user: User, id: string) => boolean): number;
|
|
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>;
|
|
2201
|
+
/**
|
|
2202
|
+
* Fetch user + profiles (+ optional guild member). Ideal for userinfo commands.
|
|
2203
|
+
* @example
|
|
2204
|
+
* const { user, globalProfile, member } = await client.users.fetchWithProfile(
|
|
2205
|
+
* userId,
|
|
2206
|
+
* { guildId: message.guildId ?? undefined },
|
|
2207
|
+
* );
|
|
2208
|
+
*/
|
|
2209
|
+
fetchWithProfile(userId: string, options?: {
|
|
2210
|
+
guildId?: string | null;
|
|
2211
|
+
}): Promise<FetchedUserWithProfile>;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
/** Event name constants for client.on(Events.X, handler). Use with ClientEvents for typed callbacks. */
|
|
2215
|
+
declare const Events: {
|
|
2216
|
+
readonly Ready: "ready";
|
|
2217
|
+
readonly MessageCreate: "messageCreate";
|
|
2218
|
+
readonly MessageUpdate: "messageUpdate";
|
|
2219
|
+
readonly MessageDelete: "messageDelete";
|
|
2220
|
+
readonly MessageDeleteBulk: "messageDeleteBulk";
|
|
2221
|
+
readonly MessageReactionAdd: "messageReactionAdd";
|
|
2222
|
+
readonly MessageReactionAddMany: "messageReactionAddMany";
|
|
2223
|
+
readonly MessageReactionRemove: "messageReactionRemove";
|
|
2224
|
+
readonly MessageReactionRemoveAll: "messageReactionRemoveAll";
|
|
2225
|
+
readonly MessageReactionRemoveEmoji: "messageReactionRemoveEmoji";
|
|
2226
|
+
readonly GuildCreate: "guildCreate";
|
|
2227
|
+
readonly GuildAvailable: "guildAvailable";
|
|
2228
|
+
readonly GuildUnavailable: "guildUnavailable";
|
|
2229
|
+
readonly GuildUpdate: "guildUpdate";
|
|
2230
|
+
readonly GuildDelete: "guildDelete";
|
|
2231
|
+
readonly GuildBanAdd: "guildBanAdd";
|
|
2232
|
+
readonly GuildBanRemove: "guildBanRemove";
|
|
2233
|
+
readonly GuildAuditLogEntryCreate: "guildAuditLogEntryCreate";
|
|
2234
|
+
readonly GuildEmojisUpdate: "guildEmojisUpdate";
|
|
2235
|
+
readonly GuildStickersUpdate: "guildStickersUpdate";
|
|
2236
|
+
readonly GuildCountsUpdate: "guildCountsUpdate";
|
|
2237
|
+
readonly ChannelMemberCountsUpdate: "channelMemberCountsUpdate";
|
|
2238
|
+
readonly GuildMemberAdd: "guildMemberAdd";
|
|
2239
|
+
readonly GuildMemberUpdate: "guildMemberUpdate";
|
|
2240
|
+
readonly GuildMemberRemove: "guildMemberRemove";
|
|
2241
|
+
readonly GuildMembersChunk: "guildMembersChunk";
|
|
2242
|
+
readonly GuildRoleCreate: "guildRoleCreate";
|
|
2243
|
+
readonly GuildRoleUpdate: "guildRoleUpdate";
|
|
2244
|
+
readonly GuildRoleDelete: "guildRoleDelete";
|
|
2245
|
+
readonly ChannelCreate: "channelCreate";
|
|
2246
|
+
readonly ChannelUpdate: "channelUpdate";
|
|
2247
|
+
readonly ChannelDelete: "channelDelete";
|
|
2248
|
+
readonly ChannelPinsUpdate: "channelPinsUpdate";
|
|
2249
|
+
readonly ChannelRecipientAdd: "channelRecipientAdd";
|
|
2250
|
+
readonly ChannelRecipientRemove: "channelRecipientRemove";
|
|
2251
|
+
readonly InviteCreate: "inviteCreate";
|
|
2252
|
+
readonly InviteDelete: "inviteDelete";
|
|
2253
|
+
readonly TypingStart: "typingStart";
|
|
2254
|
+
readonly UserUpdate: "userUpdate";
|
|
2255
|
+
readonly UserConnectionsUpdate: "userConnectionsUpdate";
|
|
2256
|
+
readonly WebAuthnCredentialsUpdate: "webauthnCredentialsUpdate";
|
|
2257
|
+
readonly PresenceUpdate: "presenceUpdate";
|
|
2258
|
+
readonly PresenceUpdateBulk: "presenceUpdateBulk";
|
|
2259
|
+
readonly VoiceStateUpdate: "voiceStateUpdate";
|
|
2260
|
+
readonly VoiceStateAck: "voiceStateAck";
|
|
2261
|
+
readonly VoiceServerUpdate: "voiceServerUpdate";
|
|
2262
|
+
readonly EntranceSoundPlay: "entranceSoundPlay";
|
|
2263
|
+
readonly VoiceStatesSync: "voiceStatesSync";
|
|
2264
|
+
readonly WebhooksUpdate: "webhooksUpdate";
|
|
2265
|
+
readonly Resumed: "resumed";
|
|
2266
|
+
readonly Error: "error";
|
|
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";
|
|
2274
|
+
};
|
|
2275
|
+
|
|
2276
|
+
/** Hosted Fluxer production endpoints (default when no instance is configured). */
|
|
2277
|
+
declare const DEFAULT_INSTANCE_ENDPOINTS: Readonly<APIInstanceEndpoints>;
|
|
2278
|
+
/** Immutable resolved instance descriptor attached to each {@link Client}. */
|
|
2279
|
+
interface ResolvedInstance {
|
|
2280
|
+
readonly endpoints: Readonly<APIInstanceEndpoints>;
|
|
2281
|
+
/** Full discovery document when available (fromDiscovery / fetchInstance). */
|
|
2282
|
+
readonly discovery: Readonly<APIInstance> | null;
|
|
1825
2283
|
}
|
|
2284
|
+
/** Strip trailing `/vN` and trailing slash from an API origin. */
|
|
2285
|
+
declare function normalizeApiOrigin(api: string): string;
|
|
1826
2286
|
/**
|
|
1827
|
-
*
|
|
1828
|
-
* @
|
|
1829
|
-
* const collector = channel.createMessageCollector({ filter: m => m.author.id === userId, time: 10000 });
|
|
1830
|
-
* collector.on('collect', m => console.log(m.content));
|
|
1831
|
-
* collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
|
|
2287
|
+
* Validate a raw discovery payload and return a typed {@link APIInstance}.
|
|
2288
|
+
* @throws FluxerError with {@link ErrorCodes.InvalidInstanceDiscovery}
|
|
1832
2289
|
*/
|
|
1833
|
-
declare
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
constructor(client: Client, channelId: string, options?: MessageCollectorOptions);
|
|
1842
|
-
stop(reason?: MessageCollectorEndReason): void;
|
|
1843
|
-
on<K extends keyof MessageCollectorEvents>(event: K, listener: (...args: MessageCollectorEvents[K]) => void): this;
|
|
1844
|
-
emit<K extends keyof MessageCollectorEvents>(event: K, ...args: MessageCollectorEvents[K]): boolean;
|
|
1845
|
-
}
|
|
2290
|
+
declare function parseInstanceDiscovery(raw: unknown): APIInstance;
|
|
2291
|
+
/**
|
|
2292
|
+
* Merge partial endpoint overrides onto hosted defaults.
|
|
2293
|
+
* Accepts either a full {@link APIInstance} or a partial endpoint map.
|
|
2294
|
+
*/
|
|
2295
|
+
declare function resolveInstanceEndpoints(input?: Partial<APIInstanceEndpoints> | APIInstance | null): ResolvedInstance;
|
|
2296
|
+
/** Build an invite URL for a code using the instance invite base. */
|
|
2297
|
+
declare function inviteUrl(inviteBase: string, code: string): string;
|
|
1846
2298
|
|
|
1847
2299
|
type FetchPinnedMessagesOptions = {
|
|
1848
2300
|
limit?: number;
|
|
@@ -1854,17 +2306,62 @@ type PinnedMessagesPage = {
|
|
|
1854
2306
|
hasMore: boolean;
|
|
1855
2307
|
};
|
|
1856
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
|
+
|
|
1857
2354
|
/** A channel in a guild (text, voice, category, etc.). */
|
|
1858
2355
|
declare class GuildChannel extends Channel {
|
|
1859
|
-
/** Guild ID this channel belongs to. */
|
|
1860
|
-
readonly guildId: string;
|
|
2356
|
+
/** Guild ID this channel belongs to, or null if missing from the payload. */
|
|
2357
|
+
readonly guildId: string | null;
|
|
1861
2358
|
name: string | null;
|
|
1862
2359
|
/** Position in the channel list. */
|
|
1863
2360
|
position?: number;
|
|
1864
2361
|
/** Parent category ID, or null if none. */
|
|
1865
2362
|
parentId: string | null;
|
|
1866
2363
|
/** Permission overwrites for roles/members. */
|
|
1867
|
-
permissionOverwrites:
|
|
2364
|
+
readonly permissionOverwrites: PermissionOverwriteManager;
|
|
1868
2365
|
constructor(client: Client, data: APIChannel);
|
|
1869
2366
|
/**
|
|
1870
2367
|
* Apply guild-channel fields in place.
|
|
@@ -1882,40 +2379,35 @@ declare class GuildChannel extends Channel {
|
|
|
1882
2379
|
createInvite(options?: ChannelInviteCreateOptions): Promise<Invite>;
|
|
1883
2380
|
/** Fetch all invites for this channel. Requires Manage Channels. */
|
|
1884
2381
|
fetchInvites(): Promise<Invite[]>;
|
|
1885
|
-
/**
|
|
1886
|
-
editPermission(overwriteId: string, options: {
|
|
1887
|
-
type: OverwriteType;
|
|
1888
|
-
allow?: string;
|
|
1889
|
-
deny?: string;
|
|
1890
|
-
}): Promise<void>;
|
|
1891
|
-
/** Delete a permission overwrite. Requires Manage Roles. */
|
|
1892
|
-
deletePermission(overwriteId: string): Promise<void>;
|
|
1893
|
-
/** 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`). */
|
|
1894
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>;
|
|
1895
2389
|
/** Edit this channel's settings. Requires Manage Channels. */
|
|
1896
2390
|
edit(options: ChannelEditOptions): Promise<this>;
|
|
1897
2391
|
protected applyEditPatch(_data: APIChannel): void;
|
|
1898
|
-
/** Delete this channel. Requires Manage Channels or channel ownership. */
|
|
1899
|
-
delete(options?: SudoVerificationOptions & {
|
|
1900
|
-
silent?: boolean;
|
|
1901
|
-
deleteMessages?: boolean;
|
|
1902
|
-
}): Promise<void>;
|
|
1903
2392
|
}
|
|
1904
2393
|
declare const TextChannel_base: (abstract new (...args: any[]) => {
|
|
1905
|
-
"__#private@#messages": MessageManager | undefined;
|
|
1906
2394
|
send(options: MessagePrepareInput): Promise<Message>;
|
|
1907
|
-
get messages(): MessageManager;
|
|
1908
|
-
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
|
1909
2395
|
fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
|
|
1910
2396
|
fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
|
|
2397
|
+
"__#private@#messages": MessageManager | undefined;
|
|
1911
2398
|
readonly client: Client;
|
|
1912
2399
|
readonly id: string;
|
|
1913
2400
|
type: _fluxerjs_types.ChannelType;
|
|
1914
2401
|
name: string | null;
|
|
1915
2402
|
icon: string | null;
|
|
1916
2403
|
lastPinTimestamp: string | null;
|
|
2404
|
+
get createdTimestamp(): number;
|
|
2405
|
+
get createdAt(): Date;
|
|
1917
2406
|
_patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
|
|
1918
|
-
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;
|
|
1919
2411
|
isDM(): this is DMChannel;
|
|
1920
2412
|
isPersonalNotes(): boolean;
|
|
1921
2413
|
isVoice(): this is VoiceChannel;
|
|
@@ -1931,6 +2423,16 @@ declare const TextChannel_base: (abstract new (...args: any[]) => {
|
|
|
1931
2423
|
fetchRtcRegions(): Promise<RtcRegionPayload[]>;
|
|
1932
2424
|
fetchSlowmode(): Promise<ChannelSlowmodePayload>;
|
|
1933
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;
|
|
1934
2436
|
}) & typeof GuildChannel;
|
|
1935
2437
|
/** A text channel in a guild (supports sending messages). */
|
|
1936
2438
|
declare class TextChannel extends TextChannel_base {
|
|
@@ -1938,25 +2440,103 @@ declare class TextChannel extends TextChannel_base {
|
|
|
1938
2440
|
topic?: string | null;
|
|
1939
2441
|
/** Whether this channel is marked as NSFW. */
|
|
1940
2442
|
nsfw?: boolean;
|
|
2443
|
+
/** Per-channel NSFW override (`null` inherits). */
|
|
2444
|
+
nsfwOverride?: boolean | null;
|
|
1941
2445
|
/** Slowmode rate limit in seconds. */
|
|
1942
2446
|
rateLimitPerUser?: number;
|
|
1943
2447
|
/** ID of the last message sent in this channel. */
|
|
1944
2448
|
lastMessageId?: string | null;
|
|
2449
|
+
/** Content warning level. */
|
|
2450
|
+
contentWarningLevel?: number | null;
|
|
2451
|
+
/** Custom content warning text. */
|
|
2452
|
+
contentWarningText?: string | null;
|
|
1945
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>;
|
|
1946
2459
|
protected applyEditPatch(data: APIChannel): void;
|
|
1947
2460
|
}
|
|
1948
2461
|
/** A category channel (container for organizing channels). */
|
|
1949
2462
|
declare class CategoryChannel extends GuildChannel {
|
|
1950
2463
|
}
|
|
1951
|
-
|
|
1952
|
-
|
|
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;
|
|
1953
2526
|
/** Voice bitrate. */
|
|
1954
2527
|
bitrate?: number | null;
|
|
1955
2528
|
/** Maximum number of users allowed. */
|
|
1956
2529
|
userLimit?: number | null;
|
|
2530
|
+
/** Max active voice connections per user. */
|
|
2531
|
+
voiceConnectionLimit?: number | null;
|
|
1957
2532
|
/** RTC region override for this channel. */
|
|
1958
2533
|
rtcRegion?: string | null;
|
|
1959
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>;
|
|
1960
2540
|
protected applyEditPatch(data: APIChannel): void;
|
|
1961
2541
|
}
|
|
1962
2542
|
/** A link channel (redirects to an external URL). */
|
|
@@ -1964,23 +2544,27 @@ declare class LinkChannel extends GuildChannel {
|
|
|
1964
2544
|
/** External URL this channel links to. */
|
|
1965
2545
|
url: string | null;
|
|
1966
2546
|
constructor(client: Client, data: APIChannel);
|
|
2547
|
+
protected applyEditPatch(data: APIChannel): void;
|
|
1967
2548
|
}
|
|
1968
2549
|
|
|
1969
2550
|
declare const DMChannel_base: (abstract new (...args: any[]) => {
|
|
1970
|
-
"__#private@#messages": MessageManager | undefined;
|
|
1971
2551
|
send(options: MessagePrepareInput): Promise<Message>;
|
|
1972
|
-
get messages(): MessageManager;
|
|
1973
|
-
createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
|
|
1974
2552
|
fetchPinnedMessages(options?: FetchPinnedMessagesOptions): Promise<Message[]>;
|
|
1975
2553
|
fetchPinnedMessagesPage(options?: FetchPinnedMessagesOptions): Promise<PinnedMessagesPage>;
|
|
2554
|
+
"__#private@#messages": MessageManager | undefined;
|
|
1976
2555
|
readonly client: Client;
|
|
1977
2556
|
readonly id: string;
|
|
1978
2557
|
type: ChannelType;
|
|
1979
2558
|
name: string | null;
|
|
1980
2559
|
icon: string | null;
|
|
1981
2560
|
lastPinTimestamp: string | null;
|
|
2561
|
+
get createdTimestamp(): number;
|
|
2562
|
+
get createdAt(): Date;
|
|
1982
2563
|
_patch(data: APIChannelPartial | APIChannel): void;
|
|
1983
|
-
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;
|
|
1984
2568
|
isDM(): this is DMChannel;
|
|
1985
2569
|
isPersonalNotes(): boolean;
|
|
1986
2570
|
isVoice(): this is VoiceChannel;
|
|
@@ -1996,6 +2580,16 @@ declare const DMChannel_base: (abstract new (...args: any[]) => {
|
|
|
1996
2580
|
fetchRtcRegions(): Promise<RtcRegionPayload[]>;
|
|
1997
2581
|
fetchSlowmode(): Promise<ChannelSlowmodePayload>;
|
|
1998
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;
|
|
1999
2593
|
}) & typeof Channel;
|
|
2000
2594
|
/** DM / Group DM / personal notes channel. */
|
|
2001
2595
|
declare class DMChannel extends DMChannel_base {
|
|
@@ -2007,14 +2601,36 @@ declare class DMChannel extends DMChannel_base {
|
|
|
2007
2601
|
recipients: User[];
|
|
2008
2602
|
/** Custom nicknames for users in a group DM. */
|
|
2009
2603
|
nicks: Record<string, string>;
|
|
2010
|
-
constructor(client: Client, data: APIChannelPartial
|
|
2011
|
-
/**
|
|
2604
|
+
constructor(client: Client, data: APIChannelPartial | APIChannel);
|
|
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
|
+
*/
|
|
2012
2619
|
purgeMessages(): Promise<number>;
|
|
2013
|
-
/**
|
|
2620
|
+
/**
|
|
2621
|
+
* Pin this DM channel to the top of the DM list.
|
|
2622
|
+
* Session-token helper; bots usually skip this.
|
|
2623
|
+
*/
|
|
2014
2624
|
pinInList(): Promise<void>;
|
|
2015
|
-
/**
|
|
2625
|
+
/**
|
|
2626
|
+
* Unpin this DM channel from the DM list.
|
|
2627
|
+
* Session-token helper; bots usually skip this.
|
|
2628
|
+
*/
|
|
2016
2629
|
unpinFromList(): Promise<void>;
|
|
2017
|
-
/**
|
|
2630
|
+
/**
|
|
2631
|
+
* Add a user to this group DM.
|
|
2632
|
+
* Captcha-gated when captcha is enabled; bots are not exempt (`CaptchaRequiredError`).
|
|
2633
|
+
*/
|
|
2018
2634
|
addRecipient(userId: string): Promise<void>;
|
|
2019
2635
|
/** Remove a user from this group DM. */
|
|
2020
2636
|
removeRecipient(userId: string, options?: {
|
|
@@ -2022,8 +2638,14 @@ declare class DMChannel extends DMChannel_base {
|
|
|
2022
2638
|
}): Promise<void>;
|
|
2023
2639
|
}
|
|
2024
2640
|
|
|
2025
|
-
/**
|
|
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
|
+
*/
|
|
2026
2647
|
declare abstract class Channel extends Base {
|
|
2648
|
+
#private;
|
|
2027
2649
|
/** The {@link Client} that instantiated this channel. */
|
|
2028
2650
|
readonly client: Client;
|
|
2029
2651
|
/** Snowflake ID of this channel. */
|
|
@@ -2037,17 +2659,32 @@ declare abstract class Channel extends Base {
|
|
|
2037
2659
|
/** ISO8601 timestamp of the last pinned message update. */
|
|
2038
2660
|
lastPinTimestamp: string | null;
|
|
2039
2661
|
constructor(client: Client, data: APIChannelPartial);
|
|
2662
|
+
/** Unix timestamp (ms) when this channel was created, derived from its snowflake ID. */
|
|
2663
|
+
get createdTimestamp(): number;
|
|
2664
|
+
/** Date when this channel was created, derived from its snowflake ID. */
|
|
2665
|
+
get createdAt(): Date;
|
|
2040
2666
|
/**
|
|
2041
2667
|
* Apply shared channel fields in place (gateway CHANNEL_UPDATE when type is unchanged).
|
|
2042
2668
|
* @internal
|
|
2043
2669
|
*/
|
|
2044
2670
|
_patch(data: APIChannelPartial | APIChannel): void;
|
|
2045
|
-
/**
|
|
2671
|
+
/** @internal Factory wired after subclasses load. */
|
|
2046
2672
|
static from(_c: Client, _d: APIChannel | APIChannelPartial): GuildChannel | TextChannel;
|
|
2673
|
+
/** @internal Factory wired after subclasses load. */
|
|
2047
2674
|
static fromOrCreate(_c: Client, _d: APIChannel | APIChannelPartial): TextChannel | DMChannel | GuildChannel;
|
|
2675
|
+
/** @internal Factory wired after subclasses load. */
|
|
2048
2676
|
static createDM(_c: Client, _d: APIChannelPartial): DMChannel;
|
|
2049
|
-
/**
|
|
2050
|
-
|
|
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;
|
|
2051
2688
|
/** Check if this is a DM, group DM, or personal notes channel. */
|
|
2052
2689
|
isDM(): this is DMChannel;
|
|
2053
2690
|
/** Check if this is a personal notes channel. */
|
|
@@ -2062,11 +2699,17 @@ declare abstract class Channel extends Base {
|
|
|
2062
2699
|
* - `bulkDelete(['id1'])` — single DELETE; 2–100 uses bulk-delete route
|
|
2063
2700
|
*/
|
|
2064
2701
|
bulkDelete(countOrIds: number | readonly string[]): Promise<string[]>;
|
|
2065
|
-
/** 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. */
|
|
2066
2703
|
bulkDeleteMyMessages(options?: SudoVerificationOptions): Promise<void>;
|
|
2067
|
-
/**
|
|
2704
|
+
/**
|
|
2705
|
+
* Mark all pinned messages as read in this channel.
|
|
2706
|
+
* Session-token helper; bots usually skip this.
|
|
2707
|
+
*/
|
|
2068
2708
|
acknowledgePins(): Promise<void>;
|
|
2069
|
-
/**
|
|
2709
|
+
/**
|
|
2710
|
+
* Clear the read state for this channel.
|
|
2711
|
+
* Session-token helper; bots usually skip this.
|
|
2712
|
+
*/
|
|
2070
2713
|
clearReadState(): Promise<void>;
|
|
2071
2714
|
/** Request upload URLs for attachments before sending a message. */
|
|
2072
2715
|
requestAttachmentUploads(attachments: AttachmentUploadPlanItem[]): Promise<AttachmentUploadPlanResponse>;
|
|
@@ -2076,393 +2719,180 @@ declare abstract class Channel extends Base {
|
|
|
2076
2719
|
uploadAttachmentsForSend(files: UploadFileForSend[]): Promise<_fluxerjs_types.RESTPostAPIMessageUploadedAttachment[]>;
|
|
2077
2720
|
/** Trigger the typing indicator in this channel. */
|
|
2078
2721
|
sendTyping(): Promise<void>;
|
|
2079
|
-
/**
|
|
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
|
+
*/
|
|
2080
2727
|
fetchRtcRegions(): Promise<RtcRegionPayload[]>;
|
|
2081
2728
|
/** Fetch slowmode state for this channel. */
|
|
2082
2729
|
fetchSlowmode(): Promise<ChannelSlowmodePayload>;
|
|
2083
|
-
/**
|
|
2730
|
+
/** Whether this channel type can carry messages (does not check permissions). */
|
|
2084
2731
|
canSendMessage(): boolean;
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
/**
|
|
2088
|
-
|
|
2089
|
-
* Extends {@link Collection} (`.get()`, `.set()`, `.filter()`, …).
|
|
2090
|
-
*/
|
|
2091
|
-
declare class ChannelManager extends Collection<string, Channel | GuildChannel> {
|
|
2092
|
-
private readonly client;
|
|
2093
|
-
private readonly maxSize;
|
|
2094
|
-
constructor(client: Client);
|
|
2095
|
-
/** Set a channel in the cache (evicts oldest if at capacity). */
|
|
2096
|
-
set(key: string, value: Channel): this;
|
|
2097
|
-
/** Retrieve from cache, otherwise {@link fetch}. */
|
|
2098
|
-
resolve(channelId: string): Promise<Channel>;
|
|
2099
|
-
/**
|
|
2100
|
-
* Fetch a channel by ID (returns cache if present).
|
|
2101
|
-
* @throws {@link FluxerError} with CHANNEL_NOT_FOUND if missing
|
|
2102
|
-
*/
|
|
2103
|
-
fetch(channelId: string): Promise<Channel>;
|
|
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;
|
|
2104
2736
|
/**
|
|
2105
|
-
*
|
|
2106
|
-
*
|
|
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 });
|
|
2107
2741
|
*/
|
|
2108
|
-
|
|
2742
|
+
awaitMessages(options?: MessageCollectorOptions & {
|
|
2743
|
+
errors?: MessageCollectorEndReason[];
|
|
2744
|
+
}): Promise<Collection<string, Message>>;
|
|
2109
2745
|
/**
|
|
2110
|
-
*
|
|
2746
|
+
* Delete this channel (or close it if it is a DM).
|
|
2747
|
+
* Guild channels require Manage Channels. `silent` / `deleteMessages` are Fluxer query params.
|
|
2111
2748
|
* @example
|
|
2112
|
-
* await client.channels.
|
|
2749
|
+
* const channel = await client.channels.fetch(channelId);
|
|
2750
|
+
* await channel.delete();
|
|
2113
2751
|
*/
|
|
2114
|
-
|
|
2752
|
+
delete(options?: SudoVerificationOptions & {
|
|
2753
|
+
silent?: boolean;
|
|
2754
|
+
deleteMessages?: boolean;
|
|
2755
|
+
}): Promise<void>;
|
|
2756
|
+
/** Channel mention (`<#id>`). */
|
|
2757
|
+
toString(): string;
|
|
2115
2758
|
}
|
|
2116
2759
|
|
|
2117
|
-
/**
|
|
2118
|
-
|
|
2119
|
-
* Extends {@link Collection} so you can use `.get()`, `.set()`, `.filter()`, etc.
|
|
2120
|
-
*/
|
|
2121
|
-
declare class GuildManager extends Collection<string, Guild> {
|
|
2122
|
-
private readonly client;
|
|
2123
|
-
private readonly maxSize;
|
|
2124
|
-
constructor(client: Client);
|
|
2125
|
-
/** Set a guild in the cache (evicts oldest if at capacity). */
|
|
2126
|
-
set(key: string, value: Guild): this;
|
|
2127
|
-
/**
|
|
2128
|
-
* Get a guild from cache or fetch from the API if not present.
|
|
2129
|
-
* @param guildId - Snowflake of the guild
|
|
2130
|
-
* @returns The guild
|
|
2131
|
-
* @throws FluxerError with GUILD_NOT_FOUND if missing
|
|
2132
|
-
*/
|
|
2133
|
-
resolve(guildId: string): Promise<Guild>;
|
|
2134
|
-
/**
|
|
2135
|
-
* Fetch a guild by ID (returns cache if present).
|
|
2136
|
-
* @throws FluxerError with GUILD_NOT_FOUND if missing
|
|
2137
|
-
*/
|
|
2138
|
-
fetch(guildId: string): Promise<Guild>;
|
|
2139
|
-
}
|
|
2760
|
+
/** Channel types that can carry messages (guild text, guild voice, DMs). */
|
|
2761
|
+
type TextBasedChannel = TextChannel | VoiceChannel | DMChannel;
|
|
2140
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
|
+
};
|
|
2141
2769
|
/**
|
|
2142
|
-
*
|
|
2143
|
-
*
|
|
2144
|
-
* @see {@link DEFAULT_CACHE_LIMITS}
|
|
2145
|
-
*/
|
|
2146
|
-
interface CacheSizeLimits {
|
|
2147
|
-
/** Max channels cached globally. `0` = unbounded. */
|
|
2148
|
-
channels?: number;
|
|
2149
|
-
/** Max guilds cached. `0` = unbounded. */
|
|
2150
|
-
guilds?: number;
|
|
2151
|
-
/** Max users cached globally. `0` = unbounded. */
|
|
2152
|
-
users?: number;
|
|
2153
|
-
/** Max messages per channel (`channel.messages.get` / `oldMessage`). `0` = off. */
|
|
2154
|
-
messages?: number;
|
|
2155
|
-
/** Max members per guild. `0` = unbounded. */
|
|
2156
|
-
members?: number;
|
|
2157
|
-
}
|
|
2158
|
-
/**
|
|
2159
|
-
* Default cache policy — opt out per field with `0`.
|
|
2160
|
-
* Applied when {@link ClientOptions.cache} is omitted or partial.
|
|
2161
|
-
*/
|
|
2162
|
-
declare const DEFAULT_CACHE_LIMITS: Required<CacheSizeLimits>;
|
|
2163
|
-
/**
|
|
2164
|
-
* Configuration options for {@link Client}.
|
|
2165
|
-
* @example
|
|
2166
|
-
* ```ts
|
|
2167
|
-
* const client = new Client({
|
|
2168
|
-
* instance: { api: 'https://api.example.com' },
|
|
2169
|
-
* cache: { guilds: 100, messages: 20 },
|
|
2170
|
-
* waitForGuilds: true,
|
|
2171
|
-
* });
|
|
2172
|
-
* ```
|
|
2770
|
+
* Guild member — roles via {@link GuildMember.roles}, permissions via {@link permissions} / {@link permissionsIn}.
|
|
2771
|
+
* Cached per guild in {@link Guild.members}.
|
|
2173
2772
|
*/
|
|
2174
|
-
|
|
2175
|
-
/**
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2773
|
+
declare class GuildMember extends Base {
|
|
2774
|
+
/** Discriminant vs {@link PartialGuildMember}: always `false` on a hydrated member. */
|
|
2775
|
+
readonly partial: false;
|
|
2776
|
+
/** Parent client instance. */
|
|
2777
|
+
readonly client: Client;
|
|
2778
|
+
/** User ID (same as `user.id`). */
|
|
2779
|
+
readonly id: string;
|
|
2780
|
+
/** The underlying {@link User}. */
|
|
2781
|
+
readonly user: User;
|
|
2782
|
+
/** The guild this member belongs to. */
|
|
2783
|
+
readonly guild: Guild;
|
|
2784
|
+
/** Guild-specific nickname (null = use global name or username). */
|
|
2785
|
+
nick: string | null;
|
|
2786
|
+
/** Role manager for this member. */
|
|
2787
|
+
readonly roles: GuildMemberRoleManager;
|
|
2788
|
+
/** When this member joined the guild. */
|
|
2789
|
+
readonly joinedAt: Date;
|
|
2790
|
+
/** Timeout end date (null = not timed out). */
|
|
2791
|
+
communicationDisabledUntil: Date | null;
|
|
2792
|
+
/** Whether this member is voice-muted. */
|
|
2793
|
+
mute: boolean;
|
|
2794
|
+
/** Whether this member is voice-deafened. */
|
|
2795
|
+
deaf: boolean;
|
|
2796
|
+
/** Guild-specific avatar hash (null = use user avatar). */
|
|
2797
|
+
avatar: string | null;
|
|
2798
|
+
/** Guild-specific banner hash. */
|
|
2799
|
+
banner: string | null;
|
|
2800
|
+
/** Guild-specific accent color (24-bit RGB). */
|
|
2801
|
+
accentColor: number | null;
|
|
2802
|
+
/** Guild-specific profile flags. */
|
|
2803
|
+
profileFlags: number | null;
|
|
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);
|
|
2187
2811
|
/**
|
|
2188
|
-
*
|
|
2189
|
-
*
|
|
2812
|
+
* Apply an API member payload in place (gateway GUILD_MEMBER_UPDATE / REST edit).
|
|
2813
|
+
* @internal
|
|
2190
2814
|
*/
|
|
2191
|
-
|
|
2192
|
-
/** Silence the intents-not-supported warning. */
|
|
2193
|
-
suppressIntentWarning?: boolean;
|
|
2815
|
+
_patch(data: GuildMemberData): void;
|
|
2194
2816
|
/**
|
|
2195
|
-
*
|
|
2196
|
-
* @
|
|
2817
|
+
* Snapshot for `guildMemberUpdate` old-member arg (before in-place patch).
|
|
2818
|
+
* @internal
|
|
2197
2819
|
*/
|
|
2198
|
-
|
|
2820
|
+
_clone(): GuildMember;
|
|
2821
|
+
get displayName(): string;
|
|
2822
|
+
/** Renders a mention for this member: `<@id>`. */
|
|
2823
|
+
toString(): string;
|
|
2824
|
+
avatarURL(options?: {
|
|
2825
|
+
size?: number;
|
|
2826
|
+
extension?: string;
|
|
2827
|
+
}): string | null;
|
|
2828
|
+
displayAvatarURL(options?: {
|
|
2829
|
+
size?: number;
|
|
2830
|
+
extension?: string;
|
|
2831
|
+
}): string;
|
|
2832
|
+
bannerURL(options?: {
|
|
2833
|
+
size?: number;
|
|
2834
|
+
extension?: string;
|
|
2835
|
+
}): string | null;
|
|
2199
2836
|
/**
|
|
2200
|
-
*
|
|
2201
|
-
* @
|
|
2837
|
+
* PATCH member (`/members/@me` when editing the bot).
|
|
2838
|
+
* @example
|
|
2839
|
+
* await member.edit({ nick: 'Ada' });
|
|
2202
2840
|
*/
|
|
2203
|
-
|
|
2841
|
+
edit(options: GuildMemberEditOptions): Promise<this>;
|
|
2204
2842
|
/**
|
|
2205
|
-
*
|
|
2206
|
-
* @
|
|
2207
|
-
* ```ts
|
|
2208
|
-
* defaultAllowedMentions: {
|
|
2209
|
-
* parse: ['users'],
|
|
2210
|
-
* repliedUser: false,
|
|
2211
|
-
* }
|
|
2212
|
-
* ```
|
|
2843
|
+
* Guild-level permissions (roles only, no channel overwrites).
|
|
2844
|
+
* @see {@link permissionsIn} for channel-specific permissions
|
|
2213
2845
|
*/
|
|
2214
|
-
|
|
2215
|
-
/** Mention types to parse (`roles`, `users`, `everyone`). */
|
|
2216
|
-
parse?: Array<'roles' | 'users' | 'everyone'>;
|
|
2217
|
-
/** Specific role IDs allowed to be mentioned. */
|
|
2218
|
-
roles?: string[];
|
|
2219
|
-
/** Specific user IDs allowed to be mentioned. */
|
|
2220
|
-
users?: string[];
|
|
2221
|
-
/** Whether to ping the user being replied to. */
|
|
2222
|
-
repliedUser?: boolean;
|
|
2223
|
-
};
|
|
2846
|
+
get permissions(): PermissionsBitField;
|
|
2224
2847
|
/**
|
|
2225
|
-
*
|
|
2226
|
-
* @
|
|
2848
|
+
* Effective permissions in a channel (roles + overwrites).
|
|
2849
|
+
* @param channel - The guild channel
|
|
2850
|
+
* @returns Computed permissions bitfield
|
|
2227
2851
|
*/
|
|
2228
|
-
|
|
2852
|
+
permissionsIn(channel: GuildChannel): PermissionsBitField;
|
|
2229
2853
|
/**
|
|
2230
|
-
*
|
|
2854
|
+
* Move to a voice channel, or `null` to disconnect. Requires Move Members.
|
|
2855
|
+
* @param channelId - Voice channel ID or null to disconnect
|
|
2856
|
+
* @param connectionId - Optional connection ID for multi-session scenarios
|
|
2231
2857
|
*/
|
|
2232
|
-
|
|
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>;
|
|
2233
2863
|
/**
|
|
2234
|
-
*
|
|
2235
|
-
*
|
|
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.
|
|
2236
2866
|
*/
|
|
2237
|
-
|
|
2867
|
+
get kickable(): boolean;
|
|
2238
2868
|
/**
|
|
2239
|
-
*
|
|
2240
|
-
* @default true (`false` useful in tests)
|
|
2869
|
+
* Whether the bot can ban this member (cache-only; needs `members.me`).
|
|
2241
2870
|
*/
|
|
2242
|
-
|
|
2871
|
+
get bannable(): boolean;
|
|
2243
2872
|
/**
|
|
2244
|
-
*
|
|
2245
|
-
* Provide if the runtime lacks a native WebSocket implementation.
|
|
2873
|
+
* Whether the bot can timeout this member (cache-only; needs `members.me`).
|
|
2246
2874
|
*/
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
addEventListener?(type: string, listener: (e: unknown) => void): void;
|
|
2252
|
-
on?(event: string, cb: (data?: unknown) => void): void;
|
|
2253
|
-
};
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
|
-
/** Hosted Fluxer production endpoints (default when no instance is configured). */
|
|
2257
|
-
declare const DEFAULT_INSTANCE_ENDPOINTS: Readonly<APIInstanceEndpoints>;
|
|
2258
|
-
/** Immutable resolved instance descriptor attached to each {@link Client}. */
|
|
2259
|
-
interface ResolvedInstance {
|
|
2260
|
-
readonly endpoints: Readonly<APIInstanceEndpoints>;
|
|
2261
|
-
/** Full discovery document when available (fromDiscovery / fetchInstance). */
|
|
2262
|
-
readonly discovery: Readonly<APIInstance> | null;
|
|
2263
|
-
}
|
|
2264
|
-
/** Strip trailing `/vN` and trailing slash from an API origin. */
|
|
2265
|
-
declare function normalizeApiOrigin(api: string): string;
|
|
2266
|
-
/**
|
|
2267
|
-
* Validate a raw discovery payload and return a typed {@link APIInstance}.
|
|
2268
|
-
* @throws FluxerError with {@link ErrorCodes.InvalidInstanceDiscovery}
|
|
2269
|
-
*/
|
|
2270
|
-
declare function parseInstanceDiscovery(raw: unknown): APIInstance;
|
|
2271
|
-
/**
|
|
2272
|
-
* Merge partial endpoint overrides onto hosted defaults.
|
|
2273
|
-
* Accepts either a full {@link APIInstance} or a partial endpoint map.
|
|
2274
|
-
*/
|
|
2275
|
-
declare function resolveInstanceEndpoints(input?: Partial<APIInstanceEndpoints> | APIInstance | null): ResolvedInstance;
|
|
2276
|
-
/** Build an invite URL for a code using the instance invite base. */
|
|
2277
|
-
declare function inviteUrl(inviteBase: string, code: string): string;
|
|
2278
|
-
|
|
2279
|
-
/** The logged-in bot/user (`client.user`). */
|
|
2280
|
-
declare class ClientUser extends User {
|
|
2281
|
-
readonly client: Client;
|
|
2282
|
-
constructor(client: Client, data: APIUserPartial);
|
|
2283
|
-
/** Broadcast presence (gateway opcode 3) on all shards. */
|
|
2284
|
-
setPresence(presence: PresenceUpdateOptions): void;
|
|
2285
|
-
/** GET /users/@me/guilds — returns camelCase partial guilds. */
|
|
2286
|
-
fetchGuilds(): Promise<PartialUserGuildPayload[]>;
|
|
2287
|
-
/** DELETE /users/@me/guilds/{guild_id} */
|
|
2288
|
-
leaveGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
|
|
2289
|
-
/** Delete every message authored by the caller across a guild (sudo). */
|
|
2290
|
-
bulkDeleteMyMessagesInGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
|
|
2291
|
-
}
|
|
2292
|
-
|
|
2293
|
-
type MemberPayload = APIGuildMember & {
|
|
2294
|
-
user: {
|
|
2295
|
-
id: string;
|
|
2296
|
-
};
|
|
2297
|
-
};
|
|
2298
|
-
/** Result of {@link UserManager.fetchWithProfile}. */
|
|
2299
|
-
interface FetchedUserWithProfile {
|
|
2300
|
-
user: User;
|
|
2301
|
-
userData: APIUserPartial;
|
|
2302
|
-
globalProfile: ProfilePayload | null;
|
|
2303
|
-
serverProfile: ProfilePayload | null;
|
|
2304
|
-
member: GuildMember | null;
|
|
2305
|
-
memberData: MemberPayload | null;
|
|
2306
|
-
}
|
|
2307
|
-
/**
|
|
2308
|
-
* User cache + fetch/profile helpers.
|
|
2309
|
-
* Extends Collection (`.get()`, `.set()`, `.filter()`, …).
|
|
2310
|
-
* Access via {@link Client.users}.
|
|
2311
|
-
*/
|
|
2312
|
-
declare class UserManager extends Collection<string, User> {
|
|
2313
|
-
private readonly client;
|
|
2314
|
-
private readonly maxSize;
|
|
2315
|
-
constructor(client: Client);
|
|
2316
|
-
set(key: string, value: User): this;
|
|
2317
|
-
/** Remove matching users (skips `client.user`). Returns count removed. */
|
|
2318
|
-
sweep(filter?: (user: User, id: string) => boolean): number;
|
|
2319
|
-
/** Fetch a user by ID and update cache. */
|
|
2320
|
-
fetch(userId: string): Promise<User>;
|
|
2875
|
+
get moderatable(): boolean;
|
|
2876
|
+
private _moderatableWith;
|
|
2877
|
+
/** Negative when this member's highest role is below `other`'s. */
|
|
2878
|
+
private _compareRolePosition;
|
|
2321
2879
|
/**
|
|
2322
|
-
*
|
|
2323
|
-
*
|
|
2324
|
-
* const { user, globalProfile, member } = await client.users.fetchWithProfile(
|
|
2325
|
-
* userId,
|
|
2326
|
-
* { guildId: message.guildId ?? undefined },
|
|
2327
|
-
* );
|
|
2880
|
+
* Timeout this member for `durationMs` milliseconds, or pass `null` to clear.
|
|
2881
|
+
* Requires Moderate Members.
|
|
2328
2882
|
*/
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
|
-
/** Map a wire pack summary to camelCase. */
|
|
2335
|
-
declare function toPackSummaryPayload(data: APIPackSummary): PackSummaryPayload;
|
|
2336
|
-
/** CamelCase pack dashboard section. */
|
|
2337
|
-
interface PackDashboardSectionPayload {
|
|
2338
|
-
installedLimit: number;
|
|
2339
|
-
createdLimit: number;
|
|
2340
|
-
installed: PackSummaryPayload[];
|
|
2341
|
-
created: PackSummaryPayload[];
|
|
2342
|
-
}
|
|
2343
|
-
/** CamelCase pack dashboard. */
|
|
2344
|
-
interface PackDashboardPayload {
|
|
2345
|
-
emoji: PackDashboardSectionPayload;
|
|
2346
|
-
sticker: PackDashboardSectionPayload;
|
|
2347
|
-
}
|
|
2348
|
-
/** REST wrappers for `/packs/*`. Access via `client.packs`. */
|
|
2349
|
-
declare class PackManager {
|
|
2350
|
-
private readonly client;
|
|
2351
|
-
constructor(client: Client);
|
|
2352
|
-
/** Fetch the current user's pack dashboard (camelCase summaries). */
|
|
2353
|
-
fetchDashboard(): Promise<PackDashboardPayload>;
|
|
2354
|
-
/** Create a pack. */
|
|
2355
|
-
create(packType: PackType, body: PackCreateOptions): Promise<PackSummaryPayload>;
|
|
2356
|
-
/** Edit a pack. */
|
|
2357
|
-
edit(packId: string, body: PackEditOptions): Promise<PackSummaryPayload>;
|
|
2358
|
-
/** Delete a pack. */
|
|
2359
|
-
delete(packId: string): Promise<void>;
|
|
2360
|
-
/** Install a pack for the current user. */
|
|
2361
|
-
install(packId: string): Promise<void>;
|
|
2362
|
-
/** Uninstall a pack for the current user. */
|
|
2363
|
-
uninstall(packId: string): Promise<void>;
|
|
2364
|
-
/** List invites for a pack. */
|
|
2365
|
-
listInvites(packId: string): Promise<PackInvitePayload[]>;
|
|
2366
|
-
/** Create an invite for a pack. */
|
|
2367
|
-
createInvite(packId: string, options?: PackInviteCreateOptions): Promise<PackInvitePayload>;
|
|
2368
|
-
/** List emojis in a pack. */
|
|
2369
|
-
listEmojis(packId: string): Promise<PackEmojiPayload[]>;
|
|
2370
|
-
/** Create an emoji in a pack. */
|
|
2371
|
-
createEmoji(packId: string, options: ExpressionCreateOptions): Promise<PackEmojiPayload>;
|
|
2372
|
-
/** Bulk-create emojis in a pack. */
|
|
2373
|
-
createEmojisBulk(packId: string, emojis: ExpressionCreateOptions[]): Promise<PackBulkCreatePayload<PackEmojiPayload>>;
|
|
2374
|
-
/** Edit an emoji in a pack. */
|
|
2375
|
-
editEmoji(packId: string, emojiId: string, options: ExpressionEditOptions): Promise<PackEmojiPayload>;
|
|
2376
|
-
/** Delete an emoji from a pack. */
|
|
2377
|
-
deleteEmoji(packId: string, emojiId: string): Promise<void>;
|
|
2378
|
-
/** List stickers in a pack. */
|
|
2379
|
-
listStickers(packId: string): Promise<PackStickerPayload[]>;
|
|
2380
|
-
/** Create a sticker in a pack. */
|
|
2381
|
-
createSticker(packId: string, options: StickerCreateOptions): Promise<PackStickerPayload>;
|
|
2382
|
-
/** Bulk-create stickers in a pack. */
|
|
2383
|
-
createStickersBulk(packId: string, stickers: StickerCreateOptions[]): Promise<PackBulkCreatePayload<PackStickerPayload>>;
|
|
2384
|
-
/** Edit a sticker in a pack. */
|
|
2385
|
-
editSticker(packId: string, stickerId: string, options: StickerEditOptions): Promise<PackStickerPayload>;
|
|
2386
|
-
/** Delete a sticker from a pack. */
|
|
2387
|
-
deleteSticker(packId: string, stickerId: string): Promise<void>;
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
|
-
/** Event name constants for client.on(Events.X, handler). Use with ClientEvents for typed callbacks. */
|
|
2391
|
-
declare const Events: {
|
|
2392
|
-
readonly Ready: "ready";
|
|
2393
|
-
readonly MessageCreate: "messageCreate";
|
|
2394
|
-
readonly MessageUpdate: "messageUpdate";
|
|
2395
|
-
readonly MessageDelete: "messageDelete";
|
|
2396
|
-
readonly MessageDeleteBulk: "messageDeleteBulk";
|
|
2397
|
-
readonly MessageReactionAdd: "messageReactionAdd";
|
|
2398
|
-
readonly MessageReactionAddMany: "messageReactionAddMany";
|
|
2399
|
-
readonly MessageReactionRemove: "messageReactionRemove";
|
|
2400
|
-
readonly MessageReactionRemoveAll: "messageReactionRemoveAll";
|
|
2401
|
-
readonly MessageReactionRemoveEmoji: "messageReactionRemoveEmoji";
|
|
2402
|
-
readonly GuildCreate: "guildCreate";
|
|
2403
|
-
readonly GuildAvailable: "guildAvailable";
|
|
2404
|
-
readonly GuildUnavailable: "guildUnavailable";
|
|
2405
|
-
readonly GuildUpdate: "guildUpdate";
|
|
2406
|
-
readonly GuildDelete: "guildDelete";
|
|
2407
|
-
readonly GuildBanAdd: "guildBanAdd";
|
|
2408
|
-
readonly GuildBanRemove: "guildBanRemove";
|
|
2409
|
-
readonly GuildAuditLogEntryCreate: "guildAuditLogEntryCreate";
|
|
2410
|
-
readonly GuildEmojisUpdate: "guildEmojisUpdate";
|
|
2411
|
-
readonly GuildStickersUpdate: "guildStickersUpdate";
|
|
2412
|
-
readonly GuildCountsUpdate: "guildCountsUpdate";
|
|
2413
|
-
readonly ChannelMemberCountsUpdate: "channelMemberCountsUpdate";
|
|
2414
|
-
readonly GuildMemberAdd: "guildMemberAdd";
|
|
2415
|
-
readonly GuildMemberUpdate: "guildMemberUpdate";
|
|
2416
|
-
readonly GuildMemberRemove: "guildMemberRemove";
|
|
2417
|
-
readonly GuildMembersChunk: "guildMembersChunk";
|
|
2418
|
-
readonly GuildRoleCreate: "guildRoleCreate";
|
|
2419
|
-
readonly GuildRoleUpdate: "guildRoleUpdate";
|
|
2420
|
-
readonly GuildRoleDelete: "guildRoleDelete";
|
|
2421
|
-
readonly ChannelCreate: "channelCreate";
|
|
2422
|
-
readonly ChannelUpdate: "channelUpdate";
|
|
2423
|
-
readonly ChannelDelete: "channelDelete";
|
|
2424
|
-
readonly ChannelPinsUpdate: "channelPinsUpdate";
|
|
2425
|
-
readonly InviteCreate: "inviteCreate";
|
|
2426
|
-
readonly InviteDelete: "inviteDelete";
|
|
2427
|
-
readonly TypingStart: "typingStart";
|
|
2428
|
-
readonly UserUpdate: "userUpdate";
|
|
2429
|
-
readonly UserConnectionsUpdate: "userConnectionsUpdate";
|
|
2430
|
-
readonly WebAuthnCredentialsUpdate: "webauthnCredentialsUpdate";
|
|
2431
|
-
readonly PresenceUpdate: "presenceUpdate";
|
|
2432
|
-
readonly PresenceUpdateBulk: "presenceUpdateBulk";
|
|
2433
|
-
readonly VoiceStateUpdate: "voiceStateUpdate";
|
|
2434
|
-
readonly VoiceStateAck: "voiceStateAck";
|
|
2435
|
-
readonly VoiceServerUpdate: "voiceServerUpdate";
|
|
2436
|
-
readonly EntranceSoundPlay: "entranceSoundPlay";
|
|
2437
|
-
readonly VoiceStatesSync: "voiceStatesSync";
|
|
2438
|
-
readonly WebhooksUpdate: "webhooksUpdate";
|
|
2439
|
-
readonly Resumed: "resumed";
|
|
2440
|
-
readonly Error: "error";
|
|
2441
|
-
readonly Debug: "debug";
|
|
2442
|
-
};
|
|
2443
|
-
|
|
2444
|
-
/** Minimal message data for MessageDelete when the full message is not available. */
|
|
2445
|
-
interface PartialMessage {
|
|
2446
|
-
id: string;
|
|
2447
|
-
channelId: string;
|
|
2448
|
-
channel?: Channel | null;
|
|
2449
|
-
/** Message content, when provided by the gateway (e.g. Fluxer). */
|
|
2450
|
-
content?: string | null;
|
|
2451
|
-
/** Author user ID, when provided by the gateway (e.g. Fluxer). */
|
|
2452
|
-
authorId?: string | null;
|
|
2883
|
+
timeout(durationMs: number | null, reason?: string): Promise<this>;
|
|
2884
|
+
private _effectivePermissions;
|
|
2885
|
+
private _basePermissions;
|
|
2453
2886
|
}
|
|
2454
2887
|
|
|
2455
2888
|
/**
|
|
2456
|
-
|
|
2457
2889
|
* Callback parameter types for client events. Use with client.on(Events.X, handler).
|
|
2458
|
-
|
|
2459
2890
|
* @see Events
|
|
2460
|
-
|
|
2461
2891
|
*/
|
|
2462
2892
|
interface ClientEvents {
|
|
2463
2893
|
[Events.Ready]: [];
|
|
2464
2894
|
[Events.MessageCreate]: [message: Message];
|
|
2465
|
-
[Events.MessageUpdate]: [oldMessage: Message | null, newMessage: Message];
|
|
2895
|
+
[Events.MessageUpdate]: [oldMessage: Message | null, newMessage: Message | PartialMessage];
|
|
2466
2896
|
[Events.MessageDelete]: [message: PartialMessage];
|
|
2467
2897
|
[Events.MessageReactionAdd]: [payload: MessageReactionPayload];
|
|
2468
2898
|
[Events.MessageReactionAddMany]: [payload: MessageReactionAddManyPayload];
|
|
@@ -2480,7 +2910,7 @@ interface ClientEvents {
|
|
|
2480
2910
|
[Events.ChannelDelete]: [channel: Channel];
|
|
2481
2911
|
[Events.GuildMemberAdd]: [member: GuildMember];
|
|
2482
2912
|
[Events.GuildMemberUpdate]: [oldMember: GuildMember | null, newMember: GuildMember];
|
|
2483
|
-
[Events.GuildMemberRemove]: [member: GuildMember];
|
|
2913
|
+
[Events.GuildMemberRemove]: [member: GuildMember | PartialGuildMember];
|
|
2484
2914
|
[Events.GuildMembersChunk]: [payload: GuildMembersChunkPayload];
|
|
2485
2915
|
[Events.GuildCountsUpdate]: [payload: GuildCountsUpdatePayload];
|
|
2486
2916
|
[Events.ChannelMemberCountsUpdate]: [payload: ChannelMemberCountsUpdatePayload];
|
|
@@ -2497,9 +2927,13 @@ interface ClientEvents {
|
|
|
2497
2927
|
[Events.GuildEmojisUpdate]: [payload: GuildEmojisUpdatePayload];
|
|
2498
2928
|
[Events.GuildStickersUpdate]: [payload: GuildStickersUpdatePayload];
|
|
2499
2929
|
[Events.GuildRoleCreate]: [role: Role];
|
|
2500
|
-
|
|
2501
|
-
[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];
|
|
2502
2934
|
[Events.ChannelPinsUpdate]: [payload: ChannelPinsUpdatePayload];
|
|
2935
|
+
[Events.ChannelRecipientAdd]: [payload: ChannelRecipientPayload];
|
|
2936
|
+
[Events.ChannelRecipientRemove]: [payload: ChannelRecipientPayload];
|
|
2503
2937
|
[Events.InviteCreate]: [invite: Invite];
|
|
2504
2938
|
[Events.InviteDelete]: [payload: InviteDeletePayload];
|
|
2505
2939
|
[Events.TypingStart]: [payload: TypingStartPayload];
|
|
@@ -2512,6 +2946,24 @@ interface ClientEvents {
|
|
|
2512
2946
|
[Events.Resumed]: [];
|
|
2513
2947
|
[Events.Error]: [error: Error];
|
|
2514
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
|
+
}];
|
|
2515
2967
|
}
|
|
2516
2968
|
type ClientEventName = keyof ClientEvents;
|
|
2517
2969
|
type ClientEventListener<K extends ClientEventName> = (...args: ClientEvents[K]) => void;
|
|
@@ -2540,14 +2992,22 @@ declare class Client extends EventEmitter {
|
|
|
2540
2992
|
readonly channels: ChannelManager;
|
|
2541
2993
|
/** User cache and manager. */
|
|
2542
2994
|
readonly users: UserManager;
|
|
2543
|
-
/**
|
|
2544
|
-
readonly
|
|
2545
|
-
/** Typed event handlers. Prefer `client.
|
|
2995
|
+
/** Cache limits, stats, sweeps, and cascade entry points. */
|
|
2996
|
+
readonly cache: CacheController;
|
|
2997
|
+
/** Typed event handlers. Prefer `client.on(Events.*, ...)`. */
|
|
2546
2998
|
readonly events: ClientEventMethods;
|
|
2547
2999
|
/** The authenticated bot user. Null until READY is received. */
|
|
2548
3000
|
user: ClientUser | null;
|
|
2549
3001
|
/** Timestamp when the client became ready. Null until READY is received. */
|
|
2550
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;
|
|
2551
3011
|
/** @internal WebSocket manager. */
|
|
2552
3012
|
_ws: WebSocketManager | null;
|
|
2553
3013
|
/** When waitForGuilds, guild IDs still expected via GUILD_CREATE. */
|
|
@@ -2559,6 +3019,8 @@ declare class Client extends EventEmitter {
|
|
|
2559
3019
|
private readonly _messageCache;
|
|
2560
3020
|
/** Resolved client options (cache defaults applied). */
|
|
2561
3021
|
readonly options: ClientOptions;
|
|
3022
|
+
/** Structured logger (zero-dep). */
|
|
3023
|
+
readonly logger: Logger;
|
|
2562
3024
|
constructor(options?: ClientOptions);
|
|
2563
3025
|
/**
|
|
2564
3026
|
* Create a client from instance discovery (`GET /.well-known/fluxer`).
|
|
@@ -2622,35 +3084,38 @@ declare class Client extends EventEmitter {
|
|
|
2622
3084
|
*/
|
|
2623
3085
|
fetchApplication(): Promise<APIApplicationMe>;
|
|
2624
3086
|
/**
|
|
2625
|
-
* Fetch OAuth2 applications
|
|
2626
|
-
*
|
|
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.
|
|
2627
3090
|
*/
|
|
2628
3091
|
fetchOAuthApplications(): Promise<APIOAuthApplication[]>;
|
|
2629
|
-
/**
|
|
2630
|
-
* Check username#discriminator availability.
|
|
2631
|
-
* @param username - Username to check
|
|
2632
|
-
* @param discriminator - Discriminator to check
|
|
2633
|
-
* @returns Availability result
|
|
2634
|
-
*/
|
|
2635
|
-
checkUsernameTag(username: string, discriminator: string): Promise<APIUserTagCheck>;
|
|
2636
3092
|
/**
|
|
2637
3093
|
* Preload recent messages for multiple channels (batch endpoint).
|
|
2638
|
-
* @
|
|
2639
|
-
* @returns Preload response with message counts/timestamps
|
|
3094
|
+
* Prefer this over {@link bulkFetchMessages} for bots (`bulkFetchMessages` is user-account only).
|
|
2640
3095
|
*/
|
|
2641
3096
|
preloadMessages(channelIds: string[]): Promise<APIPreloadMessagesResponse>;
|
|
2642
3097
|
/**
|
|
2643
3098
|
* Preload recent messages (alternate endpoint).
|
|
2644
|
-
*
|
|
2645
|
-
* @returns Preload response with message counts/timestamps
|
|
3099
|
+
* Prefer this over {@link bulkFetchMessages} for bots.
|
|
2646
3100
|
*/
|
|
2647
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
|
+
*/
|
|
2648
3107
|
bulkFetchMessages(requests: BulkFetchMessagesRequest[], options?: BulkFetchMessagesOptions & {
|
|
2649
3108
|
hydrate?: true;
|
|
2650
3109
|
}): Promise<BulkFetchMessagesResult>;
|
|
2651
3110
|
bulkFetchMessages(requests: BulkFetchMessagesRequest[], options: BulkFetchMessagesOptions & {
|
|
2652
3111
|
hydrate: false;
|
|
2653
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>;
|
|
2654
3119
|
/** @internal */
|
|
2655
3120
|
_getMessageCache(channelId: string): Map<string, APIMessage> | null;
|
|
2656
3121
|
/** @internal */
|
|
@@ -2659,15 +3124,23 @@ declare class Client extends EventEmitter {
|
|
|
2659
3124
|
_removeMessageFromCache(channelId: string, messageId: string): void;
|
|
2660
3125
|
/** @internal */
|
|
2661
3126
|
_clearMessageCache(channelId: string): void;
|
|
3127
|
+
/** @internal */
|
|
3128
|
+
_messageCacheStats(): {
|
|
3129
|
+
channels: number;
|
|
3130
|
+
messages: number;
|
|
3131
|
+
};
|
|
2662
3132
|
/**
|
|
2663
3133
|
* Sweep cached messages (remove entries matching filter).
|
|
3134
|
+
* Prefer {@link CacheController.sweepMessages} (`client.cache.sweepMessages`).
|
|
3135
|
+
* The filter receives a hydrated {@link Message} (`createdAt`), not the stored wire payload.
|
|
2664
3136
|
* @param filter - Predicate to test each message (return true to remove)
|
|
2665
3137
|
* @param channelId - Optional channel ID to scope sweep
|
|
2666
3138
|
* @returns Count of messages removed
|
|
2667
3139
|
*/
|
|
2668
|
-
sweepMessages(filter?: (message:
|
|
3140
|
+
sweepMessages(filter?: (message: Message, channelId: string) => boolean, channelId?: string): number;
|
|
2669
3141
|
/**
|
|
2670
3142
|
* Sweep cached members across all guilds (remove entries matching filter).
|
|
3143
|
+
* Prefer {@link CacheController.sweepMembers} (`client.cache.sweepMembers`).
|
|
2671
3144
|
* @param filter - Predicate to test each member (return true to remove)
|
|
2672
3145
|
* @returns Total count of members removed
|
|
2673
3146
|
*/
|
|
@@ -2681,6 +3154,9 @@ declare class Client extends EventEmitter {
|
|
|
2681
3154
|
getOrCreateUser(data: APIUserPartial): User;
|
|
2682
3155
|
/**
|
|
2683
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);
|
|
2684
3160
|
* @throws {@link FluxerError} with {@link ErrorCodes.NotLoggedIn}
|
|
2685
3161
|
*/
|
|
2686
3162
|
get ws(): WebSocketManager;
|
|
@@ -2690,24 +3166,57 @@ declare class Client extends EventEmitter {
|
|
|
2690
3166
|
* @param payload - Gateway send payload (opcode + data)
|
|
2691
3167
|
*/
|
|
2692
3168
|
sendToGateway(shardId: number, payload: GatewaySendPayload): void;
|
|
3169
|
+
/**
|
|
3170
|
+
* Request guild members via gateway opcode 8 (`GUILD_MEMBERS_CHUNK` responses).
|
|
3171
|
+
* Provide `guildId` and/or `guildIds`.
|
|
3172
|
+
*/
|
|
3173
|
+
requestGuildMembers(options: {
|
|
3174
|
+
guildId?: string;
|
|
3175
|
+
guildIds?: string[];
|
|
3176
|
+
query?: string;
|
|
3177
|
+
limit?: number;
|
|
3178
|
+
userIds?: string[];
|
|
3179
|
+
presences?: boolean;
|
|
3180
|
+
nonce?: string;
|
|
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;
|
|
2693
3200
|
/**
|
|
2694
3201
|
* Broadcast a gateway payload to all shards.
|
|
2695
3202
|
* @param payload - Gateway send payload
|
|
2696
3203
|
* @internal
|
|
2697
3204
|
*/
|
|
2698
3205
|
_sendToAllShards(payload: GatewaySendPayload): void;
|
|
2699
|
-
/** @internal Process gateway dispatch payloads. */
|
|
2700
|
-
private handleDispatch;
|
|
2701
3206
|
/**
|
|
2702
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);
|
|
2703
3212
|
* @param token - Bot token from the developer portal
|
|
2704
3213
|
* @param options - Optional abort signal for cancellation
|
|
2705
|
-
* @returns
|
|
3214
|
+
* @returns This client (for chaining)
|
|
2706
3215
|
* @throws {@link FluxerError} if already logged in or token is invalid
|
|
2707
3216
|
*/
|
|
2708
3217
|
login(token: string, options?: {
|
|
2709
3218
|
signal?: AbortSignal;
|
|
2710
|
-
}): Promise<
|
|
3219
|
+
}): Promise<this>;
|
|
2711
3220
|
/** @internal Finalize the READY event emission. */
|
|
2712
3221
|
_finalizeReady(): void;
|
|
2713
3222
|
/** @internal Mark a guild as received during startup. */
|
|
@@ -2731,7 +3240,21 @@ declare class Client extends EventEmitter {
|
|
|
2731
3240
|
assertReady(): asserts this is Client & {
|
|
2732
3241
|
user: NonNullable<Client['user']>;
|
|
2733
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
|
+
*/
|
|
2734
3257
|
static get Routes(): typeof Routes;
|
|
2735
3258
|
}
|
|
2736
3259
|
|
|
2737
|
-
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 };
|