@fluxerjs/core 2.1.0 → 2.2.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 +13 -0
- package/dist/{subpath-message-CWiBEUUV.d.mts → SubpathMessage-D70lAT7N.d.mts} +1934 -1697
- package/dist/{subpath-message-CWiBEUUV.d.ts → SubpathMessage-D70lAT7N.d.ts} +1934 -1697
- package/dist/client.d.mts +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/client.js +4958 -4373
- package/dist/client.mjs +4867 -4277
- package/dist/cluster.d.mts +3 -3
- package/dist/cluster.d.ts +3 -3
- package/dist/cluster.js +4965 -4380
- package/dist/cluster.mjs +5001 -4411
- package/dist/errors.js +8 -8
- package/dist/errors.mjs +4 -4
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +5027 -4438
- package/dist/index.mjs +4835 -4239
- package/dist/message.d.mts +3 -3
- package/dist/message.d.ts +3 -3
- package/dist/message.js +145 -52
- package/dist/message.mjs +123 -30
- package/package.json +8 -7
|
@@ -1,208 +1,134 @@
|
|
|
1
|
-
import { Collection } from '@fluxerjs/collection';
|
|
1
|
+
import { Collection, LimitedCollection } from '@fluxerjs/collection';
|
|
2
2
|
import * as _fluxerjs_types from '@fluxerjs/types';
|
|
3
|
-
import {
|
|
4
|
-
import { EventEmitter } from 'events';
|
|
3
|
+
import { OverwriteType, APIGuild, APIRole, SystemChannelFlagsValue, DefaultMessageNotifications, GuildVerificationLevel, GuildMFALevel, GuildExplicitContentFilter, SplashCardAlignment, GuildNSFWLevel, GuildFeature, APIEmoji, APISticker, RESTPostAPIEmbed, RESTPostAPIMessageUploadedAttachment, APIAllowedMentions, MessageReferenceType, APIMessageReference, APIMessageAttachment, MessageType, APIEmbed, APIMessageSticker, APIMessageReaction, APIMessageSnapshot, APIMessageCall, APIMessage, APIUserPartial, APIBan, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, InviteType, APIGuildPartial, APIChannelPartial, APIPackInviteInfo, APIInvite, APIWebhook, ChannelCreateRequest, AuditLogActionType, APIInstanceEndpoints, APIInstance, GatewayPresenceUpdateData, PackType, APIPackSummary, APIGuildMember, APIChannel, APIChannelOverwrite, ChannelType, GatewayVoiceStateUpdateDispatchData, GatewayVoiceStateAckDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayEntranceSoundPlayDispatchData, GatewayVoiceStatesSyncData, GatewayUserConnectionsUpdateDispatchData, GatewayWebAuthnCredentialsUpdateDispatchData, GatewayReceivePayload, APIGatewayBotResponse, APIEmojiMetadata, APIStickerMetadata, APIApplicationMe, APIOAuthApplication, APIUserTagCheck, APIPreloadMessagesResponse, APIBulkMessageFetchResponse, GatewaySendPayload, Routes } from '@fluxerjs/types';
|
|
4
|
+
import { EventEmitter } from 'node:events';
|
|
5
5
|
import { REST } from '@fluxerjs/rest';
|
|
6
|
+
import { PermissionResolvable, PermissionsBitField, LogLevel, Logger } from '@fluxerjs/util';
|
|
6
7
|
import { WebSocketManager } from '@fluxerjs/ws';
|
|
7
|
-
import { EmbedBuilder, MessagePayload
|
|
8
|
-
import { PermissionResolvable, PermissionsBitField } from '@fluxerjs/util';
|
|
8
|
+
import { EmbedBuilder, MessagePayload } from '@fluxerjs/builders';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
filename?: string;
|
|
15
|
-
}
|
|
16
|
-
/** File data for message attachment uploads. Use `data` for buffers or `url` to fetch from a URL. */
|
|
17
|
-
type MessageFileData = {
|
|
18
|
-
name: string;
|
|
19
|
-
data: Blob | ArrayBuffer | Uint8Array | Buffer;
|
|
20
|
-
filename?: string;
|
|
21
|
-
} | {
|
|
22
|
-
name: string;
|
|
23
|
-
url: string;
|
|
10
|
+
/** Attachment upload / message attachment SDK options. */
|
|
11
|
+
/** Edits to an existing message attachment (by `id`) when editing a message. */
|
|
12
|
+
interface MessageAttachmentEdit {
|
|
13
|
+
id: number | string;
|
|
24
14
|
filename?: string;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
id: number;
|
|
29
|
-
filename: string;
|
|
15
|
+
uploadFilename?: string;
|
|
16
|
+
fileSize?: number;
|
|
17
|
+
contentType?: string;
|
|
30
18
|
title?: string | null;
|
|
31
19
|
description?: string | null;
|
|
32
|
-
/** MessageAttachmentFlags: IS_SPOILER (8), CONTAINS_EXPLICIT_MEDIA (16), IS_ANIMATED (32) */
|
|
33
20
|
flags?: number;
|
|
34
21
|
}
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
* Common allowed-mentions presets.
|
|
48
|
-
* @example
|
|
49
|
-
* await message.reply('Got it!', { ping: false });
|
|
50
|
-
* await message.reply({ content: 'Got it!', allowedMentions: AllowedMentions.suppressReplyPing });
|
|
51
|
-
*/
|
|
52
|
-
declare const AllowedMentions: {
|
|
53
|
-
readonly suppressReplyPing: {
|
|
54
|
-
repliedUser: false;
|
|
55
|
-
};
|
|
56
|
-
readonly none: {
|
|
57
|
-
parse: never[];
|
|
58
|
-
};
|
|
59
|
-
readonly all: {
|
|
60
|
-
parse: ("users" | "roles" | "everyone")[];
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
/** Target message for `replyTo` / `forward` on send options. */
|
|
64
|
-
type MessageReplyTarget = {
|
|
65
|
-
/** Channel that owns the target message. */
|
|
66
|
-
channelId: string;
|
|
67
|
-
/** Target message snowflake. */
|
|
68
|
-
messageId: string;
|
|
69
|
-
/** Guild id when known (optional for DMs / partials). */
|
|
70
|
-
guildId?: string | null;
|
|
71
|
-
/** {@link MessageReferenceType.Default} = reply, {@link MessageReferenceType.Forward} = forward */
|
|
72
|
-
type?: MessageReferenceType;
|
|
73
|
-
/** Attachment ids to include when forwarding. */
|
|
74
|
-
attachmentIds?: string[];
|
|
75
|
-
/** Embed indices to include when forwarding. */
|
|
76
|
-
embedIndices?: number[];
|
|
22
|
+
/** Convert {@link MessageAttachmentEdit} entries to wire attachment objects. */
|
|
23
|
+
declare function toMessageAttachmentEditWire(attachments: readonly MessageAttachmentEdit[]): Array<Record<string, unknown>>;
|
|
24
|
+
/** Plan item for {@link Channel.requestAttachmentUploads}. */
|
|
25
|
+
interface AttachmentUploadPlanItem {
|
|
26
|
+
id: number;
|
|
27
|
+
filename: string;
|
|
28
|
+
fileSize: number;
|
|
29
|
+
contentType: string;
|
|
30
|
+
}
|
|
31
|
+
/** Convert plan items to the attachments request wire body. */
|
|
32
|
+
declare function toAttachmentUploadPlanBody(attachments: readonly AttachmentUploadPlanItem[]): {
|
|
33
|
+
attachments: Array<Record<string, unknown>>;
|
|
77
34
|
};
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
uploadedAttachments?: RESTPostAPIMessageUploadedAttachment[];
|
|
90
|
-
/** Who may be mentioned; see {@link AllowedMentionsOptions}. */
|
|
91
|
-
allowedMentions?: AllowedMentionsOptions;
|
|
92
|
-
/** Reply to an existing message (sets message_reference). */
|
|
93
|
-
replyTo?: MessageReplyTarget;
|
|
94
|
-
/** Forward an existing message into this channel. */
|
|
95
|
-
forward?: MessageReplyTarget;
|
|
96
|
-
/**
|
|
97
|
-
* Shortcut for reply pings. `false` sets `allowedMentions.repliedUser` to false.
|
|
98
|
-
* Prefer explicit {@link AllowedMentionsOptions} when you need full control.
|
|
99
|
-
*/
|
|
100
|
-
ping?: boolean;
|
|
101
|
-
/** Text-to-speech flag. */
|
|
102
|
-
tts?: boolean;
|
|
103
|
-
/** Sticker snowflakes to attach. */
|
|
104
|
-
stickerIds?: string[];
|
|
105
|
-
/** Client-generated nonce for deduplication. */
|
|
106
|
-
nonce?: string;
|
|
107
|
-
/** Favorite meme id when sending a saved meme. */
|
|
108
|
-
favoriteMemeId?: string;
|
|
109
|
-
/** Message flags bitfield. */
|
|
110
|
-
flags?: number;
|
|
35
|
+
/** Multipart complete item for {@link Channel.completeAttachmentUploads}. */
|
|
36
|
+
interface AttachmentUploadCompleteItem {
|
|
37
|
+
uploadFilename: string;
|
|
38
|
+
uploadId: string;
|
|
39
|
+
}
|
|
40
|
+
/** Convert complete items to the attachments/complete wire body. */
|
|
41
|
+
declare function toAttachmentUploadCompleteBody(uploads: readonly AttachmentUploadCompleteItem[]): {
|
|
42
|
+
uploads: Array<{
|
|
43
|
+
upload_filename: string;
|
|
44
|
+
upload_id: string;
|
|
45
|
+
}>;
|
|
111
46
|
};
|
|
112
|
-
/**
|
|
113
|
-
interface
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
attachments?: Array<{
|
|
117
|
-
id: number;
|
|
118
|
-
filename: string;
|
|
119
|
-
title?: string | null;
|
|
120
|
-
description?: string | null;
|
|
121
|
-
flags?: number;
|
|
122
|
-
} | RESTPostAPIMessageUploadedAttachment>;
|
|
123
|
-
allowed_mentions?: APIAllowedMentions;
|
|
124
|
-
message_reference?: APIMessageReference;
|
|
125
|
-
sticker_ids?: string[];
|
|
126
|
-
nonce?: string;
|
|
127
|
-
favorite_meme_id?: string;
|
|
128
|
-
tts?: boolean;
|
|
129
|
-
flags?: number;
|
|
47
|
+
/** Part in a multipart upload plan response. */
|
|
48
|
+
interface AttachmentUploadPartPayload {
|
|
49
|
+
partNumber: number;
|
|
50
|
+
uploadUrl: string;
|
|
130
51
|
}
|
|
131
|
-
/**
|
|
132
|
-
interface
|
|
133
|
-
|
|
134
|
-
|
|
52
|
+
/** Singlepart plan response item. */
|
|
53
|
+
interface AttachmentUploadSinglepartPayload {
|
|
54
|
+
id: number;
|
|
55
|
+
filename: string;
|
|
56
|
+
uploadFilename: string;
|
|
57
|
+
fileSize: number;
|
|
58
|
+
contentType: string;
|
|
59
|
+
uploadMode: 'singlepart';
|
|
60
|
+
uploadUrl: string;
|
|
61
|
+
}
|
|
62
|
+
/** Multipart plan response item. */
|
|
63
|
+
interface AttachmentUploadMultipartPayload {
|
|
64
|
+
id: number;
|
|
65
|
+
filename: string;
|
|
66
|
+
uploadFilename: string;
|
|
67
|
+
fileSize: number;
|
|
68
|
+
contentType: string;
|
|
69
|
+
uploadMode: 'multipart';
|
|
70
|
+
uploadId: string;
|
|
71
|
+
partSize: number;
|
|
72
|
+
parts: AttachmentUploadPartPayload[];
|
|
73
|
+
}
|
|
74
|
+
type AttachmentUploadPlanResponseItem = AttachmentUploadSinglepartPayload | AttachmentUploadMultipartPayload;
|
|
75
|
+
/** CamelCase response from {@link Channel.requestAttachmentUploads}. */
|
|
76
|
+
interface AttachmentUploadPlanResponse {
|
|
77
|
+
attachments: AttachmentUploadPlanResponseItem[];
|
|
78
|
+
}
|
|
79
|
+
/** CamelCase response from {@link Channel.completeAttachmentUploads}. */
|
|
80
|
+
interface AttachmentUploadCompleteResponse {
|
|
81
|
+
uploads: Array<{
|
|
82
|
+
uploadFilename: string;
|
|
83
|
+
}>;
|
|
135
84
|
}
|
|
136
85
|
|
|
137
|
-
/**
|
|
138
|
-
type MessagePrepareDefaults = {
|
|
139
|
-
defaultAllowedMentions?: AllowedMentionsOptions;
|
|
140
|
-
};
|
|
141
|
-
/** Input accepted by {@link prepareMessagePostPayload} and channel send helpers. */
|
|
142
|
-
type MessagePrepareInput = string | MessageSendOptions | MessagePayload$1;
|
|
143
|
-
/**
|
|
144
|
-
* Build a full message POST payload (body + optional files) from send options
|
|
145
|
-
* or a builders {@link MessagePayload}.
|
|
146
|
-
* Applies {@link MessagePrepareDefaults.defaultAllowedMentions} when the call omits `allowedMentions`.
|
|
147
|
-
*/
|
|
148
|
-
declare function prepareMessagePostPayload(options: MessagePrepareInput, defaults?: MessagePrepareDefaults): Promise<MessagePostPayload>;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* CamelCase SDK option types that serialize to OpenAPI wire bodies.
|
|
152
|
-
*/
|
|
86
|
+
/** Channel edit / invite / RTC / slowmode SDK options. */
|
|
153
87
|
|
|
154
|
-
/**
|
|
155
|
-
interface
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
joinedAtGte?: number;
|
|
161
|
-
joinedAtLte?: number;
|
|
162
|
-
isBot?: boolean;
|
|
163
|
-
userCreatedAtGte?: number;
|
|
164
|
-
userCreatedAtLte?: number;
|
|
165
|
-
sortBy?: 'joinedAt' | 'relevance';
|
|
166
|
-
sortOrder?: 'asc' | 'desc';
|
|
88
|
+
/** A single permission overwrite (`allow`/`deny` bitfield strings) for a channel edit. */
|
|
89
|
+
interface ChannelPermissionOverwriteOptions {
|
|
90
|
+
id: string;
|
|
91
|
+
type: OverwriteType;
|
|
92
|
+
allow?: string;
|
|
93
|
+
deny?: string;
|
|
167
94
|
}
|
|
168
|
-
/**
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
95
|
+
/** Options for {@link GuildChannel.edit}. */
|
|
96
|
+
interface ChannelEditOptions {
|
|
97
|
+
name?: string | null;
|
|
98
|
+
topic?: string | null;
|
|
99
|
+
parentId?: string | null;
|
|
100
|
+
bitrate?: number | null;
|
|
101
|
+
userLimit?: number | null;
|
|
102
|
+
nsfw?: boolean;
|
|
103
|
+
rateLimitPerUser?: number;
|
|
104
|
+
rtcRegion?: string | null;
|
|
105
|
+
permissionOverwrites?: ChannelPermissionOverwriteOptions[];
|
|
177
106
|
}
|
|
178
|
-
/** Convert
|
|
179
|
-
declare function
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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;
|
|
107
|
+
/** Convert {@link ChannelEditOptions} to the channel PATCH wire body. */
|
|
108
|
+
declare function toChannelEditBody(options: ChannelEditOptions): Record<string, unknown>;
|
|
109
|
+
/** Options for {@link GuildChannel.createInvite}. */
|
|
110
|
+
interface ChannelInviteCreateOptions {
|
|
111
|
+
maxUses?: number;
|
|
112
|
+
maxAge?: number;
|
|
113
|
+
unique?: boolean;
|
|
114
|
+
temporary?: boolean;
|
|
192
115
|
}
|
|
193
|
-
/**
|
|
194
|
-
|
|
116
|
+
/** Convert {@link ChannelInviteCreateOptions} to the invite create wire body. */
|
|
117
|
+
declare function toChannelInviteBody(options: ChannelInviteCreateOptions): Record<string, unknown>;
|
|
118
|
+
interface RtcRegionPayload {
|
|
119
|
+
id: string;
|
|
195
120
|
name: string;
|
|
196
|
-
|
|
121
|
+
emoji: string;
|
|
197
122
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
123
|
+
/** CamelCase slowmode state from {@link Channel.fetchSlowmode}. */
|
|
124
|
+
interface ChannelSlowmodePayload {
|
|
125
|
+
rateLimitPerUser: number;
|
|
126
|
+
retryAfterMs: number;
|
|
127
|
+
nextSendAllowedAt: string | null;
|
|
201
128
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
*/
|
|
129
|
+
|
|
130
|
+
/** Guild discovery SDK options and payloads. */
|
|
131
|
+
/** Options for applying a guild to discovery. */
|
|
206
132
|
interface DiscoveryApplicationOptions {
|
|
207
133
|
description?: string;
|
|
208
134
|
/** Discovery category (`category_type` on the wire). */
|
|
@@ -214,43 +140,55 @@ interface DiscoveryApplicationOptions {
|
|
|
214
140
|
}
|
|
215
141
|
/** Convert {@link DiscoveryApplicationOptions} to the discovery wire body. */
|
|
216
142
|
declare function toDiscoveryBody(options: DiscoveryApplicationOptions): Record<string, unknown>;
|
|
217
|
-
/** CamelCase
|
|
218
|
-
interface
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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;
|
|
143
|
+
/** CamelCase view of a guild's discovery application record. */
|
|
144
|
+
interface DiscoveryApplicationPayload {
|
|
145
|
+
guildId: string;
|
|
146
|
+
guildNsfwLevel?: number | null;
|
|
147
|
+
status: string;
|
|
148
|
+
description: string;
|
|
149
|
+
categoryType: number;
|
|
150
|
+
primaryLanguage?: string | null;
|
|
151
|
+
customTags?: string[];
|
|
152
|
+
appliedAt?: string;
|
|
153
|
+
reviewedAt?: string | null;
|
|
242
154
|
}
|
|
243
|
-
/**
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
maxAge?: number;
|
|
249
|
-
unique?: boolean;
|
|
155
|
+
/** CamelCase discovery status. */
|
|
156
|
+
interface DiscoveryStatusPayload {
|
|
157
|
+
application?: DiscoveryApplicationPayload | null;
|
|
158
|
+
eligible: boolean;
|
|
159
|
+
minMemberCount: number;
|
|
250
160
|
}
|
|
251
|
-
/**
|
|
252
|
-
declare function
|
|
253
|
-
|
|
161
|
+
/** Map wire discovery application → camelCase. */
|
|
162
|
+
declare function toDiscoveryApplicationPayload(data: {
|
|
163
|
+
guild_id: string;
|
|
164
|
+
guild_nsfw_level?: number | null;
|
|
165
|
+
status: string;
|
|
166
|
+
description: string;
|
|
167
|
+
category_type: number;
|
|
168
|
+
primary_language?: string | null;
|
|
169
|
+
custom_tags?: string[];
|
|
170
|
+
applied_at?: string;
|
|
171
|
+
reviewed_at?: string | null;
|
|
172
|
+
}): DiscoveryApplicationPayload;
|
|
173
|
+
/** Map wire discovery status → camelCase. */
|
|
174
|
+
declare function toDiscoveryStatusPayload(data: {
|
|
175
|
+
application?: {
|
|
176
|
+
guild_id: string;
|
|
177
|
+
guild_nsfw_level?: number | null;
|
|
178
|
+
status: string;
|
|
179
|
+
description: string;
|
|
180
|
+
category_type: number;
|
|
181
|
+
primary_language?: string | null;
|
|
182
|
+
custom_tags?: string[];
|
|
183
|
+
applied_at?: string;
|
|
184
|
+
reviewed_at?: string | null;
|
|
185
|
+
} | null;
|
|
186
|
+
eligible: boolean;
|
|
187
|
+
min_member_count: number;
|
|
188
|
+
}): DiscoveryStatusPayload;
|
|
189
|
+
|
|
190
|
+
/** Emoji / sticker SDK options. */
|
|
191
|
+
/** Options for creating a guild/pack emoji (`name` + base64 `image`). */
|
|
254
192
|
interface ExpressionCreateOptions {
|
|
255
193
|
name: string;
|
|
256
194
|
image: string;
|
|
@@ -281,7 +219,91 @@ interface StickerEditOptions {
|
|
|
281
219
|
declare function toStickerCreateBody(options: StickerCreateOptions): Record<string, unknown>;
|
|
282
220
|
/** Convert {@link StickerEditOptions} to the sticker edit wire body. */
|
|
283
221
|
declare function toStickerEditBody(options: StickerEditOptions): Record<string, unknown>;
|
|
284
|
-
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* CamelCase options for creating a guild role.
|
|
225
|
+
* Serialized to snake_case wire fields before REST via {@link toRoleRequestBody}.
|
|
226
|
+
*/
|
|
227
|
+
interface RoleCreateOptions {
|
|
228
|
+
/** Role name. */
|
|
229
|
+
name?: string;
|
|
230
|
+
/** Permissions bitfield string or {@link PermissionResolvable}. */
|
|
231
|
+
permissions?: string | PermissionResolvable;
|
|
232
|
+
/** Role color as 24-bit RGB. */
|
|
233
|
+
color?: number;
|
|
234
|
+
/** Whether the role is displayed separately in the member list. */
|
|
235
|
+
hoist?: boolean;
|
|
236
|
+
/** Whether the role can be @mentioned. */
|
|
237
|
+
mentionable?: boolean;
|
|
238
|
+
/** Unicode emoji for the role. */
|
|
239
|
+
unicodeEmoji?: string | null;
|
|
240
|
+
/** Sort position in the role list. */
|
|
241
|
+
position?: number;
|
|
242
|
+
/** Hoisted position (visual separator group). */
|
|
243
|
+
hoistPosition?: number | null;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* CamelCase options for editing a guild role.
|
|
247
|
+
* Serialized to snake_case wire fields before REST.
|
|
248
|
+
*/
|
|
249
|
+
type RoleEditOptions = RoleCreateOptions;
|
|
250
|
+
|
|
251
|
+
type GuildData = Partial<APIGuild> & {
|
|
252
|
+
id: string;
|
|
253
|
+
roles?: APIRole[];
|
|
254
|
+
ownerId?: string;
|
|
255
|
+
};
|
|
256
|
+
/** CamelCase SDK options for PATCH /guilds/{id}. */
|
|
257
|
+
type GuildEditOptions = {
|
|
258
|
+
name?: string;
|
|
259
|
+
icon?: string | null;
|
|
260
|
+
systemChannelId?: string | null;
|
|
261
|
+
systemChannelFlags?: number | SystemChannelFlagsValue;
|
|
262
|
+
afkChannelId?: string | null;
|
|
263
|
+
afkTimeout?: number;
|
|
264
|
+
defaultMessageNotifications?: DefaultMessageNotifications;
|
|
265
|
+
verificationLevel?: GuildVerificationLevel;
|
|
266
|
+
mfaLevel?: GuildMFALevel;
|
|
267
|
+
explicitContentFilter?: GuildExplicitContentFilter;
|
|
268
|
+
banner?: string | null;
|
|
269
|
+
splash?: string | null;
|
|
270
|
+
embedSplash?: string | null;
|
|
271
|
+
splashCardAlignment?: SplashCardAlignment;
|
|
272
|
+
nsfwLevel?: GuildNSFWLevel;
|
|
273
|
+
features?: GuildFeature[];
|
|
274
|
+
};
|
|
275
|
+
type GuildBanOptions = {
|
|
276
|
+
reason?: string;
|
|
277
|
+
/** Delete message history for this many days (0–7). */
|
|
278
|
+
deleteMessageDays?: number;
|
|
279
|
+
/** Temporary ban duration in seconds. */
|
|
280
|
+
banDurationSeconds?: number;
|
|
281
|
+
};
|
|
282
|
+
type ChannelPositionUpdate = {
|
|
283
|
+
id: string;
|
|
284
|
+
position?: number;
|
|
285
|
+
parentId?: string | null;
|
|
286
|
+
lockPermissions?: boolean;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
/** Guild member search / edit SDK options. */
|
|
290
|
+
/** Filters and paging for {@link Guild.searchMembers}. */
|
|
291
|
+
interface GuildMemberSearchOptions {
|
|
292
|
+
query?: string;
|
|
293
|
+
limit?: number;
|
|
294
|
+
offset?: number;
|
|
295
|
+
roleIds?: string[];
|
|
296
|
+
joinedAtGte?: number;
|
|
297
|
+
joinedAtLte?: number;
|
|
298
|
+
isBot?: boolean;
|
|
299
|
+
userCreatedAtGte?: number;
|
|
300
|
+
userCreatedAtLte?: number;
|
|
301
|
+
sortBy?: 'joinedAt' | 'relevance';
|
|
302
|
+
sortOrder?: 'asc' | 'desc';
|
|
303
|
+
}
|
|
304
|
+
/** Convert {@link GuildMemberSearchOptions} to the wire search body. */
|
|
305
|
+
declare function toMemberSearchBody(options: GuildMemberSearchOptions): Record<string, unknown>;
|
|
306
|
+
/** Fields to update on a guild member (nick, roles, profile, voice/timeout state). */
|
|
285
307
|
interface GuildMemberEditOptions {
|
|
286
308
|
nick?: string | null;
|
|
287
309
|
roles?: string[];
|
|
@@ -300,169 +322,101 @@ interface GuildMemberEditOptions {
|
|
|
300
322
|
}
|
|
301
323
|
/** Convert {@link GuildMemberEditOptions} to the member PATCH wire body. */
|
|
302
324
|
declare function toMemberEditBody(options: GuildMemberEditOptions): Record<string, unknown>;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
325
|
+
|
|
326
|
+
/** Message bulk-fetch SDK options. */
|
|
327
|
+
/** A single channel's request within a bulk message fetch. */
|
|
328
|
+
interface BulkFetchMessagesRequest {
|
|
329
|
+
channelId: string;
|
|
330
|
+
limit: number;
|
|
331
|
+
before?: string;
|
|
332
|
+
after?: string;
|
|
333
|
+
around?: string;
|
|
309
334
|
}
|
|
310
|
-
/**
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
335
|
+
/** Convert bulk-fetch requests to wire items. */
|
|
336
|
+
declare function toBulkFetchWire(requests: readonly BulkFetchMessagesRequest[]): Array<{
|
|
337
|
+
channel_id: string;
|
|
338
|
+
limit: number;
|
|
339
|
+
before?: string;
|
|
340
|
+
after?: string;
|
|
341
|
+
around?: string;
|
|
342
|
+
}>;
|
|
343
|
+
|
|
344
|
+
/** Pack create/edit/invite + pack payload types. */
|
|
345
|
+
/** Options for creating an expression pack. */
|
|
346
|
+
interface PackCreateOptions {
|
|
347
|
+
name: string;
|
|
348
|
+
description?: string | null;
|
|
321
349
|
}
|
|
322
|
-
/**
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
350
|
+
/** Fields to update on an expression pack. */
|
|
351
|
+
interface PackEditOptions {
|
|
352
|
+
name?: string;
|
|
353
|
+
description?: string | null;
|
|
354
|
+
}
|
|
355
|
+
/** Options for creating a pack invite. */
|
|
356
|
+
interface PackInviteCreateOptions {
|
|
326
357
|
maxUses?: number;
|
|
327
358
|
maxAge?: number;
|
|
328
359
|
unique?: boolean;
|
|
329
|
-
temporary?: boolean;
|
|
330
360
|
}
|
|
331
|
-
/** Convert {@link
|
|
332
|
-
declare function
|
|
333
|
-
/**
|
|
334
|
-
interface
|
|
335
|
-
id:
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
fileSize?: number;
|
|
339
|
-
contentType?: string;
|
|
340
|
-
title?: string | null;
|
|
341
|
-
description?: string | null;
|
|
342
|
-
flags?: number;
|
|
361
|
+
/** Convert {@link PackInviteCreateOptions} to the pack invite wire body. */
|
|
362
|
+
declare function toPackInviteBody(options: PackInviteCreateOptions): Record<string, unknown>;
|
|
363
|
+
/** Small emoji payload returned from pack list/create. */
|
|
364
|
+
interface PackEmojiPayload {
|
|
365
|
+
id: string;
|
|
366
|
+
name: string;
|
|
367
|
+
animated?: boolean;
|
|
343
368
|
}
|
|
344
|
-
/**
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
369
|
+
/** Small sticker payload from pack list/create. */
|
|
370
|
+
interface PackStickerPayload {
|
|
371
|
+
id: string;
|
|
372
|
+
name: string;
|
|
373
|
+
description: string;
|
|
374
|
+
tags: string[];
|
|
375
|
+
animated: boolean;
|
|
376
|
+
nsfw: boolean;
|
|
352
377
|
}
|
|
353
|
-
/**
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
378
|
+
/** Invite metadata payload (camelCase). */
|
|
379
|
+
interface PackInvitePayload {
|
|
380
|
+
code: string;
|
|
381
|
+
maxUses?: number;
|
|
382
|
+
maxAge?: number;
|
|
383
|
+
uses?: number;
|
|
384
|
+
temporary?: boolean;
|
|
385
|
+
unique?: boolean;
|
|
386
|
+
createdAt?: string;
|
|
387
|
+
expiresAt?: string | null;
|
|
361
388
|
}
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
389
|
+
/** Bulk create result (camelCase). */
|
|
390
|
+
interface PackBulkCreatePayload<T> {
|
|
391
|
+
success: T[];
|
|
392
|
+
failed: Array<{
|
|
393
|
+
name: string;
|
|
394
|
+
error: string;
|
|
367
395
|
}>;
|
|
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
|
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
397
|
+
|
|
398
|
+
/** Presence update SDK options. */
|
|
399
|
+
/** Options for `client.user.setPresence()` (status, activities, custom status). */
|
|
400
|
+
interface PresenceUpdateOptions {
|
|
401
|
+
status: 'online' | 'idle' | 'dnd' | 'invisible';
|
|
402
|
+
since?: number | null;
|
|
403
|
+
afk?: boolean;
|
|
404
|
+
activities?: Array<{
|
|
405
|
+
name: string;
|
|
406
|
+
type: number;
|
|
407
|
+
url?: string | null;
|
|
405
408
|
}>;
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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;
|
|
409
|
+
customStatus?: {
|
|
410
|
+
text?: string | null;
|
|
411
|
+
emojiName?: string | null;
|
|
412
|
+
emojiId?: string | null;
|
|
461
413
|
} | null;
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
414
|
+
}
|
|
415
|
+
/** Convert presence options to gateway opcode 3 payload. */
|
|
416
|
+
declare function toPresenceWire(options: PresenceUpdateOptions): Record<string, unknown>;
|
|
417
|
+
|
|
418
|
+
/** User profile SDK payloads. */
|
|
419
|
+
/** CamelCase user profile fields (pronouns, bio, banner, colors, theme). */
|
|
466
420
|
interface UserProfilePayload {
|
|
467
421
|
pronouns?: string | null;
|
|
468
422
|
bio?: string | null;
|
|
@@ -504,39 +458,26 @@ declare function toProfilePayload(data: {
|
|
|
504
458
|
type?: string | null;
|
|
505
459
|
}> | null;
|
|
506
460
|
}): ProfilePayload;
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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;
|
|
461
|
+
|
|
462
|
+
/** Sudo verification SDK options. */
|
|
463
|
+
/** Credentials for a sudo (elevated-action) verification: password and/or MFA. */
|
|
464
|
+
interface SudoVerificationOptions {
|
|
465
|
+
password?: string;
|
|
466
|
+
mfaMethod?: 'totp' | 'webauthn';
|
|
467
|
+
mfaCode?: string;
|
|
468
|
+
webauthnResponse?: Record<string, unknown>;
|
|
469
|
+
webauthnChallenge?: string;
|
|
532
470
|
}
|
|
533
|
-
/**
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
471
|
+
/** Convert {@link SudoVerificationOptions} to the wire sudo body. */
|
|
472
|
+
declare function toSudoBody(options: SudoVerificationOptions): Record<string, unknown>;
|
|
473
|
+
|
|
474
|
+
/** Webhook SDK options. */
|
|
475
|
+
/** Fields to update on a webhook (name, avatar, or move channel). */
|
|
476
|
+
interface WebhookEditOptions {
|
|
477
|
+
name?: string;
|
|
478
|
+
avatar?: string | null;
|
|
479
|
+
/** Move webhook to another channel (bot auth only). */
|
|
480
|
+
channelId?: string;
|
|
540
481
|
}
|
|
541
482
|
|
|
542
483
|
/** Base class for all Fluxer structures. Provides the client reference. */
|
|
@@ -564,10 +505,22 @@ declare class GuildEmoji extends Base {
|
|
|
564
505
|
constructor(client: Client, data: APIEmoji & {
|
|
565
506
|
guild_id?: string;
|
|
566
507
|
}, guildId: string);
|
|
508
|
+
/**
|
|
509
|
+
* Patch mutable fields in place. Does not change `id` or `animated`
|
|
510
|
+
* (callers should replace the instance when `animated` changes).
|
|
511
|
+
* @internal
|
|
512
|
+
*/
|
|
513
|
+
_patch(data: APIEmoji): void;
|
|
567
514
|
/** CDN URL for this emoji image. */
|
|
568
515
|
get url(): string;
|
|
569
|
-
/** Emoji identifier for use in reactions: `name:id` */
|
|
516
|
+
/** Emoji identifier for use in reactions: `name:id` (or `a:name:id` when animated). */
|
|
570
517
|
get identifier(): string;
|
|
518
|
+
/** Unix timestamp (ms) when this emoji was created, derived from its snowflake ID. */
|
|
519
|
+
get createdTimestamp(): number;
|
|
520
|
+
/** Date when this emoji was created, derived from its snowflake ID. */
|
|
521
|
+
get createdAt(): Date;
|
|
522
|
+
/** Renders this emoji for use in message content: `<:name:id>` (or `<a:name:id>` when animated). */
|
|
523
|
+
toString(): string;
|
|
571
524
|
/** Delete this emoji. Requires Manage Emojis and Stickers permission. */
|
|
572
525
|
delete(): Promise<void>;
|
|
573
526
|
/**
|
|
@@ -579,757 +532,623 @@ declare class GuildEmoji extends Base {
|
|
|
579
532
|
}): Promise<GuildEmoji>;
|
|
580
533
|
}
|
|
581
534
|
|
|
535
|
+
/** Represents a custom sticker in a guild. */
|
|
536
|
+
declare class GuildSticker extends Base {
|
|
537
|
+
readonly client: Client;
|
|
538
|
+
readonly id: string;
|
|
539
|
+
readonly guildId: string;
|
|
540
|
+
name: string;
|
|
541
|
+
description: string;
|
|
542
|
+
tags: string[];
|
|
543
|
+
readonly animated: boolean;
|
|
544
|
+
/** Whether this sticker is classified as NSFW */
|
|
545
|
+
nsfw: boolean;
|
|
546
|
+
/** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
|
|
547
|
+
constructor(client: Client, data: APISticker & {
|
|
548
|
+
guild_id?: string;
|
|
549
|
+
}, guildId: string);
|
|
550
|
+
/**
|
|
551
|
+
* Patch mutable fields in place. Does not change `id` or `animated`
|
|
552
|
+
* (callers should replace the instance when `animated` changes).
|
|
553
|
+
* @internal
|
|
554
|
+
*/
|
|
555
|
+
_patch(data: APISticker): void;
|
|
556
|
+
/** CDN URL for this sticker image. */
|
|
557
|
+
get url(): string;
|
|
558
|
+
/** Unix timestamp (ms) when this sticker was created, derived from its snowflake ID. */
|
|
559
|
+
get createdTimestamp(): number;
|
|
560
|
+
/** Date when this sticker was created, derived from its snowflake ID. */
|
|
561
|
+
get createdAt(): Date;
|
|
562
|
+
/** Delete this sticker. Requires Manage Emojis and Stickers permission. */
|
|
563
|
+
delete(): Promise<void>;
|
|
564
|
+
/**
|
|
565
|
+
* Edit this sticker's name and/or description.
|
|
566
|
+
* Requires Manage Emojis and Stickers permission.
|
|
567
|
+
*/
|
|
568
|
+
edit(options: {
|
|
569
|
+
name?: string;
|
|
570
|
+
description?: string;
|
|
571
|
+
}): Promise<GuildSticker>;
|
|
572
|
+
}
|
|
573
|
+
|
|
582
574
|
/**
|
|
583
|
-
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
575
|
+
* Guild role.
|
|
576
|
+
* Cached in {@link Guild.roles}; permissions computed via {@link GuildMember.permissions}.
|
|
586
577
|
*/
|
|
587
|
-
declare class
|
|
588
|
-
|
|
589
|
-
|
|
578
|
+
declare class Role extends Base {
|
|
579
|
+
/** Parent client instance. */
|
|
580
|
+
readonly client: Client;
|
|
581
|
+
/** Role snowflake ID. */
|
|
582
|
+
readonly id: string;
|
|
583
|
+
/** Guild this role belongs to. */
|
|
584
|
+
readonly guildId: string;
|
|
585
|
+
/** Role name. */
|
|
586
|
+
name: string;
|
|
587
|
+
/** Role color (24-bit RGB). */
|
|
588
|
+
color: number;
|
|
589
|
+
/** Role position (higher = above). */
|
|
590
|
+
position: number;
|
|
591
|
+
/** @internal Raw permissions bitfield string. */
|
|
592
|
+
_permissions: string;
|
|
593
|
+
/** Whether this role is hoisted (shown separately in member list). */
|
|
594
|
+
hoist: boolean;
|
|
595
|
+
/** Whether this role is mentionable. */
|
|
596
|
+
mentionable: boolean;
|
|
597
|
+
/** Unicode emoji for this role (null = none). */
|
|
598
|
+
unicodeEmoji: string | null;
|
|
599
|
+
/** Hoist position (null = not hoisted). */
|
|
600
|
+
hoistPosition: number | null;
|
|
601
|
+
constructor(client: Client, data: APIRole, guildId: string);
|
|
590
602
|
/**
|
|
591
|
-
*
|
|
603
|
+
* Permissions bitfield (Administrator grants all permissions).
|
|
592
604
|
*/
|
|
593
|
-
|
|
605
|
+
get permissions(): PermissionsBitField;
|
|
594
606
|
/**
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
* @param userId - Snowflake of the user
|
|
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);
|
|
607
|
+
* Format as a mention string (`<@&id>`).
|
|
608
|
+
* @returns Mention syntax
|
|
603
609
|
*/
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
* const perms = guild.members.me?.permissions;
|
|
612
|
-
* if (perms?.has(PermissionFlags.BanMembers)) { ... }
|
|
613
|
-
*/
|
|
614
|
-
get me(): GuildMember | null;
|
|
615
|
-
/**
|
|
616
|
-
* Fetch the current bot user as a GuildMember in this guild.
|
|
617
|
-
* Caches the result in guild.members.
|
|
618
|
-
*
|
|
619
|
-
* @throws FluxerError with CLIENT_NOT_READY if client.user is null
|
|
620
|
-
* @example
|
|
621
|
-
* const me = await guild.members.fetchMe();
|
|
622
|
-
* console.log(me.displayName);
|
|
623
|
-
*/
|
|
624
|
-
fetchMe(): Promise<GuildMember>;
|
|
610
|
+
/** Unix timestamp (ms) when this role was created, derived from its snowflake ID. */
|
|
611
|
+
get createdTimestamp(): number;
|
|
612
|
+
/** Date when this role was created, derived from its snowflake ID. */
|
|
613
|
+
get createdAt(): Date;
|
|
614
|
+
toString(): string;
|
|
615
|
+
/** @internal */
|
|
616
|
+
_patch(data: APIRole): void;
|
|
625
617
|
/**
|
|
626
|
-
*
|
|
618
|
+
* Snapshot for role-update events (before in-place patch).
|
|
619
|
+
* @internal
|
|
627
620
|
*/
|
|
628
|
-
|
|
621
|
+
_clone(): Role;
|
|
629
622
|
/**
|
|
630
|
-
*
|
|
631
|
-
* @param options -
|
|
632
|
-
* @returns
|
|
623
|
+
* PATCH role. Requires Manage Roles.
|
|
624
|
+
* @param options - CamelCase fields to update
|
|
625
|
+
* @returns This role instance (updated in-place)
|
|
633
626
|
*/
|
|
634
|
-
|
|
635
|
-
limit?: number;
|
|
636
|
-
after?: string;
|
|
637
|
-
}): Promise<GuildMember[]>;
|
|
627
|
+
edit(options: RoleEditOptions): Promise<Role>;
|
|
638
628
|
/**
|
|
639
|
-
*
|
|
640
|
-
* @param options - CamelCase search query, filters, and pagination
|
|
641
|
-
* @returns CamelCase search results; `member` is set from cache when present
|
|
642
|
-
* @example
|
|
643
|
-
* const { members } = await guild.members.search({ query: 'alex', limit: 25 });
|
|
629
|
+
* DELETE role. Requires Manage Roles.
|
|
644
630
|
*/
|
|
645
|
-
|
|
631
|
+
delete(): Promise<void>;
|
|
646
632
|
}
|
|
647
633
|
|
|
634
|
+
/** Resolved file data (after URL fetch). Used internally by REST layer. */
|
|
635
|
+
interface ResolvedMessageFile {
|
|
636
|
+
name: string;
|
|
637
|
+
data: Blob | ArrayBuffer | Uint8Array | Buffer;
|
|
638
|
+
filename?: string;
|
|
639
|
+
}
|
|
640
|
+
/** File data for message attachment uploads. Use `data` for buffers or `url` to fetch from a URL. */
|
|
641
|
+
type MessageFileData = {
|
|
642
|
+
name: string;
|
|
643
|
+
data: Blob | ArrayBuffer | Uint8Array | Buffer;
|
|
644
|
+
filename?: string;
|
|
645
|
+
} | {
|
|
646
|
+
name: string;
|
|
647
|
+
url: string;
|
|
648
|
+
filename?: string;
|
|
649
|
+
};
|
|
650
|
+
/** Attachment metadata for file uploads (id matches FormData index). */
|
|
651
|
+
interface MessageAttachmentMeta {
|
|
652
|
+
id: number;
|
|
653
|
+
filename: string;
|
|
654
|
+
title?: string | null;
|
|
655
|
+
description?: string | null;
|
|
656
|
+
/** MessageAttachmentFlags: IS_SPOILER (8), CONTAINS_EXPLICIT_MEDIA (16), IS_ANIMATED (32) */
|
|
657
|
+
flags?: number;
|
|
658
|
+
}
|
|
659
|
+
/** SDK options for allowed mentions (camelCase). Converted to APIAllowedMentions on send. */
|
|
660
|
+
type AllowedMentionsOptions = {
|
|
661
|
+
/** Mention parse groups to allow (`users`, `roles`, `everyone`). Empty array suppresses all. */
|
|
662
|
+
parse?: APIAllowedMentions['parse'];
|
|
663
|
+
/** Explicit user IDs that may be mentioned. */
|
|
664
|
+
users?: string[];
|
|
665
|
+
/** Explicit role IDs that may be mentioned. */
|
|
666
|
+
roles?: string[];
|
|
667
|
+
/** Whether to @mention and notify the author of the replied-to message. */
|
|
668
|
+
repliedUser?: boolean;
|
|
669
|
+
};
|
|
648
670
|
/**
|
|
649
|
-
*
|
|
650
|
-
*
|
|
671
|
+
* Common allowed-mentions presets.
|
|
672
|
+
* @example
|
|
673
|
+
* await message.reply('Got it!', { ping: false });
|
|
674
|
+
* await message.reply({ content: 'Got it!', allowedMentions: AllowedMentions.suppressReplyPing });
|
|
651
675
|
*/
|
|
652
|
-
declare
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
readonly
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
/**
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
|
|
671
|
-
/**
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}): string;
|
|
697
|
-
/**
|
|
698
|
-
* User banner CDN URL (null if no banner set).
|
|
699
|
-
* @param options - Size and extension options
|
|
700
|
-
* @returns CDN URL or null
|
|
701
|
-
*/
|
|
702
|
-
bannerURL(options?: {
|
|
703
|
-
size?: number;
|
|
704
|
-
extension?: string;
|
|
705
|
-
}): string | null;
|
|
706
|
-
/**
|
|
707
|
-
* Format as a mention string (`<@id>`).
|
|
708
|
-
* @returns Mention syntax
|
|
709
|
-
*/
|
|
710
|
-
toString(): string;
|
|
711
|
-
/**
|
|
712
|
-
* Create or fetch the DM channel with this user.
|
|
713
|
-
* @returns DM channel instance (cached if already open)
|
|
714
|
-
*/
|
|
715
|
-
createDM(): Promise<DMChannel>;
|
|
676
|
+
declare const AllowedMentions: {
|
|
677
|
+
readonly suppressReplyPing: {
|
|
678
|
+
repliedUser: false;
|
|
679
|
+
};
|
|
680
|
+
readonly none: {
|
|
681
|
+
parse: never[];
|
|
682
|
+
};
|
|
683
|
+
readonly all: {
|
|
684
|
+
parse: ("roles" | "users" | "everyone")[];
|
|
685
|
+
};
|
|
686
|
+
};
|
|
687
|
+
/** Target message for `replyTo` / `forward` on send options. */
|
|
688
|
+
type MessageReplyTarget = {
|
|
689
|
+
/** Channel that owns the target message. */
|
|
690
|
+
channelId: string;
|
|
691
|
+
/** Target message snowflake. */
|
|
692
|
+
messageId: string;
|
|
693
|
+
/** Guild id when known (optional for DMs / partials). */
|
|
694
|
+
guildId?: string | null;
|
|
695
|
+
/** {@link MessageReferenceType.Default} = reply, {@link MessageReferenceType.Forward} = forward */
|
|
696
|
+
type?: MessageReferenceType;
|
|
697
|
+
/** Attachment ids to include when forwarding. */
|
|
698
|
+
attachmentIds?: string[];
|
|
699
|
+
/** Embed indices to include when forwarding. */
|
|
700
|
+
embedIndices?: number[];
|
|
701
|
+
};
|
|
702
|
+
/** Options for sending a message via channel/message helpers. */
|
|
703
|
+
type MessageSendOptions = {
|
|
704
|
+
/** Plain text body. */
|
|
705
|
+
content?: string;
|
|
706
|
+
/** Embed payloads or {@link EmbedBuilder} instances. */
|
|
707
|
+
embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
|
|
708
|
+
/** Local files or remote URLs to upload with the message. */
|
|
709
|
+
files?: MessageFileData[];
|
|
710
|
+
/** Attachment metadata aligned with uploaded `files` indices. */
|
|
711
|
+
attachments?: MessageAttachmentMeta[];
|
|
712
|
+
/** Already-uploaded CDN attachments (skip multipart). */
|
|
713
|
+
uploadedAttachments?: RESTPostAPIMessageUploadedAttachment[];
|
|
714
|
+
/** Who may be mentioned; see {@link AllowedMentionsOptions}. */
|
|
715
|
+
allowedMentions?: AllowedMentionsOptions;
|
|
716
|
+
/** Reply to an existing message (sets message_reference). */
|
|
717
|
+
replyTo?: MessageReplyTarget;
|
|
718
|
+
/** Forward an existing message into this channel. */
|
|
719
|
+
forward?: MessageReplyTarget;
|
|
716
720
|
/**
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
* @returns Sent message
|
|
721
|
+
* Shortcut for reply pings. `false` sets `allowedMentions.repliedUser` to false.
|
|
722
|
+
* Prefer explicit {@link AllowedMentionsOptions} when you need full control.
|
|
720
723
|
*/
|
|
721
|
-
|
|
724
|
+
ping?: boolean;
|
|
725
|
+
/** Text-to-speech flag. */
|
|
726
|
+
tts?: boolean;
|
|
727
|
+
/** Sticker snowflakes to attach. */
|
|
728
|
+
stickerIds?: string[];
|
|
729
|
+
/** Client-generated nonce for deduplication. */
|
|
730
|
+
nonce?: string;
|
|
731
|
+
/** Favorite meme id when sending a saved meme. */
|
|
732
|
+
favoriteMemeId?: string;
|
|
733
|
+
/** Message flags bitfield. */
|
|
734
|
+
flags?: number;
|
|
735
|
+
};
|
|
736
|
+
/** API-ready body from MessageSendOptions. */
|
|
737
|
+
interface SendBodyResult {
|
|
738
|
+
content?: string;
|
|
739
|
+
embeds?: RESTPostAPIEmbed[];
|
|
740
|
+
attachments?: Array<{
|
|
741
|
+
id: number;
|
|
742
|
+
filename: string;
|
|
743
|
+
title?: string | null;
|
|
744
|
+
description?: string | null;
|
|
745
|
+
flags?: number;
|
|
746
|
+
} | RESTPostAPIMessageUploadedAttachment>;
|
|
747
|
+
allowed_mentions?: APIAllowedMentions;
|
|
748
|
+
message_reference?: APIMessageReference;
|
|
749
|
+
sticker_ids?: string[];
|
|
750
|
+
nonce?: string;
|
|
751
|
+
favorite_meme_id?: string;
|
|
752
|
+
tts?: boolean;
|
|
753
|
+
flags?: number;
|
|
722
754
|
}
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
readonly guildId: string;
|
|
728
|
-
readonly user: User;
|
|
729
|
-
readonly reason: string | null;
|
|
730
|
-
/** ISO timestamp when a temporary ban expires. Null for permanent bans. */
|
|
731
|
-
readonly expiresAt: string | null;
|
|
732
|
-
/** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
|
|
733
|
-
constructor(client: Client, data: APIBan & {
|
|
734
|
-
guild_id?: string;
|
|
735
|
-
}, guildId: string);
|
|
736
|
-
/**
|
|
737
|
-
* Remove this ban (unban the user).
|
|
738
|
-
* Requires Ban Members permission.
|
|
739
|
-
*/
|
|
740
|
-
unban(): Promise<void>;
|
|
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>;
|
|
762
|
-
/**
|
|
763
|
-
* Edit this sticker's name and/or description.
|
|
764
|
-
* Requires Manage Emojis and Stickers permission.
|
|
765
|
-
*/
|
|
766
|
-
edit(options: {
|
|
767
|
-
name?: string;
|
|
768
|
-
description?: string;
|
|
769
|
-
}): Promise<GuildSticker>;
|
|
755
|
+
/** REST post payload for POST /channels/{id}/messages. */
|
|
756
|
+
interface MessagePostPayload {
|
|
757
|
+
body: SendBodyResult;
|
|
758
|
+
files?: ResolvedMessageFile[];
|
|
770
759
|
}
|
|
771
760
|
|
|
761
|
+
/** Optional client defaults applied when a send omits the matching field. */
|
|
762
|
+
type MessagePrepareDefaults = {
|
|
763
|
+
defaultAllowedMentions?: AllowedMentionsOptions;
|
|
764
|
+
};
|
|
765
|
+
/** Input accepted by {@link prepareMessagePostPayload} and channel send helpers. */
|
|
766
|
+
type MessagePrepareInput = string | MessageSendOptions | MessagePayload;
|
|
772
767
|
/**
|
|
773
|
-
*
|
|
774
|
-
*
|
|
768
|
+
* Build a full message POST payload (body + optional files) from send options
|
|
769
|
+
* or a builders {@link MessagePayload}.
|
|
770
|
+
* Applies {@link MessagePrepareDefaults.defaultAllowedMentions} when the call omits `allowedMentions`.
|
|
775
771
|
*/
|
|
776
|
-
declare
|
|
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>;
|
|
804
|
-
}
|
|
772
|
+
declare function prepareMessagePostPayload(options: MessagePrepareInput, defaults?: MessagePrepareDefaults): Promise<MessagePostPayload>;
|
|
805
773
|
|
|
806
|
-
/**
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
/** Hoisted position (visual separator group). */
|
|
826
|
-
hoistPosition?: number | null;
|
|
774
|
+
/** Options for {@link ReactionCollector} / `message.createReactionCollector()`. */
|
|
775
|
+
interface ReactionCollectorOptions {
|
|
776
|
+
/** Filter function. Return true to collect the reaction. */
|
|
777
|
+
filter?: (reaction: MessageReaction, user: User) => boolean;
|
|
778
|
+
/** Max duration in ms. Collector stops when time expires. */
|
|
779
|
+
time?: number;
|
|
780
|
+
/** Max reactions to collect. Collector stops when limit reached. */
|
|
781
|
+
max?: number;
|
|
782
|
+
}
|
|
783
|
+
type ReactionCollectorEndReason = 'time' | 'limit' | 'user';
|
|
784
|
+
/** A single collected reaction paired with the user who added it. */
|
|
785
|
+
interface CollectedReaction {
|
|
786
|
+
reaction: MessageReaction;
|
|
787
|
+
user: User;
|
|
788
|
+
}
|
|
789
|
+
/** Typed event map for {@link ReactionCollector}: `collect` per reaction, `end` when it stops. */
|
|
790
|
+
interface ReactionCollectorEvents {
|
|
791
|
+
collect: [reaction: MessageReaction, user: User];
|
|
792
|
+
end: [collected: Collection<string, CollectedReaction>, reason: ReactionCollectorEndReason];
|
|
827
793
|
}
|
|
828
794
|
/**
|
|
829
|
-
*
|
|
830
|
-
*
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
*
|
|
836
|
-
*
|
|
795
|
+
* Collects reactions on a message. Use message.createReactionCollector().
|
|
796
|
+
*
|
|
797
|
+
* Listens to both {@link Events.MessageReactionAdd} and {@link Events.MessageReactionAddMany}
|
|
798
|
+
* (gateway may batch rapid reactions into ADD_MANY instead of individual ADD events).
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* const collector = message.createReactionCollector({ filter: (r, u) => u.id === userId, time: 10000 });
|
|
802
|
+
* collector.on('collect', (reaction, user) => console.log(user.username, 'reacted', reaction.emoji.name));
|
|
803
|
+
* collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
|
|
837
804
|
*/
|
|
838
|
-
declare class
|
|
839
|
-
/** Parent client instance. */
|
|
805
|
+
declare class ReactionCollector extends EventEmitter {
|
|
840
806
|
readonly client: Client;
|
|
841
|
-
|
|
842
|
-
readonly
|
|
843
|
-
|
|
844
|
-
readonly
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
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>;
|
|
884
|
-
/**
|
|
885
|
-
* DELETE role. Requires Manage Roles.
|
|
886
|
-
*/
|
|
887
|
-
delete(): Promise<void>;
|
|
807
|
+
readonly messageId: string;
|
|
808
|
+
readonly channelId: string;
|
|
809
|
+
readonly options: Required<ReactionCollectorOptions>;
|
|
810
|
+
readonly collected: Collection<string, CollectedReaction>;
|
|
811
|
+
private _timeout;
|
|
812
|
+
private _ended;
|
|
813
|
+
private readonly _onAdd;
|
|
814
|
+
private readonly _onAddMany;
|
|
815
|
+
constructor(client: Client, messageId: string, channelId: string, options?: ReactionCollectorOptions);
|
|
816
|
+
private _collect;
|
|
817
|
+
stop(reason?: ReactionCollectorEndReason): void;
|
|
818
|
+
on<K extends keyof ReactionCollectorEvents>(event: K, listener: (...args: ReactionCollectorEvents[K]) => void): this;
|
|
819
|
+
emit<K extends keyof ReactionCollectorEvents>(event: K, ...args: ReactionCollectorEvents[K]): boolean;
|
|
888
820
|
}
|
|
889
821
|
|
|
890
|
-
/**
|
|
891
|
-
|
|
892
|
-
username?: string;
|
|
893
|
-
avatarUrl?: string;
|
|
894
|
-
};
|
|
895
|
-
/** Edit a previously sent webhook message (`EmbedBuilder` values are serialized). */
|
|
896
|
-
interface WebhookMessageEditOptions {
|
|
822
|
+
/** Options for PATCH /channels/{id}/messages/{id}. */
|
|
823
|
+
interface MessageEditOptions {
|
|
897
824
|
content?: string | null;
|
|
898
825
|
embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
|
|
899
|
-
attachments?: MessageAttachmentEdit[];
|
|
900
|
-
flags?: number;
|
|
901
826
|
allowedMentions?: AllowedMentionsOptions;
|
|
827
|
+
flags?: number;
|
|
828
|
+
/** Keep by snowflake `id`, or add via `uploadFilename` from the presigned upload flow. */
|
|
829
|
+
attachments?: MessageAttachmentEdit[];
|
|
902
830
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
*/
|
|
909
|
-
|
|
910
|
-
/** Parent client instance. */
|
|
911
|
-
readonly client: Client;
|
|
912
|
-
/** Webhook snowflake ID. */
|
|
913
|
-
readonly id: string;
|
|
914
|
-
/** Guild this webhook belongs to. */
|
|
915
|
-
readonly guildId: string;
|
|
916
|
-
/** Channel this webhook posts to. */
|
|
917
|
-
channelId: string;
|
|
918
|
-
/** Webhook name. */
|
|
919
|
-
name: string;
|
|
920
|
-
/** Webhook avatar hash (null = default). */
|
|
921
|
-
avatar: string | null;
|
|
922
|
-
/** Present after create / `fromToken`; omitted when fetching by ID. */
|
|
923
|
-
readonly token: string | null;
|
|
924
|
-
/** The user that created this webhook. */
|
|
925
|
-
readonly user: User;
|
|
926
|
-
constructor(client: Client, data: APIWebhook & {
|
|
927
|
-
token?: string | null;
|
|
928
|
-
});
|
|
929
|
-
avatarURL(options?: {
|
|
930
|
-
size?: number;
|
|
931
|
-
extension?: string;
|
|
932
|
-
}): string | null;
|
|
933
|
-
/** Delete this webhook (token auth when available, otherwise bot auth). */
|
|
934
|
-
delete(): Promise<void>;
|
|
935
|
-
/**
|
|
936
|
-
* Edit name/avatar. With bot auth (no token), `channelId` may also be set.
|
|
937
|
-
*/
|
|
938
|
-
edit(options: WebhookEditOptions): Promise<this>;
|
|
939
|
-
/**
|
|
940
|
-
* Execute the webhook. Requires token.
|
|
941
|
-
* @param wait - When true, appends `?wait=true` and returns the created `Message`.
|
|
942
|
-
*/
|
|
943
|
-
send(options: string | WebhookSendOptions, wait?: boolean): Promise<Message | undefined>;
|
|
944
|
-
/** Edit a message previously sent by this webhook. Requires token. */
|
|
945
|
-
editMessage(messageId: string, options: WebhookMessageEditOptions): Promise<Message>;
|
|
946
|
-
/** Fetch a message sent by this webhook. Requires token. */
|
|
947
|
-
fetchMessage(messageId: string): Promise<Message>;
|
|
948
|
-
/** Delete a message sent by this webhook. Requires token. */
|
|
949
|
-
deleteMessage(messageId: string): Promise<void>;
|
|
950
|
-
/** Fetch a webhook by ID (bot auth; no token). */
|
|
951
|
-
static fetch(client: Client, webhookId: string): Promise<Webhook>;
|
|
952
|
-
/** Build a webhook from a stored id + token (e.g. webhook URL). */
|
|
953
|
-
static fromToken(client: Client, webhookId: string, token: string, options?: {
|
|
954
|
-
channelId?: string;
|
|
955
|
-
guildId?: string;
|
|
956
|
-
name?: string;
|
|
957
|
-
}): Webhook;
|
|
958
|
-
private requireToken;
|
|
959
|
-
private messageRoute;
|
|
831
|
+
type PreparedMessagePost = Awaited<ReturnType<typeof prepareMessagePostPayload>>;
|
|
832
|
+
/** Second-arg / inline options for `message.reply()`. */
|
|
833
|
+
interface ReplyOptions {
|
|
834
|
+
/** `false` suppresses the replied-user ping (`allowed_mentions.replied_user`). Default: client `defaultReplyPing`. */
|
|
835
|
+
ping?: boolean;
|
|
836
|
+
/** Reply to a different message. Default: this message. */
|
|
837
|
+
replyTo?: Message | MessageReplyTarget;
|
|
960
838
|
}
|
|
961
839
|
|
|
962
|
-
type
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
/** CamelCase SDK options for PATCH /guilds/{id}. */
|
|
967
|
-
type GuildEditOptions = {
|
|
968
|
-
name?: string;
|
|
969
|
-
icon?: string | null;
|
|
970
|
-
systemChannelId?: string | null;
|
|
971
|
-
systemChannelFlags?: number | SystemChannelFlagsValue;
|
|
972
|
-
afkChannelId?: string | null;
|
|
973
|
-
afkTimeout?: number;
|
|
974
|
-
defaultMessageNotifications?: DefaultMessageNotifications;
|
|
975
|
-
verificationLevel?: GuildVerificationLevel;
|
|
976
|
-
mfaLevel?: GuildMFALevel;
|
|
977
|
-
explicitContentFilter?: GuildExplicitContentFilter;
|
|
978
|
-
banner?: string | null;
|
|
979
|
-
splash?: string | null;
|
|
980
|
-
embedSplash?: string | null;
|
|
981
|
-
splashCardAlignment?: SplashCardAlignment;
|
|
982
|
-
nsfwLevel?: GuildNSFWLevel;
|
|
983
|
-
features?: GuildFeature[];
|
|
984
|
-
};
|
|
985
|
-
type GuildBanOptions = {
|
|
986
|
-
reason?: string;
|
|
987
|
-
/** Delete message history for this many days (0–7). */
|
|
988
|
-
deleteMessageDays?: number;
|
|
989
|
-
/** Temporary ban duration in seconds. */
|
|
990
|
-
banDurationSeconds?: number;
|
|
991
|
-
};
|
|
992
|
-
type ChannelPositionUpdate = {
|
|
993
|
-
id: string;
|
|
994
|
-
position?: number;
|
|
995
|
-
parentId?: string | null;
|
|
996
|
-
lockPermissions?: boolean;
|
|
840
|
+
type EmojiInput = string | {
|
|
841
|
+
name: string;
|
|
842
|
+
id?: string;
|
|
843
|
+
animated?: boolean;
|
|
997
844
|
};
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
/** The {@link Client} that instantiated this guild. */
|
|
845
|
+
/** A message in a channel. */
|
|
846
|
+
declare class Message extends Base {
|
|
847
|
+
/** The {@link Client} that instantiated this message. */
|
|
1002
848
|
readonly client: Client;
|
|
1003
|
-
/** Snowflake ID of this
|
|
849
|
+
/** Snowflake ID of this message. */
|
|
1004
850
|
readonly id: string;
|
|
1005
|
-
/**
|
|
1006
|
-
|
|
1007
|
-
/** Guild
|
|
1008
|
-
|
|
1009
|
-
/**
|
|
1010
|
-
|
|
1011
|
-
/**
|
|
1012
|
-
|
|
1013
|
-
/**
|
|
1014
|
-
|
|
1015
|
-
/**
|
|
1016
|
-
|
|
1017
|
-
/**
|
|
1018
|
-
|
|
1019
|
-
/**
|
|
1020
|
-
|
|
1021
|
-
/**
|
|
1022
|
-
|
|
1023
|
-
/**
|
|
1024
|
-
|
|
1025
|
-
/**
|
|
1026
|
-
|
|
1027
|
-
/**
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
|
|
1031
|
-
/**
|
|
1032
|
-
|
|
1033
|
-
/**
|
|
1034
|
-
|
|
1035
|
-
/**
|
|
1036
|
-
|
|
1037
|
-
/**
|
|
1038
|
-
|
|
1039
|
-
/**
|
|
1040
|
-
|
|
1041
|
-
/**
|
|
1042
|
-
|
|
1043
|
-
/**
|
|
1044
|
-
|
|
1045
|
-
/**
|
|
1046
|
-
|
|
1047
|
-
/**
|
|
1048
|
-
|
|
1049
|
-
/**
|
|
1050
|
-
|
|
1051
|
-
/** Cached
|
|
1052
|
-
|
|
1053
|
-
/** Cached
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
|
|
1057
|
-
/**
|
|
1058
|
-
|
|
1059
|
-
* @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE
|
|
1060
|
-
*/
|
|
1061
|
-
constructor(client: Client, data: GuildData);
|
|
1062
|
-
/** Patch metadata in place; preserves members/channels/emojis/stickers caches. */
|
|
1063
|
-
_patch(data: GuildData): void;
|
|
1064
|
-
/** Get the full CDN URL for the guild's icon (or null). */
|
|
1065
|
-
iconURL(options?: {
|
|
1066
|
-
size?: number;
|
|
1067
|
-
}): string | null;
|
|
1068
|
-
/** Get the full CDN URL for the guild's banner (or null). */
|
|
1069
|
-
bannerURL(options?: {
|
|
1070
|
-
size?: number;
|
|
1071
|
-
}): string | null;
|
|
1072
|
-
/** Get the full CDN URL for the guild's invite splash (or null). */
|
|
1073
|
-
splashURL(options?: {
|
|
1074
|
-
size?: number;
|
|
1075
|
-
}): string | null;
|
|
851
|
+
/** Channel ID where this message was sent. */
|
|
852
|
+
readonly channelId: string;
|
|
853
|
+
/** Guild ID if in a guild channel, null for DMs. */
|
|
854
|
+
readonly guildId: string | null;
|
|
855
|
+
/** The user who sent this message. */
|
|
856
|
+
readonly author: User;
|
|
857
|
+
/** Text content of the message. */
|
|
858
|
+
content: string;
|
|
859
|
+
/** When the message was created. */
|
|
860
|
+
readonly createdAt: Date;
|
|
861
|
+
/** When the message was last edited, or null if never edited. */
|
|
862
|
+
readonly editedAt: Date | null;
|
|
863
|
+
/** Whether the message is pinned. */
|
|
864
|
+
pinned: boolean;
|
|
865
|
+
/** Attached files (images, videos, etc.). */
|
|
866
|
+
readonly attachments: Collection<string, APIMessageAttachment>;
|
|
867
|
+
/** Message type (Default, Reply, etc.). */
|
|
868
|
+
readonly type: MessageType;
|
|
869
|
+
/** Message flags bitfield. */
|
|
870
|
+
readonly flags: number;
|
|
871
|
+
/** Whether `@everyone` or `@here` was mentioned. */
|
|
872
|
+
readonly mentionEveryone: boolean;
|
|
873
|
+
/** Whether this is a text-to-speech message. */
|
|
874
|
+
readonly tts: boolean;
|
|
875
|
+
/** Embedded content (rich previews, etc.). */
|
|
876
|
+
readonly embeds: APIEmbed[];
|
|
877
|
+
/** Stickers sent with the message. */
|
|
878
|
+
readonly stickers: APIMessageSticker[];
|
|
879
|
+
/** Reactions on the message. */
|
|
880
|
+
readonly reactions: APIMessageReaction[];
|
|
881
|
+
/** Reference to a replied-to message, if any. */
|
|
882
|
+
readonly messageReference: APIMessageReference | null;
|
|
883
|
+
/** Message snapshots for forwarded messages. */
|
|
884
|
+
readonly messageSnapshots: APIMessageSnapshot[];
|
|
885
|
+
/** Call data if this message represents a call event. */
|
|
886
|
+
readonly call: APIMessageCall | null;
|
|
887
|
+
/** The full referenced (replied-to) message, or null. */
|
|
888
|
+
readonly referencedMessage: Message | null;
|
|
889
|
+
/** Webhook ID if sent by a webhook. */
|
|
890
|
+
readonly webhookId: string | null;
|
|
891
|
+
/** Users mentioned in the message. */
|
|
892
|
+
readonly mentions: User[];
|
|
893
|
+
/** Role IDs mentioned in the message. */
|
|
894
|
+
readonly mentionRoles: string[];
|
|
895
|
+
/** Client-side nonce for deduplication. */
|
|
896
|
+
readonly nonce: string | null;
|
|
897
|
+
/** Cached text/DM/guild channel, or null if uncached. */
|
|
898
|
+
get channel(): (TextChannel | DMChannel | GuildChannel) | null;
|
|
899
|
+
/** Cached guild, or null for DMs / uncached. */
|
|
900
|
+
get guild(): Guild | null;
|
|
901
|
+
/** Fetch and resolve the channel this message is in. */
|
|
902
|
+
resolveChannel(): Promise<Channel>;
|
|
903
|
+
/** Fetch and resolve the guild, or null if a DM. */
|
|
904
|
+
resolveGuild(): Promise<Guild | null>;
|
|
1076
905
|
/**
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
906
|
+
* Construct a message from API data.
|
|
907
|
+
* @param data - API message from REST or MESSAGE_CREATE
|
|
1079
908
|
*/
|
|
1080
|
-
|
|
1081
|
-
/**
|
|
1082
|
-
|
|
1083
|
-
/**
|
|
1084
|
-
|
|
1085
|
-
/** Fetch all webhooks in this guild. */
|
|
1086
|
-
fetchWebhooks(): Promise<Webhook[]>;
|
|
1087
|
-
/** Fetch all invites in this guild. Requires Manage Guild. */
|
|
1088
|
-
fetchInvites(): Promise<Invite[]>;
|
|
1089
|
-
/** Fetch a specific invite by code or URL. */
|
|
1090
|
-
fetchInvite(codeOrUrl: string): Promise<Invite>;
|
|
1091
|
-
/** Fetch a guild member by user ID. */
|
|
1092
|
-
fetchMember(userId: string): Promise<GuildMember>;
|
|
1093
|
-
/** Fetch the bot's own member object in this guild. */
|
|
1094
|
-
fetchMe(): Promise<GuildMember>;
|
|
909
|
+
constructor(client: Client, data: APIMessage);
|
|
910
|
+
/** Send a message in this channel without replying. */
|
|
911
|
+
send(options: MessagePrepareInput): Promise<Message>;
|
|
912
|
+
/** Send a message to another channel by ID. */
|
|
913
|
+
sendTo(channelId: string, options: MessagePrepareInput): Promise<Message>;
|
|
1095
914
|
/**
|
|
1096
|
-
*
|
|
915
|
+
* Reply to this message.
|
|
1097
916
|
* @example
|
|
1098
|
-
* await
|
|
917
|
+
* await message.reply('Pong!');
|
|
918
|
+
* await message.reply('No ping!', { ping: false });
|
|
919
|
+
* await message.reply({ content: 'Silent', allowedMentions: AllowedMentions.suppressReplyPing });
|
|
1099
920
|
*/
|
|
1100
|
-
|
|
1101
|
-
/**
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
/**
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
/**
|
|
1118
|
-
|
|
1119
|
-
/**
|
|
1120
|
-
|
|
1121
|
-
/**
|
|
1122
|
-
|
|
1123
|
-
/**
|
|
1124
|
-
|
|
1125
|
-
/**
|
|
1126
|
-
|
|
1127
|
-
/**
|
|
1128
|
-
|
|
1129
|
-
/**
|
|
1130
|
-
|
|
1131
|
-
/**
|
|
1132
|
-
|
|
1133
|
-
name: string;
|
|
1134
|
-
image: string;
|
|
1135
|
-
}): Promise<GuildEmoji>;
|
|
1136
|
-
/** Clone an emoji from another guild. Requires Manage Emojis and Stickers. */
|
|
1137
|
-
cloneEmoji(sourceEmojiId: string): Promise<GuildEmoji>;
|
|
1138
|
-
/** Create multiple emojis at once (bulk operation). */
|
|
1139
|
-
createEmojisBulk(emojiList: Array<{
|
|
1140
|
-
name: string;
|
|
1141
|
-
image: string;
|
|
1142
|
-
}>): Promise<{
|
|
1143
|
-
success: GuildEmoji[];
|
|
1144
|
-
failed: Array<{
|
|
1145
|
-
name: string;
|
|
1146
|
-
error: string;
|
|
1147
|
-
}>;
|
|
1148
|
-
}>;
|
|
1149
|
-
/** Create a new sticker in this guild. Requires Manage Emojis and Stickers. */
|
|
1150
|
-
createSticker(options: {
|
|
1151
|
-
name: string;
|
|
1152
|
-
image: string;
|
|
1153
|
-
description?: string | null;
|
|
1154
|
-
tags?: string[];
|
|
1155
|
-
}): Promise<GuildSticker>;
|
|
1156
|
-
/** Clone a sticker from another guild. Requires Manage Emojis and Stickers. */
|
|
1157
|
-
cloneSticker(sourceStickerId: string): Promise<GuildSticker>;
|
|
1158
|
-
/** Create multiple stickers at once (bulk operation). */
|
|
1159
|
-
createStickersBulk(stickerList: Array<{
|
|
1160
|
-
name: string;
|
|
1161
|
-
image: string;
|
|
1162
|
-
description?: string;
|
|
1163
|
-
tags?: string[];
|
|
1164
|
-
}>): Promise<{
|
|
1165
|
-
success: GuildSticker[];
|
|
1166
|
-
failed: Array<{
|
|
1167
|
-
name: string;
|
|
1168
|
-
error: string;
|
|
1169
|
-
}>;
|
|
1170
|
-
}>;
|
|
1171
|
-
/** Fetch all stickers in this guild from the API. */
|
|
1172
|
-
fetchStickers(): Promise<GuildSticker[]>;
|
|
1173
|
-
/** Fetch a specific sticker by ID. */
|
|
1174
|
-
fetchSticker(stickerId: string): Promise<GuildSticker>;
|
|
1175
|
-
/** Fetch audit log entries. Requires View Audit Log. */
|
|
1176
|
-
fetchAuditLogs(options?: {
|
|
921
|
+
reply(options: string | (MessageSendOptions & ReplyOptions), replyOptions?: ReplyOptions): Promise<Message>;
|
|
922
|
+
/** Test helper — prefer {@link reply} / `prepareMessagePostPayload()`. */
|
|
923
|
+
static _createMessageBody(content: string | MessageSendOptions, referenced_message?: {
|
|
924
|
+
channel_id: string;
|
|
925
|
+
message_id: string;
|
|
926
|
+
guild_id?: string;
|
|
927
|
+
}, ping?: boolean): Promise<PreparedMessagePost>;
|
|
928
|
+
/** Send a prepared payload (internal helper). */
|
|
929
|
+
_send(payload: PreparedMessagePost): Promise<Message>;
|
|
930
|
+
/** Edit this message (requires author or admin permissions). */
|
|
931
|
+
edit(options: MessageEditOptions): Promise<Message>;
|
|
932
|
+
/** Create a {@link ReactionCollector} for this message. */
|
|
933
|
+
createReactionCollector(options?: ReactionCollectorOptions): ReactionCollector;
|
|
934
|
+
/** Fetch the latest version of this message from the API. */
|
|
935
|
+
fetch(): Promise<Message>;
|
|
936
|
+
/** Delete this message. */
|
|
937
|
+
delete(): Promise<void>;
|
|
938
|
+
/** Delete a specific attachment from this message. */
|
|
939
|
+
deleteAttachment(attachmentId: string): Promise<void>;
|
|
940
|
+
/** Pin this message in the channel. */
|
|
941
|
+
pin(): Promise<void>;
|
|
942
|
+
/** Unpin this message from the channel. */
|
|
943
|
+
unpin(): Promise<void>;
|
|
944
|
+
/** React to this message with an emoji. */
|
|
945
|
+
react(emoji: EmojiInput): Promise<void>;
|
|
946
|
+
/** Remove a reaction (bot's own or a user's if ID is provided). */
|
|
947
|
+
removeReaction(emoji: EmojiInput, userId?: string): Promise<void>;
|
|
948
|
+
/** Remove all reactions from this message. */
|
|
949
|
+
removeAllReactions(): Promise<void>;
|
|
950
|
+
/** Remove all reactions of a specific emoji. */
|
|
951
|
+
removeReactionEmoji(emoji: EmojiInput): Promise<void>;
|
|
952
|
+
/** Fetch users who reacted with a specific emoji. */
|
|
953
|
+
fetchReactionUsers(emoji: EmojiInput, options?: {
|
|
1177
954
|
limit?: number;
|
|
1178
|
-
before?: string;
|
|
1179
955
|
after?: string;
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
fetchDiscoveryStatus(): Promise<DiscoveryStatusPayload>;
|
|
1191
|
-
/** Apply for guild discovery. */
|
|
1192
|
-
applyForDiscovery(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
|
|
1193
|
-
/** Edit an existing discovery application. */
|
|
1194
|
-
editDiscoveryApplication(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
|
|
1195
|
-
/** Withdraw the guild's discovery application. */
|
|
1196
|
-
withdrawDiscoveryApplication(): Promise<void>;
|
|
1197
|
-
/** Delete this guild (owner only). User accounts may need sudo/MFA in `options`. */
|
|
1198
|
-
delete(options?: SudoVerificationOptions): Promise<void>;
|
|
1199
|
-
/** Transfer guild ownership to another user (owner only). */
|
|
1200
|
-
transferOwnership(newOwnerId: string, password?: string): Promise<void>;
|
|
956
|
+
}): Promise<User[]>;
|
|
957
|
+
/** Fetch reaction users with pagination metadata. */
|
|
958
|
+
fetchReactionUsersPage(emoji: EmojiInput, options?: {
|
|
959
|
+
limit?: number;
|
|
960
|
+
after?: string;
|
|
961
|
+
}): Promise<{
|
|
962
|
+
users: User[];
|
|
963
|
+
hasMore: boolean;
|
|
964
|
+
nextAfter: string | null;
|
|
965
|
+
}>;
|
|
1201
966
|
}
|
|
1202
967
|
|
|
1203
|
-
/**
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
*/
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
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;
|
|
968
|
+
/** Minimal message data for MessageDelete when the full message is not available. */
|
|
969
|
+
interface PartialMessage {
|
|
970
|
+
id: string;
|
|
971
|
+
channelId: string;
|
|
972
|
+
channel?: Channel | null;
|
|
973
|
+
/** Message content, when provided by the gateway (e.g. Fluxer). */
|
|
974
|
+
content?: string | null;
|
|
975
|
+
/** Author user ID, when provided by the gateway (e.g. Fluxer). */
|
|
976
|
+
authorId?: string | null;
|
|
1222
977
|
}
|
|
1223
978
|
|
|
1224
979
|
/**
|
|
1225
|
-
*
|
|
1226
|
-
* Cached
|
|
980
|
+
* User (or bot) on Fluxer.
|
|
981
|
+
* Cached in {@link Client.users} and hydrated via {@link Client.getOrCreateUser}.
|
|
1227
982
|
*/
|
|
1228
|
-
declare class
|
|
983
|
+
declare class User extends Base {
|
|
1229
984
|
/** Parent client instance. */
|
|
1230
985
|
readonly client: Client;
|
|
1231
|
-
/** User ID
|
|
986
|
+
/** User snowflake ID. */
|
|
1232
987
|
readonly id: string;
|
|
1233
|
-
/**
|
|
1234
|
-
|
|
1235
|
-
/**
|
|
1236
|
-
|
|
1237
|
-
/**
|
|
1238
|
-
|
|
1239
|
-
/**
|
|
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). */
|
|
988
|
+
/** Username (not unique across the platform). */
|
|
989
|
+
username: string;
|
|
990
|
+
/** Legacy discriminator (e.g., `"0001"`). */
|
|
991
|
+
discriminator: string;
|
|
992
|
+
/** Display name (preferred over username). */
|
|
993
|
+
globalName: string | null;
|
|
994
|
+
/** Avatar hash (null = default avatar). */
|
|
1250
995
|
avatar: string | null;
|
|
1251
|
-
/**
|
|
996
|
+
/** Whether this user is a bot. */
|
|
997
|
+
readonly bot: boolean;
|
|
998
|
+
/** Accent color for the profile (24-bit RGB). */
|
|
999
|
+
avatarColor: number | null;
|
|
1000
|
+
/** User flags bitfield (badges, staff, etc.). */
|
|
1001
|
+
flags: number | null;
|
|
1002
|
+
/** Whether this is a system user (e.g., Fluxer System). */
|
|
1003
|
+
readonly system: boolean;
|
|
1004
|
+
/** Banner hash for profile. */
|
|
1252
1005
|
banner: string | null;
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
* Apply an API member payload in place (gateway GUILD_MEMBER_UPDATE / REST edit).
|
|
1262
|
-
* @internal
|
|
1263
|
-
*/
|
|
1264
|
-
_patch(data: APIGuildMember): void;
|
|
1006
|
+
constructor(client: Client, data: APIUserPartial & {
|
|
1007
|
+
banner?: string | null;
|
|
1008
|
+
});
|
|
1009
|
+
/** @internal */
|
|
1010
|
+
_patch(data: APIUserPartial & {
|
|
1011
|
+
banner?: string | null;
|
|
1012
|
+
}): void;
|
|
1013
|
+
private cdnOpts;
|
|
1265
1014
|
/**
|
|
1266
|
-
*
|
|
1267
|
-
* @
|
|
1015
|
+
* User avatar CDN URL (null if no custom avatar set).
|
|
1016
|
+
* @param options - Size and extension options
|
|
1017
|
+
* @returns CDN URL or null
|
|
1268
1018
|
*/
|
|
1269
|
-
_clone(): GuildMember;
|
|
1270
|
-
get displayName(): string;
|
|
1271
1019
|
avatarURL(options?: {
|
|
1272
1020
|
size?: number;
|
|
1273
1021
|
extension?: string;
|
|
1274
1022
|
}): string | null;
|
|
1023
|
+
/**
|
|
1024
|
+
* User avatar URL or default avatar fallback.
|
|
1025
|
+
* @param options - Size and extension options
|
|
1026
|
+
* @returns CDN URL (never null)
|
|
1027
|
+
*/
|
|
1275
1028
|
displayAvatarURL(options?: {
|
|
1276
1029
|
size?: number;
|
|
1277
1030
|
extension?: string;
|
|
1278
1031
|
}): string;
|
|
1032
|
+
/**
|
|
1033
|
+
* User banner CDN URL (null if no banner set).
|
|
1034
|
+
* @param options - Size and extension options
|
|
1035
|
+
* @returns CDN URL or null
|
|
1036
|
+
*/
|
|
1279
1037
|
bannerURL(options?: {
|
|
1280
1038
|
size?: number;
|
|
1281
1039
|
extension?: string;
|
|
1282
1040
|
}): string | null;
|
|
1283
|
-
/** PATCH member (`/members/@me` when editing the bot). */
|
|
1284
|
-
edit(options: GuildMemberEditOptions): Promise<this>;
|
|
1285
1041
|
/**
|
|
1286
|
-
*
|
|
1287
|
-
* @
|
|
1042
|
+
* Format as a mention string (`<@id>`).
|
|
1043
|
+
* @returns Mention syntax
|
|
1288
1044
|
*/
|
|
1289
|
-
|
|
1045
|
+
/** Unix timestamp (ms) when this account was created, derived from its snowflake ID. */
|
|
1046
|
+
get createdTimestamp(): number;
|
|
1047
|
+
/** Date when this account was created, derived from its snowflake ID. */
|
|
1048
|
+
get createdAt(): Date;
|
|
1049
|
+
toString(): string;
|
|
1290
1050
|
/**
|
|
1291
|
-
*
|
|
1292
|
-
* @
|
|
1293
|
-
* @returns Computed permissions bitfield
|
|
1051
|
+
* Create or fetch the DM channel with this user.
|
|
1052
|
+
* @returns DM channel instance (cached if already open)
|
|
1294
1053
|
*/
|
|
1295
|
-
|
|
1054
|
+
createDM(): Promise<DMChannel>;
|
|
1296
1055
|
/**
|
|
1297
|
-
*
|
|
1298
|
-
* @param
|
|
1299
|
-
* @
|
|
1056
|
+
* Send a DM to this user.
|
|
1057
|
+
* @param options - {@link MessagePrepareInput}
|
|
1058
|
+
* @returns Sent message
|
|
1300
1059
|
*/
|
|
1301
|
-
|
|
1302
|
-
private _effectivePermissions;
|
|
1303
|
-
private _basePermissions;
|
|
1060
|
+
send(options: MessagePrepareInput): Promise<Message>;
|
|
1304
1061
|
}
|
|
1305
1062
|
|
|
1306
|
-
/**
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
/**
|
|
1313
|
-
|
|
1314
|
-
*/
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1063
|
+
/** Represents a ban in a guild. */
|
|
1064
|
+
declare class GuildBan extends Base {
|
|
1065
|
+
readonly client: Client;
|
|
1066
|
+
readonly guildId: string;
|
|
1067
|
+
readonly user: User;
|
|
1068
|
+
readonly reason: string | null;
|
|
1069
|
+
/** ISO timestamp when a temporary ban expires. Null for permanent bans. */
|
|
1070
|
+
readonly expiresAt: string | null;
|
|
1071
|
+
/** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
|
|
1072
|
+
constructor(client: Client, data: APIBan & {
|
|
1073
|
+
guild_id?: string;
|
|
1074
|
+
}, guildId: string);
|
|
1075
|
+
/**
|
|
1076
|
+
* Remove this ban (unban the user).
|
|
1077
|
+
* Requires Ban Members permission.
|
|
1078
|
+
*/
|
|
1079
|
+
unban(): Promise<void>;
|
|
1322
1080
|
}
|
|
1081
|
+
|
|
1082
|
+
/** Role ID or Role object. */
|
|
1083
|
+
type RoleResolvable = string | Role;
|
|
1323
1084
|
/**
|
|
1324
|
-
*
|
|
1085
|
+
* Manages a guild member's roles (`add` / `remove` / `set` / `cache`).
|
|
1086
|
+
* Requires Manage Roles for mutations.
|
|
1325
1087
|
*/
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1088
|
+
declare class GuildMemberRoleManager {
|
|
1089
|
+
private readonly member;
|
|
1090
|
+
private ids;
|
|
1091
|
+
constructor(member: GuildMember, initial?: string[]);
|
|
1092
|
+
get roleIds(): readonly string[];
|
|
1093
|
+
has(roleOrId: RoleResolvable): boolean;
|
|
1094
|
+
/** Live Role objects from `guild.roles` for this member's role IDs. */
|
|
1095
|
+
get cache(): Collection<string, Role>;
|
|
1096
|
+
add(roleOrId: RoleResolvable): Promise<void>;
|
|
1097
|
+
remove(roleOrId: RoleResolvable): Promise<void>;
|
|
1098
|
+
set(roleIds: string[]): Promise<void>;
|
|
1099
|
+
/** @internal Sync from API member payload. */
|
|
1100
|
+
_patch(roleIds: string[]): void;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/** Represents a reaction added to or removed from a message. */
|
|
1104
|
+
declare class MessageReaction extends Base {
|
|
1105
|
+
readonly client: Client;
|
|
1106
|
+
readonly messageId: string;
|
|
1107
|
+
readonly channelId: string;
|
|
1108
|
+
readonly guildId: string | null;
|
|
1109
|
+
readonly emoji: ReactionEmojiPayload;
|
|
1110
|
+
/** Raw gateway payload for low-level access. */
|
|
1111
|
+
readonly _data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData;
|
|
1112
|
+
constructor(client: Client, data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData);
|
|
1113
|
+
/** Emoji as a string for reaction routes: unicode or `name:id` (`a:name:id` when animated). */
|
|
1114
|
+
get emojiIdentifier(): string;
|
|
1115
|
+
/** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
|
|
1116
|
+
get guild(): Guild | null;
|
|
1117
|
+
/**
|
|
1118
|
+
* Fetch the message this reaction belongs to.
|
|
1119
|
+
* Use when you need to edit, delete, or otherwise interact with the message.
|
|
1120
|
+
* @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
|
|
1121
|
+
*/
|
|
1122
|
+
fetchMessage(): Promise<Message>;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
/** CamelCase emoji on reaction events. */
|
|
1126
|
+
interface ReactionEmojiPayload {
|
|
1127
|
+
id?: string;
|
|
1128
|
+
name: string;
|
|
1129
|
+
animated?: boolean;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Payload emitted for {@link Events.MessageReactionAdd} / {@link Events.MessageReactionRemove}.
|
|
1133
|
+
*/
|
|
1134
|
+
interface MessageReactionPayload {
|
|
1135
|
+
reaction: MessageReaction;
|
|
1136
|
+
user: User;
|
|
1137
|
+
messageId: string;
|
|
1138
|
+
channelId: string;
|
|
1139
|
+
emoji: ReactionEmojiPayload;
|
|
1140
|
+
userId: string;
|
|
1141
|
+
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Payload emitted for {@link Events.GuildRoleDelete}.
|
|
1144
|
+
*/
|
|
1145
|
+
interface GuildRoleDeletePayload {
|
|
1146
|
+
roleId: string;
|
|
1147
|
+
guildId: string;
|
|
1148
|
+
role: Role | null;
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Payload emitted for {@link Events.MessageDeleteBulk}.
|
|
1333
1152
|
* Normalized from `GatewayMessageDeleteBulkDispatchData`.
|
|
1334
1153
|
*/
|
|
1335
1154
|
interface MessageDeleteBulkPayload {
|
|
@@ -1518,298 +1337,940 @@ interface GuildMemberSearchHit {
|
|
|
1518
1337
|
/** Cached {@link GuildMember} when available after search hydration. */
|
|
1519
1338
|
member: GuildMember | null;
|
|
1520
1339
|
}
|
|
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;
|
|
1340
|
+
/** Guild member search response (camelCase). */
|
|
1341
|
+
interface GuildMemberSearchPayload {
|
|
1342
|
+
guildId: string;
|
|
1343
|
+
members: GuildMemberSearchHit[];
|
|
1344
|
+
/** Total matches across pages (`total_result_count`). */
|
|
1345
|
+
total?: number;
|
|
1346
|
+
/** Results on this page (`page_result_count`). */
|
|
1347
|
+
pageResultCount?: number;
|
|
1348
|
+
/** Whether more pages exist after this offset. */
|
|
1349
|
+
hasMore?: boolean;
|
|
1350
|
+
/** Search index still building. */
|
|
1351
|
+
indexing?: boolean;
|
|
1352
|
+
}
|
|
1353
|
+
/** Pack summary (camelCase view of {@link APIPackSummary}). */
|
|
1354
|
+
interface PackSummaryPayload {
|
|
1355
|
+
id: string;
|
|
1356
|
+
name: string;
|
|
1357
|
+
description: string | null;
|
|
1358
|
+
type: string;
|
|
1359
|
+
creatorId: string;
|
|
1360
|
+
createdAt: string;
|
|
1361
|
+
updatedAt: string;
|
|
1362
|
+
installedAt?: string;
|
|
1363
|
+
/** Original wire object when useful for debugging. */
|
|
1364
|
+
raw?: unknown;
|
|
1365
|
+
}
|
|
1366
|
+
/** Partial guild from GET /users/@me/guilds. */
|
|
1367
|
+
interface PartialUserGuildPayload {
|
|
1368
|
+
id: string;
|
|
1369
|
+
name: string;
|
|
1370
|
+
icon: string | null;
|
|
1371
|
+
owner?: boolean;
|
|
1372
|
+
permissions?: string | null;
|
|
1373
|
+
features?: string[];
|
|
1374
|
+
/** Present when fetched with `{ withCounts: true }`. */
|
|
1375
|
+
approximateMemberCount?: number;
|
|
1376
|
+
/** Present when fetched with `{ withCounts: true }`. */
|
|
1377
|
+
approximatePresenceCount?: number;
|
|
1378
|
+
}
|
|
1379
|
+
/** Payload for {@link Events.ChannelRecipientAdd} / {@link Events.ChannelRecipientRemove}. */
|
|
1380
|
+
interface ChannelRecipientPayload {
|
|
1381
|
+
channelId: string;
|
|
1382
|
+
user: User;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
/**
|
|
1386
|
+
* Manages guild members with a Collection-like API.
|
|
1387
|
+
* Extends LimitedCollection so you can use .get(), .set(), .filter(), etc.
|
|
1388
|
+
*/
|
|
1389
|
+
declare class GuildMemberManager extends LimitedCollection<string, GuildMember> {
|
|
1390
|
+
private readonly guild;
|
|
1391
|
+
constructor(guild: Guild);
|
|
1392
|
+
/**
|
|
1393
|
+
* Get a guild member from cache or fetch from the API if not present.
|
|
1394
|
+
* Convenience helper to avoid repeating `guild.members.get(userId) ?? (await guild.fetchMember(userId))`.
|
|
1395
|
+
* @param userId - Snowflake of the user
|
|
1396
|
+
* @returns The guild member
|
|
1397
|
+
* @throws FluxerError with MEMBER_NOT_FOUND if user is not in the guild (404)
|
|
1398
|
+
* @example
|
|
1399
|
+
* const member = await guild.members.resolve(userId);
|
|
1400
|
+
* console.log(member.displayName);
|
|
1401
|
+
*/
|
|
1402
|
+
resolve(userId: string): Promise<GuildMember>;
|
|
1403
|
+
/**
|
|
1404
|
+
* The current bot user as a GuildMember in this guild.
|
|
1405
|
+
* Returns null if the bot's member is not cached or client.user is null.
|
|
1406
|
+
* Use fetchMe() to load the bot's member when not cached.
|
|
1407
|
+
*
|
|
1408
|
+
* @example
|
|
1409
|
+
* const perms = guild.members.me?.permissions;
|
|
1410
|
+
* if (perms?.has(PermissionFlags.BanMembers)) { ... }
|
|
1411
|
+
*/
|
|
1412
|
+
get me(): GuildMember | null;
|
|
1413
|
+
/**
|
|
1414
|
+
* Fetch the current bot user as a GuildMember in this guild.
|
|
1415
|
+
* Caches the result in guild.members.
|
|
1416
|
+
*
|
|
1417
|
+
* @throws FluxerError with CLIENT_NOT_READY if client.user is null
|
|
1418
|
+
* @example
|
|
1419
|
+
* const me = await guild.members.fetchMe();
|
|
1420
|
+
* console.log(me.displayName);
|
|
1421
|
+
*/
|
|
1422
|
+
fetchMe(): Promise<GuildMember>;
|
|
1423
|
+
/**
|
|
1424
|
+
* Fetch guild members with pagination. GET /guilds/{id}/members.
|
|
1425
|
+
* @param options - limit (1-1000), after (user ID for pagination)
|
|
1426
|
+
* @returns Array of GuildMember objects (cached in guild.members)
|
|
1427
|
+
*/
|
|
1428
|
+
fetch(options?: {
|
|
1429
|
+
limit?: number;
|
|
1430
|
+
after?: string;
|
|
1431
|
+
}): Promise<GuildMember[]>;
|
|
1432
|
+
/**
|
|
1433
|
+
* Search guild members. POST /guilds/{id}/members-search.
|
|
1434
|
+
* @param options - CamelCase search query, filters, and pagination
|
|
1435
|
+
* @returns CamelCase search results; `member` is set from cache when present
|
|
1436
|
+
* @example
|
|
1437
|
+
* const { members } = await guild.members.search({ query: 'alex', limit: 25 });
|
|
1438
|
+
*/
|
|
1439
|
+
search(options?: GuildMemberSearchOptions): Promise<GuildMemberSearchPayload>;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* Invite to a guild channel, group DM, or emoji/sticker pack.
|
|
1444
|
+
* Discriminate with `type` / `isGuild()` / `isGroupDM()` / `isPack()`.
|
|
1445
|
+
*/
|
|
1446
|
+
declare class Invite extends Base {
|
|
1447
|
+
readonly client: Client;
|
|
1448
|
+
readonly code: string;
|
|
1449
|
+
readonly type: InviteType;
|
|
1450
|
+
readonly guild: APIGuildPartial | null;
|
|
1451
|
+
readonly channel: APIChannelPartial | null;
|
|
1452
|
+
readonly pack: APIPackInviteInfo | null;
|
|
1453
|
+
readonly inviter: User | null;
|
|
1454
|
+
readonly memberCount: number | null;
|
|
1455
|
+
readonly presenceCount: number | null;
|
|
1456
|
+
readonly expiresAt: string | null;
|
|
1457
|
+
readonly temporary: boolean | null;
|
|
1458
|
+
readonly createdAt: string | null;
|
|
1459
|
+
readonly uses: number | null;
|
|
1460
|
+
readonly maxUses: number | null;
|
|
1461
|
+
readonly maxAge: number | null;
|
|
1462
|
+
constructor(client: Client, data: APIInvite);
|
|
1463
|
+
isGuild(): boolean;
|
|
1464
|
+
isGroupDM(): boolean;
|
|
1465
|
+
isPack(): boolean;
|
|
1466
|
+
/** Full invite URL (uses this client's instance invite base). */
|
|
1467
|
+
get url(): string;
|
|
1468
|
+
/** Cached guild for guild invites, else null. */
|
|
1469
|
+
getGuild(): Guild | null;
|
|
1470
|
+
/** Fetch invite metadata by code or URL (does not join). */
|
|
1471
|
+
static fetch(client: Client, codeOrUrl: string): Promise<Invite>;
|
|
1472
|
+
/** Delete this invite. Requires Manage Guild or Create Instant Invite. */
|
|
1473
|
+
delete(): Promise<void>;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
/** Execute-webhook options: shared message fields plus username/avatar overrides. */
|
|
1477
|
+
type WebhookSendOptions = Pick<MessageSendOptions, 'content' | 'embeds' | 'tts' | 'allowedMentions' | 'files' | 'attachments'> & {
|
|
1478
|
+
username?: string;
|
|
1479
|
+
avatarUrl?: string;
|
|
1480
|
+
};
|
|
1481
|
+
/** Edit a previously sent webhook message (`EmbedBuilder` values are serialized). */
|
|
1482
|
+
interface WebhookMessageEditOptions {
|
|
1483
|
+
content?: string | null;
|
|
1484
|
+
embeds?: (RESTPostAPIEmbed | EmbedBuilder)[];
|
|
1485
|
+
attachments?: MessageAttachmentEdit[];
|
|
1486
|
+
flags?: number;
|
|
1487
|
+
allowedMentions?: AllowedMentionsOptions;
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Incoming webhook. Token is only present after create / `fromToken`;
|
|
1491
|
+
* fetched webhooks use bot auth and cannot execute.
|
|
1492
|
+
* @see {@link Webhook.fromToken} to construct from URL
|
|
1493
|
+
* @see {@link Webhook.fetch} to fetch by ID with bot auth
|
|
1494
|
+
*/
|
|
1495
|
+
declare class Webhook extends Base {
|
|
1496
|
+
/** Parent client instance. */
|
|
1497
|
+
readonly client: Client;
|
|
1498
|
+
/** Webhook snowflake ID. */
|
|
1499
|
+
readonly id: string;
|
|
1500
|
+
/** Guild this webhook belongs to. */
|
|
1501
|
+
readonly guildId: string;
|
|
1502
|
+
/** Channel this webhook posts to. */
|
|
1503
|
+
channelId: string;
|
|
1504
|
+
/** Webhook name. */
|
|
1505
|
+
name: string;
|
|
1506
|
+
/** Webhook avatar hash (null = default). */
|
|
1507
|
+
avatar: string | null;
|
|
1508
|
+
/** Present after create / `fromToken`; omitted when fetching by ID. */
|
|
1509
|
+
readonly token: string | null;
|
|
1510
|
+
/** The user that created this webhook. */
|
|
1511
|
+
readonly user: User;
|
|
1512
|
+
constructor(client: Client, data: APIWebhook & {
|
|
1513
|
+
token?: string | null;
|
|
1514
|
+
});
|
|
1515
|
+
avatarURL(options?: {
|
|
1516
|
+
size?: number;
|
|
1517
|
+
extension?: string;
|
|
1518
|
+
}): string | null;
|
|
1519
|
+
/** Unix timestamp (ms) when this webhook was created, derived from its snowflake ID. */
|
|
1520
|
+
get createdTimestamp(): number;
|
|
1521
|
+
/** Date when this webhook was created, derived from its snowflake ID. */
|
|
1522
|
+
get createdAt(): Date;
|
|
1523
|
+
/** Delete this webhook (token auth when available, otherwise bot auth). */
|
|
1524
|
+
delete(): Promise<void>;
|
|
1525
|
+
/**
|
|
1526
|
+
* Edit name/avatar. With bot auth (no token), `channelId` may also be set.
|
|
1527
|
+
*/
|
|
1528
|
+
edit(options: WebhookEditOptions): Promise<this>;
|
|
1529
|
+
/**
|
|
1530
|
+
* Execute the webhook. Requires token.
|
|
1531
|
+
* @param wait - When true, appends `?wait=true` and returns the created `Message`.
|
|
1532
|
+
*/
|
|
1533
|
+
send(options: string | WebhookSendOptions, wait?: boolean): Promise<Message | undefined>;
|
|
1534
|
+
/** Edit a message previously sent by this webhook. Requires token. */
|
|
1535
|
+
editMessage(messageId: string, options: WebhookMessageEditOptions): Promise<Message>;
|
|
1536
|
+
/** Fetch a message sent by this webhook. Requires token. */
|
|
1537
|
+
fetchMessage(messageId: string): Promise<Message>;
|
|
1538
|
+
/** Delete a message sent by this webhook. Requires token. */
|
|
1539
|
+
deleteMessage(messageId: string): Promise<void>;
|
|
1540
|
+
/** Fetch a webhook by ID (bot auth; no token). */
|
|
1541
|
+
static fetch(client: Client, webhookId: string): Promise<Webhook>;
|
|
1542
|
+
/** Build a webhook from a stored id + token (e.g. webhook URL). */
|
|
1543
|
+
static fromToken(client: Client, webhookId: string, token: string, options?: {
|
|
1544
|
+
channelId?: string;
|
|
1545
|
+
guildId?: string;
|
|
1546
|
+
name?: string;
|
|
1547
|
+
}): Webhook;
|
|
1548
|
+
private requireToken;
|
|
1549
|
+
private messageRoute;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
/** Represents a Fluxer guild (server). */
|
|
1553
|
+
declare class Guild extends Base {
|
|
1554
|
+
/** The {@link Client} that instantiated this guild. */
|
|
1555
|
+
readonly client: Client;
|
|
1556
|
+
/** Snowflake ID of this guild. */
|
|
1557
|
+
readonly id: string;
|
|
1558
|
+
/** Whether the guild is currently available through the gateway. */
|
|
1559
|
+
available: boolean;
|
|
1560
|
+
/** Guild name. */
|
|
1561
|
+
name: string;
|
|
1562
|
+
/** Icon hash (use {@link iconURL} to get full CDN URL). */
|
|
1563
|
+
icon: string | null;
|
|
1564
|
+
/** Banner hash (use {@link bannerURL} to get full CDN URL). */
|
|
1565
|
+
banner: string | null;
|
|
1566
|
+
/** User ID of the guild owner. */
|
|
1567
|
+
ownerId: string;
|
|
1568
|
+
/** Invite splash hash (use {@link splashURL} to get full CDN URL). */
|
|
1569
|
+
splash: string | null;
|
|
1570
|
+
/** Vanity invite code if the guild has one. */
|
|
1571
|
+
vanityURLCode: string | null;
|
|
1572
|
+
/** Features enabled for this guild. */
|
|
1573
|
+
features: GuildFeature[];
|
|
1574
|
+
/** Verification level required for members to send messages. */
|
|
1575
|
+
verificationLevel: GuildVerificationLevel;
|
|
1576
|
+
/** Default notification level for members. */
|
|
1577
|
+
defaultMessageNotifications: DefaultMessageNotifications;
|
|
1578
|
+
/** Explicit content filter level. */
|
|
1579
|
+
explicitContentFilter: GuildExplicitContentFilter;
|
|
1580
|
+
/** AFK voice channel ID, or null if none. */
|
|
1581
|
+
afkChannelId: string | null;
|
|
1582
|
+
/** AFK timeout in seconds. */
|
|
1583
|
+
afkTimeout: number;
|
|
1584
|
+
/** System messages channel ID, or null if none. */
|
|
1585
|
+
systemChannelId: string | null;
|
|
1586
|
+
/** Rules channel ID (for Community guilds), or null if none. */
|
|
1587
|
+
rulesChannelId: string | null;
|
|
1588
|
+
/** NSFW level for this guild. */
|
|
1589
|
+
nsfwLevel: GuildNSFWLevel;
|
|
1590
|
+
/** MFA level required for moderation actions. */
|
|
1591
|
+
mfaLevel: GuildMFALevel;
|
|
1592
|
+
/** Banner width in pixels. */
|
|
1593
|
+
bannerWidth?: number | null;
|
|
1594
|
+
/** Banner height in pixels. */
|
|
1595
|
+
bannerHeight?: number | null;
|
|
1596
|
+
/** Splash width in pixels. */
|
|
1597
|
+
splashWidth?: number | null;
|
|
1598
|
+
/** Splash height in pixels. */
|
|
1599
|
+
splashHeight?: number | null;
|
|
1600
|
+
/** Last known member count, or null if none has been received. */
|
|
1601
|
+
memberCount: number | null;
|
|
1602
|
+
/** Last known online member count, or null if none has been received. */
|
|
1603
|
+
onlineCount: number | null;
|
|
1604
|
+
/** Member manager for this guild (fetch/add/remove members). */
|
|
1605
|
+
members: GuildMemberManager;
|
|
1606
|
+
/** Cached channels in this guild. */
|
|
1607
|
+
channels: LimitedCollection<string, GuildChannel>;
|
|
1608
|
+
/** Cached roles in this guild. */
|
|
1609
|
+
roles: LimitedCollection<string, Role>;
|
|
1610
|
+
/** Cached emojis in this guild. */
|
|
1611
|
+
emojis: LimitedCollection<string, GuildEmoji>;
|
|
1612
|
+
/** Cached stickers in this guild. */
|
|
1613
|
+
stickers: LimitedCollection<string, GuildSticker>;
|
|
1614
|
+
/**
|
|
1615
|
+
* Construct a guild from API data.
|
|
1616
|
+
* @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE
|
|
1617
|
+
*/
|
|
1618
|
+
constructor(client: Client, data: GuildData);
|
|
1619
|
+
/** Patch metadata in place; preserves members/channels/emojis/stickers caches. */
|
|
1620
|
+
_patch(data: GuildData): void;
|
|
1621
|
+
/**
|
|
1622
|
+
* Adjust {@link memberCount} after a join/leave when a baseline is known.
|
|
1623
|
+
* No-op while the count is still unknown (`null`).
|
|
1624
|
+
*/
|
|
1625
|
+
adjustMemberCount(delta: 1 | -1): void;
|
|
1626
|
+
/** Unix timestamp (ms) when this guild was created, derived from its snowflake ID. */
|
|
1627
|
+
get createdTimestamp(): number;
|
|
1628
|
+
/** Date when this guild was created, derived from its snowflake ID. */
|
|
1629
|
+
get createdAt(): Date;
|
|
1630
|
+
/** The guild's name. */
|
|
1631
|
+
toString(): string;
|
|
1632
|
+
/** Get the full CDN URL for the guild's icon (or null). */
|
|
1633
|
+
iconURL(options?: {
|
|
1634
|
+
size?: number;
|
|
1635
|
+
}): string | null;
|
|
1636
|
+
/** Get the full CDN URL for the guild's banner (or null). */
|
|
1637
|
+
bannerURL(options?: {
|
|
1638
|
+
size?: number;
|
|
1639
|
+
}): string | null;
|
|
1640
|
+
/** Get the full CDN URL for the guild's invite splash (or null). */
|
|
1641
|
+
splashURL(options?: {
|
|
1642
|
+
size?: number;
|
|
1643
|
+
}): string | null;
|
|
1644
|
+
/**
|
|
1645
|
+
* Create a channel. `data.type`: 0=text, 2=voice, 4=category, 998=link (set `url`).
|
|
1646
|
+
* Requires Manage Channels.
|
|
1647
|
+
*/
|
|
1648
|
+
createChannel(data: ChannelCreateRequest): Promise<GuildChannel>;
|
|
1649
|
+
/** Fetch all channels in this guild from the API. */
|
|
1650
|
+
fetchChannels(): Promise<GuildChannel[]>;
|
|
1651
|
+
/** Update channel positions (reordering). */
|
|
1652
|
+
setChannelPositions(updates: ChannelPositionUpdate[]): Promise<void>;
|
|
1653
|
+
/** Fetch all webhooks in this guild. */
|
|
1654
|
+
fetchWebhooks(): Promise<Webhook[]>;
|
|
1655
|
+
/** Fetch all invites in this guild. Requires Manage Guild. */
|
|
1656
|
+
fetchInvites(): Promise<Invite[]>;
|
|
1657
|
+
/** Fetch a specific invite by code or URL. */
|
|
1658
|
+
fetchInvite(codeOrUrl: string): Promise<Invite>;
|
|
1659
|
+
/** Fetch a guild member by user ID. */
|
|
1660
|
+
fetchMember(userId: string): Promise<GuildMember>;
|
|
1661
|
+
/** Fetch the bot's own member object in this guild. */
|
|
1662
|
+
fetchMe(): Promise<GuildMember>;
|
|
1663
|
+
/**
|
|
1664
|
+
* Create a role. `permissions` accepts a bitfield string or {@link PermissionResolvable}.
|
|
1665
|
+
* @example
|
|
1666
|
+
* await guild.createRole({ name: 'Mod', permissions: ['KickMembers', 'BanMembers'] });
|
|
1667
|
+
*/
|
|
1668
|
+
createRole(options?: RoleCreateOptions): Promise<Role>;
|
|
1669
|
+
/** Fetch all roles in this guild from the API. */
|
|
1670
|
+
fetchRoles(): Promise<Role[]>;
|
|
1671
|
+
/** Fetch a specific role by ID. */
|
|
1672
|
+
fetchRole(roleId: string): Promise<Role>;
|
|
1673
|
+
/** Resolve role mention, snowflake, or name to a role ID. */
|
|
1674
|
+
resolveRoleId(arg: string): Promise<string | null>;
|
|
1675
|
+
/** Update role positions (reordering). Returns cached {@link Role} instances. */
|
|
1676
|
+
setRolePositions(updates: Array<{
|
|
1677
|
+
id: string;
|
|
1678
|
+
position?: number;
|
|
1679
|
+
}>): Promise<Role[]>;
|
|
1680
|
+
/** Update role hoist positions (visual separator groups). Returns cached {@link Role} instances. */
|
|
1681
|
+
setRoleHoistPositions(updates: Array<{
|
|
1682
|
+
id: string;
|
|
1683
|
+
hoistPosition?: number;
|
|
1684
|
+
}>): Promise<Role[]>;
|
|
1685
|
+
/** Reset all role hoist positions to zero. Returns cached {@link Role} instances. */
|
|
1686
|
+
resetRoleHoistPositions(): Promise<Role[]>;
|
|
1687
|
+
/** Ban a user from the guild. Requires Ban Members. `ban_duration_seconds`: 0 = permanent. */
|
|
1688
|
+
ban(userId: string, options?: GuildBanOptions): Promise<void>;
|
|
1689
|
+
/** Fetch all bans in this guild. Requires Ban Members. */
|
|
1690
|
+
fetchBans(): Promise<GuildBan[]>;
|
|
1691
|
+
/** Unban a user from the guild. Requires Ban Members. */
|
|
1692
|
+
unban(userId: string): Promise<void>;
|
|
1693
|
+
/** Kick a user from the guild. Requires Kick Members. */
|
|
1694
|
+
kick(userId: string): Promise<void>;
|
|
1695
|
+
/** Fetch all emojis in this guild from the API. */
|
|
1696
|
+
fetchEmojis(): Promise<GuildEmoji[]>;
|
|
1697
|
+
/** Fetch a specific emoji by ID. */
|
|
1698
|
+
fetchEmoji(emojiId: string): Promise<GuildEmoji>;
|
|
1699
|
+
/** Create a new emoji in this guild. Requires Manage Emojis and Stickers. */
|
|
1700
|
+
createEmoji(options: {
|
|
1701
|
+
name: string;
|
|
1702
|
+
image: string;
|
|
1703
|
+
}): Promise<GuildEmoji>;
|
|
1704
|
+
/** Clone an emoji from another guild. Requires Manage Emojis and Stickers. */
|
|
1705
|
+
cloneEmoji(sourceEmojiId: string): Promise<GuildEmoji>;
|
|
1706
|
+
/** Create multiple emojis at once (bulk operation). */
|
|
1707
|
+
createEmojisBulk(emojiList: Array<{
|
|
1708
|
+
name: string;
|
|
1709
|
+
image: string;
|
|
1710
|
+
}>): Promise<{
|
|
1711
|
+
success: GuildEmoji[];
|
|
1712
|
+
failed: Array<{
|
|
1713
|
+
name: string;
|
|
1714
|
+
error: string;
|
|
1715
|
+
}>;
|
|
1716
|
+
}>;
|
|
1717
|
+
/** Create a new sticker in this guild. Requires Manage Emojis and Stickers. */
|
|
1718
|
+
createSticker(options: {
|
|
1719
|
+
name: string;
|
|
1720
|
+
image: string;
|
|
1721
|
+
description?: string | null;
|
|
1722
|
+
tags?: string[];
|
|
1723
|
+
}): Promise<GuildSticker>;
|
|
1724
|
+
/** Clone a sticker from another guild. Requires Manage Emojis and Stickers. */
|
|
1725
|
+
cloneSticker(sourceStickerId: string): Promise<GuildSticker>;
|
|
1726
|
+
/** Create multiple stickers at once (bulk operation). */
|
|
1727
|
+
createStickersBulk(stickerList: Array<{
|
|
1728
|
+
name: string;
|
|
1729
|
+
image: string;
|
|
1730
|
+
description?: string;
|
|
1731
|
+
tags?: string[];
|
|
1732
|
+
}>): Promise<{
|
|
1733
|
+
success: GuildSticker[];
|
|
1734
|
+
failed: Array<{
|
|
1735
|
+
name: string;
|
|
1736
|
+
error: string;
|
|
1737
|
+
}>;
|
|
1738
|
+
}>;
|
|
1739
|
+
/** Fetch all stickers in this guild from the API. */
|
|
1740
|
+
fetchStickers(): Promise<GuildSticker[]>;
|
|
1741
|
+
/** Fetch a specific sticker by ID. */
|
|
1742
|
+
fetchSticker(stickerId: string): Promise<GuildSticker>;
|
|
1743
|
+
/** Fetch audit log entries. Requires View Audit Log. */
|
|
1744
|
+
fetchAuditLogs(options?: {
|
|
1745
|
+
limit?: number;
|
|
1746
|
+
before?: string;
|
|
1747
|
+
after?: string;
|
|
1748
|
+
userId?: string;
|
|
1749
|
+
actionType?: AuditLogActionType;
|
|
1750
|
+
}): Promise<AuditLogFetchPayload>;
|
|
1751
|
+
/** Edit guild settings. Requires guild owner or Administrator. */
|
|
1752
|
+
edit(options: GuildEditOptions): Promise<this>;
|
|
1753
|
+
/** Fetch the guild's vanity invite URL (if available). */
|
|
1754
|
+
fetchVanityURL(): Promise<VanityURLPayload>;
|
|
1755
|
+
/** Edit the guild's vanity invite code. */
|
|
1756
|
+
editVanityURL(code: string | null): Promise<VanityURLPayload>;
|
|
1757
|
+
/** Fetch the guild's discovery status. */
|
|
1758
|
+
fetchDiscoveryStatus(): Promise<DiscoveryStatusPayload>;
|
|
1759
|
+
/** Apply for guild discovery. */
|
|
1760
|
+
applyForDiscovery(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
|
|
1761
|
+
/** Edit an existing discovery application. */
|
|
1762
|
+
editDiscoveryApplication(body: DiscoveryApplicationOptions): Promise<DiscoveryApplicationPayload>;
|
|
1763
|
+
/** Withdraw the guild's discovery application. */
|
|
1764
|
+
withdrawDiscoveryApplication(): Promise<void>;
|
|
1765
|
+
/** Delete this guild (owner only). User accounts may need sudo/MFA in `options`. */
|
|
1766
|
+
delete(options?: SudoVerificationOptions): Promise<void>;
|
|
1767
|
+
/** Transfer guild ownership to another user (owner only). */
|
|
1768
|
+
transferOwnership(newOwnerId: string, password?: string): Promise<void>;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
/**
|
|
1772
|
+
* Optional cache size limits (FIFO eviction when exceeded).
|
|
1773
|
+
*
|
|
1774
|
+
* | Value | Meaning |
|
|
1775
|
+
* |-------|---------|
|
|
1776
|
+
* | positive number | Max entries |
|
|
1777
|
+
* | `0` or `Infinity` | Unbounded |
|
|
1778
|
+
* | `false` (`messages` only) | Message cache disabled |
|
|
1779
|
+
*
|
|
1780
|
+
* @see {@link DEFAULT_CACHE_LIMITS}
|
|
1781
|
+
* @see {@link resolveCacheLimits}
|
|
1782
|
+
*/
|
|
1783
|
+
interface CacheSizeLimits {
|
|
1784
|
+
/** Max channels cached globally. `0` = unbounded. */
|
|
1785
|
+
channels?: number;
|
|
1786
|
+
/** Max guilds cached. `0` = unbounded. */
|
|
1787
|
+
guilds?: number;
|
|
1788
|
+
/** Max users cached globally. `0` = unbounded. */
|
|
1789
|
+
users?: number;
|
|
1790
|
+
/**
|
|
1791
|
+
* Max messages per channel, or `false` to disable message caching.
|
|
1792
|
+
* `0` / `Infinity` = unbounded (legacy `0` previously meant off — use `false`).
|
|
1793
|
+
*/
|
|
1794
|
+
messages?: number | false;
|
|
1795
|
+
/** Max members per guild. `0` = unbounded. */
|
|
1796
|
+
members?: number;
|
|
1797
|
+
/** Max roles per guild. `0` = unbounded. @default 0 */
|
|
1798
|
+
roles?: number;
|
|
1799
|
+
/** Max emojis per guild. `0` = unbounded. @default 0 */
|
|
1800
|
+
emojis?: number;
|
|
1801
|
+
/** Max stickers per guild. `0` = unbounded. @default 0 */
|
|
1802
|
+
stickers?: number;
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Default cache policy — opt out per field with `0` (or `messages: false` to disable).
|
|
1806
|
+
* Applied when {@link ClientOptions.cache} is omitted or partial.
|
|
1807
|
+
*/
|
|
1808
|
+
declare const DEFAULT_CACHE_LIMITS: Required<Omit<CacheSizeLimits, 'messages'>> & {
|
|
1809
|
+
messages: number;
|
|
1810
|
+
};
|
|
1811
|
+
/**
|
|
1812
|
+
* Fully resolved cache limits used at runtime.
|
|
1813
|
+
* Numeric buckets use `Infinity` for unbounded; `messages` may be `false` (disabled).
|
|
1814
|
+
*/
|
|
1815
|
+
interface ResolvedCacheLimits {
|
|
1816
|
+
guilds: number;
|
|
1817
|
+
channels: number;
|
|
1818
|
+
users: number;
|
|
1819
|
+
members: number;
|
|
1820
|
+
/** Per-channel message cap, `Infinity` if unbounded, or `false` if disabled. */
|
|
1821
|
+
messages: number | false;
|
|
1822
|
+
roles: number;
|
|
1823
|
+
emojis: number;
|
|
1824
|
+
stickers: number;
|
|
1825
|
+
}
|
|
1826
|
+
/** Result of {@link resolveCacheLimits}. */
|
|
1827
|
+
interface ResolvedCacheOptions {
|
|
1828
|
+
/** Limits for LimitedCollection / MessageCache. */
|
|
1829
|
+
limits: ResolvedCacheLimits;
|
|
1830
|
+
/** Merged options object stored on `client.options.cache`. */
|
|
1831
|
+
cache: Required<Omit<CacheSizeLimits, 'messages'>> & {
|
|
1832
|
+
messages: number | false;
|
|
1833
|
+
};
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* Normalize a numeric cache limit.
|
|
1837
|
+
* Positive finite → floored max; `0` / `Infinity` / NaN / negative → unbounded (`Infinity`).
|
|
1838
|
+
*/
|
|
1839
|
+
declare function normalizeCacheLimit(value: number | undefined, fallback: number): number;
|
|
1840
|
+
/**
|
|
1841
|
+
* Resolve and validate {@link ClientOptions.cache} once at Client construction.
|
|
1842
|
+
* Emits a warning when `messages: 0` is passed (legacy “off”; now unbounded — use `false`).
|
|
1843
|
+
*/
|
|
1844
|
+
declare function resolveCacheLimits(input?: CacheSizeLimits): ResolvedCacheOptions;
|
|
1845
|
+
/**
|
|
1846
|
+
* Configuration options for {@link Client}.
|
|
1847
|
+
* @example
|
|
1848
|
+
* ```ts
|
|
1849
|
+
* const client = new Client({
|
|
1850
|
+
* instance: { api: 'https://api.example.com' },
|
|
1851
|
+
* cache: { guilds: 100, messages: 20 },
|
|
1852
|
+
* waitForGuilds: true,
|
|
1853
|
+
* });
|
|
1854
|
+
* ```
|
|
1855
|
+
*/
|
|
1856
|
+
interface ClientOptions {
|
|
1857
|
+
/**
|
|
1858
|
+
* Instance endpoints for this client (API, CDN, invite, etc.).
|
|
1859
|
+
* Pass a partial map to override hosted defaults, or a full discovery document.
|
|
1860
|
+
* Prefer this over `rest.api` for multi-instance / self-hosted bots.
|
|
1861
|
+
* @see {@link Client.fromDiscovery}
|
|
1862
|
+
*/
|
|
1863
|
+
instance?: Partial<APIInstanceEndpoints> | APIInstance;
|
|
1864
|
+
/**
|
|
1865
|
+
* REST options. Prefer {@link ClientOptions.instance} for the API host.
|
|
1866
|
+
* If both `instance.api` (or resolved default) and `rest.api` are set and differ, construction throws.
|
|
1867
|
+
*/
|
|
1868
|
+
rest?: Partial<ConstructorParameters<typeof REST>[0]>;
|
|
1869
|
+
/**
|
|
1870
|
+
* Gateway intents (Fluxer currently always sends `0`).
|
|
1871
|
+
* Reserved for future use.
|
|
1872
|
+
*/
|
|
1873
|
+
intents?: number;
|
|
1874
|
+
/** Silence the intents-not-supported warning. */
|
|
1875
|
+
suppressIntentWarning?: boolean;
|
|
1876
|
+
/** {@link GatewayIdentifyFlags} bitfield sent as Identify `flags`. */
|
|
1877
|
+
identifyFlags?: number;
|
|
1878
|
+
/** Dispatch event names to suppress for this session (`ignored_events`). */
|
|
1879
|
+
ignoredEvents?: string[];
|
|
1880
|
+
/** Prefer hydrating this guild first after READY (`initial_guild_id`). */
|
|
1881
|
+
initialGuildId?: string;
|
|
1882
|
+
/**
|
|
1883
|
+
* Delay Ready until all READY guilds arrive via GUILD_CREATE; queue other dispatches until then.
|
|
1884
|
+
* @default false
|
|
1885
|
+
*/
|
|
1886
|
+
waitForGuilds?: boolean;
|
|
1887
|
+
/**
|
|
1888
|
+
* Cache size limits per bucket. Defaults to {@link DEFAULT_CACHE_LIMITS}.
|
|
1889
|
+
* Pass `0` / `Infinity` per numeric field for unbounded; `messages: false` to disable message caching.
|
|
1890
|
+
* @see {@link CacheSizeLimits}
|
|
1891
|
+
*/
|
|
1892
|
+
cache?: CacheSizeLimits;
|
|
1893
|
+
/**
|
|
1894
|
+
* Default allowed mentions when a send omits them (per-call wins).
|
|
1895
|
+
* @example
|
|
1896
|
+
* ```ts
|
|
1897
|
+
* defaultAllowedMentions: {
|
|
1898
|
+
* parse: ['users'],
|
|
1899
|
+
* repliedUser: false,
|
|
1900
|
+
* }
|
|
1901
|
+
* ```
|
|
1902
|
+
*/
|
|
1903
|
+
defaultAllowedMentions?: {
|
|
1904
|
+
/** Mention types to parse (`roles`, `users`, `everyone`). */
|
|
1905
|
+
parse?: Array<'roles' | 'users' | 'everyone'>;
|
|
1906
|
+
/** Specific role IDs allowed to be mentioned. */
|
|
1907
|
+
roles?: string[];
|
|
1908
|
+
/** Specific user IDs allowed to be mentioned. */
|
|
1909
|
+
users?: string[];
|
|
1910
|
+
/** Whether to ping the user being replied to. */
|
|
1911
|
+
repliedUser?: boolean;
|
|
1912
|
+
};
|
|
1913
|
+
/**
|
|
1914
|
+
* Default reply ping for `message.reply` when `ping` is omitted.
|
|
1915
|
+
* @default true
|
|
1916
|
+
*/
|
|
1917
|
+
defaultReplyPing?: boolean;
|
|
1918
|
+
/**
|
|
1919
|
+
* Initial presence on identify (also updatable via `client.user.setPresence`).
|
|
1920
|
+
*/
|
|
1921
|
+
presence?: GatewayPresenceUpdateData;
|
|
1922
|
+
/**
|
|
1923
|
+
* Emit gateway debug strings.
|
|
1924
|
+
* @default true
|
|
1925
|
+
*/
|
|
1926
|
+
gatewayDebug?: boolean;
|
|
1927
|
+
/** Minimum log level for {@link Client.logger}. Default: `warn`. */
|
|
1928
|
+
logLevel?: LogLevel;
|
|
1929
|
+
/** Custom logger instance (overrides {@link logLevel} sink defaults). */
|
|
1930
|
+
logger?: Logger;
|
|
1931
|
+
/**
|
|
1932
|
+
* Defer dispatch handlers to the next macrotask so WS `message` stays responsive.
|
|
1933
|
+
* @default true (`false` useful in tests)
|
|
1934
|
+
*/
|
|
1935
|
+
gatewayDeferHandlers?: boolean;
|
|
1936
|
+
/**
|
|
1937
|
+
* Optional WebSocket constructor (e.g. `ws` in Node).
|
|
1938
|
+
* Provide if the runtime lacks a native WebSocket implementation.
|
|
1939
|
+
*/
|
|
1940
|
+
WebSocket?: new (url: string) => {
|
|
1941
|
+
send(data: string | ArrayBufferLike): void;
|
|
1942
|
+
close(code?: number): void;
|
|
1943
|
+
readyState: number;
|
|
1944
|
+
addEventListener?(type: string, listener: (e: unknown) => void): void;
|
|
1945
|
+
on?(event: string, cb: (data?: unknown) => void): void;
|
|
1946
|
+
};
|
|
1533
1947
|
}
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1948
|
+
|
|
1949
|
+
/** Snapshot of current cache sizes. */
|
|
1950
|
+
interface CacheStats {
|
|
1951
|
+
guilds: number;
|
|
1952
|
+
channels: number;
|
|
1953
|
+
users: number;
|
|
1954
|
+
members: number;
|
|
1955
|
+
messages: number;
|
|
1956
|
+
messageChannels: number;
|
|
1957
|
+
roles: number;
|
|
1958
|
+
emojis: number;
|
|
1959
|
+
stickers: number;
|
|
1546
1960
|
}
|
|
1547
|
-
/**
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1961
|
+
/**
|
|
1962
|
+
* Public cache facade: limits, stats, sweeps, and cascade teardown entry points.
|
|
1963
|
+
* Not a second source of truth — wraps managers / {@link MessageCache}.
|
|
1964
|
+
*/
|
|
1965
|
+
declare class CacheController {
|
|
1966
|
+
private readonly client;
|
|
1967
|
+
/** Resolved limits applied at Client construction. */
|
|
1968
|
+
readonly limits: ResolvedCacheLimits;
|
|
1969
|
+
/** Re-entrancy guard for dual-index / guild cascade teardown. */
|
|
1970
|
+
private _cascading;
|
|
1971
|
+
constructor(client: Client, limits: ResolvedCacheLimits);
|
|
1972
|
+
/** Whether a cascade teardown is currently in progress. */
|
|
1973
|
+
get cascading(): boolean;
|
|
1974
|
+
/** Current sizes for each cache bucket. */
|
|
1975
|
+
stats(): CacheStats;
|
|
1976
|
+
sweepMessages(filter?: (message: APIMessage, channelId: string) => boolean, channelId?: string): number;
|
|
1977
|
+
sweepMembers(filter?: (member: GuildMember, guildId: string) => boolean): number;
|
|
1978
|
+
sweepUsers(filter?: (user: User, id: string) => boolean): number;
|
|
1979
|
+
/**
|
|
1980
|
+
* Sweep channels from the global index (cascades guild index + message cache).
|
|
1981
|
+
* Returns count removed.
|
|
1982
|
+
*/
|
|
1983
|
+
sweepChannels(filter?: (channel: Channel, id: string) => boolean): number;
|
|
1984
|
+
/**
|
|
1985
|
+
* Sweep guilds (cascades channels + message caches). Returns count removed.
|
|
1986
|
+
*/
|
|
1987
|
+
sweepGuilds(filter?: (guild: Guild, id: string) => boolean): number;
|
|
1988
|
+
/**
|
|
1989
|
+
* Tear down nested caches when a guild leaves `client.guilds`.
|
|
1990
|
+
* Removes channels from the global index, clears message caches, and empties guild collections.
|
|
1991
|
+
* Does not mass-delete `client.users`.
|
|
1992
|
+
* @internal
|
|
1993
|
+
*/
|
|
1994
|
+
cascadeGuild(guild: Guild): void;
|
|
1995
|
+
/**
|
|
1996
|
+
* Keep dual channel indexes + message cache aligned when a channel leaves a cache.
|
|
1997
|
+
* Uses `Map.prototype.delete` so ChannelManager/Guild channel `delete` overrides do not re-enter.
|
|
1998
|
+
* @param channel - Channel being removed
|
|
1999
|
+
* @param from - Which index initiated the removal (`global` = client.channels, `guild` = guild.channels)
|
|
2000
|
+
* @internal
|
|
2001
|
+
*/
|
|
2002
|
+
cascadeChannel(channel: Channel, from?: 'global' | 'guild' | 'both'): void;
|
|
1555
2003
|
}
|
|
1556
2004
|
|
|
1557
|
-
/**
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
readonly
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
get emojiIdentifier(): string;
|
|
1569
|
-
/** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
|
|
1570
|
-
get guild(): Guild | null;
|
|
2005
|
+
/**
|
|
2006
|
+
* Channel cache + fetch/send helpers.
|
|
2007
|
+
* Extends {@link LimitedCollection} (`.get()`, `.set()`, `.filter()`, …).
|
|
2008
|
+
* FIFO-evicts (and keeps guild indexes / message caches aligned) at `cache.channels`.
|
|
2009
|
+
*/
|
|
2010
|
+
declare class ChannelManager extends LimitedCollection<string, Channel | GuildChannel> {
|
|
2011
|
+
private readonly client;
|
|
2012
|
+
constructor(client: Client);
|
|
2013
|
+
delete(key: string): boolean;
|
|
2014
|
+
/** Retrieve from cache, otherwise {@link fetch}. */
|
|
2015
|
+
resolve(channelId: string): Promise<Channel>;
|
|
1571
2016
|
/**
|
|
1572
|
-
* Fetch
|
|
1573
|
-
*
|
|
1574
|
-
* @throws FluxerError with
|
|
2017
|
+
* Fetch a channel by ID.
|
|
2018
|
+
* Returns the cached channel unless `force` is set, in which case REST metadata is applied.
|
|
2019
|
+
* @throws {@link FluxerError} with CHANNEL_NOT_FOUND if missing
|
|
1575
2020
|
*/
|
|
1576
|
-
|
|
2021
|
+
fetch(channelId: string, options?: {
|
|
2022
|
+
force?: boolean;
|
|
2023
|
+
}): Promise<Channel>;
|
|
2024
|
+
/**
|
|
2025
|
+
* Fetch a message by channel + message ID (no channel resolve required).
|
|
2026
|
+
* Prefer `channel.messages.fetch(messageId)` when you already have a text channel.
|
|
2027
|
+
*/
|
|
2028
|
+
fetchMessage(channelId: string, messageId: string): Promise<Message>;
|
|
2029
|
+
/**
|
|
2030
|
+
* Send to a channel by ID without resolving it first.
|
|
2031
|
+
* @example
|
|
2032
|
+
* await client.channels.send(logChannelId, 'User joined!');
|
|
2033
|
+
*/
|
|
2034
|
+
send(channelId: string, payload: MessagePrepareInput): Promise<Message>;
|
|
1577
2035
|
}
|
|
1578
2036
|
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
/**
|
|
1583
|
-
|
|
1584
|
-
/**
|
|
1585
|
-
|
|
2037
|
+
/** The logged-in bot/user (`client.user`). */
|
|
2038
|
+
declare class ClientUser extends User {
|
|
2039
|
+
readonly client: Client;
|
|
2040
|
+
/** Broadcast presence (gateway opcode 3) on all shards. */
|
|
2041
|
+
setPresence(presence: PresenceUpdateOptions): void;
|
|
2042
|
+
/** GET /users/@me — refresh the logged-in user from REST and patch this instance. */
|
|
2043
|
+
fetch(): Promise<this>;
|
|
2044
|
+
/** GET /users/@me/guilds — returns camelCase partial guilds. */
|
|
2045
|
+
fetchGuilds(options?: {
|
|
2046
|
+
withCounts?: boolean;
|
|
2047
|
+
}): Promise<PartialUserGuildPayload[]>;
|
|
2048
|
+
/** DELETE /users/@me/guilds/{guild_id} */
|
|
2049
|
+
leaveGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
|
|
2050
|
+
/** Delete every message authored by the caller across a guild (sudo). */
|
|
2051
|
+
bulkDeleteMyMessagesInGuild(guildId: string, options?: SudoVerificationOptions): Promise<void>;
|
|
1586
2052
|
}
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
2053
|
+
|
|
2054
|
+
/** Options for GET /channels/{id}/messages. */
|
|
2055
|
+
interface FetchMessagesOptions {
|
|
2056
|
+
limit?: number;
|
|
2057
|
+
before?: string;
|
|
2058
|
+
after?: string;
|
|
2059
|
+
around?: string;
|
|
1591
2060
|
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
2061
|
+
/** Options for {@link Client.bulkFetchMessages}. */
|
|
2062
|
+
interface BulkFetchMessagesOptions {
|
|
2063
|
+
/** When true (default), hydrate {@link Message}s and update the cache. */
|
|
2064
|
+
hydrate?: boolean;
|
|
2065
|
+
}
|
|
2066
|
+
/** One channel's slice of a bulk message fetch. */
|
|
2067
|
+
interface BulkFetchMessagesChannelResult {
|
|
2068
|
+
channelId: string;
|
|
2069
|
+
messages: Collection<string, Message>;
|
|
2070
|
+
}
|
|
2071
|
+
/** Result of {@link MessageManager.bulkFetch}: per-channel message collections. */
|
|
2072
|
+
interface BulkFetchMessagesResult {
|
|
2073
|
+
channels: BulkFetchMessagesChannelResult[];
|
|
1595
2074
|
}
|
|
1596
2075
|
/**
|
|
1597
|
-
*
|
|
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).
|
|
2076
|
+
* Per-channel message cache + fetch. Access via `channel.messages`.
|
|
1601
2077
|
*
|
|
1602
|
-
*
|
|
1603
|
-
*
|
|
1604
|
-
* collector.on('collect', (reaction, user) => console.log(user.username, 'reacted', reaction.emoji.name));
|
|
1605
|
-
* collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
|
|
2078
|
+
* `fetch` always writes through the client message cache (when enabled) and
|
|
2079
|
+
* constructs {@link Message} from the cached payload so `get` stays coherent.
|
|
1606
2080
|
*/
|
|
1607
|
-
declare class
|
|
1608
|
-
readonly client
|
|
1609
|
-
readonly
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
private
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
2081
|
+
declare class MessageManager {
|
|
2082
|
+
private readonly client;
|
|
2083
|
+
private readonly channelId;
|
|
2084
|
+
constructor(client: Client, channelId: string);
|
|
2085
|
+
/** Retrieve a cached message by ID, or `undefined` if missing / caching disabled. */
|
|
2086
|
+
get(messageId: string): Message | undefined;
|
|
2087
|
+
/** Fetch a single message by ID. */
|
|
2088
|
+
fetch(messageId: string): Promise<Message>;
|
|
2089
|
+
/** Fetch multiple messages with query options (limit, before, after, around). */
|
|
2090
|
+
fetch(options: FetchMessagesOptions): Promise<Collection<string, Message>>;
|
|
2091
|
+
/** Cache API data and return a {@link Message} built from the cached entry when present. */
|
|
2092
|
+
private wrap;
|
|
2093
|
+
/** Fetch a single message from the API. */
|
|
2094
|
+
private fetchOne;
|
|
2095
|
+
/** Fetch multiple messages from the API with pagination/filtering. */
|
|
2096
|
+
private fetchMany;
|
|
1622
2097
|
}
|
|
1623
2098
|
|
|
1624
|
-
/**
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
2099
|
+
/** Map a wire pack summary to camelCase. */
|
|
2100
|
+
declare function toPackSummaryPayload(data: APIPackSummary): PackSummaryPayload;
|
|
2101
|
+
/** CamelCase pack dashboard section. */
|
|
2102
|
+
interface PackDashboardSectionPayload {
|
|
2103
|
+
installedLimit: number;
|
|
2104
|
+
createdLimit: number;
|
|
2105
|
+
installed: PackSummaryPayload[];
|
|
2106
|
+
created: PackSummaryPayload[];
|
|
1632
2107
|
}
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
2108
|
+
/** CamelCase pack dashboard. */
|
|
2109
|
+
interface PackDashboardPayload {
|
|
2110
|
+
emoji: PackDashboardSectionPayload;
|
|
2111
|
+
sticker: PackDashboardSectionPayload;
|
|
2112
|
+
}
|
|
2113
|
+
/** REST wrappers for `/packs/*`. Access via `client.packs`. */
|
|
2114
|
+
declare class PackManager {
|
|
2115
|
+
private readonly client;
|
|
2116
|
+
constructor(client: Client);
|
|
2117
|
+
/** Fetch the current user's pack dashboard (camelCase summaries). */
|
|
2118
|
+
fetchDashboard(): Promise<PackDashboardPayload>;
|
|
2119
|
+
/** Create a pack. */
|
|
2120
|
+
create(packType: PackType, body: PackCreateOptions): Promise<PackSummaryPayload>;
|
|
2121
|
+
/** Edit a pack. */
|
|
2122
|
+
edit(packId: string, body: PackEditOptions): Promise<PackSummaryPayload>;
|
|
2123
|
+
/** Delete a pack. */
|
|
2124
|
+
delete(packId: string): Promise<void>;
|
|
2125
|
+
/** Install a pack for the current user. */
|
|
2126
|
+
install(packId: string): Promise<void>;
|
|
2127
|
+
/** Uninstall a pack for the current user. */
|
|
2128
|
+
uninstall(packId: string): Promise<void>;
|
|
2129
|
+
/** List invites for a pack. */
|
|
2130
|
+
listInvites(packId: string): Promise<PackInvitePayload[]>;
|
|
2131
|
+
/** Create an invite for a pack. */
|
|
2132
|
+
createInvite(packId: string, options?: PackInviteCreateOptions): Promise<PackInvitePayload>;
|
|
2133
|
+
/** List emojis in a pack. */
|
|
2134
|
+
listEmojis(packId: string): Promise<PackEmojiPayload[]>;
|
|
2135
|
+
/** Create an emoji in a pack. */
|
|
2136
|
+
createEmoji(packId: string, options: ExpressionCreateOptions): Promise<PackEmojiPayload>;
|
|
2137
|
+
/** Bulk-create emojis in a pack. */
|
|
2138
|
+
createEmojisBulk(packId: string, emojis: ExpressionCreateOptions[]): Promise<PackBulkCreatePayload<PackEmojiPayload>>;
|
|
2139
|
+
/** Edit an emoji in a pack. */
|
|
2140
|
+
editEmoji(packId: string, emojiId: string, options: ExpressionEditOptions): Promise<PackEmojiPayload>;
|
|
2141
|
+
/** Delete an emoji from a pack. */
|
|
2142
|
+
deleteEmoji(packId: string, emojiId: string): Promise<void>;
|
|
2143
|
+
/** List stickers in a pack. */
|
|
2144
|
+
listStickers(packId: string): Promise<PackStickerPayload[]>;
|
|
2145
|
+
/** Create a sticker in a pack. */
|
|
2146
|
+
createSticker(packId: string, options: StickerCreateOptions): Promise<PackStickerPayload>;
|
|
2147
|
+
/** Bulk-create stickers in a pack. */
|
|
2148
|
+
createStickersBulk(packId: string, stickers: StickerCreateOptions[]): Promise<PackBulkCreatePayload<PackStickerPayload>>;
|
|
2149
|
+
/** Edit a sticker in a pack. */
|
|
2150
|
+
editSticker(packId: string, stickerId: string, options: StickerEditOptions): Promise<PackStickerPayload>;
|
|
2151
|
+
/** Delete a sticker from a pack. */
|
|
2152
|
+
deleteSticker(packId: string, stickerId: string): Promise<void>;
|
|
1640
2153
|
}
|
|
1641
2154
|
|
|
1642
|
-
type
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
2155
|
+
type MemberPayload = APIGuildMember & {
|
|
2156
|
+
user: {
|
|
2157
|
+
id: string;
|
|
2158
|
+
};
|
|
1646
2159
|
};
|
|
1647
|
-
/**
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
readonly
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
readonly attachments: Collection<string, APIMessageAttachment>;
|
|
1669
|
-
/** Message type (Default, Reply, etc.). */
|
|
1670
|
-
readonly type: MessageType;
|
|
1671
|
-
/** Message flags bitfield. */
|
|
1672
|
-
readonly flags: number;
|
|
1673
|
-
/** Whether `@everyone` or `@here` was mentioned. */
|
|
1674
|
-
readonly mentionEveryone: boolean;
|
|
1675
|
-
/** Whether this is a text-to-speech message. */
|
|
1676
|
-
readonly tts: boolean;
|
|
1677
|
-
/** Embedded content (rich previews, etc.). */
|
|
1678
|
-
readonly embeds: APIEmbed[];
|
|
1679
|
-
/** Stickers sent with the message. */
|
|
1680
|
-
readonly stickers: APIMessageSticker[];
|
|
1681
|
-
/** Reactions on the message. */
|
|
1682
|
-
readonly reactions: APIMessageReaction[];
|
|
1683
|
-
/** Reference to a replied-to message, if any. */
|
|
1684
|
-
readonly messageReference: APIMessageReference | null;
|
|
1685
|
-
/** Message snapshots for forwarded messages. */
|
|
1686
|
-
readonly messageSnapshots: APIMessageSnapshot[];
|
|
1687
|
-
/** Call data if this message represents a call event. */
|
|
1688
|
-
readonly call: APIMessageCall | null;
|
|
1689
|
-
/** The full referenced (replied-to) message, or null. */
|
|
1690
|
-
readonly referencedMessage: Message | null;
|
|
1691
|
-
/** Webhook ID if sent by a webhook. */
|
|
1692
|
-
readonly webhookId: string | null;
|
|
1693
|
-
/** Users mentioned in the message. */
|
|
1694
|
-
readonly mentions: User[];
|
|
1695
|
-
/** Role IDs mentioned in the message. */
|
|
1696
|
-
readonly mentionRoles: string[];
|
|
1697
|
-
/** Client-side nonce for deduplication. */
|
|
1698
|
-
readonly nonce: string | null;
|
|
1699
|
-
/** Cached text/DM/guild channel, or null if uncached. */
|
|
1700
|
-
get channel(): (TextChannel | DMChannel | GuildChannel) | null;
|
|
1701
|
-
/** Cached guild, or null for DMs / uncached. */
|
|
1702
|
-
get guild(): Guild | null;
|
|
1703
|
-
/** Fetch and resolve the channel this message is in. */
|
|
1704
|
-
resolveChannel(): Promise<Channel>;
|
|
1705
|
-
/** Fetch and resolve the guild, or null if a DM. */
|
|
1706
|
-
resolveGuild(): Promise<Guild | null>;
|
|
1707
|
-
/**
|
|
1708
|
-
* Construct a message from API data.
|
|
1709
|
-
* @param data - API message from REST or MESSAGE_CREATE
|
|
1710
|
-
*/
|
|
1711
|
-
constructor(client: Client, data: APIMessage);
|
|
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>;
|
|
2160
|
+
/** Result of {@link UserManager.fetchWithProfile}. */
|
|
2161
|
+
interface FetchedUserWithProfile {
|
|
2162
|
+
user: User;
|
|
2163
|
+
userData: APIUserPartial;
|
|
2164
|
+
globalProfile: ProfilePayload | null;
|
|
2165
|
+
serverProfile: ProfilePayload | null;
|
|
2166
|
+
member: GuildMember | null;
|
|
2167
|
+
memberData: MemberPayload | null;
|
|
2168
|
+
}
|
|
2169
|
+
/**
|
|
2170
|
+
* User cache + fetch/profile helpers.
|
|
2171
|
+
* Extends LimitedCollection (`.get()`, `.set()`, `.filter()`, …).
|
|
2172
|
+
* Access via {@link Client.users}.
|
|
2173
|
+
*/
|
|
2174
|
+
declare class UserManager extends LimitedCollection<string, User> {
|
|
2175
|
+
private readonly client;
|
|
2176
|
+
constructor(client: Client);
|
|
2177
|
+
/** Remove matching users (skips `client.user`). Returns count removed. */
|
|
2178
|
+
sweep(filter?: (user: User, id: string) => boolean): number;
|
|
2179
|
+
/** Fetch a user by ID and update cache. */
|
|
2180
|
+
fetch(userId: string): Promise<User>;
|
|
1716
2181
|
/**
|
|
1717
|
-
*
|
|
2182
|
+
* Fetch user + profiles (+ optional guild member). Ideal for userinfo commands.
|
|
1718
2183
|
* @example
|
|
1719
|
-
* await
|
|
1720
|
-
*
|
|
1721
|
-
*
|
|
2184
|
+
* const { user, globalProfile, member } = await client.users.fetchWithProfile(
|
|
2185
|
+
* userId,
|
|
2186
|
+
* { guildId: message.guildId ?? undefined },
|
|
2187
|
+
* );
|
|
1722
2188
|
*/
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
channel_id: string;
|
|
1727
|
-
message_id: string;
|
|
1728
|
-
guild_id?: string;
|
|
1729
|
-
}, ping?: boolean): Promise<MessagePayload>;
|
|
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
|
-
}>;
|
|
2189
|
+
fetchWithProfile(userId: string, options?: {
|
|
2190
|
+
guildId?: string | null;
|
|
2191
|
+
}): Promise<FetchedUserWithProfile>;
|
|
1768
2192
|
}
|
|
1769
2193
|
|
|
1770
|
-
/**
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
2194
|
+
/** Event name constants for client.on(Events.X, handler). Use with ClientEvents for typed callbacks. */
|
|
2195
|
+
declare const Events: {
|
|
2196
|
+
readonly Ready: "ready";
|
|
2197
|
+
readonly MessageCreate: "messageCreate";
|
|
2198
|
+
readonly MessageUpdate: "messageUpdate";
|
|
2199
|
+
readonly MessageDelete: "messageDelete";
|
|
2200
|
+
readonly MessageDeleteBulk: "messageDeleteBulk";
|
|
2201
|
+
readonly MessageReactionAdd: "messageReactionAdd";
|
|
2202
|
+
readonly MessageReactionAddMany: "messageReactionAddMany";
|
|
2203
|
+
readonly MessageReactionRemove: "messageReactionRemove";
|
|
2204
|
+
readonly MessageReactionRemoveAll: "messageReactionRemoveAll";
|
|
2205
|
+
readonly MessageReactionRemoveEmoji: "messageReactionRemoveEmoji";
|
|
2206
|
+
readonly GuildCreate: "guildCreate";
|
|
2207
|
+
readonly GuildAvailable: "guildAvailable";
|
|
2208
|
+
readonly GuildUnavailable: "guildUnavailable";
|
|
2209
|
+
readonly GuildUpdate: "guildUpdate";
|
|
2210
|
+
readonly GuildDelete: "guildDelete";
|
|
2211
|
+
readonly GuildBanAdd: "guildBanAdd";
|
|
2212
|
+
readonly GuildBanRemove: "guildBanRemove";
|
|
2213
|
+
readonly GuildAuditLogEntryCreate: "guildAuditLogEntryCreate";
|
|
2214
|
+
readonly GuildEmojisUpdate: "guildEmojisUpdate";
|
|
2215
|
+
readonly GuildStickersUpdate: "guildStickersUpdate";
|
|
2216
|
+
readonly GuildCountsUpdate: "guildCountsUpdate";
|
|
2217
|
+
readonly ChannelMemberCountsUpdate: "channelMemberCountsUpdate";
|
|
2218
|
+
readonly GuildMemberAdd: "guildMemberAdd";
|
|
2219
|
+
readonly GuildMemberUpdate: "guildMemberUpdate";
|
|
2220
|
+
readonly GuildMemberRemove: "guildMemberRemove";
|
|
2221
|
+
readonly GuildMembersChunk: "guildMembersChunk";
|
|
2222
|
+
readonly GuildRoleCreate: "guildRoleCreate";
|
|
2223
|
+
readonly GuildRoleUpdate: "guildRoleUpdate";
|
|
2224
|
+
readonly GuildRoleDelete: "guildRoleDelete";
|
|
2225
|
+
readonly ChannelCreate: "channelCreate";
|
|
2226
|
+
readonly ChannelUpdate: "channelUpdate";
|
|
2227
|
+
readonly ChannelDelete: "channelDelete";
|
|
2228
|
+
readonly ChannelPinsUpdate: "channelPinsUpdate";
|
|
2229
|
+
readonly ChannelRecipientAdd: "channelRecipientAdd";
|
|
2230
|
+
readonly ChannelRecipientRemove: "channelRecipientRemove";
|
|
2231
|
+
readonly InviteCreate: "inviteCreate";
|
|
2232
|
+
readonly InviteDelete: "inviteDelete";
|
|
2233
|
+
readonly TypingStart: "typingStart";
|
|
2234
|
+
readonly UserUpdate: "userUpdate";
|
|
2235
|
+
readonly UserConnectionsUpdate: "userConnectionsUpdate";
|
|
2236
|
+
readonly WebAuthnCredentialsUpdate: "webauthnCredentialsUpdate";
|
|
2237
|
+
readonly PresenceUpdate: "presenceUpdate";
|
|
2238
|
+
readonly PresenceUpdateBulk: "presenceUpdateBulk";
|
|
2239
|
+
readonly VoiceStateUpdate: "voiceStateUpdate";
|
|
2240
|
+
readonly VoiceStateAck: "voiceStateAck";
|
|
2241
|
+
readonly VoiceServerUpdate: "voiceServerUpdate";
|
|
2242
|
+
readonly EntranceSoundPlay: "entranceSoundPlay";
|
|
2243
|
+
readonly VoiceStatesSync: "voiceStatesSync";
|
|
2244
|
+
readonly WebhooksUpdate: "webhooksUpdate";
|
|
2245
|
+
readonly Resumed: "resumed";
|
|
2246
|
+
readonly Error: "error";
|
|
2247
|
+
readonly Debug: "debug";
|
|
2248
|
+
};
|
|
2249
|
+
|
|
2250
|
+
/** Hosted Fluxer production endpoints (default when no instance is configured). */
|
|
2251
|
+
declare const DEFAULT_INSTANCE_ENDPOINTS: Readonly<APIInstanceEndpoints>;
|
|
2252
|
+
/** Immutable resolved instance descriptor attached to each {@link Client}. */
|
|
2253
|
+
interface ResolvedInstance {
|
|
2254
|
+
readonly endpoints: Readonly<APIInstanceEndpoints>;
|
|
2255
|
+
/** Full discovery document when available (fromDiscovery / fetchInstance). */
|
|
2256
|
+
readonly discovery: Readonly<APIInstance> | null;
|
|
1788
2257
|
}
|
|
2258
|
+
/** Strip trailing `/vN` and trailing slash from an API origin. */
|
|
2259
|
+
declare function normalizeApiOrigin(api: string): string;
|
|
1789
2260
|
/**
|
|
1790
|
-
*
|
|
1791
|
-
*
|
|
1792
|
-
* `fetch` always writes through the client message cache (when enabled) and
|
|
1793
|
-
* constructs {@link Message} from the cached payload so `get` stays coherent.
|
|
2261
|
+
* Validate a raw discovery payload and return a typed {@link APIInstance}.
|
|
2262
|
+
* @throws FluxerError with {@link ErrorCodes.InvalidInstanceDiscovery}
|
|
1794
2263
|
*/
|
|
1795
|
-
declare
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
/** Fetch multiple messages with query options (limit, before, after, around). */
|
|
1804
|
-
fetch(options: FetchMessagesOptions): Promise<Collection<string, Message>>;
|
|
1805
|
-
/** Cache API data and return a {@link Message} built from the cached entry when present. */
|
|
1806
|
-
private wrap;
|
|
1807
|
-
/** Fetch a single message from the API. */
|
|
1808
|
-
private fetchOne;
|
|
1809
|
-
/** Fetch multiple messages from the API with pagination/filtering. */
|
|
1810
|
-
private fetchMany;
|
|
1811
|
-
}
|
|
2264
|
+
declare function parseInstanceDiscovery(raw: unknown): APIInstance;
|
|
2265
|
+
/**
|
|
2266
|
+
* Merge partial endpoint overrides onto hosted defaults.
|
|
2267
|
+
* Accepts either a full {@link APIInstance} or a partial endpoint map.
|
|
2268
|
+
*/
|
|
2269
|
+
declare function resolveInstanceEndpoints(input?: Partial<APIInstanceEndpoints> | APIInstance | null): ResolvedInstance;
|
|
2270
|
+
/** Build an invite URL for a code using the instance invite base. */
|
|
2271
|
+
declare function inviteUrl(inviteBase: string, code: string): string;
|
|
1812
2272
|
|
|
2273
|
+
/** Options for {@link MessageCollector} / `channel.createMessageCollector()`. */
|
|
1813
2274
|
interface MessageCollectorOptions {
|
|
1814
2275
|
/** Filter function. Return true to collect the message. */
|
|
1815
2276
|
filter?: (message: Message) => boolean;
|
|
@@ -1819,6 +2280,7 @@ interface MessageCollectorOptions {
|
|
|
1819
2280
|
max?: number;
|
|
1820
2281
|
}
|
|
1821
2282
|
type MessageCollectorEndReason = 'time' | 'limit' | 'user';
|
|
2283
|
+
/** Typed event map for {@link MessageCollector}: `collect` per message, `end` when it stops. */
|
|
1822
2284
|
interface MessageCollectorEvents {
|
|
1823
2285
|
collect: [message: Message];
|
|
1824
2286
|
end: [collected: Collection<string, Message>, reason: MessageCollectorEndReason];
|
|
@@ -1914,6 +2376,8 @@ declare const TextChannel_base: (abstract new (...args: any[]) => {
|
|
|
1914
2376
|
name: string | null;
|
|
1915
2377
|
icon: string | null;
|
|
1916
2378
|
lastPinTimestamp: string | null;
|
|
2379
|
+
get createdTimestamp(): number;
|
|
2380
|
+
get createdAt(): Date;
|
|
1917
2381
|
_patch(data: _fluxerjs_types.APIChannelPartial | APIChannel): void;
|
|
1918
2382
|
isTextBased(): this is TextChannel | DMChannel;
|
|
1919
2383
|
isDM(): this is DMChannel;
|
|
@@ -1979,6 +2443,8 @@ declare const DMChannel_base: (abstract new (...args: any[]) => {
|
|
|
1979
2443
|
name: string | null;
|
|
1980
2444
|
icon: string | null;
|
|
1981
2445
|
lastPinTimestamp: string | null;
|
|
2446
|
+
get createdTimestamp(): number;
|
|
2447
|
+
get createdAt(): Date;
|
|
1982
2448
|
_patch(data: APIChannelPartial | APIChannel): void;
|
|
1983
2449
|
isTextBased(): this is TextChannel | DMChannel;
|
|
1984
2450
|
isDM(): this is DMChannel;
|
|
@@ -2007,7 +2473,7 @@ declare class DMChannel extends DMChannel_base {
|
|
|
2007
2473
|
recipients: User[];
|
|
2008
2474
|
/** Custom nicknames for users in a group DM. */
|
|
2009
2475
|
nicks: Record<string, string>;
|
|
2010
|
-
constructor(client: Client, data: APIChannelPartial
|
|
2476
|
+
constructor(client: Client, data: APIChannelPartial | APIChannel);
|
|
2011
2477
|
/** Purge all messages from personal notes. Only works on personal notes channels. */
|
|
2012
2478
|
purgeMessages(): Promise<number>;
|
|
2013
2479
|
/** Pin this DM channel to the top of the DM list. */
|
|
@@ -2037,12 +2503,16 @@ declare abstract class Channel extends Base {
|
|
|
2037
2503
|
/** ISO8601 timestamp of the last pinned message update. */
|
|
2038
2504
|
lastPinTimestamp: string | null;
|
|
2039
2505
|
constructor(client: Client, data: APIChannelPartial);
|
|
2506
|
+
/** Unix timestamp (ms) when this channel was created, derived from its snowflake ID. */
|
|
2507
|
+
get createdTimestamp(): number;
|
|
2508
|
+
/** Date when this channel was created, derived from its snowflake ID. */
|
|
2509
|
+
get createdAt(): Date;
|
|
2040
2510
|
/**
|
|
2041
2511
|
* Apply shared channel fields in place (gateway CHANNEL_UPDATE when type is unchanged).
|
|
2042
2512
|
* @internal
|
|
2043
2513
|
*/
|
|
2044
2514
|
_patch(data: APIChannelPartial | APIChannel): void;
|
|
2045
|
-
/** Wired in `structures/
|
|
2515
|
+
/** Wired in `structures/channel/index.ts` after subclasses load. */
|
|
2046
2516
|
static from(_c: Client, _d: APIChannel | APIChannelPartial): GuildChannel | TextChannel;
|
|
2047
2517
|
static fromOrCreate(_c: Client, _d: APIChannel | APIChannelPartial): TextChannel | DMChannel | GuildChannel;
|
|
2048
2518
|
static createDM(_c: Client, _d: APIChannelPartial): DMChannel;
|
|
@@ -2085,379 +2555,92 @@ declare abstract class Channel extends Base {
|
|
|
2085
2555
|
}
|
|
2086
2556
|
|
|
2087
2557
|
/**
|
|
2088
|
-
*
|
|
2089
|
-
*
|
|
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>;
|
|
2104
|
-
/**
|
|
2105
|
-
* Fetch a message by channel + message ID (no channel resolve required).
|
|
2106
|
-
* Prefer `channel.messages.fetch(messageId)` when you already have a text channel.
|
|
2107
|
-
*/
|
|
2108
|
-
fetchMessage(channelId: string, messageId: string): Promise<Message>;
|
|
2109
|
-
/**
|
|
2110
|
-
* Send to a channel by ID without resolving it first.
|
|
2111
|
-
* @example
|
|
2112
|
-
* await client.channels.send(logChannelId, 'User joined!');
|
|
2113
|
-
*/
|
|
2114
|
-
send(channelId: string, payload: MessagePrepareInput): Promise<Message>;
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
/**
|
|
2118
|
-
* Guild cache and manager with fetch.
|
|
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
|
-
}
|
|
2140
|
-
|
|
2141
|
-
/**
|
|
2142
|
-
* Optional cache size limits (FIFO eviction when exceeded).
|
|
2143
|
-
* Use `0` for unbounded growth on that bucket.
|
|
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
|
-
* ```
|
|
2558
|
+
* Guild member — roles via {@link GuildMember.roles}, permissions via {@link permissions} / {@link permissionsIn}.
|
|
2559
|
+
* Cached per guild in {@link Guild.members}.
|
|
2173
2560
|
*/
|
|
2174
|
-
|
|
2175
|
-
/**
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
/**
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
/**
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
* @example
|
|
2207
|
-
* ```ts
|
|
2208
|
-
* defaultAllowedMentions: {
|
|
2209
|
-
* parse: ['users'],
|
|
2210
|
-
* repliedUser: false,
|
|
2211
|
-
* }
|
|
2212
|
-
* ```
|
|
2213
|
-
*/
|
|
2214
|
-
defaultAllowedMentions?: {
|
|
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
|
-
};
|
|
2224
|
-
/**
|
|
2225
|
-
* Default reply ping for `message.reply` when `ping` is omitted.
|
|
2226
|
-
* @default true
|
|
2227
|
-
*/
|
|
2228
|
-
defaultReplyPing?: boolean;
|
|
2561
|
+
declare class GuildMember extends Base {
|
|
2562
|
+
/** Parent client instance. */
|
|
2563
|
+
readonly client: Client;
|
|
2564
|
+
/** User ID (same as `user.id`). */
|
|
2565
|
+
readonly id: string;
|
|
2566
|
+
/** The underlying {@link User}. */
|
|
2567
|
+
readonly user: User;
|
|
2568
|
+
/** The guild this member belongs to. */
|
|
2569
|
+
readonly guild: Guild;
|
|
2570
|
+
/** Guild-specific nickname (null = use global name or username). */
|
|
2571
|
+
nick: string | null;
|
|
2572
|
+
/** Role manager for this member. */
|
|
2573
|
+
readonly roles: GuildMemberRoleManager;
|
|
2574
|
+
/** When this member joined the guild. */
|
|
2575
|
+
readonly joinedAt: Date;
|
|
2576
|
+
/** Timeout end date (null = not timed out). */
|
|
2577
|
+
communicationDisabledUntil: Date | null;
|
|
2578
|
+
/** Whether this member is voice-muted. */
|
|
2579
|
+
mute: boolean;
|
|
2580
|
+
/** Whether this member is voice-deafened. */
|
|
2581
|
+
deaf: boolean;
|
|
2582
|
+
/** Guild-specific avatar hash (null = use user avatar). */
|
|
2583
|
+
avatar: string | null;
|
|
2584
|
+
/** Guild-specific banner hash. */
|
|
2585
|
+
banner: string | null;
|
|
2586
|
+
/** Guild-specific accent color (24-bit RGB). */
|
|
2587
|
+
accentColor: number | null;
|
|
2588
|
+
/** Guild-specific profile flags. */
|
|
2589
|
+
profileFlags: number | null;
|
|
2590
|
+
constructor(client: Client, data: APIGuildMember & {
|
|
2591
|
+
guild_id?: string;
|
|
2592
|
+
}, guild: Guild);
|
|
2229
2593
|
/**
|
|
2230
|
-
*
|
|
2594
|
+
* Apply an API member payload in place (gateway GUILD_MEMBER_UPDATE / REST edit).
|
|
2595
|
+
* @internal
|
|
2231
2596
|
*/
|
|
2232
|
-
|
|
2597
|
+
_patch(data: APIGuildMember): void;
|
|
2233
2598
|
/**
|
|
2234
|
-
*
|
|
2235
|
-
* @
|
|
2599
|
+
* Snapshot for `guildMemberUpdate` old-member arg (before in-place patch).
|
|
2600
|
+
* @internal
|
|
2236
2601
|
*/
|
|
2237
|
-
|
|
2602
|
+
_clone(): GuildMember;
|
|
2603
|
+
get displayName(): string;
|
|
2604
|
+
/** Renders a mention for this member: `<@id>`. */
|
|
2605
|
+
toString(): string;
|
|
2606
|
+
avatarURL(options?: {
|
|
2607
|
+
size?: number;
|
|
2608
|
+
extension?: string;
|
|
2609
|
+
}): string | null;
|
|
2610
|
+
displayAvatarURL(options?: {
|
|
2611
|
+
size?: number;
|
|
2612
|
+
extension?: string;
|
|
2613
|
+
}): string;
|
|
2614
|
+
bannerURL(options?: {
|
|
2615
|
+
size?: number;
|
|
2616
|
+
extension?: string;
|
|
2617
|
+
}): string | null;
|
|
2618
|
+
/** PATCH member (`/members/@me` when editing the bot). */
|
|
2619
|
+
edit(options: GuildMemberEditOptions): Promise<this>;
|
|
2238
2620
|
/**
|
|
2239
|
-
*
|
|
2240
|
-
* @
|
|
2621
|
+
* Guild-level permissions (roles only, no channel overwrites).
|
|
2622
|
+
* @see {@link permissionsIn} for channel-specific permissions
|
|
2241
2623
|
*/
|
|
2242
|
-
|
|
2624
|
+
get permissions(): PermissionsBitField;
|
|
2243
2625
|
/**
|
|
2244
|
-
*
|
|
2245
|
-
*
|
|
2626
|
+
* Effective permissions in a channel (roles + overwrites).
|
|
2627
|
+
* @param channel - The guild channel
|
|
2628
|
+
* @returns Computed permissions bitfield
|
|
2246
2629
|
*/
|
|
2247
|
-
|
|
2248
|
-
send(data: string | ArrayBufferLike): void;
|
|
2249
|
-
close(code?: number): void;
|
|
2250
|
-
readyState: number;
|
|
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>;
|
|
2630
|
+
permissionsIn(channel: GuildChannel): PermissionsBitField;
|
|
2321
2631
|
/**
|
|
2322
|
-
*
|
|
2323
|
-
* @
|
|
2324
|
-
*
|
|
2325
|
-
* userId,
|
|
2326
|
-
* { guildId: message.guildId ?? undefined },
|
|
2327
|
-
* );
|
|
2632
|
+
* Move to a voice channel, or `null` to disconnect. Requires Move Members.
|
|
2633
|
+
* @param channelId - Voice channel ID or null to disconnect
|
|
2634
|
+
* @param connectionId - Optional connection ID for multi-session scenarios
|
|
2328
2635
|
*/
|
|
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;
|
|
2636
|
+
move(channelId: string | null, connectionId?: string | null): Promise<void>;
|
|
2637
|
+
private _effectivePermissions;
|
|
2638
|
+
private _basePermissions;
|
|
2453
2639
|
}
|
|
2454
2640
|
|
|
2455
2641
|
/**
|
|
2456
|
-
|
|
2457
2642
|
* Callback parameter types for client events. Use with client.on(Events.X, handler).
|
|
2458
|
-
|
|
2459
2643
|
* @see Events
|
|
2460
|
-
|
|
2461
2644
|
*/
|
|
2462
2645
|
interface ClientEvents {
|
|
2463
2646
|
[Events.Ready]: [];
|
|
@@ -2500,6 +2683,8 @@ interface ClientEvents {
|
|
|
2500
2683
|
[Events.GuildRoleUpdate]: [payload: GuildRoleUpdatePayload];
|
|
2501
2684
|
[Events.GuildRoleDelete]: [payload: GuildRoleDeletePayload];
|
|
2502
2685
|
[Events.ChannelPinsUpdate]: [payload: ChannelPinsUpdatePayload];
|
|
2686
|
+
[Events.ChannelRecipientAdd]: [payload: ChannelRecipientPayload];
|
|
2687
|
+
[Events.ChannelRecipientRemove]: [payload: ChannelRecipientPayload];
|
|
2503
2688
|
[Events.InviteCreate]: [invite: Invite];
|
|
2504
2689
|
[Events.InviteDelete]: [payload: InviteDeletePayload];
|
|
2505
2690
|
[Events.TypingStart]: [payload: TypingStartPayload];
|
|
@@ -2520,6 +2705,36 @@ type ClientEventMethods = {
|
|
|
2520
2705
|
[K in keyof typeof Events]: (cb: (...args: ClientEvents[(typeof Events)[K]]) => void) => Client;
|
|
2521
2706
|
};
|
|
2522
2707
|
|
|
2708
|
+
/**
|
|
2709
|
+
* Guild cache and manager with fetch.
|
|
2710
|
+
* Extends {@link LimitedCollection} so you can use `.get()`, `.set()`, `.filter()`, etc.
|
|
2711
|
+
* FIFO-evicts (and cascades nested caches) when at the resolved `cache.guilds` limit.
|
|
2712
|
+
*/
|
|
2713
|
+
declare class GuildManager extends LimitedCollection<string, Guild> {
|
|
2714
|
+
private readonly client;
|
|
2715
|
+
constructor(client: Client);
|
|
2716
|
+
/**
|
|
2717
|
+
* Remove a guild and cascade its channels / message caches.
|
|
2718
|
+
* FIFO eviction uses `onEvict` instead (via `super.delete` in LimitedCollection).
|
|
2719
|
+
*/
|
|
2720
|
+
delete(key: string): boolean;
|
|
2721
|
+
/**
|
|
2722
|
+
* Get a guild from cache or fetch from the API if not present.
|
|
2723
|
+
* @param guildId - Snowflake of the guild
|
|
2724
|
+
* @returns The guild
|
|
2725
|
+
* @throws FluxerError with GUILD_NOT_FOUND if missing
|
|
2726
|
+
*/
|
|
2727
|
+
resolve(guildId: string): Promise<Guild>;
|
|
2728
|
+
/**
|
|
2729
|
+
* Fetch a guild by ID.
|
|
2730
|
+
* Returns the cached guild unless `force` is set, in which case REST metadata is applied via `_patch`.
|
|
2731
|
+
* @throws FluxerError with GUILD_NOT_FOUND if missing
|
|
2732
|
+
*/
|
|
2733
|
+
fetch(guildId: string, options?: {
|
|
2734
|
+
force?: boolean;
|
|
2735
|
+
}): Promise<Guild>;
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2523
2738
|
/** Bootstrap origin for {@link Client.fromDiscovery}. */
|
|
2524
2739
|
type DiscoveryOrigin = string | {
|
|
2525
2740
|
api: string;
|
|
@@ -2540,6 +2755,8 @@ declare class Client extends EventEmitter {
|
|
|
2540
2755
|
readonly channels: ChannelManager;
|
|
2541
2756
|
/** User cache and manager. */
|
|
2542
2757
|
readonly users: UserManager;
|
|
2758
|
+
/** Cache limits, stats, sweeps, and cascade entry points. */
|
|
2759
|
+
readonly cache: CacheController;
|
|
2543
2760
|
/** Emoji/sticker pack REST wrappers (`/packs/*`). */
|
|
2544
2761
|
readonly packs: PackManager;
|
|
2545
2762
|
/** Typed event handlers. Prefer `client.events.*` or `client.on(Events.*, ...)`. */
|
|
@@ -2559,6 +2776,8 @@ declare class Client extends EventEmitter {
|
|
|
2559
2776
|
private readonly _messageCache;
|
|
2560
2777
|
/** Resolved client options (cache defaults applied). */
|
|
2561
2778
|
readonly options: ClientOptions;
|
|
2779
|
+
/** Structured logger (zero-dep). */
|
|
2780
|
+
readonly logger: Logger;
|
|
2562
2781
|
constructor(options?: ClientOptions);
|
|
2563
2782
|
/**
|
|
2564
2783
|
* Create a client from instance discovery (`GET /.well-known/fluxer`).
|
|
@@ -2659,8 +2878,14 @@ declare class Client extends EventEmitter {
|
|
|
2659
2878
|
_removeMessageFromCache(channelId: string, messageId: string): void;
|
|
2660
2879
|
/** @internal */
|
|
2661
2880
|
_clearMessageCache(channelId: string): void;
|
|
2881
|
+
/** @internal */
|
|
2882
|
+
_messageCacheStats(): {
|
|
2883
|
+
channels: number;
|
|
2884
|
+
messages: number;
|
|
2885
|
+
};
|
|
2662
2886
|
/**
|
|
2663
2887
|
* Sweep cached messages (remove entries matching filter).
|
|
2888
|
+
* Prefer {@link CacheController.sweepMessages} (`client.cache.sweepMessages`).
|
|
2664
2889
|
* @param filter - Predicate to test each message (return true to remove)
|
|
2665
2890
|
* @param channelId - Optional channel ID to scope sweep
|
|
2666
2891
|
* @returns Count of messages removed
|
|
@@ -2668,6 +2893,7 @@ declare class Client extends EventEmitter {
|
|
|
2668
2893
|
sweepMessages(filter?: (message: APIMessage, channelId: string) => boolean, channelId?: string): number;
|
|
2669
2894
|
/**
|
|
2670
2895
|
* Sweep cached members across all guilds (remove entries matching filter).
|
|
2896
|
+
* Prefer {@link CacheController.sweepMembers} (`client.cache.sweepMembers`).
|
|
2671
2897
|
* @param filter - Predicate to test each member (return true to remove)
|
|
2672
2898
|
* @returns Total count of members removed
|
|
2673
2899
|
*/
|
|
@@ -2690,14 +2916,25 @@ declare class Client extends EventEmitter {
|
|
|
2690
2916
|
* @param payload - Gateway send payload (opcode + data)
|
|
2691
2917
|
*/
|
|
2692
2918
|
sendToGateway(shardId: number, payload: GatewaySendPayload): void;
|
|
2919
|
+
/**
|
|
2920
|
+
* Request guild members via gateway opcode 8 (`GUILD_MEMBERS_CHUNK` responses).
|
|
2921
|
+
* Provide `guildId` and/or `guildIds`.
|
|
2922
|
+
*/
|
|
2923
|
+
requestGuildMembers(options: {
|
|
2924
|
+
guildId?: string;
|
|
2925
|
+
guildIds?: string[];
|
|
2926
|
+
query?: string;
|
|
2927
|
+
limit?: number;
|
|
2928
|
+
userIds?: string[];
|
|
2929
|
+
presences?: boolean;
|
|
2930
|
+
nonce?: string;
|
|
2931
|
+
}): void;
|
|
2693
2932
|
/**
|
|
2694
2933
|
* Broadcast a gateway payload to all shards.
|
|
2695
2934
|
* @param payload - Gateway send payload
|
|
2696
2935
|
* @internal
|
|
2697
2936
|
*/
|
|
2698
2937
|
_sendToAllShards(payload: GatewaySendPayload): void;
|
|
2699
|
-
/** @internal Process gateway dispatch payloads. */
|
|
2700
|
-
private handleDispatch;
|
|
2701
2938
|
/**
|
|
2702
2939
|
* Connect to the gateway with a bot token.
|
|
2703
2940
|
* @param token - Bot token from the developer portal
|
|
@@ -2734,4 +2971,4 @@ declare class Client extends EventEmitter {
|
|
|
2734
2971
|
static get Routes(): typeof Routes;
|
|
2735
2972
|
}
|
|
2736
2973
|
|
|
2737
|
-
export {
|
|
2974
|
+
export { GuildMember as $, AllowedMentions as A, Base as B, CacheController as C, type ClientEventName as D, type ClientEvents as E, type ClientOptions as F, ClientUser as G, type CollectedReaction as H, DEFAULT_CACHE_LIMITS as I, DEFAULT_INSTANCE_ENDPOINTS as J, DMChannel as K, type DiscoveryApplicationOptions as L, type DiscoveryApplicationPayload as M, type DiscoveryOrigin as N, type DiscoveryStatusPayload as O, Events as P, type ExpressionCreateOptions as Q, type ExpressionEditOptions as R, type FetchMessagesOptions as S, type FetchPinnedMessagesOptions as T, type FetchedUserWithProfile as U, Guild as V, GuildBan as W, GuildChannel as X, type GuildCountsUpdatePayload as Y, GuildEmoji as Z, type GuildEmojisUpdatePayload as _, type AllowedMentionsOptions as a, type SudoVerificationOptions as a$, type GuildMemberEditOptions as a0, GuildMemberManager as a1, GuildMemberRoleManager as a2, type GuildMemberSearchHit as a3, type GuildMemberSearchOptions as a4, type GuildMemberSearchPayload as a5, type GuildMembersChunkPayload as a6, type GuildRoleDeletePayload as a7, type GuildRoleUpdatePayload as a8, GuildSticker as a9, type PackInviteCreateOptions as aA, type PackInvitePayload as aB, PackManager as aC, type PackStickerPayload as aD, type PackSummaryPayload as aE, type PartialMessage as aF, type PartialUserGuildPayload as aG, type PinnedMessagesPage as aH, type PresenceActivity as aI, type PresenceUpdateBulkPayload as aJ, type PresenceUpdateOptions as aK, type PresenceUpdatePayload as aL, type ProfilePayload as aM, ReactionCollector as aN, type ReactionCollectorEndReason as aO, type ReactionCollectorOptions as aP, type ReactionEmojiPayload as aQ, type ReplyOptions as aR, type ResolvedCacheLimits as aS, type ResolvedInstance as aT, Role as aU, type RoleCreateOptions as aV, type RoleEditOptions as aW, type RoleResolvable as aX, type RtcRegionPayload as aY, type StickerCreateOptions as aZ, type StickerEditOptions as a_, type GuildStickersUpdatePayload as aa, Invite as ab, type InviteDeletePayload as ac, LinkChannel as ad, Message as ae, type MessageAttachmentEdit as af, MessageCollector as ag, type MessageCollectorEndReason as ah, type MessageCollectorOptions as ai, type MessageDeleteBulkPayload as aj, type MessageEditOptions as ak, MessageManager as al, MessageReaction as am, type MessageReactionAddManyEntry as an, type MessageReactionAddManyPayload as ao, type MessageReactionPayload as ap, type MessageReactionRemoveAllPayload as aq, type MessageReactionRemoveEmojiPayload as ar, type MessageReplyTarget as as, type MessageSendOptions as at, type PackBulkCreatePayload as au, type PackCreateOptions as av, type PackDashboardPayload as aw, type PackDashboardSectionPayload as ax, type PackEditOptions as ay, type PackEmojiPayload as az, type AttachmentUploadCompleteItem as b, TextChannel as b0, type TypingStartPayload as b1, type UploadFileForSend as b2, User as b3, UserManager as b4, type VanityURLPayload as b5, VoiceChannel as b6, Webhook as b7, type WebhookEditOptions as b8, type WebhookMessageEditOptions as b9, toStickerEditBody as bA, toSudoBody as bB, type WebhookSendOptions as ba, type WebhooksUpdatePayload as bb, inviteUrl as bc, normalizeApiOrigin as bd, normalizeCacheLimit as be, parseInstanceDiscovery as bf, resolveCacheLimits as bg, resolveInstanceEndpoints as bh, toAttachmentUploadCompleteBody as bi, toAttachmentUploadPlanBody as bj, toBulkFetchWire as bk, toChannelEditBody as bl, toChannelInviteBody as bm, toDiscoveryApplicationPayload as bn, toDiscoveryBody as bo, toDiscoveryStatusPayload as bp, toEmojiCreateBody as bq, toEmojiEditBody as br, toMemberEditBody as bs, toMemberSearchBody as bt, toMessageAttachmentEditWire as bu, toPackInviteBody as bv, toPackSummaryPayload as bw, toPresenceWire as bx, toProfilePayload as by, toStickerCreateBody as bz, type AttachmentUploadCompleteResponse as c, type AttachmentUploadPlanItem as d, type AttachmentUploadPlanResponse as e, type AuditLogChange as f, type AuditLogEntryPayload as g, type AuditLogFetchPayload as h, type BulkFetchMessagesChannelResult as i, type BulkFetchMessagesOptions as j, type BulkFetchMessagesRequest as k, type BulkFetchMessagesResult as l, type CacheSizeLimits as m, type CacheStats as n, CategoryChannel as o, Channel as p, type ChannelEditOptions as q, type ChannelInviteCreateOptions as r, ChannelManager as s, type ChannelMemberCountsUpdatePayload as t, type ChannelPinsUpdatePayload as u, type ChannelRecipientPayload as v, type ChannelSlowmodePayload as w, Client as x, type ClientEventListener as y, type ClientEventMethods as z };
|