oceanic.js 1.11.3-dev.61c7380 → 1.11.3-dev.6564cdb

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 (77) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/Client.js +3 -1
  3. package/dist/lib/Constants.d.ts +61 -8
  4. package/dist/lib/Constants.js +70 -4
  5. package/dist/lib/gateway/Shard.d.ts +4 -1
  6. package/dist/lib/gateway/Shard.js +27 -7
  7. package/dist/lib/gateway/ShardManager.js +2 -2
  8. package/dist/lib/gateway/compression/base.d.ts +1 -0
  9. package/dist/lib/gateway/compression/pako.d.ts +1 -0
  10. package/dist/lib/gateway/compression/zlib-sync.d.ts +1 -0
  11. package/dist/lib/gateway/compression/zstd.d.ts +2 -5
  12. package/dist/lib/gateway/compression/zstd.js +5 -18
  13. package/dist/lib/gateway/events.d.ts +5 -0
  14. package/dist/lib/gateway/events.js +47 -4
  15. package/dist/lib/index.d.ts +1 -0
  16. package/dist/lib/index.js +4 -2
  17. package/dist/lib/routes/Applications.d.ts +20 -1
  18. package/dist/lib/routes/Applications.js +66 -4
  19. package/dist/lib/routes/Channels.d.ts +9 -1
  20. package/dist/lib/routes/Channels.js +21 -4
  21. package/dist/lib/routes/Guilds.d.ts +43 -1
  22. package/dist/lib/routes/Guilds.js +91 -2
  23. package/dist/lib/routes/Interactions.d.ts +5 -3
  24. package/dist/lib/routes/Interactions.js +35 -11
  25. package/dist/lib/routes/Miscellaneous.d.ts +6 -0
  26. package/dist/lib/routes/Miscellaneous.js +12 -1
  27. package/dist/lib/routes/Webhooks.js +14 -2
  28. package/dist/lib/structures/Application.d.ts +7 -1
  29. package/dist/lib/structures/Application.js +10 -1
  30. package/dist/lib/structures/ApplicationCommand.d.ts +3 -1
  31. package/dist/lib/structures/ApplicationCommand.js +5 -1
  32. package/dist/lib/structures/Attachment.d.ts +8 -0
  33. package/dist/lib/structures/Attachment.js +11 -1
  34. package/dist/lib/structures/AutocompleteInteraction.d.ts +2 -2
  35. package/dist/lib/structures/AutocompleteInteraction.js +2 -2
  36. package/dist/lib/structures/ClientApplication.d.ts +6 -1
  37. package/dist/lib/structures/ClientApplication.js +8 -1
  38. package/dist/lib/structures/CommandInteraction.d.ts +15 -12
  39. package/dist/lib/structures/CommandInteraction.js +26 -23
  40. package/dist/lib/structures/ComponentInteraction.d.ts +15 -14
  41. package/dist/lib/structures/ComponentInteraction.js +24 -25
  42. package/dist/lib/structures/Entitlement.d.ts +2 -2
  43. package/dist/lib/structures/Entitlement.js +5 -5
  44. package/dist/lib/structures/Guild.d.ts +32 -2
  45. package/dist/lib/structures/Guild.js +41 -1
  46. package/dist/lib/structures/Message.d.ts +3 -3
  47. package/dist/lib/structures/Message.js +25 -16
  48. package/dist/lib/structures/ModalSubmitInteraction.d.ts +14 -13
  49. package/dist/lib/structures/ModalSubmitInteraction.js +22 -18
  50. package/dist/lib/structures/PingInteraction.d.ts +2 -2
  51. package/dist/lib/structures/PingInteraction.js +2 -2
  52. package/dist/lib/structures/Soundboard.d.ts +42 -0
  53. package/dist/lib/structures/Soundboard.js +73 -0
  54. package/dist/lib/structures/Subscription.d.ts +25 -0
  55. package/dist/lib/structures/Subscription.js +38 -0
  56. package/dist/lib/types/applications.d.ts +89 -8
  57. package/dist/lib/types/channels.d.ts +351 -188
  58. package/dist/lib/types/client.d.ts +8 -2
  59. package/dist/lib/types/events.d.ts +15 -3
  60. package/dist/lib/types/gateway-raw.d.ts +37 -2
  61. package/dist/lib/types/gateway.d.ts +10 -2
  62. package/dist/lib/types/guilds.d.ts +28 -0
  63. package/dist/lib/types/interactions.d.ts +64 -7
  64. package/dist/lib/types/json.d.ts +23 -6
  65. package/dist/lib/types/webhooks.d.ts +6 -2
  66. package/dist/lib/util/Errors.d.ts +4 -0
  67. package/dist/lib/util/Errors.js +9 -2
  68. package/dist/lib/util/Routes.d.ts +7 -0
  69. package/dist/lib/util/Routes.js +18 -5
  70. package/dist/lib/util/Util.d.ts +10 -6
  71. package/dist/lib/util/Util.js +99 -12
  72. package/dist/lib/util/interactions/MessageInteractionResponse.d.ts +5 -2
  73. package/dist/lib/util/interactions/MessageInteractionResponse.js +9 -7
  74. package/dist/package.json +20 -20
  75. package/esm.mjs +2 -0
  76. package/package.json +19 -20
  77. package/patches/typedoc-plugin-merge-modules@5.1.0.patch +1 -1
@@ -1,6 +1,6 @@
1
1
  /** @module Types/Channels */
2
2
  import type { NullablePartialEmoji, PartialEmoji, RawInviteGuild, RawMember } from "./guilds";
3
- import type { RawApplication, RawPartialApplication } from "./applications";
3
+ import type { RESTApplication, RawApplication, RawPartialApplication } from "./applications";
4
4
  import type { RawUser, RawUserWithMember } from "./users";
5
5
  import type { File } from "./request-handler";
6
6
  import type { RawScheduledEvent } from "./scheduled-events";
@@ -40,7 +40,8 @@ import type {
40
40
  ImplementedChannelTypes,
41
41
  ThreadOnlyChannelTypes,
42
42
  ReactionType,
43
- PollLayoutType
43
+ PollLayoutType,
44
+ SeparatorSpacingSize
44
45
  } from "../Constants";
45
46
  import type Member from "../structures/Member";
46
47
  import type AnnouncementChannel from "../structures/AnnouncementChannel";
@@ -298,7 +299,7 @@ export interface CreateMessageOptions {
298
299
  /** An array of [partial attachments](https://discord.com/developers/docs/resources/channel#attachment-object) related to the sent files. */
299
300
  attachments?: Array<MessageAttachment>;
300
301
  /** An array of [components](https://discord.com/developers/docs/interactions/message-components) to send. `snake_case` keys should be converted to `camelCase`, or passed through {@link Util.rawMessageComponents | Util#rawMessageComponents}. */
301
- components?: Array<MessageActionRow>;
302
+ components?: Array<MessageComponent>;
302
303
  /** The content of the message. */
303
304
  content?: string;
304
305
  /** An array of [embeds](https://discord.com/developers/docs/resources/channel#embed-object) to send. `snake_case` keys should be converted to `camelCase`, or passed through {@link Util.rawEmbeds | Util#rawEmbeds}. */
@@ -307,7 +308,7 @@ export interface CreateMessageOptions {
307
308
  enforceNonce?: boolean;
308
309
  /** The files to send. */
309
310
  files?: Array<File>;
310
- /** The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to send with the message. */
311
+ /** The {@link Constants.MessageFlags | Message Flags} to send with the message. */
311
312
  flags?: number;
312
313
  /** Reply to a message. */
313
314
  messageReference?: MessageReference;
@@ -355,6 +356,8 @@ export interface EmbedBase extends EmbedOptionsBase {
355
356
  export interface RawEmbed extends EmbedBase {
356
357
  author?: RawEmbedAuthor;
357
358
  fields?: Array<EmbedField>;
359
+ /** The {@link Constants.EmbedFlags | Embed Flags} for the embed. */
360
+ flags?: number;
358
361
  footer?: RawEmbedFooter;
359
362
  image?: RawEmbedImage;
360
363
  provider?: EmbedProvider;
@@ -365,6 +368,8 @@ export interface RawEmbed extends EmbedBase {
365
368
  export interface Embed extends EmbedBase {
366
369
  author?: EmbedAuthor;
367
370
  fields?: Array<EmbedField>;
371
+ /** The {@link Constants.EmbedFlags | Embed Flags} for the embed. */
372
+ flags?: number;
368
373
  footer?: EmbedFooter;
369
374
  image?: EmbedImage;
370
375
  provider?: EmbedProvider;
@@ -384,36 +389,41 @@ export interface RawEmbedAuthor extends EmbedAuthorBase {
384
389
  proxy_icon_url?: string;
385
390
  }
386
391
 
387
- export interface EmbedAuthorOptions extends EmbedAuthorBase {
392
+ export interface EmbedAuthor extends EmbedAuthorOptions {
388
393
  iconURL?: string;
394
+ proxyIconURL?: string;
389
395
  }
390
396
 
391
397
  export interface RawEmbedAuthorOptions extends EmbedAuthorBase {
392
398
  icon_url?: string;
393
399
  }
394
400
 
395
- export interface EmbedAuthor extends EmbedAuthorOptions {
401
+ export interface EmbedAuthorOptions extends EmbedAuthorBase {
396
402
  iconURL?: string;
397
- proxyIconURL?: string;
398
403
  }
404
+
399
405
  export interface EmbedFooterBase {
400
406
  text: string;
401
407
  }
402
408
 
403
- export interface EmbedFooterOptions extends EmbedFooterBase {
404
- iconURL?: string;
405
- }
406
-
407
409
  export interface RawEmbedFooterOptions extends EmbedFooterBase {
408
410
  icon_url?: string;
409
411
  }
410
412
 
413
+ export interface EmbedFooterOptions extends EmbedFooterBase {
414
+ iconURL?: string;
415
+ }
416
+
411
417
  export interface RawEmbedFooter extends EmbedFooterBase {
418
+ /** The {@link Constants.EmbedMediaFlags | Embed Media Flags} for the media. */
419
+ flags?: number;
412
420
  icon_url?: string;
413
421
  proxy_icon_url?: string;
414
422
  }
415
423
 
416
424
  export interface EmbedFooter extends EmbedFooterOptions {
425
+ /** The {@link Constants.EmbedMediaFlags | Embed Media Flags} for the media. */
426
+ flags?: number;
417
427
  iconURL?: string;
418
428
  proxyIconURL?: string;
419
429
  }
@@ -424,17 +434,21 @@ export interface EmbedImageBase {
424
434
  }
425
435
 
426
436
  export interface RawEmbedImage extends EmbedImageBase, EmbedImageOptions {
437
+ /** The {@link Constants.EmbedMediaFlags | Embed Media Flags} for the media. */
438
+ flags?: number;
427
439
  proxy_url?: string;
428
440
  }
429
441
 
430
- export interface EmbedImageOptions {
431
- url: string;
432
- }
433
-
434
442
  export interface EmbedImage extends EmbedImageBase, EmbedImageOptions {
443
+ /** The {@link Constants.EmbedMediaFlags | Embed Media Flags} for the media. */
444
+ flags?: number;
435
445
  proxyURL?: string;
436
446
  }
437
447
 
448
+ export interface EmbedImageOptions {
449
+ url: string;
450
+ }
451
+
438
452
  export interface EmbedField {
439
453
  inline?: boolean;
440
454
  name: string;
@@ -482,177 +496,10 @@ export interface MessageReference {
482
496
  messageID?: string;
483
497
  }
484
498
 
485
- export type RawComponent = RawMessageComponent | RawModalComponent;
486
- export type RawMessageComponent = RawButtonComponent | RawSelectMenuComponent;
487
- export type RawModalComponent = RawTextInput;
488
- export type RawButtonComponent = RawTextButton | URLButton | RawPremiumButton;
489
- export type RawSelectMenuComponent = RawStringSelectMenu | RawUserSelectMenu | RawRoleSelectMenu | RawMentionableSelectMenu | RawChannelSelectMenu;
490
- export type ToComponentFromRaw<T extends RawComponent> =
491
- T extends RawTextButton ? TextButton :
492
- T extends URLButton ? URLButton :
493
- T extends RawStringSelectMenu ? StringSelectMenu :
494
- T extends RawUserSelectMenu ? UserSelectMenu :
495
- T extends RawRoleSelectMenu ? RoleSelectMenu :
496
- T extends RawMentionableSelectMenu ? MentionableSelectMenu :
497
- T extends RawChannelSelectMenu ? ChannelSelectMenu :
498
- T extends RawTextInput ? TextInput :
499
- never;
500
- export type ToRawFromComponent<T extends Component> =
501
- T extends TextButton ? RawTextButton :
502
- T extends URLButton ? URLButton :
503
- T extends StringSelectMenu ? RawStringSelectMenu :
504
- T extends UserSelectMenu ? RawUserSelectMenu :
505
- T extends RoleSelectMenu ? RawRoleSelectMenu :
506
- T extends MentionableSelectMenu ? RawMentionableSelectMenu :
507
- T extends ChannelSelectMenu ? RawChannelSelectMenu :
508
- T extends TextInput ? RawTextInput :
509
- never;
510
- export interface RawActionRowBase<T extends RawComponent> {
511
- components: Array<T>;
512
- type: ComponentTypes.ACTION_ROW;
513
- }
514
-
515
- export interface RawMessageActionRow extends RawActionRowBase<RawMessageComponent> {}
516
- export interface RawModalActionRow extends RawActionRowBase<RawModalComponent> {}
517
- export type ActionRowToRaw<T extends MessageActionRow | ModalActionRow> =
518
- T extends MessageActionRow ? RawMessageActionRow :
519
- T extends ModalActionRow ? RawModalActionRow : never;
520
-
521
- export type Component = MessageComponent | ModalComponent;
522
- export type MessageComponent = ButtonComponent | SelectMenuComponent;
523
- export type ModalComponent = TextInput;
524
- export type ButtonComponent = TextButton | URLButton | PremiumButton;
525
- export type SelectMenuComponent = StringSelectMenu | UserSelectMenu | RoleSelectMenu | MentionableSelectMenu | ChannelSelectMenu;
526
-
527
- export interface ActionRowBase<T extends Component> {
528
- components: Array<T>;
529
- type: ComponentTypes.ACTION_ROW;
530
- }
531
-
532
- export interface MessageActionRow extends ActionRowBase<MessageComponent> {}
533
- export interface ModalActionRow extends ActionRowBase<ModalComponent> {}
534
-
535
- export interface ButtonBase {
536
- disabled?: boolean;
537
- emoji?: NullablePartialEmoji;
538
- label?: string;
539
- style: ButtonStyles;
540
- type: ComponentTypes.BUTTON;
541
- }
542
-
543
- export interface RawTextButton extends ButtonBase {
544
- custom_id: string;
545
- style: ButtonStyles.PRIMARY | ButtonStyles.SECONDARY | ButtonStyles.SUCCESS | ButtonStyles.DANGER;
546
- }
547
-
548
- export interface TextButton extends ButtonBase {
549
- customID: string;
550
- style: ButtonStyles.PRIMARY | ButtonStyles.SECONDARY | ButtonStyles.SUCCESS | ButtonStyles.DANGER;
551
- }
552
-
553
- export interface URLButton extends ButtonBase {
554
- style: ButtonStyles.LINK;
555
- url: string;
556
- }
557
-
558
- export interface RawPremiumButton extends Omit<ButtonBase, "label" | "emoji"> {
559
- sku_id: string;
560
- style: ButtonStyles.PREMIUM;
561
- }
562
-
563
- export interface PremiumButton extends Omit<ButtonBase, "label" | "emoji"> {
564
- skuID: string;
565
- style: ButtonStyles.PREMIUM;
566
- }
567
-
568
- export interface RawSelectMenuBase<T extends SelectMenuTypes> {
569
- custom_id: string;
570
- disabled?: boolean;
571
- max_values?: number;
572
- min_values?: number;
573
- placeholder?: string;
574
- type: T;
575
- }
576
-
577
- export interface RawStringSelectMenuOptions {
578
- options: Array<SelectOption>;
579
- }
580
-
581
- export interface RawChannelSelectMenuOptions {
582
- channel_types: Array<ChannelTypes>;
583
- }
584
-
585
- export interface RawStringSelectMenu extends RawSelectMenuBase<ComponentTypes.STRING_SELECT>, RawStringSelectMenuOptions {}
586
- export interface RawUserSelectMenu extends RawSelectMenuBase<ComponentTypes.USER_SELECT>, DefaultValuesRaw {}
587
- export interface RawRoleSelectMenu extends RawSelectMenuBase<ComponentTypes.ROLE_SELECT>, DefaultValuesRaw {}
588
- export interface RawMentionableSelectMenu extends RawSelectMenuBase<ComponentTypes.MENTIONABLE_SELECT>, DefaultValuesRaw {}
589
- export interface RawChannelSelectMenu extends RawSelectMenuBase<ComponentTypes.CHANNEL_SELECT>, RawChannelSelectMenuOptions, DefaultValuesRaw {}
590
-
591
-
592
- export interface SelectMenuBase<T extends SelectMenuTypes> {
593
- customID: string;
594
- disabled?: boolean;
595
- maxValues?: number;
596
- minValues?: number;
597
- placeholder?: string;
598
- type: T;
599
- }
600
-
601
- interface DefaultValuesRaw {
602
- default_values?: Array<SelectMenuDefaultValue>;
603
- }
604
-
605
- interface DefaultValues {
606
- defaultValues?: Array<SelectMenuDefaultValue>;
607
- }
608
-
609
- export interface StringSelectMenuOptions {
610
- options: Array<SelectOption>;
611
- }
612
-
613
- export interface ChannelSelectMenuOptions {
614
- channelTypes: Array<ChannelTypes>;
615
- }
616
-
617
- export interface StringSelectMenu extends SelectMenuBase<ComponentTypes.STRING_SELECT>, StringSelectMenuOptions {}
618
- export interface UserSelectMenu extends SelectMenuBase<ComponentTypes.USER_SELECT>, DefaultValues {}
619
- export interface RoleSelectMenu extends SelectMenuBase<ComponentTypes.ROLE_SELECT>, DefaultValues {}
620
- export interface MentionableSelectMenu extends SelectMenuBase<ComponentTypes.MENTIONABLE_SELECT>, DefaultValues {}
621
- export interface ChannelSelectMenu extends SelectMenuBase<ComponentTypes.CHANNEL_SELECT>, ChannelSelectMenuOptions, DefaultValues {}
622
-
623
- export interface SelectOption {
624
- default?: boolean;
625
- description?: string;
626
- emoji?: NullablePartialEmoji;
627
- label: string;
628
- value: string;
629
- }
630
-
631
- export interface RawTextInput {
632
- custom_id: string;
633
- label: string;
634
- max_length?: number;
635
- min_length?: number;
636
- placeholder?: string;
637
- required?: boolean;
638
- style: TextInputStyles;
639
- type: ComponentTypes.TEXT_INPUT;
640
- value?: string;
641
- }
642
-
643
- export interface TextInput {
644
- customID: string;
645
- label: string;
646
- maxLength?: number;
647
- minLength?: number;
648
- placeholder?: string;
649
- required?: boolean;
650
- style: TextInputStyles;
651
- type: ComponentTypes.TEXT_INPUT;
652
- value?: string;
653
- }
654
-
655
499
  export interface RawAttachment {
500
+ application?: RESTApplication;
501
+ clip_created_at?: string;
502
+ clip_participants?: Array<RawUser>;
656
503
  content_type?: string;
657
504
  description?: string;
658
505
  duration_secs?: number;
@@ -689,7 +536,7 @@ export interface RawMessage {
689
536
  author: RawUser; // this can be an invalid user if `webhook_id` is set
690
537
  call?: RawCall;
691
538
  channel_id: string;
692
- components?: Array<RawMessageActionRow>;
539
+ components?: Array<RawMessageComponent>;
693
540
  content: string;
694
541
  edited_timestamp: string | null;
695
542
  embeds: Array<RawEmbed>;
@@ -722,6 +569,17 @@ export interface RawMessage {
722
569
  webhook_id?: string;
723
570
  }
724
571
 
572
+ export interface RawSoundboard {
573
+ available: boolean;
574
+ emoji_id: string | null;
575
+ emoji_name: string | null;
576
+ guild_id?: string;
577
+ name: string;
578
+ sound_id: string;
579
+ user?: RawUser;
580
+ volume: number;
581
+ }
582
+
725
583
  export interface RawCall {
726
584
  ended_timestamp?: string | null;
727
585
  participants: Array<string>;
@@ -798,6 +656,8 @@ export interface RawMessageInteractionMetadata {
798
656
  interacted_message_id?: string;
799
657
  name?: string;
800
658
  original_response_message_id?: string;
659
+ target_message_id?: string;
660
+ target_user?: RawUser;
801
661
  triggering_interaction_metadata?: Omit<RawMessageInteractionMetadata, "triggering_interaction_metadata">;
802
662
  type: InteractionTypes;
803
663
  user: RawUser;
@@ -807,18 +667,38 @@ export interface MessageInteractionMetadata {
807
667
  /** Details about the authorizing user or server for the installation(s) relevant to the interaction. See [Discord's docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for more information. */
808
668
  authorizingIntegrationOwners: AuthorizingIntegrationOwners;
809
669
  id: string;
810
- /** The ID of the message that contained interactive component, present only on messages created from component interactions */
670
+ /** The ID of the message that contained interactive component, present only on messages created from component interactions. */
811
671
  interactedMessageID?: string;
812
- /** Name of the command, including subcommands and subcommand groups, present only on application command interactions. */
672
+ /** Name of the command, including subcommands and subcommand groups, present only on messages created from application command interactions. */
813
673
  name?: string;
814
674
  /** The ID of the original response message, present only on follow-up messages. */
815
675
  originalResponseMessageID?: string;
676
+ /** The message the command was run on, present only on messages created from application command interactions. */
677
+ targetMessageID?: string;
678
+ /** The user the command was run on, present only on messages created from application command interactions. */
679
+ targetUser?: User;
816
680
  /** Metadata for the interaction that was used to open the modal, present only on modal submit interactions. */
817
681
  triggeringInteractionMetadata?: Omit<MessageInteractionMetadata, "triggeringInteractionMetadata" | "name">;
818
682
  type: InteractionTypes;
683
+ /** The user that triggered the reaction. */
819
684
  user: User;
820
685
  }
821
686
 
687
+ export interface ApplicationCommandMessageInteractionMetadata extends Omit<MessageInteractionMetadata, "triggeringInteractionMetadata" | "name" | "interactedMessageID" | "type">, Required<Pick<MessageInteractionMetadata, "name">> {
688
+ type: InteractionTypes.APPLICATION_COMMAND;
689
+ }
690
+
691
+ export interface ComponentMessageInteractionMetadata extends Omit<MessageInteractionMetadata, "triggeringInteractionMetadata" | "name" | "interactedMessageID" | "targetMessageID" | "targetUser" | "type">, Required<Pick<MessageInteractionMetadata, "interactedMessageID">> {
692
+ type: InteractionTypes.MESSAGE_COMPONENT;
693
+ }
694
+
695
+ export interface ModalSubmitMessageInteractionMetadata extends Omit<MessageInteractionMetadata, "triggeringInteractionMetadata" | "name" | "interactedMessageID" | "targetMessageID" | "targetUser" | "type"> {
696
+ triggeringInteractionMetadata: ApplicationCommandMessageInteractionMetadata | ComponentMessageInteractionMetadata;
697
+ type: InteractionTypes.MODAL_SUBMIT;
698
+ }
699
+
700
+ export type AnyMessageInteractionMetadata = ApplicationCommandMessageInteractionMetadata | ComponentMessageInteractionMetadata | ModalSubmitMessageInteractionMetadata;
701
+
822
702
 
823
703
  export interface StickerItem {
824
704
  format_type: StickerFormatTypes;
@@ -920,6 +800,13 @@ export interface GetReactionsOptions {
920
800
  type?: ReactionType;
921
801
  }
922
802
 
803
+ export interface SendSoundboardSoundOptions {
804
+ /** The ID of the soundboard sound to send. */
805
+ soundID: string;
806
+ /** The ID of the guild the soundboard sound is from. */
807
+ sourceGuildID?: string;
808
+ }
809
+
923
810
  export interface EditMessageOptions extends Nullable<Pick<CreateMessageOptions, "content" | "embeds" | "allowedMentions" | "components" | "attachments" | "files" | "flags">> {}
924
811
 
925
812
  export interface EditPermissionOptions {
@@ -1315,3 +1202,279 @@ export interface MessagePollResults {
1315
1202
  victorAnswerText?: string;
1316
1203
  victorAnswerVotes: number;
1317
1204
  }
1205
+
1206
+ export interface RawTextDisplayComponent extends Omit<TextDisplayComponent, "id"> {}
1207
+ export interface RawThumbnailComponent extends Omit<ThumbnailComponent, "id"> {}
1208
+ export interface RawMediaGalleryComponent extends Omit<MediaGalleryComponent, "id"> {}
1209
+ export interface RawSeparatorComponent extends Omit<SeparatorComponent, "id"> {}
1210
+ export interface RawFileComponent extends Omit<FileComponent, "id"> {}
1211
+
1212
+ export interface RawSectionComponent extends BaseComponent {
1213
+ accessory: RawThumbnailComponent | RawButtonComponent;
1214
+ components: Array<RawTextDisplayComponent>;
1215
+ type: ComponentTypes.SECTION;
1216
+ }
1217
+
1218
+ export type RawComponent = AnyRawMessageComponent | AnyRawModalComponent;
1219
+ export type AnyRawMessageComponent = RawMessageComponent | RawMessageActionRowComponent | RawThumbnailComponent;
1220
+ export type AnyRawModalComponent = RawModalComponent | RawModalActionRowComponent;
1221
+ export type RawMessageActionRowComponent = RawButtonComponent | RawSelectMenuComponent;
1222
+ export type RawMessageComponent = RawMessageActionRow | RawSectionComponent | RawTextDisplayComponent | RawMediaGalleryComponent | RawSeparatorComponent | RawFileComponent | RawContainerComponent;
1223
+ export type RawModalActionRowComponent = RawTextInput;
1224
+ export type RawModalComponent = RawModalActionRow;
1225
+ export type RawButtonComponent = RawTextButton | URLButton | RawPremiumButton;
1226
+ export type RawSelectMenuComponent = RawStringSelectMenu | RawUserSelectMenu | RawRoleSelectMenu | RawMentionableSelectMenu | RawChannelSelectMenu;
1227
+
1228
+ export type ToComponentFromRaw<T extends RawComponent> =
1229
+ T extends RawMessageActionRow ? MessageActionRow :
1230
+ T extends RawModalActionRow ? ModalActionRow :
1231
+ T extends RawTextButton ? TextButton :
1232
+ T extends URLButton ? URLButton :
1233
+ T extends RawStringSelectMenu ? StringSelectMenu :
1234
+ T extends RawUserSelectMenu ? UserSelectMenu :
1235
+ T extends RawRoleSelectMenu ? RoleSelectMenu :
1236
+ T extends RawMentionableSelectMenu ? MentionableSelectMenu :
1237
+ T extends RawChannelSelectMenu ? ChannelSelectMenu :
1238
+ T extends RawTextInput ? TextInput :
1239
+ T extends RawSectionComponent ? SectionComponent :
1240
+ T extends RawTextDisplayComponent ? TextDisplayComponent :
1241
+ T extends RawThumbnailComponent ? ThumbnailComponent :
1242
+ T extends RawMediaGalleryComponent ? MediaGalleryComponent :
1243
+ T extends RawSeparatorComponent ? SeparatorComponent :
1244
+ T extends RawFileComponent ? FileComponent :
1245
+ T extends RawContainerComponent ? ContainerComponent :
1246
+ never;
1247
+ export type ToRawFromComponent<T extends Component> =
1248
+ T extends MessageActionRow ? RawMessageActionRow :
1249
+ T extends ModalActionRow ? RawModalActionRow :
1250
+ T extends TextButton ? RawTextButton :
1251
+ T extends URLButton ? URLButton :
1252
+ T extends StringSelectMenu ? RawStringSelectMenu :
1253
+ T extends UserSelectMenu ? RawUserSelectMenu :
1254
+ T extends RoleSelectMenu ? RawRoleSelectMenu :
1255
+ T extends MentionableSelectMenu ? RawMentionableSelectMenu :
1256
+ T extends ChannelSelectMenu ? RawChannelSelectMenu :
1257
+ T extends TextInput ? RawTextInput :
1258
+ T extends SectionComponent ? RawSectionComponent :
1259
+ T extends TextDisplayComponent ? RawTextDisplayComponent :
1260
+ T extends ThumbnailComponent ? RawThumbnailComponent :
1261
+ T extends MediaGalleryComponent ? RawMediaGalleryComponent :
1262
+ T extends SeparatorComponent ? RawSeparatorComponent :
1263
+ T extends FileComponent ? RawFileComponent :
1264
+ T extends ContainerComponent ? RawContainerComponent :
1265
+ never;
1266
+
1267
+ export interface RawActionRowBase<T extends RawComponent> {
1268
+ components: Array<T>;
1269
+ type: ComponentTypes.ACTION_ROW;
1270
+ }
1271
+
1272
+ export interface RawMessageActionRow extends RawActionRowBase<RawMessageActionRowComponent> {}
1273
+ export interface RawModalActionRow extends RawActionRowBase<RawModalActionRowComponent> {}
1274
+ export type ActionRowToRaw<T extends MessageActionRow | ModalActionRow> =
1275
+ T extends MessageActionRow ? RawMessageActionRow :
1276
+ T extends ModalActionRow ? RawModalActionRow : never;
1277
+
1278
+ export type Component = AnyMessageComponent | AnyModalComponent;
1279
+ export type AnyMessageComponent = MessageComponent | MessageActionRowComponent | ThumbnailComponent;
1280
+ export type AnyModalComponent = ModalComponent | ModalActionRowComponent;
1281
+ export type MessageActionRowComponent = ButtonComponent | SelectMenuComponent;
1282
+ export type MessageComponent = MessageActionRow | SectionComponent | TextDisplayComponent | MediaGalleryComponent | SeparatorComponent | FileComponent | ContainerComponent;
1283
+ export type ModalActionRowComponent = TextInput;
1284
+ export type ModalComponent = ModalActionRow;
1285
+ export type ButtonComponent = TextButton | URLButton | PremiumButton;
1286
+ export type SelectMenuComponent = StringSelectMenu | UserSelectMenu | RoleSelectMenu | MentionableSelectMenu | ChannelSelectMenu;
1287
+
1288
+ export interface BaseComponent {
1289
+ /** Autoincremented number if not provided */
1290
+ id?: number;
1291
+ type: ComponentTypes;
1292
+ }
1293
+
1294
+ export interface ActionRowBase<T extends Component> extends BaseComponent {
1295
+ components: Array<T>;
1296
+ type: ComponentTypes.ACTION_ROW;
1297
+ }
1298
+
1299
+ export interface MessageActionRow extends ActionRowBase<MessageActionRowComponent> {}
1300
+ export interface ModalActionRow extends ActionRowBase<ModalActionRowComponent> {}
1301
+
1302
+ export interface ButtonBase extends BaseComponent {
1303
+ disabled?: boolean;
1304
+ emoji?: NullablePartialEmoji;
1305
+ label?: string;
1306
+ style: ButtonStyles;
1307
+ type: ComponentTypes.BUTTON;
1308
+ }
1309
+
1310
+ export interface RawTextButton extends ButtonBase {
1311
+ custom_id: string;
1312
+ style: ButtonStyles.PRIMARY | ButtonStyles.SECONDARY | ButtonStyles.SUCCESS | ButtonStyles.DANGER;
1313
+ }
1314
+
1315
+ export interface TextButton extends ButtonBase {
1316
+ customID: string;
1317
+ style: ButtonStyles.PRIMARY | ButtonStyles.SECONDARY | ButtonStyles.SUCCESS | ButtonStyles.DANGER;
1318
+ }
1319
+
1320
+ export interface URLButton extends ButtonBase {
1321
+ style: ButtonStyles.LINK;
1322
+ url: string;
1323
+ }
1324
+
1325
+ export interface RawPremiumButton extends Omit<ButtonBase, "label" | "emoji"> {
1326
+ sku_id: string;
1327
+ style: ButtonStyles.PREMIUM;
1328
+ }
1329
+
1330
+ export interface PremiumButton extends Omit<ButtonBase, "label" | "emoji"> {
1331
+ skuID: string;
1332
+ style: ButtonStyles.PREMIUM;
1333
+ }
1334
+
1335
+ export interface RawSelectMenuBase<T extends SelectMenuTypes> {
1336
+ custom_id: string;
1337
+ disabled?: boolean;
1338
+ max_values?: number;
1339
+ min_values?: number;
1340
+ placeholder?: string;
1341
+ type: T;
1342
+ }
1343
+
1344
+ export interface RawStringSelectMenuOptions {
1345
+ options: Array<SelectOption>;
1346
+ }
1347
+
1348
+ export interface RawChannelSelectMenuOptions {
1349
+ channel_types: Array<ChannelTypes>;
1350
+ }
1351
+
1352
+ export interface RawStringSelectMenu extends RawSelectMenuBase<ComponentTypes.STRING_SELECT>, RawStringSelectMenuOptions {}
1353
+ export interface RawUserSelectMenu extends RawSelectMenuBase<ComponentTypes.USER_SELECT>, DefaultValuesRaw {}
1354
+ export interface RawRoleSelectMenu extends RawSelectMenuBase<ComponentTypes.ROLE_SELECT>, DefaultValuesRaw {}
1355
+ export interface RawMentionableSelectMenu extends RawSelectMenuBase<ComponentTypes.MENTIONABLE_SELECT>, DefaultValuesRaw {}
1356
+ export interface RawChannelSelectMenu extends RawSelectMenuBase<ComponentTypes.CHANNEL_SELECT>, RawChannelSelectMenuOptions, DefaultValuesRaw {}
1357
+
1358
+
1359
+ export interface SelectMenuBase<T extends SelectMenuTypes> extends BaseComponent {
1360
+ customID: string;
1361
+ disabled?: boolean;
1362
+ maxValues?: number;
1363
+ minValues?: number;
1364
+ placeholder?: string;
1365
+ type: T;
1366
+ }
1367
+
1368
+ interface DefaultValuesRaw {
1369
+ default_values?: Array<SelectMenuDefaultValue>;
1370
+ }
1371
+
1372
+ interface DefaultValues {
1373
+ defaultValues?: Array<SelectMenuDefaultValue>;
1374
+ }
1375
+
1376
+ export interface StringSelectMenuOptions {
1377
+ options: Array<SelectOption>;
1378
+ }
1379
+
1380
+ export interface ChannelSelectMenuOptions {
1381
+ channelTypes: Array<ChannelTypes>;
1382
+ }
1383
+
1384
+ export interface StringSelectMenu extends SelectMenuBase<ComponentTypes.STRING_SELECT>, StringSelectMenuOptions {}
1385
+ export interface UserSelectMenu extends SelectMenuBase<ComponentTypes.USER_SELECT>, DefaultValues {}
1386
+ export interface RoleSelectMenu extends SelectMenuBase<ComponentTypes.ROLE_SELECT>, DefaultValues {}
1387
+ export interface MentionableSelectMenu extends SelectMenuBase<ComponentTypes.MENTIONABLE_SELECT>, DefaultValues {}
1388
+ export interface ChannelSelectMenu extends SelectMenuBase<ComponentTypes.CHANNEL_SELECT>, ChannelSelectMenuOptions, DefaultValues {}
1389
+
1390
+ export interface SelectOption {
1391
+ default?: boolean;
1392
+ description?: string;
1393
+ emoji?: NullablePartialEmoji;
1394
+ label: string;
1395
+ value: string;
1396
+ }
1397
+
1398
+ export interface RawTextInput {
1399
+ custom_id: string;
1400
+ label: string;
1401
+ max_length?: number;
1402
+ min_length?: number;
1403
+ placeholder?: string;
1404
+ required?: boolean;
1405
+ style: TextInputStyles;
1406
+ type: ComponentTypes.TEXT_INPUT;
1407
+ value?: string;
1408
+ }
1409
+
1410
+ export interface TextInput extends BaseComponent {
1411
+ customID: string;
1412
+ label: string;
1413
+ maxLength?: number;
1414
+ minLength?: number;
1415
+ placeholder?: string;
1416
+ required?: boolean;
1417
+ style: TextInputStyles;
1418
+ type: ComponentTypes.TEXT_INPUT;
1419
+ value?: string;
1420
+ }
1421
+
1422
+ export interface UnfurledMediaItem {
1423
+ url: string;
1424
+ }
1425
+
1426
+ export interface SectionComponent extends BaseComponent {
1427
+ accessory: ThumbnailComponent | ButtonComponent;
1428
+ components: Array<TextDisplayComponent>;
1429
+ type: ComponentTypes.SECTION;
1430
+ }
1431
+
1432
+ export interface TextDisplayComponent extends BaseComponent {
1433
+ content: string;
1434
+ type: ComponentTypes.TEXT_DISPLAY;
1435
+ }
1436
+
1437
+ export interface ThumbnailComponent extends BaseComponent {
1438
+ description?: string;
1439
+ media: UnfurledMediaItem;
1440
+ spoiler?: boolean;
1441
+ type: ComponentTypes.THUMBNAIL;
1442
+ }
1443
+
1444
+ export interface MediaGalleryItem {
1445
+ description?: string;
1446
+ media: UnfurledMediaItem;
1447
+ spoiler?: boolean;
1448
+ }
1449
+
1450
+ export interface MediaGalleryComponent extends BaseComponent {
1451
+ items: Array<MediaGalleryItem>;
1452
+ type: ComponentTypes.MEDIA_GALLERY;
1453
+ }
1454
+
1455
+ export interface SeparatorComponent extends BaseComponent {
1456
+ divider?: boolean;
1457
+ spacing?: SeparatorSpacingSize;
1458
+ type: ComponentTypes.SEPARATOR;
1459
+ }
1460
+
1461
+ export interface FileComponent extends BaseComponent {
1462
+ // The UnfurledMediaItem ONLY supports attachment://<filename> references
1463
+ file: UnfurledMediaItem;
1464
+ spoiler?: boolean;
1465
+ type: ComponentTypes.FILE;
1466
+ }
1467
+
1468
+ export interface ContainerComponent extends BaseComponent {
1469
+ accentColor?: number;
1470
+ components: Array<MessageActionRow | TextDisplayComponent | SectionComponent | MediaGalleryComponent | SeparatorComponent | FileComponent>;
1471
+ spoiler?: boolean;
1472
+ type: ComponentTypes.CONTAINER;
1473
+ }
1474
+
1475
+ export interface RawContainerComponent extends Omit<BaseComponent, "id"> {
1476
+ accent_color?: number;
1477
+ components: Array<RawMessageActionRow | RawTextDisplayComponent | RawSectionComponent | RawMediaGalleryComponent | RawSeparatorComponent | RawFileComponent>;
1478
+ spoiler?: boolean;
1479
+ type: ComponentTypes.CONTAINER;
1480
+ }