discord.js 15.0.0-djs-file-upload.1761302390-5ae769c9e → 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.
Files changed (44) hide show
  1. package/package.json +18 -20
  2. package/src/client/Client.js +110 -24
  3. package/src/client/websocket/handlers/RATE_LIMITED.js +24 -0
  4. package/src/client/websocket/handlers/READY.js +4 -0
  5. package/src/client/websocket/handlers/index.js +1 -0
  6. package/src/errors/DJSError.js +7 -3
  7. package/src/errors/ErrorCodes.js +2 -4
  8. package/src/errors/Messages.js +2 -3
  9. package/src/index.js +0 -3
  10. package/src/managers/CachedManager.js +5 -5
  11. package/src/managers/ChannelManager.js +10 -7
  12. package/src/managers/GuildBanManager.js +3 -3
  13. package/src/managers/GuildEmojiManager.js +2 -2
  14. package/src/managers/GuildEmojiRoleManager.js +9 -1
  15. package/src/managers/GuildMemberManager.js +44 -23
  16. package/src/managers/GuildMemberRoleManager.js +11 -2
  17. package/src/managers/MessageManager.js +25 -18
  18. package/src/structures/ApplicationCommand.js +4 -5
  19. package/src/structures/ClientApplication.js +2 -0
  20. package/src/structures/Embed.js +1 -1
  21. package/src/structures/Guild.js +11 -1
  22. package/src/structures/GuildInvite.js +1 -1
  23. package/src/structures/GuildMember.js +12 -9
  24. package/src/structures/Message.js +18 -15
  25. package/src/structures/MessagePayload.js +21 -17
  26. package/src/structures/ModalComponentResolver.js +1 -1
  27. package/src/structures/ModalSubmitInteraction.js +6 -6
  28. package/src/structures/PermissionOverwrites.js +1 -1
  29. package/src/structures/Role.js +1 -1
  30. package/src/structures/ThreadChannel.js +1 -1
  31. package/src/structures/Webhook.js +6 -11
  32. package/src/structures/interfaces/TextBasedChannel.js +7 -9
  33. package/src/util/APITypes.js +10 -0
  34. package/src/util/Components.js +52 -42
  35. package/src/util/Constants.js +2 -0
  36. package/src/util/DataResolver.js +5 -2
  37. package/src/util/GuildMemberFlagsBitField.js +1 -1
  38. package/src/util/Options.js +9 -5
  39. package/src/util/Util.js +18 -13
  40. package/typings/index.d.mts +148 -173
  41. package/typings/index.d.ts +148 -173
  42. package/src/client/BaseClient.js +0 -131
  43. package/src/client/WebhookClient.js +0 -119
  44. package/src/structures/AttachmentBuilder.js +0 -185
@@ -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,8 +266,9 @@ export type ActionRowComponentData = MessageActionRowComponentData;
267
266
 
268
267
  export type ActionRowComponent = MessageActionRowComponent;
269
268
 
270
- export interface ActionRowData<ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>>
271
- extends BaseComponentData {
269
+ export interface ActionRowData<
270
+ ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>,
271
+ > extends BaseComponentData {
272
272
  components: readonly ComponentType[];
273
273
  }
274
274
 
@@ -419,7 +419,7 @@ export class ApplicationCommand<PermissionsFetchType = {}> extends Base {
419
419
  public name: string;
420
420
  public nameLocalizations: LocalizationMap | null;
421
421
  public nameLocalized: string | null;
422
- public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[];
422
+ public options: (ApplicationCommandOption & { descriptionLocalized?: string; nameLocalized?: string })[] | null;
423
423
  public permissions: ApplicationCommandPermissionsManager<
424
424
  PermissionsFetchType,
425
425
  PermissionsFetchType,
@@ -493,18 +493,6 @@ export abstract class Base {
493
493
  public valueOf(): string;
494
494
  }
495
495
 
496
- export class BaseClient<Events extends {}> extends AsyncEventEmitter<Events> implements AsyncDisposable {
497
- public constructor(options?: ClientOptions | WebhookClientOptions);
498
- private decrementMaxListeners(): void;
499
- private incrementMaxListeners(): void;
500
-
501
- public options: ClientOptions | WebhookClientOptions;
502
- public rest: REST;
503
- public destroy(): void;
504
- public toJSON(...props: Record<string, boolean | string>[]): unknown;
505
- public [Symbol.asyncDispose](): Promise<void>;
506
- }
507
-
508
496
  export type GuildCacheMessage<Cached extends CacheType> = CacheTypeReducer<
509
497
  Cached,
510
498
  Message<true>,
@@ -616,7 +604,8 @@ export class BaseGuildEmoji extends Emoji {
616
604
  }
617
605
 
618
606
  export interface BaseGuildTextChannel
619
- extends TextBasedChannelFields<true>,
607
+ extends
608
+ TextBasedChannelFields<true>,
620
609
  PinnableChannelFields,
621
610
  WebhookChannelFields,
622
611
  BulkDeleteMethod,
@@ -643,7 +632,8 @@ export class BaseGuildTextChannel extends GuildChannel {
643
632
  }
644
633
 
645
634
  export interface BaseGuildVoiceChannel
646
- extends TextBasedChannelFields<true>,
635
+ extends
636
+ TextBasedChannelFields<true>,
647
637
  WebhookChannelFields,
648
638
  BulkDeleteMethod,
649
639
  SetRateLimitPerUserMethod,
@@ -914,7 +904,10 @@ export type If<Value extends boolean, TrueResult, FalseResult = null> = Value ex
914
904
  ? FalseResult
915
905
  : FalseResult | TrueResult;
916
906
 
917
- export class Client<Ready extends boolean = boolean> extends BaseClient<ClientEventTypes> {
907
+ export class Client<Ready extends boolean = boolean>
908
+ extends AsyncEventEmitter<ClientEventTypes>
909
+ implements AsyncDisposable
910
+ {
918
911
  public constructor(options: ClientOptions);
919
912
  private readonly actions: unknown;
920
913
  private readonly expectedGuilds: Set<Snowflake>;
@@ -929,6 +922,8 @@ export class Client<Ready extends boolean = boolean> extends BaseClient<ClientEv
929
922
  private _triggerClientReady(): void;
930
923
  private _validateOptions(options: ClientOptions): void;
931
924
  private get _censoredToken(): string | null;
925
+ private decrementMaxListeners(): void;
926
+ private incrementMaxListeners(): void;
932
927
  // This a technique used to brand the ready state. Or else we'll get `never` errors on typeguard checks.
933
928
  private readonly _ready: Ready;
934
929
 
@@ -940,6 +935,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient<ClientEv
940
935
  public get ping(): number | null;
941
936
  public get readyAt(): If<Ready, Date>;
942
937
  public readyTimestamp: If<Ready, number>;
938
+ public rest: REST;
943
939
  public sweepers: Sweepers;
944
940
  public shard: ShardClientUtil | null;
945
941
  public status: Status;
@@ -970,6 +966,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient<ClientEv
970
966
  public login(token?: string): Promise<string>;
971
967
  public isReady(): this is Client<true>;
972
968
  public toJSON(): unknown;
969
+ public [Symbol.asyncDispose](): Promise<void>;
973
970
  }
974
971
 
975
972
  export interface StickerPackFetchOptions {
@@ -1288,10 +1285,7 @@ export class PrimaryEntryPointCommandInteraction<
1288
1285
  }
1289
1286
 
1290
1287
  export interface DMChannel
1291
- extends TextBasedChannelFields<false, true>,
1292
- PinnableChannelFields,
1293
- MessageChannelFields,
1294
- SendMethod<false> {}
1288
+ extends TextBasedChannelFields<false, true>, PinnableChannelFields, MessageChannelFields, SendMethod<false> {}
1295
1289
  export class DMChannel extends BaseChannel {
1296
1290
  private constructor(client: Client<true>, data?: RawDMChannelData);
1297
1291
  public flags: Readonly<ChannelFlagsBitField>;
@@ -1459,6 +1453,7 @@ export class Guild extends AnonymousGuild {
1459
1453
  public widgetChannelId: Snowflake | null;
1460
1454
  public widgetEnabled: boolean | null;
1461
1455
  public get maximumBitrate(): number;
1456
+ public get maximumStageBitrate(): number;
1462
1457
  public createTemplate(name: string, description?: string): Promise<GuildTemplate>;
1463
1458
  public discoverySplashURL(options?: ImageURLOptions): string | null;
1464
1459
  public edit(options: GuildEditOptions): Promise<Guild>;
@@ -2240,7 +2235,12 @@ export class Message<InGuild extends boolean = boolean> extends Base {
2240
2235
  ): InteractionCollector<MappedInteractionTypes<InGuild>[ComponentType]>;
2241
2236
  public delete(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
2242
2237
  public edit(
2243
- content: MessageEditOptions | MessagePayload | string,
2238
+ content:
2239
+ | FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
2240
+ | JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
2241
+ | MessageEditOptions
2242
+ | MessagePayload
2243
+ | string,
2244
2244
  ): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
2245
2245
  public equals(message: Message, rawData: unknown): boolean;
2246
2246
  public fetchReference(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
@@ -2265,26 +2265,6 @@ export class Message<InGuild extends boolean = boolean> extends Base {
2265
2265
  public inGuild(): this is Message<true>;
2266
2266
  }
2267
2267
 
2268
- export class AttachmentBuilder {
2269
- public constructor(attachment: BufferResolvable | Stream, data?: AttachmentData);
2270
- public attachment: BufferResolvable | Stream;
2271
- public description: string | null;
2272
- public name: string | null;
2273
- public title: string | null;
2274
- public waveform: string | null;
2275
- public duration: number | null;
2276
- public get spoiler(): boolean;
2277
- public setDescription(description: string): this;
2278
- public setFile(attachment: BufferResolvable | Stream, name?: string): this;
2279
- public setName(name: string): this;
2280
- public setTitle(title: string): this;
2281
- public setWaveform(waveform: string): this;
2282
- public setDuration(duration: number): this;
2283
- public setSpoiler(spoiler?: boolean): this;
2284
- public toJSON(): unknown;
2285
- public static from(other: JSONEncodable<AttachmentPayload>): AttachmentBuilder;
2286
- }
2287
-
2288
2268
  export class Attachment {
2289
2269
  private constructor(data: APIAttachment);
2290
2270
  private readonly attachment: BufferResolvable | Stream;
@@ -2563,14 +2543,13 @@ export interface TextInputModalData extends BaseModalData<ComponentType.TextInpu
2563
2543
  value: string;
2564
2544
  }
2565
2545
 
2566
- export interface SelectMenuModalData<Cached extends CacheType = CacheType>
2567
- extends BaseModalData<
2568
- | ComponentType.ChannelSelect
2569
- | ComponentType.MentionableSelect
2570
- | ComponentType.RoleSelect
2571
- | ComponentType.StringSelect
2572
- | ComponentType.UserSelect
2573
- > {
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
+ > {
2574
2553
  channels?: ReadonlyCollection<
2575
2554
  Snowflake,
2576
2555
  CacheTypeReducer<Cached, GuildBasedChannel, APIInteractionDataResolvedChannel>
@@ -2583,14 +2562,15 @@ export interface SelectMenuModalData<Cached extends CacheType = CacheType>
2583
2562
  }
2584
2563
 
2585
2564
  export interface FileUploadModalData extends BaseModalData<ComponentType.FileUpload> {
2565
+ attachments: ReadonlyCollection<Snowflake, Attachment>;
2586
2566
  customId: string;
2587
- files: readonly Attachment[];
2567
+ values: readonly Snowflake[];
2588
2568
  }
2589
2569
 
2590
2570
  export type ModalData = FileUploadModalData | SelectMenuModalData | TextInputModalData;
2591
2571
 
2592
2572
  export interface LabelModalData extends BaseModalData<ComponentType.Label> {
2593
- component: readonly ModalData[];
2573
+ component: ModalData;
2594
2574
  }
2595
2575
  export interface ActionRowModalData extends BaseModalData<ComponentType.ActionRow> {
2596
2576
  components: readonly TextInputModalData[];
@@ -2660,12 +2640,13 @@ export class ModalComponentResolver<Cached extends CacheType = CacheType> {
2660
2640
 
2661
2641
  public getSelectedMentionables(customId: string, required: true): ModalSelectedMentionables<Cached>;
2662
2642
  public getSelectedMentionables(customId: string, required?: boolean): ModalSelectedMentionables<Cached> | null;
2663
- public getUploadedFiles(customId: string, required: true): ReadonlyCollection<string, Attachment>;
2664
- public getUploadedFiles(customId: string, required?: boolean): ReadonlyCollection<string, Attachment> | null;
2643
+ public getUploadedFiles(customId: string, required: true): ReadonlyCollection<Snowflake, Attachment>;
2644
+ public getUploadedFiles(customId: string, required?: boolean): ReadonlyCollection<Snowflake, Attachment> | null;
2665
2645
  }
2666
2646
 
2667
- export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = CacheType>
2668
- extends ModalSubmitInteraction<Cached> {
2647
+ export interface ModalMessageModalSubmitInteraction<
2648
+ Cached extends CacheType = CacheType,
2649
+ > extends ModalSubmitInteraction<Cached> {
2669
2650
  channelId: Snowflake;
2670
2651
  inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
2671
2652
  inGuild(): this is ModalMessageModalSubmitInteraction<'cached' | 'raw'>;
@@ -3518,14 +3499,15 @@ export interface PrivateThreadChannel extends ThreadChannel<false> {
3518
3499
  }
3519
3500
 
3520
3501
  export interface ThreadChannel<ThreadOnly extends boolean = boolean>
3521
- extends TextBasedChannelFields<true>,
3502
+ extends
3503
+ TextBasedChannelFields<true>,
3522
3504
  PinnableChannelFields,
3523
3505
  BulkDeleteMethod,
3524
3506
  SetRateLimitPerUserMethod,
3525
3507
  MessageChannelFields,
3526
3508
  SendMethod<true> {}
3527
3509
  export class ThreadChannel<ThreadOnly extends boolean = boolean> extends BaseChannel {
3528
- private constructor(guild: Guild, data?: RawThreadChannelData, client?: Client<true>);
3510
+ private constructor(guild: Guild, data: RawThreadChannelData, client?: Client<true>);
3529
3511
  public archived: boolean | null;
3530
3512
  public get archivedAt(): Date | null;
3531
3513
  public archiveTimestamp: number | null;
@@ -3742,7 +3724,7 @@ export function fetchRecommendedShardCount(token: string, options?: FetchRecomme
3742
3724
  export function flatten(obj: unknown, ...props: Record<string, boolean | string>[]): unknown;
3743
3725
 
3744
3726
  export function parseEmoji(text: string): PartialEmoji | null;
3745
- export function parseWebhookURL(url: string): WebhookClientDataIdWithToken | null;
3727
+ export function parseWebhookURL(url: string): WebhookDataIdWithToken | null;
3746
3728
  export function resolveColor(color: ColorResolvable): number;
3747
3729
  export function resolveSKUId(resolvable: SKUResolvable): Snowflake | null;
3748
3730
  export function verifyString(data: string, error?: typeof Error, errorMessage?: string, allowEmpty?: boolean): string;
@@ -3821,14 +3803,14 @@ export class VoiceState extends Base {
3821
3803
 
3822
3804
  export interface Webhook<Type extends WebhookType = WebhookType> extends WebhookFields {}
3823
3805
  export class Webhook<Type extends WebhookType = WebhookType> {
3824
- private constructor(client: Client<true>, data?: unknown);
3806
+ private constructor(client: Client<true>, data: unknown);
3825
3807
  public avatar: string | null;
3826
3808
  public avatarURL(options?: ImageURLOptions): string | null;
3827
3809
  public channelId: Snowflake;
3828
3810
  public readonly client: Client;
3829
3811
  public guildId: Snowflake;
3830
3812
  public name: string;
3831
- public owner: Type extends WebhookType.Incoming ? APIUser | User | null : APIUser | User;
3813
+ public owner: Type extends WebhookType.Incoming ? User | null : User;
3832
3814
  public sourceGuild: Type extends WebhookType.ChannelFollower ? APIPartialGuild | Guild : null;
3833
3815
  public sourceChannel: Type extends WebhookType.ChannelFollower ? AnnouncementChannel | APIPartialChannel : null;
3834
3816
  public token: Type extends WebhookType.Incoming
@@ -3847,7 +3829,7 @@ export class Webhook<Type extends WebhookType = WebhookType> {
3847
3829
  | VoiceChannel
3848
3830
  | null;
3849
3831
  public isUserCreated(): this is Webhook<WebhookType.Incoming> & {
3850
- owner: APIUser | User;
3832
+ owner: User;
3851
3833
  };
3852
3834
  public isApplicationCreated(): this is Webhook<WebhookType.Application>;
3853
3835
  public isIncoming(): this is Webhook<WebhookType.Incoming>;
@@ -3861,20 +3843,6 @@ export class Webhook<Type extends WebhookType = WebhookType> {
3861
3843
  public send(options: MessagePayload | WebhookMessageCreateOptions | string): Promise<Message<true>>;
3862
3844
  }
3863
3845
 
3864
- export interface WebhookClient extends WebhookFields, BaseClient<{}> {}
3865
- export class WebhookClient extends BaseClient<{}> {
3866
- public constructor(data: WebhookClientData, options?: WebhookClientOptions);
3867
- public readonly client: this;
3868
- public options: WebhookClientOptions;
3869
- public token: string;
3870
- public editMessage(
3871
- message: MessageResolvable,
3872
- options: MessagePayload | WebhookMessageEditOptions | string,
3873
- ): Promise<APIMessage>;
3874
- public fetchMessage(message: Snowflake, options?: WebhookFetchMessageOptions): Promise<APIMessage>;
3875
- public send(options: MessagePayload | WebhookMessageCreateOptions | string): Promise<APIMessage>;
3876
- }
3877
-
3878
3846
  export class Widget extends Base {
3879
3847
  private constructor(client: Client<true>, data: APIGuildWidget);
3880
3848
  private _patch(data: APIGuildWidget): void;
@@ -4064,14 +4032,13 @@ export enum DiscordjsErrorCodes {
4064
4032
 
4065
4033
  WebhookMessage = 'WebhookMessage',
4066
4034
  WebhookTokenUnavailable = 'WebhookTokenUnavailable',
4067
- WebhookURLInvalid = 'WebhookURLInvalid',
4068
4035
  WebhookApplication = 'WebhookApplication',
4069
4036
 
4070
4037
  MessageReferenceMissing = 'MessageReferenceMissing',
4071
4038
 
4072
4039
  EmojiType = 'EmojiType',
4073
4040
  EmojiManaged = 'EmojiManaged',
4074
- MissingManageGuildExpressionsPermission = 'MissingManageGuildExpressionsPermission',
4041
+ MissingGuildExpressionsPermission = 'MissingGuildExpressionsPermission',
4075
4042
 
4076
4043
  NotGuildSoundboardSound = 'NotGuildSoundboardSound',
4077
4044
  NotGuildSticker = 'NotGuildSticker',
@@ -4118,6 +4085,9 @@ export enum DiscordjsErrorCodes {
4118
4085
  BulkBanUsersOptionEmpty = 'BulkBanUsersOptionEmpty',
4119
4086
 
4120
4087
  PollAlreadyExpired = 'PollAlreadyExpired',
4088
+
4089
+ PermissionOverwritesTypeMandatory = 'PermissionOverwritesTypeMandatory',
4090
+ PermissionOverwritesTypeMismatch = 'PermissionOverwritesTypeMismatch',
4121
4091
  }
4122
4092
  /* eslint-enable typescript-sort-keys/string-enum */
4123
4093
 
@@ -4295,7 +4265,12 @@ export class ChannelManager extends CachedManager<Snowflake, Channel, ChannelRes
4295
4265
  private constructor(client: Client<true>, iterable: Iterable<RawChannelData>);
4296
4266
  public createMessage(
4297
4267
  channel: Exclude<TextBasedChannelResolvable, PartialGroupDMChannel>,
4298
- options: MessageCreateOptions | MessagePayload | string,
4268
+ options:
4269
+ | FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
4270
+ | JSONEncodable<RESTPostAPIChannelMessageJSONBody>
4271
+ | MessageCreateOptions
4272
+ | MessagePayload
4273
+ | string,
4299
4274
  ): Promise<OmitPartialGroupDMChannel<Message>>;
4300
4275
  public fetch(id: Snowflake, options?: FetchChannelOptions): Promise<Channel | null>;
4301
4276
  }
@@ -4647,7 +4622,12 @@ export abstract class MessageManager<InGuild extends boolean = boolean> extends
4647
4622
  public delete(message: MessageResolvable): Promise<void>;
4648
4623
  public edit(
4649
4624
  message: MessageResolvable,
4650
- options: MessageEditOptions | MessagePayload | string,
4625
+ options:
4626
+ | FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
4627
+ | JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
4628
+ | MessageEditOptions
4629
+ | MessagePayload
4630
+ | string,
4651
4631
  ): Promise<Message<InGuild>>;
4652
4632
  public fetch(options: FetchMessageOptions | MessageResolvable): Promise<Message<InGuild>>;
4653
4633
  public fetch(options?: FetchMessagesOptions): Promise<Collection<Snowflake, Message<InGuild>>>;
@@ -4824,7 +4804,14 @@ export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, type
4824
4804
  export type Constructable<Entity> = abstract new (...args: any[]) => Entity;
4825
4805
 
4826
4806
  export interface SendMethod<InGuild extends boolean = boolean> {
4827
- send(options: MessageCreateOptions | MessagePayload | string): Promise<Message<InGuild>>;
4807
+ send(
4808
+ options:
4809
+ | FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
4810
+ | JSONEncodable<RESTPostAPIChannelMessageJSONBody>
4811
+ | MessageCreateOptions
4812
+ | MessagePayload
4813
+ | string,
4814
+ ): Promise<Message<InGuild>>;
4828
4815
  }
4829
4816
 
4830
4817
  export interface PinnableChannelFields {
@@ -5077,15 +5064,17 @@ export interface ApplicationCommandAutocompleteStringOptionData extends BaseAppl
5077
5064
  type: ApplicationCommandOptionType.String;
5078
5065
  }
5079
5066
 
5080
- export interface ApplicationCommandChoicesData<Type extends number | string = number | string>
5081
- extends BaseApplicationCommandOptionsData {
5067
+ export interface ApplicationCommandChoicesData<
5068
+ Type extends number | string = number | string,
5069
+ > extends BaseApplicationCommandOptionsData {
5082
5070
  autocomplete?: false;
5083
5071
  choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
5084
5072
  type: CommandOptionChoiceResolvableType;
5085
5073
  }
5086
5074
 
5087
- export interface ApplicationCommandChoicesOption<Type extends number | string = number | string>
5088
- extends BaseApplicationCommandOptionsData {
5075
+ export interface ApplicationCommandChoicesOption<
5076
+ Type extends number | string = number | string,
5077
+ > extends BaseApplicationCommandOptionsData {
5089
5078
  autocomplete?: false;
5090
5079
  choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
5091
5080
  type: CommandOptionChoiceResolvableType;
@@ -5268,13 +5257,15 @@ export interface AutoModerationTriggerMetadata {
5268
5257
  regexPatterns: readonly string[];
5269
5258
  }
5270
5259
 
5271
- export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction>
5272
- extends CollectorOptions<[Interaction, Collection<Snowflake, Interaction>]> {
5260
+ export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction> extends CollectorOptions<
5261
+ [Interaction, Collection<Snowflake, Interaction>]
5262
+ > {
5273
5263
  componentType?: ComponentType;
5274
5264
  }
5275
5265
 
5276
- export interface AwaitModalSubmitOptions
5277
- extends CollectorOptions<[ModalSubmitInteraction, Collection<Snowflake, ModalSubmitInteraction>]> {
5266
+ export interface AwaitModalSubmitOptions extends CollectorOptions<
5267
+ [ModalSubmitInteraction, Collection<Snowflake, ModalSubmitInteraction>]
5268
+ > {
5278
5269
  time: number;
5279
5270
  }
5280
5271
 
@@ -5368,13 +5359,21 @@ export type OverriddenCaches =
5368
5359
  | 'GuildMessageManager'
5369
5360
  | 'GuildTextThreadManager';
5370
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
+
5371
5368
  // This doesn't actually work the way it looks 😢.
5372
5369
  // Narrowing the type of `manager.name` doesn't propagate type information to `holds` and the return type.
5373
- export type CacheFactory = (
5374
- managerType: CacheConstructors[Exclude<keyof Caches, OverriddenCaches>],
5375
- holds: Caches[(typeof manager)['name']][1],
5376
- manager: CacheConstructors[keyof Caches],
5377
- ) => (typeof manager)['prototype'] extends DataManager<infer Key, infer Value, any> ? Collection<Key, Value> : never;
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;
5378
5377
 
5379
5378
  export type CacheWithLimitsOptions = {
5380
5379
  [K in keyof Caches]?: Caches[K][0]['prototype'] extends DataManager<infer Key, infer Value, any>
@@ -5565,7 +5564,8 @@ export interface ClientFetchInviteOptions {
5565
5564
  withCounts?: boolean;
5566
5565
  }
5567
5566
 
5568
- export interface ClientOptions extends WebhookClientOptions {
5567
+ export interface ClientOptions {
5568
+ allowedMentions?: MessageMentionOptions;
5569
5569
  closeTimeout?: number;
5570
5570
  enforceNonce?: boolean;
5571
5571
  failIfNotExists?: boolean;
@@ -5574,6 +5574,7 @@ export interface ClientOptions extends WebhookClientOptions {
5574
5574
  makeCache?: CacheFactory;
5575
5575
  partials?: readonly Partials[];
5576
5576
  presence?: PresenceData;
5577
+ rest?: Partial<RESTOptions>;
5577
5578
  sweepers?: SweeperOptions;
5578
5579
  waitGuildTimeout?: number;
5579
5580
  ws?: Partial<WebSocketManagerOptions>;
@@ -5637,8 +5638,9 @@ export interface BaseInteractionResolvedData<Cached extends CacheType = CacheTyp
5637
5638
  users?: ReadonlyCollection<Snowflake, User>;
5638
5639
  }
5639
5640
 
5640
- export interface CommandInteractionResolvedData<Cached extends CacheType = CacheType>
5641
- extends BaseInteractionResolvedData<Cached> {
5641
+ export interface CommandInteractionResolvedData<
5642
+ Cached extends CacheType = CacheType,
5643
+ > extends BaseInteractionResolvedData<Cached> {
5642
5644
  messages?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Message, APIMessage>>;
5643
5645
  }
5644
5646
 
@@ -6277,7 +6279,7 @@ export interface GuildEmojiEditOptions {
6277
6279
 
6278
6280
  export interface GuildStickerCreateOptions {
6279
6281
  description?: string | null;
6280
- file: AttachmentPayload | BufferResolvable | JSONEncodable<AttachmentBuilder> | Stream;
6282
+ file: AttachmentPayload | BufferResolvable | Stream;
6281
6283
  name: string;
6282
6284
  reason?: string;
6283
6285
  tags: string;
@@ -6624,8 +6626,9 @@ export type CollectedMessageInteraction<Cached extends CacheType = CacheType> =
6624
6626
  ModalSubmitInteraction
6625
6627
  >;
6626
6628
 
6627
- export interface MessageComponentCollectorOptions<Interaction extends CollectedMessageInteraction>
6628
- extends AwaitMessageComponentOptions<Interaction> {
6629
+ export interface MessageComponentCollectorOptions<
6630
+ Interaction extends CollectedMessageInteraction,
6631
+ > extends AwaitMessageComponentOptions<Interaction> {
6629
6632
  max?: number;
6630
6633
  maxComponents?: number;
6631
6634
  maxUsers?: number;
@@ -6664,25 +6667,24 @@ export interface MessageMentionOptions {
6664
6667
 
6665
6668
  export type MessageMentionTypes = 'everyone' | 'roles' | 'users';
6666
6669
 
6667
- export interface MessageSnapshot
6668
- extends Partialize<
6669
- Message,
6670
- null,
6671
- Exclude<
6672
- keyof Message,
6673
- | 'attachments'
6674
- | 'client'
6675
- | 'components'
6676
- | 'content'
6677
- | 'createdTimestamp'
6678
- | 'editedTimestamp'
6679
- | 'embeds'
6680
- | 'flags'
6681
- | 'mentions'
6682
- | 'stickers'
6683
- | 'type'
6684
- >
6685
- > {}
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
+ > {}
6686
6688
 
6687
6689
  export interface BaseMessageOptions {
6688
6690
  allowedMentions?: MessageMentionOptions;
@@ -6695,14 +6697,7 @@ export interface BaseMessageOptions {
6695
6697
  )[];
6696
6698
  content?: string;
6697
6699
  embeds?: readonly (APIEmbed | JSONEncodable<APIEmbed>)[];
6698
- files?: readonly (
6699
- | Attachment
6700
- | AttachmentBuilder
6701
- | AttachmentPayload
6702
- | BufferResolvable
6703
- | JSONEncodable<APIAttachment>
6704
- | Stream
6705
- )[];
6700
+ files?: readonly (Attachment | AttachmentPayload | BufferResolvable | FileBodyEncodable<APIAttachment> | Stream)[];
6706
6701
  }
6707
6702
 
6708
6703
  export interface MessageOptionsPoll {
@@ -6730,11 +6725,7 @@ export interface MessageOptionsStickers {
6730
6725
  }
6731
6726
 
6732
6727
  export interface BaseMessageCreateOptions
6733
- extends BaseMessageOptions,
6734
- MessageOptionsPoll,
6735
- MessageOptionsFlags,
6736
- MessageOptionsTTS,
6737
- MessageOptionsStickers {
6728
+ extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS, MessageOptionsStickers {
6738
6729
  enforceNonce?: boolean;
6739
6730
  nonce?: number | string;
6740
6731
  }
@@ -6744,16 +6735,10 @@ export interface MessageCreateOptions extends BaseMessageCreateOptions {
6744
6735
  }
6745
6736
 
6746
6737
  export interface GuildForumThreadMessageCreateOptions
6747
- extends BaseMessageOptions,
6748
- MessageOptionsFlags,
6749
- MessageOptionsStickers {}
6750
-
6751
- export interface MessageEditAttachmentData {
6752
- id: Snowflake;
6753
- }
6738
+ extends BaseMessageOptions, MessageOptionsFlags, MessageOptionsStickers {}
6754
6739
 
6755
6740
  export interface MessageEditOptions extends Omit<BaseMessageOptions, 'content'> {
6756
- attachments?: readonly (Attachment | MessageEditAttachmentData)[];
6741
+ attachments?: readonly (Attachment | JSONEncodable<APIAttachment>)[];
6757
6742
  content?: string | null;
6758
6743
  flags?:
6759
6744
  | BitFieldResolvable<
@@ -6851,7 +6836,7 @@ export interface FileUploadComponentData extends BaseComponentData {
6851
6836
  customId: string;
6852
6837
  maxValues?: number;
6853
6838
  minValues?: number;
6854
- required?: number;
6839
+ required?: boolean;
6855
6840
  type: ComponentType.FileUpload;
6856
6841
  }
6857
6842
 
@@ -6862,8 +6847,7 @@ export type MessageTarget =
6862
6847
  | Message
6863
6848
  | MessageManager
6864
6849
  | TextBasedChannel
6865
- | Webhook<WebhookType.Incoming>
6866
- | WebhookClient;
6850
+ | Webhook<WebhookType.Incoming>;
6867
6851
 
6868
6852
  export interface MultipleShardRespawnOptions {
6869
6853
  respawnDelay?: number;
@@ -6950,18 +6934,20 @@ export interface PartialDMChannel extends Partialize<DMChannel, null, null, 'las
6950
6934
 
6951
6935
  export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp' | 'pending'> {}
6952
6936
 
6953
- export interface PartialMessage<InGuild extends boolean = boolean>
6954
- extends Partialize<Message<InGuild>, 'pinned' | 'system' | 'tts' | 'type', 'author' | 'cleanContent' | 'content'> {}
6937
+ export interface PartialMessage<InGuild extends boolean = boolean> extends Partialize<
6938
+ Message<InGuild>,
6939
+ 'pinned' | 'system' | 'tts' | 'type',
6940
+ 'author' | 'cleanContent' | 'content'
6941
+ > {}
6955
6942
 
6956
6943
  export interface PartialMessageReaction extends Partialize<MessageReaction, 'count'> {}
6957
6944
 
6958
- export interface PartialPoll
6959
- extends Partialize<
6960
- Poll,
6961
- 'allowMultiselect' | 'expiresTimestamp' | 'layoutType',
6962
- null,
6963
- 'answers' | 'message' | 'question'
6964
- > {
6945
+ export interface PartialPoll extends Partialize<
6946
+ Poll,
6947
+ 'allowMultiselect' | 'expiresTimestamp' | 'layoutType',
6948
+ null,
6949
+ 'answers' | 'message' | 'question'
6950
+ > {
6965
6951
  // eslint-disable-next-line no-restricted-syntax
6966
6952
  answers: Collection<number, PartialPollAnswer>;
6967
6953
  message: PartialMessage;
@@ -6972,8 +6958,11 @@ export interface PartialPollAnswer extends Partialize<PollAnswer, 'emoji' | 'tex
6972
6958
  readonly poll: PartialPoll;
6973
6959
  }
6974
6960
 
6975
- export interface PartialGuildScheduledEvent
6976
- extends Partialize<GuildScheduledEvent, 'userCount', 'entityType' | 'name' | 'privacyLevel' | 'status'> {}
6961
+ export interface PartialGuildScheduledEvent extends Partialize<
6962
+ GuildScheduledEvent,
6963
+ 'userCount',
6964
+ 'entityType' | 'name' | 'privacyLevel' | 'status'
6965
+ > {}
6977
6966
 
6978
6967
  export interface PartialThreadMember extends Partialize<ThreadMember, 'flags' | 'joinedAt' | 'joinedTimestamp'> {}
6979
6968
 
@@ -7237,22 +7226,11 @@ export interface VoiceStateEditOptions {
7237
7226
  suppressed?: boolean;
7238
7227
  }
7239
7228
 
7240
- export type WebhookClientData = WebhookClientDataIdWithToken | WebhookClientDataURL;
7241
-
7242
- export interface WebhookClientDataIdWithToken {
7229
+ export interface WebhookDataIdWithToken {
7243
7230
  id: Snowflake;
7244
7231
  token: string;
7245
7232
  }
7246
7233
 
7247
- export interface WebhookClientDataURL {
7248
- url: string;
7249
- }
7250
-
7251
- export interface WebhookClientOptions {
7252
- allowedMentions?: MessageMentionOptions;
7253
- rest?: Partial<RESTOptions>;
7254
- }
7255
-
7256
7234
  export interface WebhookDeleteOptions {
7257
7235
  reason?: string;
7258
7236
  token?: string;
@@ -7279,10 +7257,7 @@ export interface WebhookFetchMessageOptions {
7279
7257
  }
7280
7258
 
7281
7259
  export interface WebhookMessageCreateOptions
7282
- extends BaseMessageOptions,
7283
- MessageOptionsPoll,
7284
- MessageOptionsFlags,
7285
- MessageOptionsTTS {
7260
+ extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS {
7286
7261
  appliedTags?: readonly Snowflake[];
7287
7262
  avatarURL?: string;
7288
7263
  threadId?: Snowflake;