@discordjs/builders 0.13.0 → 0.14.0-dev.1650413406-585169f

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,181 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ # [0.13.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.12.0...@discordjs/builders@0.13.0) (2022-04-17)
6
+
7
+ ## Bug Fixes
8
+
9
+ - Validate select menu options (#7566) ([b1d63d9](https://github.com/discordjs/discord.js/commit/b1d63d919a61f309ac89f27016b0f148678dac2b))
10
+ - **SelectMenu:** Set `placeholder` max to 150 (#7538) ([dcd4797](https://github.com/discordjs/discord.js/commit/dcd479767b6ec980a373f2ea1f22754f41661c1e))
11
+ - Only check `instanceof Component` once (#7546) ([0aa4851](https://github.com/discordjs/discord.js/commit/0aa48516a4e33497e8e8dc50da164a57cdee09d3))
12
+ - **builders:** Allow negative min/max value of number/integer option (#7484) ([3baa340](https://github.com/discordjs/discord.js/commit/3baa340821b8ecf8a16253bc0917a1033250d7c9))
13
+ - **components:** SetX should take rest parameters (#7461) ([3617359](https://github.com/discordjs/discord.js/commit/36173590a712f041b087b7882054805a8bd42dae))
14
+ - Unsafe embed builder field normalization (#7418) ([b936103](https://github.com/discordjs/discord.js/commit/b936103395121cb21a8c616f669ddab1d2efb0f1))
15
+ - Fix some typos (#7393) ([92a04f4](https://github.com/discordjs/discord.js/commit/92a04f4d98f6c6760214034cc8f5a1eaa78893c7))
16
+ - **builders:** Make type optional in constructor (#7391) ([4abb28c](https://github.com/discordjs/discord.js/commit/4abb28c0a1256c57a60369a6b8ec9e98c265b489))
17
+ - Don't create new instances of builders classes (#7343) ([d6b56d0](https://github.com/discordjs/discord.js/commit/d6b56d0080c4c5f8ace731f1e8bcae0c9d3fb5a5))
18
+ - **builders:** Dont export `Button` component stuff twice (#7289) ([86d9d06](https://github.com/discordjs/discord.js/commit/86d9d0674347c08d056cd054cb4ce4253195bf94))
19
+
20
+ ## Documentation
21
+
22
+ - Completely fix builders example link (#7543) ([1a14c0c](https://github.com/discordjs/discord.js/commit/1a14c0ca562ea173d363a770a0437209f461fd23))
23
+ - Add slash command builders example, fixes #7338 (#7339) ([3ae6f3c](https://github.com/discordjs/discord.js/commit/3ae6f3c313091151245d6e6b52337b459ecfc765))
24
+ - **SlashCommandSubcommands:** Updating old links from Discord developer portal (#7224) ([bd7a6f2](https://github.com/discordjs/discord.js/commit/bd7a6f265212624199fb0b2ddc8ece39759c63de))
25
+
26
+ ## Features
27
+
28
+ - Slash command localization for builders (#7683) ([40b9a1d](https://github.com/discordjs/discord.js/commit/40b9a1d67d0b508ec593e030913acd8161cd17f8))
29
+ - Add API v10 support (#7477) ([72577c4](https://github.com/discordjs/discord.js/commit/72577c4bfd02524a27afb6ff4aebba9301a690d3))
30
+ - Add support for module: NodeNext in TS and ESM (#7598) ([8f1986a](https://github.com/discordjs/discord.js/commit/8f1986a6aa98365e09b00e84ad5f9f354ab61f3d))
31
+ - Add Modals and Text Inputs (#7023) ([ed92015](https://github.com/discordjs/discord.js/commit/ed920156344233241a21b0c0b99736a3a855c23c))
32
+ - Add missing `v13` component methods (#7466) ([f7257f0](https://github.com/discordjs/discord.js/commit/f7257f07655076eabfe355cb6a53260b39ca9670))
33
+ - **builders:** Add attachment command option type (#7203) ([ae0f35f](https://github.com/discordjs/discord.js/commit/ae0f35f51d68dfa5a7dc43d161ef9365171debdb))
34
+ - **components:** Add unsafe message component builders (#7387) ([6b6222b](https://github.com/discordjs/discord.js/commit/6b6222bf513d1ee8cd98fba0ad313def560b864f))
35
+ - **embed:** Add setFields (#7322) ([bcc5cda](https://github.com/discordjs/discord.js/commit/bcc5cda8a902ddb28c7e3578e0f29b4272832624))
36
+ - Add components to /builders (#7195) ([2bb40fd](https://github.com/discordjs/discord.js/commit/2bb40fd767cf5918e3ba422ff73082734bfa05b0))
37
+
38
+ ## Refactor
39
+
40
+ - Remove nickname parsing (#7736) ([78a3afc](https://github.com/discordjs/discord.js/commit/78a3afcd7fdac358e06764cc0d675e1215c785f3))
41
+ - Replace zod with shapeshift (#7547) ([3c0bbac](https://github.com/discordjs/discord.js/commit/3c0bbac82fa9988af4a62ff00c66d149fbe6b921))
42
+ - Remove store channels (#7634) ([aedddb8](https://github.com/discordjs/discord.js/commit/aedddb875e740e1f1bd77f06ce1b361fd3b7bc36))
43
+ - Allow builders to accept emoji strings (#7616) ([fb9a9c2](https://github.com/discordjs/discord.js/commit/fb9a9c221121ee1c7986f9c775b77b9691a0ae15))
44
+ - Don't return builders from API data (#7584) ([549716e](https://github.com/discordjs/discord.js/commit/549716e4fcec89ca81216a6d22aa8e623175e37a))
45
+ - Remove obsolete builder methods (#7590) ([10607db](https://github.com/discordjs/discord.js/commit/10607dbdafe257c5cbf5b952b7eecec4919e8b4a))
46
+ - **Embed:** Remove add field (#7522) ([8478d2f](https://github.com/discordjs/discord.js/commit/8478d2f4de9ac013733850cbbc67902f7c5abc55))
47
+ - Make `data` public in builders (#7486) ([ba31203](https://github.com/discordjs/discord.js/commit/ba31203a0ad96e0a00f8312c397889351e4c5cfd))
48
+ - **embed:** Remove array support in favor of rest params (#7498) ([b3fa2ec](https://github.com/discordjs/discord.js/commit/b3fa2ece402839008738ad3adce3db958445838d))
49
+ - **components:** Default set boolean methods to true (#7502) ([b122149](https://github.com/discordjs/discord.js/commit/b12214922cea2f43afbe6b1555a74a3c8e16f798))
50
+ - Make public builder props getters (#7422) ([e8252ed](https://github.com/discordjs/discord.js/commit/e8252ed3b981a4b7e4013f12efadd2f5d9318d3e))
51
+ - **builders-methods:** Make methods consistent (#7395) ([f495364](https://github.com/discordjs/discord.js/commit/f4953647ff9f39127978c73bf8a62c08462802ca))
52
+ - Remove conditional autocomplete option return types (#7396) ([0909824](https://github.com/discordjs/discord.js/commit/09098240bfb13b8afafa4ab549f06d236e0ff1c9))
53
+ - **embed:** Mark properties as readonly (#7332) ([31768fc](https://github.com/discordjs/discord.js/commit/31768fcd69ed5b4566a340bda89ce881418e8272))
54
+
55
+ ## Typings
56
+
57
+ - Fix regressions (#7649) ([5748dbe](https://github.com/discordjs/discord.js/commit/5748dbe08783beb80c526de38ccd105eb0e82664))
58
+ - Make `required` a boolean (#7307) ([c10afea](https://github.com/discordjs/discord.js/commit/c10afeadc702ab98bec5e077b3b92494a9596f9c))
59
+
60
+ # [0.12.0](https://github.com/discordjs/discord.js/compare/@discordjs/builders@0.11.0...@discordjs/builders@0.12.0) (2021-12-08)
61
+
62
+ ## Bug Fixes
63
+
64
+ - **builders:** Dont export `Button` component stuff twice (#7289) ([86d9d06](https://github.com/discordjs/discord.js/commit/86d9d0674347c08d056cd054cb4ce4253195bf94))
65
+
66
+ ## Documentation
67
+
68
+ - **SlashCommandSubcommands:** Updating old links from Discord developer portal (#7224) ([bd7a6f2](https://github.com/discordjs/discord.js/commit/bd7a6f265212624199fb0b2ddc8ece39759c63de))
69
+
70
+ ## Features
71
+
72
+ - Add components to /builders (#7195) ([2bb40fd](https://github.com/discordjs/discord.js/commit/2bb40fd767cf5918e3ba422ff73082734bfa05b0))
73
+
74
+ ## Typings
75
+
76
+ - Make `required` a boolean (#7307) ([c10afea](https://github.com/discordjs/discord.js/commit/c10afeadc702ab98bec5e077b3b92494a9596f9c))
77
+
78
+ # [0.11.0](https://github.com/discordjs/builders/compare/v0.10.0...v0.11.0) (2021-12-29)
79
+
80
+ ## Bug Fixes
81
+
82
+ - **ApplicationCommandOptions:** clean up code for builder options ([#68](https://github.com/discordjs/builders/issues/68)) ([b5d0b15](https://github.com/discordjs/builders/commit/b5d0b157b1262bd01fa011f8e0cf33adb82776e7))
83
+
84
+ # [0.10.0](https://github.com/discordjs/builders/compare/v0.9.0...v0.10.0) (2021-12-24)
85
+
86
+ ## Bug Fixes
87
+
88
+ - 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))
89
+
90
+ ## Features
91
+
92
+ - 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))
93
+
94
+ # [0.9.0](https://github.com/discordjs/builders/compare/v0.8.2...v0.9.0) (2021-12-02)
95
+
96
+ ## Bug Fixes
97
+
98
+ - replace ow with zod ([#58](https://github.com/discordjs/builders/issues/58)) ([0b6fb81](https://github.com/discordjs/builders/commit/0b6fb8161b858e42781855fb73aaa873fec58160))
99
+
100
+ ## Features
101
+
102
+ - **SlashCommandBuilder:** add autocomplete ([#53](https://github.com/discordjs/builders/issues/53)) ([05b07a7](https://github.com/discordjs/builders/commit/05b07a7e88848188c27d7380d9f948cba25ef778))
103
+
104
+ ## [0.8.2](https://github.com/discordjs/builders/compare/v0.8.1...v0.8.2) (2021-10-30)
105
+
106
+ ## Bug Fixes
107
+
108
+ - downgrade ow because of esm issues ([#55](https://github.com/discordjs/builders/issues/55)) ([3722d2c](https://github.com/discordjs/builders/commit/3722d2c1109a7a5c0abad63c1a7eb944df6e46c8))
109
+
110
+ ## [0.8.1](https://github.com/discordjs/builders/compare/v0.8.0...v0.8.1) (2021-10-29)
111
+
112
+ ## Bug Fixes
113
+
114
+ - documentation ([e33ec8d](https://github.com/discordjs/builders/commit/e33ec8dfd5785312f82e0afb017a3dac614fd71d))
115
+
116
+ # [0.7.0](https://github.com/discordjs/builders/compare/v0.6.0...v0.7.0) (2021-10-18)
117
+
118
+ ## Bug Fixes
119
+
120
+ - properly type `toJSON` methods ([#34](https://github.com/discordjs/builders/issues/34)) ([7723ad0](https://github.com/discordjs/builders/commit/7723ad0da169386e638188de220451a97513bc25))
121
+
122
+ ## Features
123
+
124
+ - **ContextMenus:** add context menu command builder ([#29](https://github.com/discordjs/builders/issues/29)) ([f0641e5](https://github.com/discordjs/builders/commit/f0641e55733de8992600f3082bcf054e6f815cf7))
125
+ - add support for channel types on channel options ([#41](https://github.com/discordjs/builders/issues/41)) ([f6c187e](https://github.com/discordjs/builders/commit/f6c187e0ad6ebe03e65186ece3e95cb1db5aeb50))
126
+
127
+ # [0.6.0](https://github.com/discordjs/builders/compare/v0.5.0...v0.6.0) (2021-08-24)
128
+
129
+ ## Bug Fixes
130
+
131
+ - **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))
132
+
133
+ ## Features
134
+
135
+ - create `Embed` builder ([#11](https://github.com/discordjs/builders/issues/11)) ([eb942a4](https://github.com/discordjs/builders/commit/eb942a4d1f3bcec9a4e370b6af602a713ad8f9b7))
136
+ - **SlashCommandBuilder:** create setDefaultPermission function ([#19](https://github.com/discordjs/builders/issues/19)) ([5d53759](https://github.com/discordjs/builders/commit/5d537593937a8da330153ce4711b7d093a80330e))
137
+ - **SlashCommands:** add number option type ([#23](https://github.com/discordjs/builders/issues/23)) ([1563991](https://github.com/discordjs/builders/commit/1563991d421bb07bf7a412c87e7613692d770f04))
138
+
139
+ # [0.5.0](https://github.com/discordjs/builders/compare/v0.3.0...v0.5.0) (2021-08-10)
140
+
141
+ ## Features
142
+
143
+ - **Formatters:** add `formatEmoji` ([#20](https://github.com/discordjs/builders/issues/20)) ([c3d8bb5](https://github.com/discordjs/builders/commit/c3d8bb5363a1d46b45c0def4277da6921e2ba209))
144
+
145
+ # [0.4.0](https://github.com/discordjs/builders/compare/v0.3.0...v0.4.0) (2021-08-05)
146
+
147
+ ## Features
148
+
149
+ - `sub command` => `subcommand` ([#18](https://github.com/discordjs/builders/pull/18)) ([95599c5](https://github.com/discordjs/builders/commit/95599c5b5366ebd054c4c277c52f1a44cda1209d))
150
+
151
+ # [0.3.0](https://github.com/discordjs/builders/compare/v0.2.0...v0.3.0) (2021-08-01)
152
+
153
+ ## Bug Fixes
154
+
155
+ - **Shrug:** Update comment ([#14](https://github.com/discordjs/builders/issues/14)) ([6fa6c40](https://github.com/discordjs/builders/commit/6fa6c405f2ea733811677d3d1bfb1e2806d504d5))
156
+ - shrug face rendering ([#13](https://github.com/discordjs/builders/issues/13)) ([6ad24ec](https://github.com/discordjs/builders/commit/6ad24ecd96c82b0f576e78e9e53fc7bf9c36ef5d))
157
+
158
+ ## Features
159
+
160
+ - **formatters:** mentions ([#9](https://github.com/discordjs/builders/issues/9)) ([f83fe99](https://github.com/discordjs/builders/commit/f83fe99b83188ed999845751ffb005c687dbd60a))
161
+ - **Formatters:** Add a spoiler function ([#16](https://github.com/discordjs/builders/issues/16)) ([c213a6a](https://github.com/discordjs/builders/commit/c213a6abb114f65653017a4edec4bdba2162d771))
162
+ - **SlashCommands:** add slash command builders ([#3](https://github.com/discordjs/builders/issues/3)) ([6aa3af0](https://github.com/discordjs/builders/commit/6aa3af07b0ee342fff91f080914bb12b3ab773f8))
163
+ - shrug, tableflip and unflip strings ([#5](https://github.com/discordjs/builders/issues/5)) ([de5fa82](https://github.com/discordjs/builders/commit/de5fa823cd6f1feba5b2d0a63b2cb1761dfd1814))
164
+
165
+ # [0.2.0](https://github.com/discordjs/builders/compare/v0.1.1...v0.2.0) (2021-07-03)
166
+
167
+ ## Features
168
+
169
+ - **Formatters:** added `hyperlink` and `hideLinkEmbed` ([#4](https://github.com/discordjs/builders/issues/4)) ([c532daf](https://github.com/discordjs/builders/commit/c532daf2ba2feae75bf9668f63462e96a5314cff))
170
+
171
+ # [0.1.1](https://github.com/discordjs/builders/compare/v0.1.0...v0.1.1) (2021-06-30)
172
+
173
+ ## Bug Fixes
174
+
175
+ - **Deps:** added `tslib` as dependency ([#2](https://github.com/discordjs/builders/issues/2)) ([5576ff3](https://github.com/discordjs/builders/commit/5576ff3b67136b957bed0ab8a4c655d5de322813))
176
+
177
+ # 0.1.0 (2021-06-30)
178
+
179
+ ## Features
180
+
181
+ - added message formatters ([#1](https://github.com/discordjs/builders/issues/1)) ([765e46d](https://github.com/discordjs/builders/commit/765e46dac96c4e49d350243e5fad34c2bc738a7c))
package/dist/index.d.ts CHANGED
@@ -21,10 +21,19 @@ declare function validateFieldLength(amountAdding: number, fields?: APIEmbedFiel
21
21
  declare const authorNamePredicate: _sapphire_shapeshift.UnionValidator<string | null>;
22
22
  declare const imageURLPredicate: _sapphire_shapeshift.UnionValidator<string | null | undefined>;
23
23
  declare const urlPredicate: _sapphire_shapeshift.UnionValidator<string | null | undefined>;
24
+ declare const embedAuthorPredicate: _sapphire_shapeshift.ObjectValidator<{
25
+ name: string | null;
26
+ iconURL: string | null | undefined;
27
+ url: string | null | undefined;
28
+ }>;
24
29
  declare const RGBPredicate: _sapphire_shapeshift.NumberValidator<number>;
25
30
  declare const colorPredicate: _sapphire_shapeshift.UnionValidator<number | [number, number, number] | null>;
26
31
  declare const descriptionPredicate: _sapphire_shapeshift.UnionValidator<string | null>;
27
32
  declare const footerTextPredicate: _sapphire_shapeshift.UnionValidator<string | null>;
33
+ declare const embedFooterPredicate: _sapphire_shapeshift.ObjectValidator<{
34
+ text: string | null;
35
+ iconURL: string | null | undefined;
36
+ }>;
28
37
  declare const timestampPredicate: _sapphire_shapeshift.UnionValidator<number | Date | null>;
29
38
  declare const titlePredicate: _sapphire_shapeshift.UnionValidator<string | null>;
30
39
 
@@ -38,10 +47,12 @@ declare const Assertions$5_validateFieldLength: typeof validateFieldLength;
38
47
  declare const Assertions$5_authorNamePredicate: typeof authorNamePredicate;
39
48
  declare const Assertions$5_imageURLPredicate: typeof imageURLPredicate;
40
49
  declare const Assertions$5_urlPredicate: typeof urlPredicate;
50
+ declare const Assertions$5_embedAuthorPredicate: typeof embedAuthorPredicate;
41
51
  declare const Assertions$5_RGBPredicate: typeof RGBPredicate;
42
52
  declare const Assertions$5_colorPredicate: typeof colorPredicate;
43
53
  declare const Assertions$5_descriptionPredicate: typeof descriptionPredicate;
44
54
  declare const Assertions$5_footerTextPredicate: typeof footerTextPredicate;
55
+ declare const Assertions$5_embedFooterPredicate: typeof embedFooterPredicate;
45
56
  declare const Assertions$5_timestampPredicate: typeof timestampPredicate;
46
57
  declare const Assertions$5_titlePredicate: typeof titlePredicate;
47
58
  declare namespace Assertions$5 {
@@ -56,10 +67,12 @@ declare namespace Assertions$5 {
56
67
  Assertions$5_authorNamePredicate as authorNamePredicate,
57
68
  Assertions$5_imageURLPredicate as imageURLPredicate,
58
69
  Assertions$5_urlPredicate as urlPredicate,
70
+ Assertions$5_embedAuthorPredicate as embedAuthorPredicate,
59
71
  Assertions$5_RGBPredicate as RGBPredicate,
60
72
  Assertions$5_colorPredicate as colorPredicate,
61
73
  Assertions$5_descriptionPredicate as descriptionPredicate,
62
74
  Assertions$5_footerTextPredicate as footerTextPredicate,
75
+ Assertions$5_embedFooterPredicate as embedFooterPredicate,
63
76
  Assertions$5_timestampPredicate as timestampPredicate,
64
77
  Assertions$5_titlePredicate as titlePredicate,
65
78
  };
package/dist/index.js CHANGED
@@ -103,8 +103,10 @@ __export(Assertions_exports, {
103
103
  authorNamePredicate: () => authorNamePredicate,
104
104
  colorPredicate: () => colorPredicate,
105
105
  descriptionPredicate: () => descriptionPredicate,
106
+ embedAuthorPredicate: () => embedAuthorPredicate,
106
107
  embedFieldPredicate: () => embedFieldPredicate,
107
108
  embedFieldsArrayPredicate: () => embedFieldsArrayPredicate,
109
+ embedFooterPredicate: () => embedFooterPredicate,
108
110
  fieldInlinePredicate: () => fieldInlinePredicate,
109
111
  fieldLengthPredicate: () => fieldLengthPredicate,
110
112
  fieldNamePredicate: () => fieldNamePredicate,
@@ -138,10 +140,19 @@ var imageURLPredicate = import_shapeshift.s.string.url({
138
140
  var urlPredicate = import_shapeshift.s.string.url({
139
141
  allowedProtocols: ["http:", "https:"]
140
142
  }).nullish;
143
+ var embedAuthorPredicate = import_shapeshift.s.object({
144
+ name: authorNamePredicate,
145
+ iconURL: imageURLPredicate,
146
+ url: urlPredicate
147
+ });
141
148
  var RGBPredicate = import_shapeshift.s.number.int.ge(0).le(255);
142
149
  var colorPredicate = import_shapeshift.s.number.int.ge(0).le(16777215).or(import_shapeshift.s.tuple([RGBPredicate, RGBPredicate, RGBPredicate])).nullable;
143
150
  var descriptionPredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(4096).nullable;
144
151
  var footerTextPredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(2048).nullable;
152
+ var embedFooterPredicate = import_shapeshift.s.object({
153
+ text: footerTextPredicate,
154
+ iconURL: imageURLPredicate
155
+ });
145
156
  var timestampPredicate = import_shapeshift.s.union(import_shapeshift.s.number, import_shapeshift.s.date).nullable;
146
157
  var titlePredicate = fieldNamePredicate.nullable;
147
158
 
@@ -240,9 +251,7 @@ var EmbedBuilder = class extends UnsafeEmbedBuilder {
240
251
  if (options === null) {
241
252
  return super.setAuthor(null);
242
253
  }
243
- authorNamePredicate.parse(options.name);
244
- urlPredicate.parse(options.iconURL);
245
- urlPredicate.parse(options.url);
254
+ embedAuthorPredicate.parse(options);
246
255
  return super.setAuthor(options);
247
256
  }
248
257
  setColor(color) {
@@ -255,8 +264,7 @@ var EmbedBuilder = class extends UnsafeEmbedBuilder {
255
264
  if (options === null) {
256
265
  return super.setFooter(null);
257
266
  }
258
- footerTextPredicate.parse(options.text);
259
- urlPredicate.parse(options.iconURL);
267
+ embedFooterPredicate.parse(options);
260
268
  return super.setFooter(options);
261
269
  }
262
270
  setImage(url) {