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