@discordjs/builders 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,126 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ # [0.12.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.11.0...@discordjs/builders@0.12.0) (2021-12-08)
6
+
7
+ ## Bug Fixes
8
+
9
+ - **builders:** Dont export `Button` component stuff twice (#7289) ([86d9d06](https://github.com/discordjs/discord.js/commit/86d9d0674347c08d056cd054cb4ce4253195bf94))
10
+
11
+ ## Documentation
12
+
13
+ - **SlashCommandSubcommands:** Updating old links from Discord developer portal (#7224) ([bd7a6f2](https://github.com/discordjs/discord.js/commit/bd7a6f265212624199fb0b2ddc8ece39759c63de))
14
+
15
+ ## Features
16
+
17
+ - Add components to /builders (#7195) ([2bb40fd](https://github.com/discordjs/discord.js/commit/2bb40fd767cf5918e3ba422ff73082734bfa05b0))
18
+
19
+ ## Typings
20
+
21
+ - Make `required` a boolean (#7307) ([c10afea](https://github.com/discordjs/discord.js/commit/c10afeadc702ab98bec5e077b3b92494a9596f9c))
22
+
23
+ # [0.11.0](https://github.com/discordjs/builders/compare/v0.10.0...v0.11.0) (2021-12-29)
24
+
25
+ ## Bug Fixes
26
+
27
+ - **ApplicationCommandOptions:** clean up code for builder options ([#68](https://github.com/discordjs/builders/issues/68)) ([b5d0b15](https://github.com/discordjs/builders/commit/b5d0b157b1262bd01fa011f8e0cf33adb82776e7))
28
+
29
+ # [0.10.0](https://github.com/discordjs/builders/compare/v0.9.0...v0.10.0) (2021-12-24)
30
+
31
+ ## Bug Fixes
32
+
33
+ - use zod instead of ow for max/min option validation ([#66](https://github.com/discordjs/builders/issues/66)) ([beb35fb](https://github.com/discordjs/builders/commit/beb35fb1f65bd6be2321e17cc792f67e8615fd48))
34
+
35
+ ## Features
36
+
37
+ - add max/min option for int and number builder options ([#47](https://github.com/discordjs/builders/issues/47)) ([2e1e860](https://github.com/discordjs/builders/commit/2e1e860b46e3453398b20df63dabb6d4325e32d1))
38
+
39
+ # [0.9.0](https://github.com/discordjs/builders/compare/v0.8.2...v0.9.0) (2021-12-02)
40
+
41
+ ## Bug Fixes
42
+
43
+ - replace ow with zod ([#58](https://github.com/discordjs/builders/issues/58)) ([0b6fb81](https://github.com/discordjs/builders/commit/0b6fb8161b858e42781855fb73aaa873fec58160))
44
+
45
+ ## Features
46
+
47
+ - **SlashCommandBuilder:** add autocomplete ([#53](https://github.com/discordjs/builders/issues/53)) ([05b07a7](https://github.com/discordjs/builders/commit/05b07a7e88848188c27d7380d9f948cba25ef778))
48
+
49
+ ## [0.8.2](https://github.com/discordjs/builders/compare/v0.8.1...v0.8.2) (2021-10-30)
50
+
51
+ ## Bug Fixes
52
+
53
+ - downgrade ow because of esm issues ([#55](https://github.com/discordjs/builders/issues/55)) ([3722d2c](https://github.com/discordjs/builders/commit/3722d2c1109a7a5c0abad63c1a7eb944df6e46c8))
54
+
55
+ ## [0.8.1](https://github.com/discordjs/builders/compare/v0.8.0...v0.8.1) (2021-10-29)
56
+
57
+ ## Bug Fixes
58
+
59
+ - documentation ([e33ec8d](https://github.com/discordjs/builders/commit/e33ec8dfd5785312f82e0afb017a3dac614fd71d))
60
+
61
+ # [0.7.0](https://github.com/discordjs/builders/compare/v0.6.0...v0.7.0) (2021-10-18)
62
+
63
+ ## Bug Fixes
64
+
65
+ - properly type `toJSON` methods ([#34](https://github.com/discordjs/builders/issues/34)) ([7723ad0](https://github.com/discordjs/builders/commit/7723ad0da169386e638188de220451a97513bc25))
66
+
67
+ ## Features
68
+
69
+ - **ContextMenus:** add context menu command builder ([#29](https://github.com/discordjs/builders/issues/29)) ([f0641e5](https://github.com/discordjs/builders/commit/f0641e55733de8992600f3082bcf054e6f815cf7))
70
+ - add support for channel types on channel options ([#41](https://github.com/discordjs/builders/issues/41)) ([f6c187e](https://github.com/discordjs/builders/commit/f6c187e0ad6ebe03e65186ece3e95cb1db5aeb50))
71
+
72
+ # [0.6.0](https://github.com/discordjs/builders/compare/v0.5.0...v0.6.0) (2021-08-24)
73
+
74
+ ## Bug Fixes
75
+
76
+ - **SlashCommandBuilder:** allow subcommands and groups to coexist at the root level ([#26](https://github.com/discordjs/builders/issues/26)) ([0be4daf](https://github.com/discordjs/builders/commit/0be4dafdfc0b5747c880be0078c00ada913eb4fb))
77
+
78
+ ## Features
79
+
80
+ - create `Embed` builder ([#11](https://github.com/discordjs/builders/issues/11)) ([eb942a4](https://github.com/discordjs/builders/commit/eb942a4d1f3bcec9a4e370b6af602a713ad8f9b7))
81
+ - **SlashCommandBuilder:** create setDefaultPermission function ([#19](https://github.com/discordjs/builders/issues/19)) ([5d53759](https://github.com/discordjs/builders/commit/5d537593937a8da330153ce4711b7d093a80330e))
82
+ - **SlashCommands:** add number option type ([#23](https://github.com/discordjs/builders/issues/23)) ([1563991](https://github.com/discordjs/builders/commit/1563991d421bb07bf7a412c87e7613692d770f04))
83
+
84
+ # [0.5.0](https://github.com/discordjs/builders/compare/v0.3.0...v0.5.0) (2021-08-10)
85
+
86
+ ## Features
87
+
88
+ - **Formatters:** add `formatEmoji` ([#20](https://github.com/discordjs/builders/issues/20)) ([c3d8bb5](https://github.com/discordjs/builders/commit/c3d8bb5363a1d46b45c0def4277da6921e2ba209))
89
+
90
+ # [0.4.0](https://github.com/discordjs/builders/compare/v0.3.0...v0.4.0) (2021-08-05)
91
+
92
+ ## Features
93
+
94
+ - `sub command` => `subcommand` ([#18](https://github.com/discordjs/builders/pull/18)) ([95599c5](https://github.com/discordjs/builders/commit/95599c5b5366ebd054c4c277c52f1a44cda1209d))
95
+
96
+ # [0.3.0](https://github.com/discordjs/builders/compare/v0.2.0...v0.3.0) (2021-08-01)
97
+
98
+ ## Bug Fixes
99
+
100
+ - **Shrug:** Update comment ([#14](https://github.com/discordjs/builders/issues/14)) ([6fa6c40](https://github.com/discordjs/builders/commit/6fa6c405f2ea733811677d3d1bfb1e2806d504d5))
101
+ - shrug face rendering ([#13](https://github.com/discordjs/builders/issues/13)) ([6ad24ec](https://github.com/discordjs/builders/commit/6ad24ecd96c82b0f576e78e9e53fc7bf9c36ef5d))
102
+
103
+ ## Features
104
+
105
+ - **formatters:** mentions ([#9](https://github.com/discordjs/builders/issues/9)) ([f83fe99](https://github.com/discordjs/builders/commit/f83fe99b83188ed999845751ffb005c687dbd60a))
106
+ - **Formatters:** Add a spoiler function ([#16](https://github.com/discordjs/builders/issues/16)) ([c213a6a](https://github.com/discordjs/builders/commit/c213a6abb114f65653017a4edec4bdba2162d771))
107
+ - **SlashCommands:** add slash command builders ([#3](https://github.com/discordjs/builders/issues/3)) ([6aa3af0](https://github.com/discordjs/builders/commit/6aa3af07b0ee342fff91f080914bb12b3ab773f8))
108
+ - shrug, tableflip and unflip strings ([#5](https://github.com/discordjs/builders/issues/5)) ([de5fa82](https://github.com/discordjs/builders/commit/de5fa823cd6f1feba5b2d0a63b2cb1761dfd1814))
109
+
110
+ # [0.2.0](https://github.com/discordjs/builders/compare/v0.1.1...v0.2.0) (2021-07-03)
111
+
112
+ ## Features
113
+
114
+ - **Formatters:** added `hyperlink` and `hideLinkEmbed` ([#4](https://github.com/discordjs/builders/issues/4)) ([c532daf](https://github.com/discordjs/builders/commit/c532daf2ba2feae75bf9668f63462e96a5314cff))
115
+
116
+ # [0.1.1](https://github.com/discordjs/builders/compare/v0.1.0...v0.1.1) (2021-06-30)
117
+
118
+ ## Bug Fixes
119
+
120
+ - **Deps:** added `tslib` as dependency ([#2](https://github.com/discordjs/builders/issues/2)) ([5576ff3](https://github.com/discordjs/builders/commit/5576ff3b67136b957bed0ab8a4c655d5de322813))
121
+
122
+ # 0.1.0 (2021-06-30)
123
+
124
+ ## Features
125
+
126
+ - added message formatters ([#1](https://github.com/discordjs/builders/issues/1)) ([765e46d](https://github.com/discordjs/builders/commit/765e46dac96c4e49d350243e5fad34c2bc738a7c))
package/README.md CHANGED
@@ -8,14 +8,14 @@
8
8
  <a href="https://discord.gg/djs"><img src="https://img.shields.io/discord/222078108977594368?color=5865F2&logo=discord&logoColor=white" alt="Discord server" /></a>
9
9
  <a href="https://www.npmjs.com/package/@discordjs/builders"><img src="https://img.shields.io/npm/v/@discordjs/builders.svg?maxAge=3600" alt="npm version" /></a>
10
10
  <a href="https://www.npmjs.com/package/@discordjs/builders"><img src="https://img.shields.io/npm/dt/@discordjs/builders.svg?maxAge=3600" alt="npm downloads" /></a>
11
- <a href="https://github.com/discordjs/builders/actions"><img src="https://github.com/discordjs/builders/workflows/Tests/badge.svg" alt="Build status" /></a>
11
+ <a href="https://github.com/discordjs/discord.js/actions"><img src="https://github.com/discordjs/discord.js/actions/workflows/test.yml/badge.svg" alt="Build status" /></a>
12
12
  <a href="https://codecov.io/gh/discordjs/builders"><img src="https://codecov.io/gh/discordjs/builders/branch/main/graph/badge.svg" alt="Code coverage" /></a>
13
13
  </p>
14
14
  </div>
15
15
 
16
16
  ## Installation
17
17
 
18
- **Node.js 16.6.0 or newer is required.**
18
+ **Node.js 16.9.0 or newer is required.**
19
19
 
20
20
  ```sh-session
21
21
  npm install @discordjs/builders
@@ -37,7 +37,7 @@ Here are some examples for the builders and utilities you can find in this packa
37
37
  See also the [Update Guide](https://discordjs.guide/additional-info/changes-in-v13.html), including updated and removed items in the library.
38
38
  - [discord.js Discord server](https://discord.gg/djs)
39
39
  - [Discord API Discord server](https://discord.gg/discord-api)
40
- - [GitHub](https://github.com/discordjs/builders)
40
+ - [GitHub](https://github.com/discordjs/discord.js/tree/main/packages/builders)
41
41
  - [npm](https://www.npmjs.com/package/@discordjs/builders)
42
42
  - [Related libraries](https://discord.com/developers/docs/topics/community-resources#libraries)
43
43
 
@@ -45,7 +45,7 @@ Here are some examples for the builders and utilities you can find in this packa
45
45
 
46
46
  Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
47
47
  [documentation](https://discord.js.org/#/docs/builders).
48
- See [the contribution guide](https://github.com/discordjs/builders/blob/main/.github/CONTRIBUTING.md) if you'd like to submit a PR.
48
+ See [the contribution guide](https://github.com/discordjs/discord.js/blob/main/.github/CONTRIBUTING.md) if you'd like to submit a PR.
49
49
 
50
50
  ## Help
51
51
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
1
+ import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, APIMessageComponentEmoji, APISelectMenuOption, ButtonStyle, ComponentType, APIMessageComponent, APIActionRowComponent, APIButtonComponent, APISelectMenuComponent, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
2
2
  import { z } from 'zod';
3
3
  import { Snowflake } from 'discord-api-types/globals';
4
4
  import { URL } from 'url';
@@ -42,36 +42,36 @@ declare const footerTextPredicate: z.ZodNullable<z.ZodString>;
42
42
  declare const timestampPredicate: z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodDate]>>;
43
43
  declare const titlePredicate: z.ZodNullable<z.ZodString>;
44
44
 
45
- declare const Assertions$2_fieldNamePredicate: typeof fieldNamePredicate;
46
- declare const Assertions$2_fieldValuePredicate: typeof fieldValuePredicate;
47
- declare const Assertions$2_fieldInlinePredicate: typeof fieldInlinePredicate;
48
- declare const Assertions$2_embedFieldPredicate: typeof embedFieldPredicate;
49
- declare const Assertions$2_embedFieldsArrayPredicate: typeof embedFieldsArrayPredicate;
50
- declare const Assertions$2_fieldLengthPredicate: typeof fieldLengthPredicate;
51
- declare const Assertions$2_validateFieldLength: typeof validateFieldLength;
52
- declare const Assertions$2_authorNamePredicate: typeof authorNamePredicate;
53
- declare const Assertions$2_urlPredicate: typeof urlPredicate;
54
- declare const Assertions$2_colorPredicate: typeof colorPredicate;
55
- declare const Assertions$2_descriptionPredicate: typeof descriptionPredicate;
56
- declare const Assertions$2_footerTextPredicate: typeof footerTextPredicate;
57
- declare const Assertions$2_timestampPredicate: typeof timestampPredicate;
58
- declare const Assertions$2_titlePredicate: typeof titlePredicate;
59
- declare namespace Assertions$2 {
45
+ declare const Assertions$3_fieldNamePredicate: typeof fieldNamePredicate;
46
+ declare const Assertions$3_fieldValuePredicate: typeof fieldValuePredicate;
47
+ declare const Assertions$3_fieldInlinePredicate: typeof fieldInlinePredicate;
48
+ declare const Assertions$3_embedFieldPredicate: typeof embedFieldPredicate;
49
+ declare const Assertions$3_embedFieldsArrayPredicate: typeof embedFieldsArrayPredicate;
50
+ declare const Assertions$3_fieldLengthPredicate: typeof fieldLengthPredicate;
51
+ declare const Assertions$3_validateFieldLength: typeof validateFieldLength;
52
+ declare const Assertions$3_authorNamePredicate: typeof authorNamePredicate;
53
+ declare const Assertions$3_urlPredicate: typeof urlPredicate;
54
+ declare const Assertions$3_colorPredicate: typeof colorPredicate;
55
+ declare const Assertions$3_descriptionPredicate: typeof descriptionPredicate;
56
+ declare const Assertions$3_footerTextPredicate: typeof footerTextPredicate;
57
+ declare const Assertions$3_timestampPredicate: typeof timestampPredicate;
58
+ declare const Assertions$3_titlePredicate: typeof titlePredicate;
59
+ declare namespace Assertions$3 {
60
60
  export {
61
- Assertions$2_fieldNamePredicate as fieldNamePredicate,
62
- Assertions$2_fieldValuePredicate as fieldValuePredicate,
63
- Assertions$2_fieldInlinePredicate as fieldInlinePredicate,
64
- Assertions$2_embedFieldPredicate as embedFieldPredicate,
65
- Assertions$2_embedFieldsArrayPredicate as embedFieldsArrayPredicate,
66
- Assertions$2_fieldLengthPredicate as fieldLengthPredicate,
67
- Assertions$2_validateFieldLength as validateFieldLength,
68
- Assertions$2_authorNamePredicate as authorNamePredicate,
69
- Assertions$2_urlPredicate as urlPredicate,
70
- Assertions$2_colorPredicate as colorPredicate,
71
- Assertions$2_descriptionPredicate as descriptionPredicate,
72
- Assertions$2_footerTextPredicate as footerTextPredicate,
73
- Assertions$2_timestampPredicate as timestampPredicate,
74
- Assertions$2_titlePredicate as titlePredicate,
61
+ Assertions$3_fieldNamePredicate as fieldNamePredicate,
62
+ Assertions$3_fieldValuePredicate as fieldValuePredicate,
63
+ Assertions$3_fieldInlinePredicate as fieldInlinePredicate,
64
+ Assertions$3_embedFieldPredicate as embedFieldPredicate,
65
+ Assertions$3_embedFieldsArrayPredicate as embedFieldsArrayPredicate,
66
+ Assertions$3_fieldLengthPredicate as fieldLengthPredicate,
67
+ Assertions$3_validateFieldLength as validateFieldLength,
68
+ Assertions$3_authorNamePredicate as authorNamePredicate,
69
+ Assertions$3_urlPredicate as urlPredicate,
70
+ Assertions$3_colorPredicate as colorPredicate,
71
+ Assertions$3_descriptionPredicate as descriptionPredicate,
72
+ Assertions$3_footerTextPredicate as footerTextPredicate,
73
+ Assertions$3_timestampPredicate as timestampPredicate,
74
+ Assertions$3_titlePredicate as titlePredicate,
75
75
  };
76
76
  }
77
77
 
@@ -448,6 +448,246 @@ declare enum Faces {
448
448
  Unflip = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)"
449
449
  }
450
450
 
451
+ /**
452
+ * Represents an option within a select menu component
453
+ */
454
+ declare class SelectMenuOption {
455
+ readonly label: string;
456
+ readonly value: string;
457
+ readonly description?: string;
458
+ readonly emoji?: APIMessageComponentEmoji;
459
+ readonly default?: boolean;
460
+ constructor(data?: APISelectMenuOption);
461
+ /**
462
+ * Sets the label of this option
463
+ * @param label The label to show on this option
464
+ */
465
+ setLabel(label: string): this;
466
+ /**
467
+ * Sets the value of this option
468
+ * @param value The value of this option
469
+ */
470
+ setValue(value: string): this;
471
+ /**
472
+ * Sets the description of this option.
473
+ * @param description The description of this option
474
+ */
475
+ setDescription(description: string): this;
476
+ /**
477
+ * Sets whether this option is selected by default
478
+ * @param isDefault Whether or not this option is selected by default
479
+ */
480
+ setDefault(isDefault: boolean): this;
481
+ /**
482
+ * Sets the emoji to display on this button
483
+ * @param emoji The emoji to display on this button
484
+ */
485
+ setEmoji(emoji: APIMessageComponentEmoji): this;
486
+ toJSON(): APISelectMenuOption;
487
+ }
488
+
489
+ declare const customIdValidator: z.ZodString;
490
+ declare const emojiValidator: z.ZodObject<{
491
+ id: z.ZodOptional<z.ZodString>;
492
+ name: z.ZodOptional<z.ZodString>;
493
+ animated: z.ZodOptional<z.ZodBoolean>;
494
+ }, "strict", z.ZodTypeAny, {
495
+ name?: string | undefined;
496
+ id?: string | undefined;
497
+ animated?: boolean | undefined;
498
+ }, {
499
+ name?: string | undefined;
500
+ id?: string | undefined;
501
+ animated?: boolean | undefined;
502
+ }>;
503
+ declare const disabledValidator: z.ZodBoolean;
504
+ declare const buttonLabelValidator: z.ZodString;
505
+ declare const buttonStyleValidator: z.ZodNumber;
506
+ declare const placeholderValidator: z.ZodString;
507
+ declare const minMaxValidator: z.ZodNumber;
508
+ declare const optionsValidator: z.ZodArray<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, "atleastone">;
509
+ declare function validateRequiredSelectMenuParameters(options: SelectMenuOption[], customId?: string): void;
510
+ declare const labelValueValidator: z.ZodString;
511
+ declare const defaultValidator: z.ZodBoolean;
512
+ declare function validateRequiredSelectMenuOptionParameters(label?: string, value?: string): void;
513
+ declare const urlValidator: z.ZodString;
514
+ declare function validateRequiredButtonParameters(style: ButtonStyle, label?: string, emoji?: APIMessageComponentEmoji, customId?: string, url?: string): void;
515
+
516
+ declare const Assertions$2_customIdValidator: typeof customIdValidator;
517
+ declare const Assertions$2_emojiValidator: typeof emojiValidator;
518
+ declare const Assertions$2_disabledValidator: typeof disabledValidator;
519
+ declare const Assertions$2_buttonLabelValidator: typeof buttonLabelValidator;
520
+ declare const Assertions$2_buttonStyleValidator: typeof buttonStyleValidator;
521
+ declare const Assertions$2_placeholderValidator: typeof placeholderValidator;
522
+ declare const Assertions$2_minMaxValidator: typeof minMaxValidator;
523
+ declare const Assertions$2_optionsValidator: typeof optionsValidator;
524
+ declare const Assertions$2_validateRequiredSelectMenuParameters: typeof validateRequiredSelectMenuParameters;
525
+ declare const Assertions$2_labelValueValidator: typeof labelValueValidator;
526
+ declare const Assertions$2_defaultValidator: typeof defaultValidator;
527
+ declare const Assertions$2_validateRequiredSelectMenuOptionParameters: typeof validateRequiredSelectMenuOptionParameters;
528
+ declare const Assertions$2_urlValidator: typeof urlValidator;
529
+ declare const Assertions$2_validateRequiredButtonParameters: typeof validateRequiredButtonParameters;
530
+ declare namespace Assertions$2 {
531
+ export {
532
+ Assertions$2_customIdValidator as customIdValidator,
533
+ Assertions$2_emojiValidator as emojiValidator,
534
+ Assertions$2_disabledValidator as disabledValidator,
535
+ Assertions$2_buttonLabelValidator as buttonLabelValidator,
536
+ Assertions$2_buttonStyleValidator as buttonStyleValidator,
537
+ Assertions$2_placeholderValidator as placeholderValidator,
538
+ Assertions$2_minMaxValidator as minMaxValidator,
539
+ Assertions$2_optionsValidator as optionsValidator,
540
+ Assertions$2_validateRequiredSelectMenuParameters as validateRequiredSelectMenuParameters,
541
+ Assertions$2_labelValueValidator as labelValueValidator,
542
+ Assertions$2_defaultValidator as defaultValidator,
543
+ Assertions$2_validateRequiredSelectMenuOptionParameters as validateRequiredSelectMenuOptionParameters,
544
+ Assertions$2_urlValidator as urlValidator,
545
+ Assertions$2_validateRequiredButtonParameters as validateRequiredButtonParameters,
546
+ };
547
+ }
548
+
549
+ /**
550
+ * Represents a discord component
551
+ */
552
+ interface Component {
553
+ /**
554
+ * The type of this component
555
+ */
556
+ readonly type: ComponentType;
557
+ /**
558
+ * Converts this component to an API-compatible JSON object
559
+ */
560
+ toJSON: () => APIMessageComponent;
561
+ }
562
+
563
+ declare type ActionRowComponent = ButtonComponent | SelectMenuComponent;
564
+ /**
565
+ * Represents an action row component
566
+ */
567
+ declare class ActionRow<T extends ActionRowComponent> implements Component {
568
+ readonly components: T[];
569
+ readonly type = ComponentType.ActionRow;
570
+ constructor(data?: APIActionRowComponent);
571
+ /**
572
+ * Adds components to this action row.
573
+ * @param components The components to add to this action row.
574
+ * @returns
575
+ */
576
+ addComponents(...components: T[]): this;
577
+ /**
578
+ * Sets the components in this action row
579
+ * @param components The components to set this row to
580
+ */
581
+ setComponents(components: T[]): this;
582
+ toJSON(): APIActionRowComponent;
583
+ }
584
+
585
+ declare class ButtonComponent implements Component {
586
+ readonly type: ComponentType.Button;
587
+ readonly style: ButtonStyle;
588
+ readonly label?: string;
589
+ readonly emoji?: APIMessageComponentEmoji;
590
+ readonly disabled?: boolean;
591
+ readonly custom_id: string;
592
+ readonly url: string;
593
+ constructor(data?: APIButtonComponent);
594
+ /**
595
+ * Sets the style of this button
596
+ * @param style The style of the button
597
+ */
598
+ setStyle(style: ButtonStyle): this;
599
+ /**
600
+ * Sets the URL for this button
601
+ * @param url The URL to open when this button is clicked
602
+ */
603
+ setURL(url: string): this;
604
+ /**
605
+ * Sets the custom Id for this button
606
+ * @param customId The custom ID to use for this button
607
+ */
608
+ setCustomId(customId: string): this;
609
+ /**
610
+ * Sets the emoji to display on this button
611
+ * @param emoji The emoji to display on this button
612
+ */
613
+ setEmoji(emoji: APIMessageComponentEmoji): this;
614
+ /**
615
+ * Sets whether this button is disable or not
616
+ * @param disabled Whether or not to disable this button or not
617
+ */
618
+ setDisabled(disabled: boolean): this;
619
+ /**
620
+ * Sets the label for this button
621
+ * @param label The label to display on this button
622
+ */
623
+ setLabel(label: string): this;
624
+ toJSON(): APIButtonComponent;
625
+ }
626
+
627
+ interface MappedComponentTypes {
628
+ [ComponentType.ActionRow]: ActionRow<ActionRowComponent>;
629
+ [ComponentType.Button]: ButtonComponent;
630
+ [ComponentType.SelectMenu]: SelectMenuComponent;
631
+ }
632
+ /**
633
+ * Factory for creating components from API data
634
+ * @param data The api data to transform to a component class
635
+ */
636
+ declare function createComponent<T extends keyof MappedComponentTypes>(data: APIMessageComponent & {
637
+ type: T;
638
+ }): MappedComponentTypes[T];
639
+
640
+ /**
641
+ * Represents a select menu component
642
+ */
643
+ declare class SelectMenuComponent implements Component {
644
+ readonly type: ComponentType.SelectMenu;
645
+ readonly options: SelectMenuOption[];
646
+ readonly placeholder?: string;
647
+ readonly min_values?: number;
648
+ readonly max_values?: number;
649
+ readonly custom_id: string;
650
+ readonly disabled?: boolean;
651
+ constructor(data?: APISelectMenuComponent);
652
+ /**
653
+ * Sets the placeholder for this select menu
654
+ * @param placeholder The placeholder to use for this select menu
655
+ */
656
+ setPlaceholder(placeholder: string): this;
657
+ /**
658
+ * Sets thes minimum values that must be selected in the select menu
659
+ * @param minValues The minimum values that must be selected
660
+ */
661
+ setMinValues(minValues: number): this;
662
+ /**
663
+ * Sets thes maximum values that must be selected in the select menu
664
+ * @param minValues The maximum values that must be selected
665
+ */
666
+ setMaxValues(maxValues: number): this;
667
+ /**
668
+ * Sets the custom Id for this select menu
669
+ * @param customId The custom ID to use for this select menu
670
+ */
671
+ setCustomId(customId: string): this;
672
+ /**
673
+ * Sets whether or not this select menu is disabled
674
+ * @param disabled Whether or not this select menu is disabled
675
+ */
676
+ setDisabled(disabled: boolean): this;
677
+ /**
678
+ * Adds options to this select menu
679
+ * @param options The options to add to this select menu
680
+ * @returns
681
+ */
682
+ addOptions(...options: SelectMenuOption[]): this;
683
+ /**
684
+ * Sets the options on this select menu
685
+ * @param options The options to set on this select menu
686
+ */
687
+ setOptions(options: SelectMenuOption[]): this;
688
+ toJSON(): APISelectMenuComponent;
689
+ }
690
+
451
691
  declare class SharedNameAndDescription {
452
692
  readonly name: string;
453
693
  readonly description: string;
@@ -467,7 +707,7 @@ declare class SharedNameAndDescription {
467
707
 
468
708
  declare abstract class ApplicationCommandOptionBase extends SharedNameAndDescription {
469
709
  abstract readonly type: ApplicationCommandOptionType;
470
- readonly required = false;
710
+ readonly required: boolean;
471
711
  /**
472
712
  * Marks the option as required
473
713
  *
@@ -509,8 +749,8 @@ interface SlashCommandChannelOption extends ApplicationCommandOptionChannelTypes
509
749
  }
510
750
 
511
751
  declare abstract class ApplicationCommandNumericOptionMinMaxValueMixin {
512
- protected readonly maxValue?: number;
513
- protected readonly minValue?: number;
752
+ readonly max_value?: number;
753
+ readonly min_value?: number;
514
754
  /**
515
755
  * Sets the maximum number value of this option
516
756
  * @param max The maximum value this option can be
@@ -644,7 +884,7 @@ declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
644
884
  /**
645
885
  * Represents a folder for subcommands
646
886
  *
647
- * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
887
+ * For more information, go to https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups
648
888
  */
649
889
  declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {
650
890
  /**
@@ -672,7 +912,7 @@ interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {
672
912
  /**
673
913
  * Represents a subcommand
674
914
  *
675
- * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
915
+ * For more information, go to https://discord.com/developers/docs/interactions/application-commands#subcommands-and-subcommand-groups
676
916
  */
677
917
  declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {
678
918
  /**
@@ -747,31 +987,31 @@ interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, P
747
987
  interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
748
988
  }
749
989
  interface ToAPIApplicationCommandOptions {
750
- toJSON(): APIApplicationCommandOption;
990
+ toJSON: () => APIApplicationCommandOption;
751
991
  }
752
992
 
753
- declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
754
993
  declare function validateName$1(name: unknown): asserts name is string;
755
994
  declare function validateDescription(description: unknown): asserts description is string;
995
+ declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
996
+ declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
756
997
  declare function validateDefaultPermission$1(value: unknown): asserts value is boolean;
757
998
  declare function validateRequired(required: unknown): asserts required is boolean;
758
- declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
759
999
  declare function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]): void;
760
1000
  declare function assertReturnOfBuilder<T extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
761
1001
 
762
1002
  declare const Assertions$1_validateDescription: typeof validateDescription;
763
- declare const Assertions$1_validateRequired: typeof validateRequired;
764
1003
  declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLength;
1004
+ declare const Assertions$1_validateRequired: typeof validateRequired;
765
1005
  declare const Assertions$1_validateMaxChoicesLength: typeof validateMaxChoicesLength;
766
1006
  declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder;
767
1007
  declare namespace Assertions$1 {
768
1008
  export {
769
- validateRequiredParameters$1 as validateRequiredParameters,
770
1009
  validateName$1 as validateName,
771
1010
  Assertions$1_validateDescription as validateDescription,
1011
+ Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength,
1012
+ validateRequiredParameters$1 as validateRequiredParameters,
772
1013
  validateDefaultPermission$1 as validateDefaultPermission,
773
1014
  Assertions$1_validateRequired as validateRequired,
774
- Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength,
775
1015
  Assertions$1_validateMaxChoicesLength as validateMaxChoicesLength,
776
1016
  Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder,
777
1017
  };
@@ -823,22 +1063,22 @@ declare class ContextMenuCommandBuilder {
823
1063
  }
824
1064
  declare type ContextMenuCommandType = ApplicationCommandType.User | ApplicationCommandType.Message;
825
1065
 
826
- declare function validateRequiredParameters(name: string, type: number): void;
1066
+ declare function validateDefaultPermission(value: unknown): asserts value is boolean;
827
1067
  declare function validateName(name: unknown): asserts name is string;
828
1068
  declare function validateType(type: unknown): asserts type is ContextMenuCommandType;
829
- declare function validateDefaultPermission(value: unknown): asserts value is boolean;
1069
+ declare function validateRequiredParameters(name: string, type: number): void;
830
1070
 
831
- declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
1071
+ declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
832
1072
  declare const Assertions_validateName: typeof validateName;
833
1073
  declare const Assertions_validateType: typeof validateType;
834
- declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
1074
+ declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
835
1075
  declare namespace Assertions {
836
1076
  export {
837
- Assertions_validateRequiredParameters as validateRequiredParameters,
1077
+ Assertions_validateDefaultPermission as validateDefaultPermission,
838
1078
  Assertions_validateName as validateName,
839
1079
  Assertions_validateType as validateType,
840
- Assertions_validateDefaultPermission as validateDefaultPermission,
1080
+ Assertions_validateRequiredParameters as validateRequiredParameters,
841
1081
  };
842
1082
  }
843
1083
 
844
- export { AuthorOptions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$2 as EmbedAssertions, Faces, FooterOptions, Assertions$1 as SlashCommandAssertions, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, blockQuote, bold, channelMention, codeBlock, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };
1084
+ export { ActionRow, ActionRowComponent, AuthorOptions, ButtonComponent, Component, Assertions$2 as ComponentAssertions, Assertions as ContextMenuCommandAssertions, ContextMenuCommandBuilder, ContextMenuCommandType, Embed, Assertions$3 as EmbedAssertions, Faces, FooterOptions, MappedComponentTypes, SelectMenuComponent, SelectMenuOption, Assertions$1 as SlashCommandAssertions, SlashCommandBooleanOption, SlashCommandBuilder, SlashCommandChannelOption, SlashCommandIntegerOption, SlashCommandMentionableOption, SlashCommandNumberOption, SlashCommandOptionsOnlyBuilder, SlashCommandRoleOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, SlashCommandSubcommandGroupBuilder, SlashCommandSubcommandsOnlyBuilder, SlashCommandUserOption, TimestampStyles, TimestampStylesString, ToAPIApplicationCommandOptions, blockQuote, bold, channelMention, codeBlock, createComponent, formatEmoji, hideLinkEmbed, hyperlink, inlineCode, italic, memberNicknameMention, quote, roleMention, spoiler, strikethrough, time, underscore, userMention };