discord.js 15.0.0-move-client-init.1761650119-a4c0a246f → 15.0.0-pr-11006.1765450224-e636950b2
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/package.json +18 -20
- package/src/client/Client.js +107 -14
- package/src/client/websocket/handlers/RATE_LIMITED.js +24 -0
- package/src/client/websocket/handlers/index.js +1 -0
- package/src/errors/DJSError.js +7 -3
- package/src/errors/ErrorCodes.js +2 -4
- package/src/errors/Messages.js +2 -3
- package/src/index.js +0 -3
- package/src/managers/CachedManager.js +5 -5
- package/src/managers/ChannelManager.js +10 -7
- package/src/managers/GuildBanManager.js +3 -3
- package/src/managers/GuildEmojiManager.js +2 -2
- package/src/managers/GuildEmojiRoleManager.js +9 -1
- package/src/managers/GuildMemberManager.js +44 -23
- package/src/managers/GuildMemberRoleManager.js +11 -2
- package/src/managers/MessageManager.js +25 -18
- package/src/structures/ApplicationCommand.js +4 -5
- package/src/structures/ClientApplication.js +2 -0
- package/src/structures/CommandInteraction.js +1 -1
- package/src/structures/Embed.js +1 -1
- package/src/structures/Guild.js +11 -1
- package/src/structures/GuildInvite.js +1 -1
- package/src/structures/GuildMember.js +12 -9
- package/src/structures/Message.js +18 -15
- package/src/structures/MessagePayload.js +21 -17
- package/src/structures/ModalComponentResolver.js +11 -0
- package/src/structures/ModalSubmitInteraction.js +23 -6
- package/src/structures/PermissionOverwrites.js +1 -1
- package/src/structures/Role.js +1 -1
- package/src/structures/ThreadChannel.js +1 -1
- package/src/structures/Webhook.js +6 -11
- package/src/structures/interfaces/TextBasedChannel.js +7 -9
- package/src/util/APITypes.js +10 -0
- package/src/util/Components.js +60 -42
- package/src/util/Constants.js +2 -0
- package/src/util/DataResolver.js +5 -2
- package/src/util/GuildMemberFlagsBitField.js +1 -1
- package/src/util/Options.js +9 -5
- package/src/util/Util.js +18 -13
- package/typings/index.d.mts +163 -171
- package/typings/index.d.ts +163 -171
- package/src/client/BaseClient.js +0 -131
- package/src/client/WebhookClient.js +0 -119
- package/src/structures/AttachmentBuilder.js +0 -185
package/typings/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { MessagePort, Worker } from 'node:worker_threads';
|
|
|
5
5
|
import { ApplicationCommandOptionAllowedChannelType, MessageActionRowComponentBuilder } from '@discordjs/builders';
|
|
6
6
|
import { Collection, ReadonlyCollection } from '@discordjs/collection';
|
|
7
7
|
import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions, EmojiURLOptions } from '@discordjs/rest';
|
|
8
|
-
import { Awaitable, JSONEncodable } from '@discordjs/util';
|
|
8
|
+
import { Awaitable, FileBodyEncodable, JSONEncodable } from '@discordjs/util';
|
|
9
9
|
import { WebSocketManager, WebSocketManagerOptions } from '@discordjs/ws';
|
|
10
10
|
import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
|
|
11
11
|
import {
|
|
@@ -66,7 +66,6 @@ import {
|
|
|
66
66
|
APIMessageTopLevelComponent,
|
|
67
67
|
APIMessageUserSelectInteractionData,
|
|
68
68
|
APIModalComponent,
|
|
69
|
-
APIModalInteractionResponseCallbackComponent,
|
|
70
69
|
APIModalInteractionResponseCallbackData,
|
|
71
70
|
APIModalSubmitInteraction,
|
|
72
71
|
APIOverwrite,
|
|
@@ -267,18 +266,21 @@ export type ActionRowComponentData = MessageActionRowComponentData;
|
|
|
267
266
|
|
|
268
267
|
export type ActionRowComponent = MessageActionRowComponent;
|
|
269
268
|
|
|
270
|
-
export interface ActionRowData<
|
|
271
|
-
extends
|
|
269
|
+
export interface ActionRowData<
|
|
270
|
+
ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>,
|
|
271
|
+
> extends BaseComponentData {
|
|
272
272
|
components: readonly ComponentType[];
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
export type ComponentInLabelData =
|
|
276
276
|
| ChannelSelectMenuComponentData
|
|
277
|
+
| FileUploadComponentData
|
|
277
278
|
| MentionableSelectMenuComponentData
|
|
278
279
|
| RoleSelectMenuComponentData
|
|
279
280
|
| StringSelectMenuComponentData
|
|
280
281
|
| TextInputComponentData
|
|
281
282
|
| UserSelectMenuComponentData;
|
|
283
|
+
|
|
282
284
|
export interface LabelData extends BaseComponentData {
|
|
283
285
|
component: ComponentInLabelData;
|
|
284
286
|
description?: string;
|
|
@@ -417,7 +419,7 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
|
|
|
417
419
|
public name: string;
|
|
418
420
|
public nameLocalizations: LocalizationMap | null;
|
|
419
421
|
public nameLocalized: string | null;
|
|
420
|
-
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[];
|
|
422
|
+
public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[] | null;
|
|
421
423
|
public permissions: ApplicationCommandPermissionsManager<
|
|
422
424
|
PermissionsFetchType,
|
|
423
425
|
PermissionsFetchType,
|
|
@@ -491,18 +493,6 @@ export abstract class Base {
|
|
|
491
493
|
public valueOf(): string;
|
|
492
494
|
}
|
|
493
495
|
|
|
494
|
-
export class BaseClient<Events extends {}> extends AsyncEventEmitter<Events> implements AsyncDisposable {
|
|
495
|
-
public constructor(options?: ClientOptions | WebhookClientOptions);
|
|
496
|
-
private decrementMaxListeners(): void;
|
|
497
|
-
private incrementMaxListeners(): void;
|
|
498
|
-
|
|
499
|
-
public options: ClientOptions | WebhookClientOptions;
|
|
500
|
-
public rest: REST;
|
|
501
|
-
public destroy(): void;
|
|
502
|
-
public toJSON(...props: Record<string, boolean | string>[]): unknown;
|
|
503
|
-
public [Symbol.asyncDispose](): Promise<void>;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
496
|
export type GuildCacheMessage<Cached extends CacheType> = CacheTypeReducer<
|
|
507
497
|
Cached,
|
|
508
498
|
Message<true>,
|
|
@@ -614,7 +604,8 @@ export class BaseGuildEmoji extends Emoji {
|
|
|
614
604
|
}
|
|
615
605
|
|
|
616
606
|
export interface BaseGuildTextChannel
|
|
617
|
-
extends
|
|
607
|
+
extends
|
|
608
|
+
TextBasedChannelFields<true>,
|
|
618
609
|
PinnableChannelFields,
|
|
619
610
|
WebhookChannelFields,
|
|
620
611
|
BulkDeleteMethod,
|
|
@@ -641,7 +632,8 @@ export class BaseGuildTextChannel extends GuildChannel {
|
|
|
641
632
|
}
|
|
642
633
|
|
|
643
634
|
export interface BaseGuildVoiceChannel
|
|
644
|
-
extends
|
|
635
|
+
extends
|
|
636
|
+
TextBasedChannelFields<true>,
|
|
645
637
|
WebhookChannelFields,
|
|
646
638
|
BulkDeleteMethod,
|
|
647
639
|
SetRateLimitPerUserMethod,
|
|
@@ -912,7 +904,10 @@ export type If<Value extends boolean, TrueResult, FalseResult = null> = Value ex
|
|
|
912
904
|
? FalseResult
|
|
913
905
|
: FalseResult | TrueResult;
|
|
914
906
|
|
|
915
|
-
export class Client<Ready extends boolean = boolean>
|
|
907
|
+
export class Client<Ready extends boolean = boolean>
|
|
908
|
+
extends AsyncEventEmitter<ClientEventTypes>
|
|
909
|
+
implements AsyncDisposable
|
|
910
|
+
{
|
|
916
911
|
public constructor(options: ClientOptions);
|
|
917
912
|
private readonly actions: unknown;
|
|
918
913
|
private readonly expectedGuilds: Set<Snowflake>;
|
|
@@ -927,6 +922,8 @@ export class Client<Ready extends boolean = boolean> extends BaseClient<ClientEv
|
|
|
927
922
|
private _triggerClientReady(): void;
|
|
928
923
|
private _validateOptions(options: ClientOptions): void;
|
|
929
924
|
private get _censoredToken(): string | null;
|
|
925
|
+
private decrementMaxListeners(): void;
|
|
926
|
+
private incrementMaxListeners(): void;
|
|
930
927
|
// This a technique used to brand the ready state. Or else we'll get `never` errors on typeguard checks.
|
|
931
928
|
private readonly _ready: Ready;
|
|
932
929
|
|
|
@@ -938,6 +935,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient<ClientEv
|
|
|
938
935
|
public get ping(): number | null;
|
|
939
936
|
public get readyAt(): If<Ready, Date>;
|
|
940
937
|
public readyTimestamp: If<Ready, number>;
|
|
938
|
+
public rest: REST;
|
|
941
939
|
public sweepers: Sweepers;
|
|
942
940
|
public shard: ShardClientUtil | null;
|
|
943
941
|
public status: Status;
|
|
@@ -968,6 +966,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient<ClientEv
|
|
|
968
966
|
public login(token?: string): Promise<string>;
|
|
969
967
|
public isReady(): this is Client<true>;
|
|
970
968
|
public toJSON(): unknown;
|
|
969
|
+
public [Symbol.asyncDispose](): Promise<void>;
|
|
971
970
|
}
|
|
972
971
|
|
|
973
972
|
export interface StickerPackFetchOptions {
|
|
@@ -1286,10 +1285,7 @@ export class PrimaryEntryPointCommandInteraction<
|
|
|
1286
1285
|
}
|
|
1287
1286
|
|
|
1288
1287
|
export interface DMChannel
|
|
1289
|
-
extends TextBasedChannelFields<false, true>,
|
|
1290
|
-
PinnableChannelFields,
|
|
1291
|
-
MessageChannelFields,
|
|
1292
|
-
SendMethod<false> {}
|
|
1288
|
+
extends TextBasedChannelFields<false, true>, PinnableChannelFields, MessageChannelFields, SendMethod<false> {}
|
|
1293
1289
|
export class DMChannel extends BaseChannel {
|
|
1294
1290
|
private constructor(client: Client<true>, data?: RawDMChannelData);
|
|
1295
1291
|
public flags: Readonly<ChannelFlagsBitField>;
|
|
@@ -1457,6 +1453,7 @@ export class Guild extends AnonymousGuild {
|
|
|
1457
1453
|
public widgetChannelId: Snowflake | null;
|
|
1458
1454
|
public widgetEnabled: boolean | null;
|
|
1459
1455
|
public get maximumBitrate(): number;
|
|
1456
|
+
public get maximumStageBitrate(): number;
|
|
1460
1457
|
public createTemplate(name: string, description?: string): Promise<GuildTemplate>;
|
|
1461
1458
|
public discoverySplashURL(options?: ImageURLOptions): string | null;
|
|
1462
1459
|
public edit(options: GuildEditOptions): Promise<Guild>;
|
|
@@ -2238,7 +2235,12 @@ export class Message<InGuild extends boolean = boolean> extends Base {
|
|
|
2238
2235
|
): InteractionCollector<MappedInteractionTypes<InGuild>[ComponentType]>;
|
|
2239
2236
|
public delete(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
|
|
2240
2237
|
public edit(
|
|
2241
|
-
content:
|
|
2238
|
+
content:
|
|
2239
|
+
| FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
|
|
2240
|
+
| JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
|
|
2241
|
+
| MessageEditOptions
|
|
2242
|
+
| MessagePayload
|
|
2243
|
+
| string,
|
|
2242
2244
|
): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
|
|
2243
2245
|
public equals(message: Message, rawData: unknown): boolean;
|
|
2244
2246
|
public fetchReference(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
|
|
@@ -2263,26 +2265,6 @@ export class Message<InGuild extends boolean = boolean> extends Base {
|
|
|
2263
2265
|
public inGuild(): this is Message<true>;
|
|
2264
2266
|
}
|
|
2265
2267
|
|
|
2266
|
-
export class AttachmentBuilder {
|
|
2267
|
-
public constructor(attachment: BufferResolvable | Stream, data?: AttachmentData);
|
|
2268
|
-
public attachment: BufferResolvable | Stream;
|
|
2269
|
-
public description: string | null;
|
|
2270
|
-
public name: string | null;
|
|
2271
|
-
public title: string | null;
|
|
2272
|
-
public waveform: string | null;
|
|
2273
|
-
public duration: number | null;
|
|
2274
|
-
public get spoiler(): boolean;
|
|
2275
|
-
public setDescription(description: string): this;
|
|
2276
|
-
public setFile(attachment: BufferResolvable | Stream, name?: string): this;
|
|
2277
|
-
public setName(name: string): this;
|
|
2278
|
-
public setTitle(title: string): this;
|
|
2279
|
-
public setWaveform(waveform: string): this;
|
|
2280
|
-
public setDuration(duration: number): this;
|
|
2281
|
-
public setSpoiler(spoiler?: boolean): this;
|
|
2282
|
-
public toJSON(): unknown;
|
|
2283
|
-
public static from(other: JSONEncodable<AttachmentPayload>): AttachmentBuilder;
|
|
2284
|
-
}
|
|
2285
|
-
|
|
2286
2268
|
export class Attachment {
|
|
2287
2269
|
private constructor(data: APIAttachment);
|
|
2288
2270
|
private readonly attachment: BufferResolvable | Stream;
|
|
@@ -2561,14 +2543,13 @@ export interface TextInputModalData extends BaseModalData<ComponentType.TextInpu
|
|
|
2561
2543
|
value: string;
|
|
2562
2544
|
}
|
|
2563
2545
|
|
|
2564
|
-
export interface SelectMenuModalData<Cached extends CacheType = CacheType>
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
> {
|
|
2546
|
+
export interface SelectMenuModalData<Cached extends CacheType = CacheType> extends BaseModalData<
|
|
2547
|
+
| ComponentType.ChannelSelect
|
|
2548
|
+
| ComponentType.MentionableSelect
|
|
2549
|
+
| ComponentType.RoleSelect
|
|
2550
|
+
| ComponentType.StringSelect
|
|
2551
|
+
| ComponentType.UserSelect
|
|
2552
|
+
> {
|
|
2572
2553
|
channels?: ReadonlyCollection<
|
|
2573
2554
|
Snowflake,
|
|
2574
2555
|
CacheTypeReducer<Cached, GuildBasedChannel, APIInteractionDataResolvedChannel>
|
|
@@ -2580,10 +2561,16 @@ export interface SelectMenuModalData<Cached extends CacheType = CacheType>
|
|
|
2580
2561
|
values: readonly string[];
|
|
2581
2562
|
}
|
|
2582
2563
|
|
|
2583
|
-
export
|
|
2564
|
+
export interface FileUploadModalData extends BaseModalData<ComponentType.FileUpload> {
|
|
2565
|
+
attachments: ReadonlyCollection<Snowflake, Attachment>;
|
|
2566
|
+
customId: string;
|
|
2567
|
+
values: readonly Snowflake[];
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
export type ModalData = FileUploadModalData | SelectMenuModalData | TextInputModalData;
|
|
2584
2571
|
|
|
2585
2572
|
export interface LabelModalData extends BaseModalData<ComponentType.Label> {
|
|
2586
|
-
component:
|
|
2573
|
+
component: ModalData;
|
|
2587
2574
|
}
|
|
2588
2575
|
export interface ActionRowModalData extends BaseModalData<ComponentType.ActionRow> {
|
|
2589
2576
|
components: readonly TextInputModalData[];
|
|
@@ -2653,10 +2640,13 @@ export class ModalComponentResolver<Cached extends CacheType = CacheType> {
|
|
|
2653
2640
|
|
|
2654
2641
|
public getSelectedMentionables(customId: string, required: true): ModalSelectedMentionables<Cached>;
|
|
2655
2642
|
public getSelectedMentionables(customId: string, required?: boolean): ModalSelectedMentionables<Cached> | null;
|
|
2643
|
+
public getUploadedFiles(customId: string, required: true): ReadonlyCollection<Snowflake, Attachment>;
|
|
2644
|
+
public getUploadedFiles(customId: string, required?: boolean): ReadonlyCollection<Snowflake, Attachment> | null;
|
|
2656
2645
|
}
|
|
2657
2646
|
|
|
2658
|
-
export interface ModalMessageModalSubmitInteraction<
|
|
2659
|
-
extends
|
|
2647
|
+
export interface ModalMessageModalSubmitInteraction<
|
|
2648
|
+
Cached extends CacheType = CacheType,
|
|
2649
|
+
> extends ModalSubmitInteraction<Cached> {
|
|
2660
2650
|
channelId: Snowflake;
|
|
2661
2651
|
inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
|
|
2662
2652
|
inGuild(): this is ModalMessageModalSubmitInteraction<'cached' | 'raw'>;
|
|
@@ -3509,14 +3499,15 @@ export interface PrivateThreadChannel extends ThreadChannel<false> {
|
|
|
3509
3499
|
}
|
|
3510
3500
|
|
|
3511
3501
|
export interface ThreadChannel<ThreadOnly extends boolean = boolean>
|
|
3512
|
-
extends
|
|
3502
|
+
extends
|
|
3503
|
+
TextBasedChannelFields<true>,
|
|
3513
3504
|
PinnableChannelFields,
|
|
3514
3505
|
BulkDeleteMethod,
|
|
3515
3506
|
SetRateLimitPerUserMethod,
|
|
3516
3507
|
MessageChannelFields,
|
|
3517
3508
|
SendMethod<true> {}
|
|
3518
3509
|
export class ThreadChannel<ThreadOnly extends boolean = boolean> extends BaseChannel {
|
|
3519
|
-
private constructor(guild: Guild, data
|
|
3510
|
+
private constructor(guild: Guild, data: RawThreadChannelData, client?: Client<true>);
|
|
3520
3511
|
public archived: boolean | null;
|
|
3521
3512
|
public get archivedAt(): Date | null;
|
|
3522
3513
|
public archiveTimestamp: number | null;
|
|
@@ -3733,7 +3724,7 @@ export function fetchRecommendedShardCount(token: string, options?: FetchRecomme
|
|
|
3733
3724
|
export function flatten(obj: unknown, ...props: Record<string, boolean | string>[]): unknown;
|
|
3734
3725
|
|
|
3735
3726
|
export function parseEmoji(text: string): PartialEmoji | null;
|
|
3736
|
-
export function parseWebhookURL(url: string):
|
|
3727
|
+
export function parseWebhookURL(url: string): WebhookDataIdWithToken | null;
|
|
3737
3728
|
export function resolveColor(color: ColorResolvable): number;
|
|
3738
3729
|
export function resolveSKUId(resolvable: SKUResolvable): Snowflake | null;
|
|
3739
3730
|
export function verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string;
|
|
@@ -3812,14 +3803,14 @@ export class VoiceState extends Base {
|
|
|
3812
3803
|
|
|
3813
3804
|
export interface Webhook<Type extends WebhookType = WebhookType> extends WebhookFields {}
|
|
3814
3805
|
export class Webhook<Type extends WebhookType = WebhookType> {
|
|
3815
|
-
private constructor(client: Client<true>, data
|
|
3806
|
+
private constructor(client: Client<true>, data: unknown);
|
|
3816
3807
|
public avatar: string | null;
|
|
3817
3808
|
public avatarURL(options?: ImageURLOptions): string | null;
|
|
3818
3809
|
public channelId: Snowflake;
|
|
3819
3810
|
public readonly client: Client;
|
|
3820
3811
|
public guildId: Snowflake;
|
|
3821
3812
|
public name: string;
|
|
3822
|
-
public owner: Type extends WebhookType.Incoming ?
|
|
3813
|
+
public owner: Type extends WebhookType.Incoming ? User | null : User;
|
|
3823
3814
|
public sourceGuild: Type extends WebhookType.ChannelFollower ? APIPartialGuild | Guild : null;
|
|
3824
3815
|
public sourceChannel: Type extends WebhookType.ChannelFollower ? AnnouncementChannel | APIPartialChannel : null;
|
|
3825
3816
|
public token: Type extends WebhookType.Incoming
|
|
@@ -3838,7 +3829,7 @@ export class Webhook<Type extends WebhookType = WebhookType> {
|
|
|
3838
3829
|
| VoiceChannel
|
|
3839
3830
|
| null;
|
|
3840
3831
|
public isUserCreated(): this is Webhook<WebhookType.Incoming> & {
|
|
3841
|
-
owner:
|
|
3832
|
+
owner: User;
|
|
3842
3833
|
};
|
|
3843
3834
|
public isApplicationCreated(): this is Webhook<WebhookType.Application>;
|
|
3844
3835
|
public isIncoming(): this is Webhook<WebhookType.Incoming>;
|
|
@@ -3852,20 +3843,6 @@ export class Webhook<Type extends WebhookType = WebhookType> {
|
|
|
3852
3843
|
public send(options: MessagePayload | WebhookMessageCreateOptions | string): Promise<Message<true>>;
|
|
3853
3844
|
}
|
|
3854
3845
|
|
|
3855
|
-
export interface WebhookClient extends WebhookFields, BaseClient<{}> {}
|
|
3856
|
-
export class WebhookClient extends BaseClient<{}> {
|
|
3857
|
-
public constructor(data: WebhookClientData, options?: WebhookClientOptions);
|
|
3858
|
-
public readonly client: this;
|
|
3859
|
-
public options: WebhookClientOptions;
|
|
3860
|
-
public token: string;
|
|
3861
|
-
public editMessage(
|
|
3862
|
-
message: MessageResolvable,
|
|
3863
|
-
options: MessagePayload | WebhookMessageEditOptions | string,
|
|
3864
|
-
): Promise<APIMessage>;
|
|
3865
|
-
public fetchMessage(message: Snowflake, options?: WebhookFetchMessageOptions): Promise<APIMessage>;
|
|
3866
|
-
public send(options: MessagePayload | WebhookMessageCreateOptions | string): Promise<APIMessage>;
|
|
3867
|
-
}
|
|
3868
|
-
|
|
3869
3846
|
export class Widget extends Base {
|
|
3870
3847
|
private constructor(client: Client<true>, data: APIGuildWidget);
|
|
3871
3848
|
private _patch(data: APIGuildWidget): void;
|
|
@@ -4055,14 +4032,13 @@ export enum DiscordjsErrorCodes {
|
|
|
4055
4032
|
|
|
4056
4033
|
WebhookMessage = 'WebhookMessage',
|
|
4057
4034
|
WebhookTokenUnavailable = 'WebhookTokenUnavailable',
|
|
4058
|
-
WebhookURLInvalid = 'WebhookURLInvalid',
|
|
4059
4035
|
WebhookApplication = 'WebhookApplication',
|
|
4060
4036
|
|
|
4061
4037
|
MessageReferenceMissing = 'MessageReferenceMissing',
|
|
4062
4038
|
|
|
4063
4039
|
EmojiType = 'EmojiType',
|
|
4064
4040
|
EmojiManaged = 'EmojiManaged',
|
|
4065
|
-
|
|
4041
|
+
MissingGuildExpressionsPermission = 'MissingGuildExpressionsPermission',
|
|
4066
4042
|
|
|
4067
4043
|
NotGuildSoundboardSound = 'NotGuildSoundboardSound',
|
|
4068
4044
|
NotGuildSticker = 'NotGuildSticker',
|
|
@@ -4109,6 +4085,9 @@ export enum DiscordjsErrorCodes {
|
|
|
4109
4085
|
BulkBanUsersOptionEmpty = 'BulkBanUsersOptionEmpty',
|
|
4110
4086
|
|
|
4111
4087
|
PollAlreadyExpired = 'PollAlreadyExpired',
|
|
4088
|
+
|
|
4089
|
+
PermissionOverwritesTypeMandatory = 'PermissionOverwritesTypeMandatory',
|
|
4090
|
+
PermissionOverwritesTypeMismatch = 'PermissionOverwritesTypeMismatch',
|
|
4112
4091
|
}
|
|
4113
4092
|
/* eslint-enable typescript-sort-keys/string-enum */
|
|
4114
4093
|
|
|
@@ -4286,7 +4265,12 @@ export class ChannelManager extends CachedManager<Snowflake, Channel, ChannelRes
|
|
|
4286
4265
|
private constructor(client: Client<true>, iterable: Iterable<RawChannelData>);
|
|
4287
4266
|
public createMessage(
|
|
4288
4267
|
channel: Exclude<TextBasedChannelResolvable, PartialGroupDMChannel>,
|
|
4289
|
-
options:
|
|
4268
|
+
options:
|
|
4269
|
+
| FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
|
|
4270
|
+
| JSONEncodable<RESTPostAPIChannelMessageJSONBody>
|
|
4271
|
+
| MessageCreateOptions
|
|
4272
|
+
| MessagePayload
|
|
4273
|
+
| string,
|
|
4290
4274
|
): Promise<OmitPartialGroupDMChannel<Message>>;
|
|
4291
4275
|
public fetch(id: Snowflake, options?: FetchChannelOptions): Promise<Channel | null>;
|
|
4292
4276
|
}
|
|
@@ -4638,7 +4622,12 @@ export abstract class MessageManager<InGuild extends boolean = boolean> extends
|
|
|
4638
4622
|
public delete(message: MessageResolvable): Promise<void>;
|
|
4639
4623
|
public edit(
|
|
4640
4624
|
message: MessageResolvable,
|
|
4641
|
-
options:
|
|
4625
|
+
options:
|
|
4626
|
+
| FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
|
|
4627
|
+
| JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
|
|
4628
|
+
| MessageEditOptions
|
|
4629
|
+
| MessagePayload
|
|
4630
|
+
| string,
|
|
4642
4631
|
): Promise<Message<InGuild>>;
|
|
4643
4632
|
public fetch(options: FetchMessageOptions | MessageResolvable): Promise<Message<InGuild>>;
|
|
4644
4633
|
public fetch(options?: FetchMessagesOptions): Promise<Collection<Snowflake, Message<InGuild>>>;
|
|
@@ -4815,7 +4804,14 @@ export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, type
|
|
|
4815
4804
|
export type Constructable<Entity> = abstract new (...args: any[]) => Entity;
|
|
4816
4805
|
|
|
4817
4806
|
export interface SendMethod<InGuild extends boolean = boolean> {
|
|
4818
|
-
send(
|
|
4807
|
+
send(
|
|
4808
|
+
options:
|
|
4809
|
+
| FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
|
|
4810
|
+
| JSONEncodable<RESTPostAPIChannelMessageJSONBody>
|
|
4811
|
+
| MessageCreateOptions
|
|
4812
|
+
| MessagePayload
|
|
4813
|
+
| string,
|
|
4814
|
+
): Promise<Message<InGuild>>;
|
|
4819
4815
|
}
|
|
4820
4816
|
|
|
4821
4817
|
export interface PinnableChannelFields {
|
|
@@ -5068,15 +5064,17 @@ export interface ApplicationCommandAutocompleteStringOptionData extends BaseAppl
|
|
|
5068
5064
|
type: ApplicationCommandOptionType.String;
|
|
5069
5065
|
}
|
|
5070
5066
|
|
|
5071
|
-
export interface ApplicationCommandChoicesData<
|
|
5072
|
-
extends
|
|
5067
|
+
export interface ApplicationCommandChoicesData<
|
|
5068
|
+
Type extends number | string = number | string,
|
|
5069
|
+
> extends BaseApplicationCommandOptionsData {
|
|
5073
5070
|
autocomplete?: false;
|
|
5074
5071
|
choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
|
|
5075
5072
|
type: CommandOptionChoiceResolvableType;
|
|
5076
5073
|
}
|
|
5077
5074
|
|
|
5078
|
-
export interface ApplicationCommandChoicesOption<
|
|
5079
|
-
extends
|
|
5075
|
+
export interface ApplicationCommandChoicesOption<
|
|
5076
|
+
Type extends number | string = number | string,
|
|
5077
|
+
> extends BaseApplicationCommandOptionsData {
|
|
5080
5078
|
autocomplete?: false;
|
|
5081
5079
|
choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
|
|
5082
5080
|
type: CommandOptionChoiceResolvableType;
|
|
@@ -5259,13 +5257,15 @@ export interface AutoModerationTriggerMetadata {
|
|
|
5259
5257
|
regexPatterns: readonly string[];
|
|
5260
5258
|
}
|
|
5261
5259
|
|
|
5262
|
-
export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction>
|
|
5263
|
-
|
|
5260
|
+
export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction> extends CollectorOptions<
|
|
5261
|
+
[Interaction, Collection<Snowflake, Interaction>]
|
|
5262
|
+
> {
|
|
5264
5263
|
componentType?: ComponentType;
|
|
5265
5264
|
}
|
|
5266
5265
|
|
|
5267
|
-
export interface AwaitModalSubmitOptions
|
|
5268
|
-
|
|
5266
|
+
export interface AwaitModalSubmitOptions extends CollectorOptions<
|
|
5267
|
+
[ModalSubmitInteraction, Collection<Snowflake, ModalSubmitInteraction>]
|
|
5268
|
+
> {
|
|
5269
5269
|
time: number;
|
|
5270
5270
|
}
|
|
5271
5271
|
|
|
@@ -5359,13 +5359,21 @@ export type OverriddenCaches =
|
|
|
5359
5359
|
| 'GuildMessageManager'
|
|
5360
5360
|
| 'GuildTextThreadManager';
|
|
5361
5361
|
|
|
5362
|
+
export interface CacheFactoryParams<Manager extends keyof Caches> {
|
|
5363
|
+
holds: Caches[Manager][1];
|
|
5364
|
+
manager: CacheConstructors[keyof Caches];
|
|
5365
|
+
managerType: CacheConstructors[Exclude<keyof Caches, OverriddenCaches>];
|
|
5366
|
+
}
|
|
5367
|
+
|
|
5362
5368
|
// This doesn't actually work the way it looks 😢.
|
|
5363
5369
|
// Narrowing the type of `manager.name` doesn't propagate type information to `holds` and the return type.
|
|
5364
|
-
export type CacheFactory = (
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
) => (typeof manager)['prototype'] extends DataManager<infer Key, infer Value, any>
|
|
5370
|
+
export type CacheFactory = ({
|
|
5371
|
+
holds,
|
|
5372
|
+
manager,
|
|
5373
|
+
managerType,
|
|
5374
|
+
}: CacheFactoryParams<keyof Caches>) => (typeof manager)['prototype'] extends DataManager<infer Key, infer Value, any>
|
|
5375
|
+
? Collection<Key, Value>
|
|
5376
|
+
: never;
|
|
5369
5377
|
|
|
5370
5378
|
export type CacheWithLimitsOptions = {
|
|
5371
5379
|
[K in keyof Caches]?: Caches[K][0]['prototype'] extends DataManager<infer Key, infer Value, any>
|
|
@@ -5556,7 +5564,8 @@ export interface ClientFetchInviteOptions {
|
|
|
5556
5564
|
withCounts?: boolean;
|
|
5557
5565
|
}
|
|
5558
5566
|
|
|
5559
|
-
export interface ClientOptions
|
|
5567
|
+
export interface ClientOptions {
|
|
5568
|
+
allowedMentions?: MessageMentionOptions;
|
|
5560
5569
|
closeTimeout?: number;
|
|
5561
5570
|
enforceNonce?: boolean;
|
|
5562
5571
|
failIfNotExists?: boolean;
|
|
@@ -5565,6 +5574,7 @@ export interface ClientOptions extends WebhookClientOptions {
|
|
|
5565
5574
|
makeCache?: CacheFactory;
|
|
5566
5575
|
partials?: readonly Partials[];
|
|
5567
5576
|
presence?: PresenceData;
|
|
5577
|
+
rest?: Partial<RESTOptions>;
|
|
5568
5578
|
sweepers?: SweeperOptions;
|
|
5569
5579
|
waitGuildTimeout?: number;
|
|
5570
5580
|
ws?: Partial<WebSocketManagerOptions>;
|
|
@@ -5621,15 +5631,16 @@ export interface CommandInteractionOption<Cached extends CacheType = CacheType>
|
|
|
5621
5631
|
}
|
|
5622
5632
|
|
|
5623
5633
|
export interface BaseInteractionResolvedData<Cached extends CacheType = CacheType> {
|
|
5634
|
+
attachments?: ReadonlyCollection<Snowflake, Attachment>;
|
|
5624
5635
|
channels?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Channel, APIInteractionDataResolvedChannel>>;
|
|
5625
5636
|
members?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, GuildMember, APIInteractionDataResolvedGuildMember>>;
|
|
5626
5637
|
roles?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Role, APIRole>>;
|
|
5627
5638
|
users?: ReadonlyCollection<Snowflake, User>;
|
|
5628
5639
|
}
|
|
5629
5640
|
|
|
5630
|
-
export interface CommandInteractionResolvedData<
|
|
5631
|
-
extends
|
|
5632
|
-
|
|
5641
|
+
export interface CommandInteractionResolvedData<
|
|
5642
|
+
Cached extends CacheType = CacheType,
|
|
5643
|
+
> extends BaseInteractionResolvedData<Cached> {
|
|
5633
5644
|
messages?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Message, APIMessage>>;
|
|
5634
5645
|
}
|
|
5635
5646
|
|
|
@@ -6268,7 +6279,7 @@ export interface GuildEmojiEditOptions {
|
|
|
6268
6279
|
|
|
6269
6280
|
export interface GuildStickerCreateOptions {
|
|
6270
6281
|
description?: string | null;
|
|
6271
|
-
file: AttachmentPayload | BufferResolvable |
|
|
6282
|
+
file: AttachmentPayload | BufferResolvable | Stream;
|
|
6272
6283
|
name: string;
|
|
6273
6284
|
reason?: string;
|
|
6274
6285
|
tags: string;
|
|
@@ -6615,8 +6626,9 @@ export type CollectedMessageInteraction<Cached extends CacheType = CacheType> =
|
|
|
6615
6626
|
ModalSubmitInteraction
|
|
6616
6627
|
>;
|
|
6617
6628
|
|
|
6618
|
-
export interface MessageComponentCollectorOptions<
|
|
6619
|
-
extends
|
|
6629
|
+
export interface MessageComponentCollectorOptions<
|
|
6630
|
+
Interaction extends CollectedMessageInteraction,
|
|
6631
|
+
> extends AwaitMessageComponentOptions<Interaction> {
|
|
6620
6632
|
max?: number;
|
|
6621
6633
|
maxComponents?: number;
|
|
6622
6634
|
maxUsers?: number;
|
|
@@ -6655,25 +6667,24 @@ export interface MessageMentionOptions {
|
|
|
6655
6667
|
|
|
6656
6668
|
export type MessageMentionTypes = 'everyone' | 'roles' | 'users';
|
|
6657
6669
|
|
|
6658
|
-
export interface MessageSnapshot
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
> {}
|
|
6670
|
+
export interface MessageSnapshot extends Partialize<
|
|
6671
|
+
Message,
|
|
6672
|
+
null,
|
|
6673
|
+
Exclude<
|
|
6674
|
+
keyof Message,
|
|
6675
|
+
| 'attachments'
|
|
6676
|
+
| 'client'
|
|
6677
|
+
| 'components'
|
|
6678
|
+
| 'content'
|
|
6679
|
+
| 'createdTimestamp'
|
|
6680
|
+
| 'editedTimestamp'
|
|
6681
|
+
| 'embeds'
|
|
6682
|
+
| 'flags'
|
|
6683
|
+
| 'mentions'
|
|
6684
|
+
| 'stickers'
|
|
6685
|
+
| 'type'
|
|
6686
|
+
>
|
|
6687
|
+
> {}
|
|
6677
6688
|
|
|
6678
6689
|
export interface BaseMessageOptions {
|
|
6679
6690
|
allowedMentions?: MessageMentionOptions;
|
|
@@ -6686,14 +6697,7 @@ export interface BaseMessageOptions {
|
|
|
6686
6697
|
)[];
|
|
6687
6698
|
content?: string;
|
|
6688
6699
|
embeds?: readonly (APIEmbed | JSONEncodable<APIEmbed>)[];
|
|
6689
|
-
files?: readonly (
|
|
6690
|
-
| Attachment
|
|
6691
|
-
| AttachmentBuilder
|
|
6692
|
-
| AttachmentPayload
|
|
6693
|
-
| BufferResolvable
|
|
6694
|
-
| JSONEncodable<APIAttachment>
|
|
6695
|
-
| Stream
|
|
6696
|
-
)[];
|
|
6700
|
+
files?: readonly (Attachment | AttachmentPayload | BufferResolvable | FileBodyEncodable<APIAttachment> | Stream)[];
|
|
6697
6701
|
}
|
|
6698
6702
|
|
|
6699
6703
|
export interface MessageOptionsPoll {
|
|
@@ -6721,11 +6725,7 @@ export interface MessageOptionsStickers {
|
|
|
6721
6725
|
}
|
|
6722
6726
|
|
|
6723
6727
|
export interface BaseMessageCreateOptions
|
|
6724
|
-
extends BaseMessageOptions,
|
|
6725
|
-
MessageOptionsPoll,
|
|
6726
|
-
MessageOptionsFlags,
|
|
6727
|
-
MessageOptionsTTS,
|
|
6728
|
-
MessageOptionsStickers {
|
|
6728
|
+
extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS, MessageOptionsStickers {
|
|
6729
6729
|
enforceNonce?: boolean;
|
|
6730
6730
|
nonce?: number | string;
|
|
6731
6731
|
}
|
|
@@ -6735,16 +6735,10 @@ export interface MessageCreateOptions extends BaseMessageCreateOptions {
|
|
|
6735
6735
|
}
|
|
6736
6736
|
|
|
6737
6737
|
export interface GuildForumThreadMessageCreateOptions
|
|
6738
|
-
extends BaseMessageOptions,
|
|
6739
|
-
MessageOptionsFlags,
|
|
6740
|
-
MessageOptionsStickers {}
|
|
6741
|
-
|
|
6742
|
-
export interface MessageEditAttachmentData {
|
|
6743
|
-
id: Snowflake;
|
|
6744
|
-
}
|
|
6738
|
+
extends BaseMessageOptions, MessageOptionsFlags, MessageOptionsStickers {}
|
|
6745
6739
|
|
|
6746
6740
|
export interface MessageEditOptions extends Omit<BaseMessageOptions, 'content'> {
|
|
6747
|
-
attachments?: readonly (Attachment |
|
|
6741
|
+
attachments?: readonly (Attachment | JSONEncodable<APIAttachment>)[];
|
|
6748
6742
|
content?: string | null;
|
|
6749
6743
|
flags?:
|
|
6750
6744
|
| BitFieldResolvable<
|
|
@@ -6838,6 +6832,14 @@ export interface TextInputComponentData extends BaseComponentData {
|
|
|
6838
6832
|
value?: string;
|
|
6839
6833
|
}
|
|
6840
6834
|
|
|
6835
|
+
export interface FileUploadComponentData extends BaseComponentData {
|
|
6836
|
+
customId: string;
|
|
6837
|
+
maxValues?: number;
|
|
6838
|
+
minValues?: number;
|
|
6839
|
+
required?: boolean;
|
|
6840
|
+
type: ComponentType.FileUpload;
|
|
6841
|
+
}
|
|
6842
|
+
|
|
6841
6843
|
export type MessageTarget =
|
|
6842
6844
|
| ChannelManager
|
|
6843
6845
|
| Interaction
|
|
@@ -6845,8 +6847,7 @@ export type MessageTarget =
|
|
|
6845
6847
|
| Message
|
|
6846
6848
|
| MessageManager
|
|
6847
6849
|
| TextBasedChannel
|
|
6848
|
-
| Webhook<WebhookType.Incoming
|
|
6849
|
-
| WebhookClient;
|
|
6850
|
+
| Webhook<WebhookType.Incoming>;
|
|
6850
6851
|
|
|
6851
6852
|
export interface MultipleShardRespawnOptions {
|
|
6852
6853
|
respawnDelay?: number;
|
|
@@ -6933,18 +6934,20 @@ export interface PartialDMChannel extends Partialize<DMChannel, null, null, 'las
|
|
|
6933
6934
|
|
|
6934
6935
|
export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp' | 'pending'> {}
|
|
6935
6936
|
|
|
6936
|
-
export interface PartialMessage<InGuild extends boolean = boolean>
|
|
6937
|
-
|
|
6937
|
+
export interface PartialMessage<InGuild extends boolean = boolean> extends Partialize<
|
|
6938
|
+
Message<InGuild>,
|
|
6939
|
+
'pinned' | 'system' | 'tts' | 'type',
|
|
6940
|
+
'author' | 'cleanContent' | 'content'
|
|
6941
|
+
> {}
|
|
6938
6942
|
|
|
6939
6943
|
export interface PartialMessageReaction extends Partialize<MessageReaction, 'count'> {}
|
|
6940
6944
|
|
|
6941
|
-
export interface PartialPoll
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
> {
|
|
6945
|
+
export interface PartialPoll extends Partialize<
|
|
6946
|
+
Poll,
|
|
6947
|
+
'allowMultiselect' | 'expiresTimestamp' | 'layoutType',
|
|
6948
|
+
null,
|
|
6949
|
+
'answers' | 'message' | 'question'
|
|
6950
|
+
> {
|
|
6948
6951
|
// eslint-disable-next-line no-restricted-syntax
|
|
6949
6952
|
answers: Collection<number, PartialPollAnswer>;
|
|
6950
6953
|
message: PartialMessage;
|
|
@@ -6955,8 +6958,11 @@ export interface PartialPollAnswer extends Partialize<PollAnswer, 'emoji' | 'tex
|
|
|
6955
6958
|
readonly poll: PartialPoll;
|
|
6956
6959
|
}
|
|
6957
6960
|
|
|
6958
|
-
export interface PartialGuildScheduledEvent
|
|
6959
|
-
|
|
6961
|
+
export interface PartialGuildScheduledEvent extends Partialize<
|
|
6962
|
+
GuildScheduledEvent,
|
|
6963
|
+
'userCount',
|
|
6964
|
+
'entityType' | 'name' | 'privacyLevel' | 'status'
|
|
6965
|
+
> {}
|
|
6960
6966
|
|
|
6961
6967
|
export interface PartialThreadMember extends Partialize<ThreadMember, 'flags' | 'joinedAt' | 'joinedTimestamp'> {}
|
|
6962
6968
|
|
|
@@ -7220,22 +7226,11 @@ export interface VoiceStateEditOptions {
|
|
|
7220
7226
|
suppressed?: boolean;
|
|
7221
7227
|
}
|
|
7222
7228
|
|
|
7223
|
-
export
|
|
7224
|
-
|
|
7225
|
-
export interface WebhookClientDataIdWithToken {
|
|
7229
|
+
export interface WebhookDataIdWithToken {
|
|
7226
7230
|
id: Snowflake;
|
|
7227
7231
|
token: string;
|
|
7228
7232
|
}
|
|
7229
7233
|
|
|
7230
|
-
export interface WebhookClientDataURL {
|
|
7231
|
-
url: string;
|
|
7232
|
-
}
|
|
7233
|
-
|
|
7234
|
-
export interface WebhookClientOptions {
|
|
7235
|
-
allowedMentions?: MessageMentionOptions;
|
|
7236
|
-
rest?: Partial<RESTOptions>;
|
|
7237
|
-
}
|
|
7238
|
-
|
|
7239
7234
|
export interface WebhookDeleteOptions {
|
|
7240
7235
|
reason?: string;
|
|
7241
7236
|
token?: string;
|
|
@@ -7262,10 +7257,7 @@ export interface WebhookFetchMessageOptions {
|
|
|
7262
7257
|
}
|
|
7263
7258
|
|
|
7264
7259
|
export interface WebhookMessageCreateOptions
|
|
7265
|
-
extends BaseMessageOptions,
|
|
7266
|
-
MessageOptionsPoll,
|
|
7267
|
-
MessageOptionsFlags,
|
|
7268
|
-
MessageOptionsTTS {
|
|
7260
|
+
extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS {
|
|
7269
7261
|
appliedTags?: readonly Snowflake[];
|
|
7270
7262
|
avatarURL?: string;
|
|
7271
7263
|
threadId?: Snowflake;
|