discord.js 15.0.0-pr-11006.1765452229-e636950b2 → 15.0.0-pr-11005.1765454364-f3f6d34e7

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.
@@ -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, FileBodyEncodable, JSONEncodable } from '@discordjs/util';
8
+ import { Awaitable, JSONEncodable } from '@discordjs/util';
9
9
  import { WebSocketManager, WebSocketManagerOptions } from '@discordjs/ws';
10
10
  import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
11
11
  import {
@@ -266,9 +266,8 @@ export type ActionRowComponentData = MessageActionRowComponentData;
266
266
 
267
267
  export type ActionRowComponent = MessageActionRowComponent;
268
268
 
269
- export interface ActionRowData<
270
- ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>,
271
- > extends BaseComponentData {
269
+ export interface ActionRowData<ComponentType extends ActionRowComponentData | JSONEncodable<APIComponentInActionRow>>
270
+ extends BaseComponentData {
272
271
  components: readonly ComponentType[];
273
272
  }
274
273
 
@@ -604,8 +603,7 @@ export class BaseGuildEmoji extends Emoji {
604
603
  }
605
604
 
606
605
  export interface BaseGuildTextChannel
607
- extends
608
- TextBasedChannelFields<true>,
606
+ extends TextBasedChannelFields<true>,
609
607
  PinnableChannelFields,
610
608
  WebhookChannelFields,
611
609
  BulkDeleteMethod,
@@ -632,8 +630,7 @@ export class BaseGuildTextChannel extends GuildChannel {
632
630
  }
633
631
 
634
632
  export interface BaseGuildVoiceChannel
635
- extends
636
- TextBasedChannelFields<true>,
633
+ extends TextBasedChannelFields<true>,
637
634
  WebhookChannelFields,
638
635
  BulkDeleteMethod,
639
636
  SetRateLimitPerUserMethod,
@@ -1285,7 +1282,10 @@ export class PrimaryEntryPointCommandInteraction<
1285
1282
  }
1286
1283
 
1287
1284
  export interface DMChannel
1288
- extends TextBasedChannelFields<false, true>, PinnableChannelFields, MessageChannelFields, SendMethod<false> {}
1285
+ extends TextBasedChannelFields<false, true>,
1286
+ PinnableChannelFields,
1287
+ MessageChannelFields,
1288
+ SendMethod<false> {}
1289
1289
  export class DMChannel extends BaseChannel {
1290
1290
  private constructor(client: Client<true>, data?: RawDMChannelData);
1291
1291
  public flags: Readonly<ChannelFlagsBitField>;
@@ -1453,7 +1453,6 @@ export class Guild extends AnonymousGuild {
1453
1453
  public widgetChannelId: Snowflake | null;
1454
1454
  public widgetEnabled: boolean | null;
1455
1455
  public get maximumBitrate(): number;
1456
- public get maximumStageBitrate(): number;
1457
1456
  public createTemplate(name: string, description?: string): Promise<GuildTemplate>;
1458
1457
  public discoverySplashURL(options?: ImageURLOptions): string | null;
1459
1458
  public edit(options: GuildEditOptions): Promise<Guild>;
@@ -2235,12 +2234,7 @@ export class Message<InGuild extends boolean = boolean> extends Base {
2235
2234
  ): InteractionCollector<MappedInteractionTypes<InGuild>[ComponentType]>;
2236
2235
  public delete(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
2237
2236
  public edit(
2238
- content:
2239
- | FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
2240
- | JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
2241
- | MessageEditOptions
2242
- | MessagePayload
2243
- | string,
2237
+ content: MessageEditOptions | MessagePayload | string,
2244
2238
  ): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
2245
2239
  public equals(message: Message, rawData: unknown): boolean;
2246
2240
  public fetchReference(): Promise<OmitPartialGroupDMChannel<Message<InGuild>>>;
@@ -2265,6 +2259,26 @@ export class Message<InGuild extends boolean = boolean> extends Base {
2265
2259
  public inGuild(): this is Message<true>;
2266
2260
  }
2267
2261
 
2262
+ export class AttachmentBuilder {
2263
+ public constructor(attachment: BufferResolvable | Stream, data?: AttachmentData);
2264
+ public attachment: BufferResolvable | Stream;
2265
+ public description: string | null;
2266
+ public name: string | null;
2267
+ public title: string | null;
2268
+ public waveform: string | null;
2269
+ public duration: number | null;
2270
+ public get spoiler(): boolean;
2271
+ public setDescription(description: string): this;
2272
+ public setFile(attachment: BufferResolvable | Stream, name?: string): this;
2273
+ public setName(name: string): this;
2274
+ public setTitle(title: string): this;
2275
+ public setWaveform(waveform: string): this;
2276
+ public setDuration(duration: number): this;
2277
+ public setSpoiler(spoiler?: boolean): this;
2278
+ public toJSON(): unknown;
2279
+ public static from(other: JSONEncodable<AttachmentPayload>): AttachmentBuilder;
2280
+ }
2281
+
2268
2282
  export class Attachment {
2269
2283
  private constructor(data: APIAttachment);
2270
2284
  private readonly attachment: BufferResolvable | Stream;
@@ -2543,13 +2557,14 @@ export interface TextInputModalData extends BaseModalData<ComponentType.TextInpu
2543
2557
  value: string;
2544
2558
  }
2545
2559
 
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
- > {
2560
+ export interface SelectMenuModalData<Cached extends CacheType = CacheType>
2561
+ extends BaseModalData<
2562
+ | ComponentType.ChannelSelect
2563
+ | ComponentType.MentionableSelect
2564
+ | ComponentType.RoleSelect
2565
+ | ComponentType.StringSelect
2566
+ | ComponentType.UserSelect
2567
+ > {
2553
2568
  channels?: ReadonlyCollection<
2554
2569
  Snowflake,
2555
2570
  CacheTypeReducer<Cached, GuildBasedChannel, APIInteractionDataResolvedChannel>
@@ -2644,9 +2659,8 @@ export class ModalComponentResolver<Cached extends CacheType = CacheType> {
2644
2659
  public getUploadedFiles(customId: string, required?: boolean): ReadonlyCollection<Snowflake, Attachment> | null;
2645
2660
  }
2646
2661
 
2647
- export interface ModalMessageModalSubmitInteraction<
2648
- Cached extends CacheType = CacheType,
2649
- > extends ModalSubmitInteraction<Cached> {
2662
+ export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = CacheType>
2663
+ extends ModalSubmitInteraction<Cached> {
2650
2664
  channelId: Snowflake;
2651
2665
  inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
2652
2666
  inGuild(): this is ModalMessageModalSubmitInteraction<'cached' | 'raw'>;
@@ -3499,8 +3513,7 @@ export interface PrivateThreadChannel extends ThreadChannel<false> {
3499
3513
  }
3500
3514
 
3501
3515
  export interface ThreadChannel<ThreadOnly extends boolean = boolean>
3502
- extends
3503
- TextBasedChannelFields<true>,
3516
+ extends TextBasedChannelFields<true>,
3504
3517
  PinnableChannelFields,
3505
3518
  BulkDeleteMethod,
3506
3519
  SetRateLimitPerUserMethod,
@@ -4038,7 +4051,7 @@ export enum DiscordjsErrorCodes {
4038
4051
 
4039
4052
  EmojiType = 'EmojiType',
4040
4053
  EmojiManaged = 'EmojiManaged',
4041
- MissingGuildExpressionsPermission = 'MissingGuildExpressionsPermission',
4054
+ MissingManageGuildExpressionsPermission = 'MissingManageGuildExpressionsPermission',
4042
4055
 
4043
4056
  NotGuildSoundboardSound = 'NotGuildSoundboardSound',
4044
4057
  NotGuildSticker = 'NotGuildSticker',
@@ -4265,12 +4278,7 @@ export class ChannelManager extends CachedManager<Snowflake, Channel, ChannelRes
4265
4278
  private constructor(client: Client<true>, iterable: Iterable<RawChannelData>);
4266
4279
  public createMessage(
4267
4280
  channel: Exclude<TextBasedChannelResolvable, PartialGroupDMChannel>,
4268
- options:
4269
- | FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
4270
- | JSONEncodable<RESTPostAPIChannelMessageJSONBody>
4271
- | MessageCreateOptions
4272
- | MessagePayload
4273
- | string,
4281
+ options: MessageCreateOptions | MessagePayload | string,
4274
4282
  ): Promise<OmitPartialGroupDMChannel<Message>>;
4275
4283
  public fetch(id: Snowflake, options?: FetchChannelOptions): Promise<Channel | null>;
4276
4284
  }
@@ -4622,12 +4630,7 @@ export abstract class MessageManager<InGuild extends boolean = boolean> extends
4622
4630
  public delete(message: MessageResolvable): Promise<void>;
4623
4631
  public edit(
4624
4632
  message: MessageResolvable,
4625
- options:
4626
- | FileBodyEncodable<RESTPatchAPIChannelMessageJSONBody>
4627
- | JSONEncodable<RESTPatchAPIChannelMessageJSONBody>
4628
- | MessageEditOptions
4629
- | MessagePayload
4630
- | string,
4633
+ options: MessageEditOptions | MessagePayload | string,
4631
4634
  ): Promise<Message<InGuild>>;
4632
4635
  public fetch(options: FetchMessageOptions | MessageResolvable): Promise<Message<InGuild>>;
4633
4636
  public fetch(options?: FetchMessagesOptions): Promise<Collection<Snowflake, Message<InGuild>>>;
@@ -4804,14 +4807,7 @@ export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, type
4804
4807
  export type Constructable<Entity> = abstract new (...args: any[]) => Entity;
4805
4808
 
4806
4809
  export interface SendMethod<InGuild extends boolean = boolean> {
4807
- send(
4808
- options:
4809
- | FileBodyEncodable<RESTPostAPIChannelMessageJSONBody>
4810
- | JSONEncodable<RESTPostAPIChannelMessageJSONBody>
4811
- | MessageCreateOptions
4812
- | MessagePayload
4813
- | string,
4814
- ): Promise<Message<InGuild>>;
4810
+ send(options: MessageCreateOptions | MessagePayload | string): Promise<Message<InGuild>>;
4815
4811
  }
4816
4812
 
4817
4813
  export interface PinnableChannelFields {
@@ -5064,17 +5060,15 @@ export interface ApplicationCommandAutocompleteStringOptionData extends BaseAppl
5064
5060
  type: ApplicationCommandOptionType.String;
5065
5061
  }
5066
5062
 
5067
- export interface ApplicationCommandChoicesData<
5068
- Type extends number | string = number | string,
5069
- > extends BaseApplicationCommandOptionsData {
5063
+ export interface ApplicationCommandChoicesData<Type extends number | string = number | string>
5064
+ extends BaseApplicationCommandOptionsData {
5070
5065
  autocomplete?: false;
5071
5066
  choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
5072
5067
  type: CommandOptionChoiceResolvableType;
5073
5068
  }
5074
5069
 
5075
- export interface ApplicationCommandChoicesOption<
5076
- Type extends number | string = number | string,
5077
- > extends BaseApplicationCommandOptionsData {
5070
+ export interface ApplicationCommandChoicesOption<Type extends number | string = number | string>
5071
+ extends BaseApplicationCommandOptionsData {
5078
5072
  autocomplete?: false;
5079
5073
  choices?: readonly ApplicationCommandOptionChoiceData<Type>[];
5080
5074
  type: CommandOptionChoiceResolvableType;
@@ -5257,15 +5251,13 @@ export interface AutoModerationTriggerMetadata {
5257
5251
  regexPatterns: readonly string[];
5258
5252
  }
5259
5253
 
5260
- export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction> extends CollectorOptions<
5261
- [Interaction, Collection<Snowflake, Interaction>]
5262
- > {
5254
+ export interface AwaitMessageComponentOptions<Interaction extends CollectedMessageInteraction>
5255
+ extends CollectorOptions<[Interaction, Collection<Snowflake, Interaction>]> {
5263
5256
  componentType?: ComponentType;
5264
5257
  }
5265
5258
 
5266
- export interface AwaitModalSubmitOptions extends CollectorOptions<
5267
- [ModalSubmitInteraction, Collection<Snowflake, ModalSubmitInteraction>]
5268
- > {
5259
+ export interface AwaitModalSubmitOptions
5260
+ extends CollectorOptions<[ModalSubmitInteraction, Collection<Snowflake, ModalSubmitInteraction>]> {
5269
5261
  time: number;
5270
5262
  }
5271
5263
 
@@ -5638,9 +5630,8 @@ export interface BaseInteractionResolvedData<Cached extends CacheType = CacheTyp
5638
5630
  users?: ReadonlyCollection<Snowflake, User>;
5639
5631
  }
5640
5632
 
5641
- export interface CommandInteractionResolvedData<
5642
- Cached extends CacheType = CacheType,
5643
- > extends BaseInteractionResolvedData<Cached> {
5633
+ export interface CommandInteractionResolvedData<Cached extends CacheType = CacheType>
5634
+ extends BaseInteractionResolvedData<Cached> {
5644
5635
  messages?: ReadonlyCollection<Snowflake, CacheTypeReducer<Cached, Message, APIMessage>>;
5645
5636
  }
5646
5637
 
@@ -6279,7 +6270,7 @@ export interface GuildEmojiEditOptions {
6279
6270
 
6280
6271
  export interface GuildStickerCreateOptions {
6281
6272
  description?: string | null;
6282
- file: AttachmentPayload | BufferResolvable | Stream;
6273
+ file: AttachmentPayload | BufferResolvable | JSONEncodable<AttachmentBuilder> | Stream;
6283
6274
  name: string;
6284
6275
  reason?: string;
6285
6276
  tags: string;
@@ -6626,9 +6617,8 @@ export type CollectedMessageInteraction<Cached extends CacheType = CacheType> =
6626
6617
  ModalSubmitInteraction
6627
6618
  >;
6628
6619
 
6629
- export interface MessageComponentCollectorOptions<
6630
- Interaction extends CollectedMessageInteraction,
6631
- > extends AwaitMessageComponentOptions<Interaction> {
6620
+ export interface MessageComponentCollectorOptions<Interaction extends CollectedMessageInteraction>
6621
+ extends AwaitMessageComponentOptions<Interaction> {
6632
6622
  max?: number;
6633
6623
  maxComponents?: number;
6634
6624
  maxUsers?: number;
@@ -6667,24 +6657,25 @@ export interface MessageMentionOptions {
6667
6657
 
6668
6658
  export type MessageMentionTypes = 'everyone' | 'roles' | 'users';
6669
6659
 
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
- > {}
6660
+ export interface MessageSnapshot
6661
+ extends Partialize<
6662
+ Message,
6663
+ null,
6664
+ Exclude<
6665
+ keyof Message,
6666
+ | 'attachments'
6667
+ | 'client'
6668
+ | 'components'
6669
+ | 'content'
6670
+ | 'createdTimestamp'
6671
+ | 'editedTimestamp'
6672
+ | 'embeds'
6673
+ | 'flags'
6674
+ | 'mentions'
6675
+ | 'stickers'
6676
+ | 'type'
6677
+ >
6678
+ > {}
6688
6679
 
6689
6680
  export interface BaseMessageOptions {
6690
6681
  allowedMentions?: MessageMentionOptions;
@@ -6697,7 +6688,14 @@ export interface BaseMessageOptions {
6697
6688
  )[];
6698
6689
  content?: string;
6699
6690
  embeds?: readonly (APIEmbed | JSONEncodable<APIEmbed>)[];
6700
- files?: readonly (Attachment | AttachmentPayload | BufferResolvable | FileBodyEncodable<APIAttachment> | Stream)[];
6691
+ files?: readonly (
6692
+ | Attachment
6693
+ | AttachmentBuilder
6694
+ | AttachmentPayload
6695
+ | BufferResolvable
6696
+ | JSONEncodable<APIAttachment>
6697
+ | Stream
6698
+ )[];
6701
6699
  }
6702
6700
 
6703
6701
  export interface MessageOptionsPoll {
@@ -6725,7 +6723,11 @@ export interface MessageOptionsStickers {
6725
6723
  }
6726
6724
 
6727
6725
  export interface BaseMessageCreateOptions
6728
- extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS, MessageOptionsStickers {
6726
+ extends BaseMessageOptions,
6727
+ MessageOptionsPoll,
6728
+ MessageOptionsFlags,
6729
+ MessageOptionsTTS,
6730
+ MessageOptionsStickers {
6729
6731
  enforceNonce?: boolean;
6730
6732
  nonce?: number | string;
6731
6733
  }
@@ -6735,10 +6737,16 @@ export interface MessageCreateOptions extends BaseMessageCreateOptions {
6735
6737
  }
6736
6738
 
6737
6739
  export interface GuildForumThreadMessageCreateOptions
6738
- extends BaseMessageOptions, MessageOptionsFlags, MessageOptionsStickers {}
6740
+ extends BaseMessageOptions,
6741
+ MessageOptionsFlags,
6742
+ MessageOptionsStickers {}
6743
+
6744
+ export interface MessageEditAttachmentData {
6745
+ id: Snowflake;
6746
+ }
6739
6747
 
6740
6748
  export interface MessageEditOptions extends Omit<BaseMessageOptions, 'content'> {
6741
- attachments?: readonly (Attachment | JSONEncodable<APIAttachment>)[];
6749
+ attachments?: readonly (Attachment | MessageEditAttachmentData)[];
6742
6750
  content?: string | null;
6743
6751
  flags?:
6744
6752
  | BitFieldResolvable<
@@ -6934,20 +6942,18 @@ export interface PartialDMChannel extends Partialize<DMChannel, null, null, 'las
6934
6942
 
6935
6943
  export interface PartialGuildMember extends Partialize<GuildMember, 'joinedAt' | 'joinedTimestamp' | 'pending'> {}
6936
6944
 
6937
- export interface PartialMessage<InGuild extends boolean = boolean> extends Partialize<
6938
- Message<InGuild>,
6939
- 'pinned' | 'system' | 'tts' | 'type',
6940
- 'author' | 'cleanContent' | 'content'
6941
- > {}
6945
+ export interface PartialMessage<InGuild extends boolean = boolean>
6946
+ extends Partialize<Message<InGuild>, 'pinned' | 'system' | 'tts' | 'type', 'author' | 'cleanContent' | 'content'> {}
6942
6947
 
6943
6948
  export interface PartialMessageReaction extends Partialize<MessageReaction, 'count'> {}
6944
6949
 
6945
- export interface PartialPoll extends Partialize<
6946
- Poll,
6947
- 'allowMultiselect' | 'expiresTimestamp' | 'layoutType',
6948
- null,
6949
- 'answers' | 'message' | 'question'
6950
- > {
6950
+ export interface PartialPoll
6951
+ extends Partialize<
6952
+ Poll,
6953
+ 'allowMultiselect' | 'expiresTimestamp' | 'layoutType',
6954
+ null,
6955
+ 'answers' | 'message' | 'question'
6956
+ > {
6951
6957
  // eslint-disable-next-line no-restricted-syntax
6952
6958
  answers: Collection<number, PartialPollAnswer>;
6953
6959
  message: PartialMessage;
@@ -6958,11 +6964,8 @@ export interface PartialPollAnswer extends Partialize<PollAnswer, 'emoji' | 'tex
6958
6964
  readonly poll: PartialPoll;
6959
6965
  }
6960
6966
 
6961
- export interface PartialGuildScheduledEvent extends Partialize<
6962
- GuildScheduledEvent,
6963
- 'userCount',
6964
- 'entityType' | 'name' | 'privacyLevel' | 'status'
6965
- > {}
6967
+ export interface PartialGuildScheduledEvent
6968
+ extends Partialize<GuildScheduledEvent, 'userCount', 'entityType' | 'name' | 'privacyLevel' | 'status'> {}
6966
6969
 
6967
6970
  export interface PartialThreadMember extends Partialize<ThreadMember, 'flags' | 'joinedAt' | 'joinedTimestamp'> {}
6968
6971
 
@@ -7257,7 +7260,10 @@ export interface WebhookFetchMessageOptions {
7257
7260
  }
7258
7261
 
7259
7262
  export interface WebhookMessageCreateOptions
7260
- extends BaseMessageOptions, MessageOptionsPoll, MessageOptionsFlags, MessageOptionsTTS {
7263
+ extends BaseMessageOptions,
7264
+ MessageOptionsPoll,
7265
+ MessageOptionsFlags,
7266
+ MessageOptionsTTS {
7261
7267
  appliedTags?: readonly Snowflake[];
7262
7268
  avatarURL?: string;
7263
7269
  threadId?: Snowflake;