@discordjs/builders 0.7.0 → 0.8.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.
Files changed (93) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +28 -8
  3. package/dist/index.d.ts +818 -17
  4. package/dist/index.js +4 -21
  5. package/dist/index.js.map +7 -1
  6. package/dist/index.mjs +4 -38
  7. package/dist/index.mjs.map +7 -0
  8. package/package.json +53 -41
  9. package/dist/index.d.ts.map +0 -1
  10. package/dist/interactions/contextMenuCommands/Assertions.d.ts +0 -6
  11. package/dist/interactions/contextMenuCommands/Assertions.d.ts.map +0 -1
  12. package/dist/interactions/contextMenuCommands/Assertions.js +0 -32
  13. package/dist/interactions/contextMenuCommands/Assertions.js.map +0 -1
  14. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts +0 -43
  15. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.d.ts.map +0 -1
  16. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.js +0 -85
  17. package/dist/interactions/contextMenuCommands/ContextMenuCommandBuilder.js.map +0 -1
  18. package/dist/interactions/slashCommands/Assertions.d.ts +0 -12
  19. package/dist/interactions/slashCommands/Assertions.d.ts.map +0 -1
  20. package/dist/interactions/slashCommands/Assertions.js +0 -63
  21. package/dist/interactions/slashCommands/Assertions.js.map +0 -1
  22. package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts +0 -58
  23. package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts.map +0 -1
  24. package/dist/interactions/slashCommands/SlashCommandBuilder.js +0 -113
  25. package/dist/interactions/slashCommands/SlashCommandBuilder.js.map +0 -1
  26. package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts +0 -54
  27. package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts.map +0 -1
  28. package/dist/interactions/slashCommands/SlashCommandSubcommands.js +0 -123
  29. package/dist/interactions/slashCommands/SlashCommandSubcommands.js.map +0 -1
  30. package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.d.ts +0 -18
  31. package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.d.ts.map +0 -1
  32. package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.js +0 -58
  33. package/dist/interactions/slashCommands/mixins/CommandChannelOptionBase.js.map +0 -1
  34. package/dist/interactions/slashCommands/mixins/CommandOptionBase.d.ts +0 -15
  35. package/dist/interactions/slashCommands/mixins/CommandOptionBase.d.ts.map +0 -1
  36. package/dist/interactions/slashCommands/mixins/CommandOptionBase.js +0 -48
  37. package/dist/interactions/slashCommands/mixins/CommandOptionBase.js.map +0 -1
  38. package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.d.ts +0 -49
  39. package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.d.ts.map +0 -1
  40. package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.js +0 -71
  41. package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.js.map +0 -1
  42. package/dist/interactions/slashCommands/mixins/CommandOptions.d.ts +0 -54
  43. package/dist/interactions/slashCommands/mixins/CommandOptions.d.ts.map +0 -1
  44. package/dist/interactions/slashCommands/mixins/CommandOptions.js +0 -91
  45. package/dist/interactions/slashCommands/mixins/CommandOptions.js.map +0 -1
  46. package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts +0 -15
  47. package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts.map +0 -1
  48. package/dist/interactions/slashCommands/mixins/NameAndDescription.js +0 -42
  49. package/dist/interactions/slashCommands/mixins/NameAndDescription.js.map +0 -1
  50. package/dist/interactions/slashCommands/options/boolean.d.ts +0 -7
  51. package/dist/interactions/slashCommands/options/boolean.d.ts.map +0 -1
  52. package/dist/interactions/slashCommands/options/boolean.js +0 -18
  53. package/dist/interactions/slashCommands/options/boolean.js.map +0 -1
  54. package/dist/interactions/slashCommands/options/channel.d.ts +0 -7
  55. package/dist/interactions/slashCommands/options/channel.d.ts.map +0 -1
  56. package/dist/interactions/slashCommands/options/channel.js +0 -18
  57. package/dist/interactions/slashCommands/options/channel.js.map +0 -1
  58. package/dist/interactions/slashCommands/options/integer.d.ts +0 -7
  59. package/dist/interactions/slashCommands/options/integer.d.ts.map +0 -1
  60. package/dist/interactions/slashCommands/options/integer.js +0 -18
  61. package/dist/interactions/slashCommands/options/integer.js.map +0 -1
  62. package/dist/interactions/slashCommands/options/mentionable.d.ts +0 -7
  63. package/dist/interactions/slashCommands/options/mentionable.d.ts.map +0 -1
  64. package/dist/interactions/slashCommands/options/mentionable.js +0 -18
  65. package/dist/interactions/slashCommands/options/mentionable.js.map +0 -1
  66. package/dist/interactions/slashCommands/options/number.d.ts +0 -7
  67. package/dist/interactions/slashCommands/options/number.d.ts.map +0 -1
  68. package/dist/interactions/slashCommands/options/number.js +0 -18
  69. package/dist/interactions/slashCommands/options/number.js.map +0 -1
  70. package/dist/interactions/slashCommands/options/role.d.ts +0 -7
  71. package/dist/interactions/slashCommands/options/role.d.ts.map +0 -1
  72. package/dist/interactions/slashCommands/options/role.js +0 -18
  73. package/dist/interactions/slashCommands/options/role.js.map +0 -1
  74. package/dist/interactions/slashCommands/options/string.d.ts +0 -7
  75. package/dist/interactions/slashCommands/options/string.d.ts.map +0 -1
  76. package/dist/interactions/slashCommands/options/string.js +0 -18
  77. package/dist/interactions/slashCommands/options/string.js.map +0 -1
  78. package/dist/interactions/slashCommands/options/user.d.ts +0 -7
  79. package/dist/interactions/slashCommands/options/user.d.ts.map +0 -1
  80. package/dist/interactions/slashCommands/options/user.js +0 -18
  81. package/dist/interactions/slashCommands/options/user.js.map +0 -1
  82. package/dist/messages/embed/Assertions.d.ts +0 -23
  83. package/dist/messages/embed/Assertions.d.ts.map +0 -1
  84. package/dist/messages/embed/Assertions.js +0 -26
  85. package/dist/messages/embed/Assertions.js.map +0 -1
  86. package/dist/messages/embed/Embed.d.ts +0 -140
  87. package/dist/messages/embed/Embed.d.ts.map +0 -1
  88. package/dist/messages/embed/Embed.js +0 -300
  89. package/dist/messages/embed/Embed.js.map +0 -1
  90. package/dist/messages/formatters.d.ts +0 -198
  91. package/dist/messages/formatters.d.ts.map +0 -1
  92. package/dist/messages/formatters.js +0 -181
  93. package/dist/messages/formatters.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,17 +1,818 @@
1
- export * as EmbedAssertions from './messages/embed/Assertions';
2
- export * from './messages/embed/Embed';
3
- export * from './messages/formatters';
4
- export * as SlashCommandAssertions from './interactions/slashCommands/Assertions';
5
- export * from './interactions/slashCommands/SlashCommandBuilder';
6
- export * from './interactions/slashCommands/SlashCommandSubcommands';
7
- export * from './interactions/slashCommands/options/boolean';
8
- export * from './interactions/slashCommands/options/channel';
9
- export * from './interactions/slashCommands/options/integer';
10
- export * from './interactions/slashCommands/options/mentionable';
11
- export * from './interactions/slashCommands/options/number';
12
- export * from './interactions/slashCommands/options/role';
13
- export * from './interactions/slashCommands/options/string';
14
- export * from './interactions/slashCommands/options/user';
15
- export * as ContextMenuCommandAssertions from './interactions/contextMenuCommands/Assertions';
16
- export * from './interactions/contextMenuCommands/ContextMenuCommandBuilder';
17
- //# sourceMappingURL=index.d.ts.map
1
+ import * as ow from 'ow';
2
+ import * as discord_api_types_v9 from 'discord-api-types/v9';
3
+ import { APIEmbedField, APIEmbed, APIEmbedThumbnail, APIEmbedImage, APIEmbedVideo, APIEmbedAuthor, APIEmbedProvider, APIEmbedFooter, ApplicationCommandOptionType, ChannelType, APIApplicationCommandChannelOptions, APIApplicationCommandOptionChoice, APIApplicationCommandSubCommandOptions, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, ApplicationCommandType } from 'discord-api-types/v9';
4
+ import { Snowflake } from 'discord-api-types/globals';
5
+ import { URL } from 'url';
6
+
7
+ declare const fieldNamePredicate: ow.StringPredicate;
8
+ declare const fieldValuePredicate: ow.StringPredicate;
9
+ declare const fieldInlinePredicate: ow.BooleanPredicate & ow.BasePredicate<boolean | undefined>;
10
+ declare const embedFieldPredicate: ow.ObjectPredicate<{
11
+ name: string;
12
+ value: string;
13
+ inline: boolean | undefined;
14
+ }>;
15
+ declare const embedFieldsArrayPredicate: ow.ArrayPredicate<{
16
+ name: string;
17
+ value: string;
18
+ inline: boolean | undefined;
19
+ }>;
20
+ declare function validateFieldLength(fields: APIEmbedField[], amountAdding: number): void;
21
+ declare const authorNamePredicate: ow.AnyPredicate<string | null>;
22
+ declare const urlPredicate: ow.AnyPredicate<string | null | undefined>;
23
+ declare const colorPredicate: ow.AnyPredicate<number | null>;
24
+ declare const descriptionPredicate: ow.AnyPredicate<string | null>;
25
+ declare const footerTextPredicate: ow.AnyPredicate<string | null>;
26
+ declare const timestampPredicate: ow.AnyPredicate<number | Date | null>;
27
+ declare const titlePredicate: ow.AnyPredicate<string | null>;
28
+
29
+ declare const Assertions$2_fieldNamePredicate: typeof fieldNamePredicate;
30
+ declare const Assertions$2_fieldValuePredicate: typeof fieldValuePredicate;
31
+ declare const Assertions$2_fieldInlinePredicate: typeof fieldInlinePredicate;
32
+ declare const Assertions$2_embedFieldPredicate: typeof embedFieldPredicate;
33
+ declare const Assertions$2_embedFieldsArrayPredicate: typeof embedFieldsArrayPredicate;
34
+ declare const Assertions$2_validateFieldLength: typeof validateFieldLength;
35
+ declare const Assertions$2_authorNamePredicate: typeof authorNamePredicate;
36
+ declare const Assertions$2_urlPredicate: typeof urlPredicate;
37
+ declare const Assertions$2_colorPredicate: typeof colorPredicate;
38
+ declare const Assertions$2_descriptionPredicate: typeof descriptionPredicate;
39
+ declare const Assertions$2_footerTextPredicate: typeof footerTextPredicate;
40
+ declare const Assertions$2_timestampPredicate: typeof timestampPredicate;
41
+ declare const Assertions$2_titlePredicate: typeof titlePredicate;
42
+ declare namespace Assertions$2 {
43
+ export {
44
+ Assertions$2_fieldNamePredicate as fieldNamePredicate,
45
+ Assertions$2_fieldValuePredicate as fieldValuePredicate,
46
+ Assertions$2_fieldInlinePredicate as fieldInlinePredicate,
47
+ Assertions$2_embedFieldPredicate as embedFieldPredicate,
48
+ Assertions$2_embedFieldsArrayPredicate as embedFieldsArrayPredicate,
49
+ Assertions$2_validateFieldLength as validateFieldLength,
50
+ Assertions$2_authorNamePredicate as authorNamePredicate,
51
+ Assertions$2_urlPredicate as urlPredicate,
52
+ Assertions$2_colorPredicate as colorPredicate,
53
+ Assertions$2_descriptionPredicate as descriptionPredicate,
54
+ Assertions$2_footerTextPredicate as footerTextPredicate,
55
+ Assertions$2_timestampPredicate as timestampPredicate,
56
+ Assertions$2_titlePredicate as titlePredicate,
57
+ };
58
+ }
59
+
60
+ interface AuthorOptions {
61
+ name: string;
62
+ url?: string;
63
+ iconURL?: string;
64
+ }
65
+ interface FooterOptions {
66
+ text: string;
67
+ iconURL?: string;
68
+ }
69
+ /**
70
+ * Represents an embed in a message (image/video preview, rich embed, etc.)
71
+ */
72
+ declare class Embed implements APIEmbed {
73
+ /**
74
+ * An array of fields of this embed
75
+ */
76
+ fields: APIEmbedField[];
77
+ /**
78
+ * The embed title
79
+ */
80
+ title?: string;
81
+ /**
82
+ * The embed description
83
+ */
84
+ description?: string;
85
+ /**
86
+ * The embed url
87
+ */
88
+ url?: string;
89
+ /**
90
+ * The embed color
91
+ */
92
+ color?: number;
93
+ /**
94
+ * The timestamp of the embed in the ISO format
95
+ */
96
+ timestamp?: string;
97
+ /**
98
+ * The embed thumbnail data
99
+ */
100
+ thumbnail?: APIEmbedThumbnail;
101
+ /**
102
+ * The embed image data
103
+ */
104
+ image?: APIEmbedImage;
105
+ /**
106
+ * Received video data
107
+ */
108
+ video?: APIEmbedVideo;
109
+ /**
110
+ * The embed author data
111
+ */
112
+ author?: APIEmbedAuthor;
113
+ /**
114
+ * Received data about the embed provider
115
+ */
116
+ provider?: APIEmbedProvider;
117
+ /**
118
+ * The embed footer data
119
+ */
120
+ footer?: APIEmbedFooter;
121
+ constructor(data?: APIEmbed);
122
+ /**
123
+ * The accumulated length for the embed title, description, fields, footer text, and author name
124
+ */
125
+ get length(): number;
126
+ /**
127
+ * Adds a field to the embed (max 25)
128
+ *
129
+ * @param field The field to add.
130
+ */
131
+ addField(field: APIEmbedField): this;
132
+ /**
133
+ * Adds fields to the embed (max 25)
134
+ *
135
+ * @param fields The fields to add
136
+ */
137
+ addFields(...fields: APIEmbedField[]): this;
138
+ /**
139
+ * Removes, replaces, or inserts fields in the embed (max 25)
140
+ *
141
+ * @param index The index to start at
142
+ * @param deleteCount The number of fields to remove
143
+ * @param fields The replacing field objects
144
+ */
145
+ spliceFields(index: number, deleteCount: number, ...fields: APIEmbedField[]): this;
146
+ /**
147
+ * Sets the author of this embed
148
+ *
149
+ * @param options The options for the author
150
+ */
151
+ setAuthor(options: AuthorOptions | null): this;
152
+ /**
153
+ * Sets the color of this embed
154
+ *
155
+ * @param color The color of the embed
156
+ */
157
+ setColor(color: number | null): this;
158
+ /**
159
+ * Sets the description of this embed
160
+ *
161
+ * @param description The description
162
+ */
163
+ setDescription(description: string | null): this;
164
+ /**
165
+ * Sets the footer of this embed
166
+ *
167
+ * @param options The options for the footer
168
+ */
169
+ setFooter(options: FooterOptions | null): this;
170
+ /**
171
+ * Sets the image of this embed
172
+ *
173
+ * @param url The URL of the image
174
+ */
175
+ setImage(url: string | null): this;
176
+ /**
177
+ * Sets the thumbnail of this embed
178
+ *
179
+ * @param url The URL of the thumbnail
180
+ */
181
+ setThumbnail(url: string | null): this;
182
+ /**
183
+ * Sets the timestamp of this embed
184
+ *
185
+ * @param timestamp The timestamp or date
186
+ */
187
+ setTimestamp(timestamp?: number | Date | null): this;
188
+ /**
189
+ * Sets the title of this embed
190
+ *
191
+ * @param title The title
192
+ */
193
+ setTitle(title: string | null): this;
194
+ /**
195
+ * Sets the URL of this embed
196
+ *
197
+ * @param url The URL
198
+ */
199
+ setURL(url: string | null): this;
200
+ /**
201
+ * Transforms the embed to a plain object
202
+ */
203
+ toJSON(): APIEmbed;
204
+ /**
205
+ * Normalizes field input and resolves strings
206
+ *
207
+ * @param fields Fields to normalize
208
+ */
209
+ static normalizeFields(...fields: APIEmbedField[]): APIEmbedField[];
210
+ }
211
+
212
+ /**
213
+ * Wraps the content inside a codeblock with no language
214
+ *
215
+ * @param content The content to wrap
216
+ */
217
+ declare function codeBlock<C extends string>(content: C): `\`\`\`\n${C}\`\`\``;
218
+ /**
219
+ * Wraps the content inside a codeblock with the specified language
220
+ *
221
+ * @param language The language for the codeblock
222
+ * @param content The content to wrap
223
+ */
224
+ declare function codeBlock<L extends string, C extends string>(language: L, content: C): `\`\`\`${L}\n${C}\`\`\``;
225
+ /**
226
+ * Wraps the content inside \`backticks\`, which formats it as inline code
227
+ *
228
+ * @param content The content to wrap
229
+ */
230
+ declare function inlineCode<C extends string>(content: C): `\`${C}\``;
231
+ /**
232
+ * Formats the content into italic text
233
+ *
234
+ * @param content The content to wrap
235
+ */
236
+ declare function italic<C extends string>(content: C): `_${C}_`;
237
+ /**
238
+ * Formats the content into bold text
239
+ *
240
+ * @param content The content to wrap
241
+ */
242
+ declare function bold<C extends string>(content: C): `**${C}**`;
243
+ /**
244
+ * Formats the content into underscored text
245
+ *
246
+ * @param content The content to wrap
247
+ */
248
+ declare function underscore<C extends string>(content: C): `__${C}__`;
249
+ /**
250
+ * Formats the content into strike-through text
251
+ *
252
+ * @param content The content to wrap
253
+ */
254
+ declare function strikethrough<C extends string>(content: C): `~~${C}~~`;
255
+ /**
256
+ * Formats the content into a quote. This needs to be at the start of the line for Discord to format it
257
+ *
258
+ * @param content The content to wrap
259
+ */
260
+ declare function quote<C extends string>(content: C): `> ${C}`;
261
+ /**
262
+ * Formats the content into a block quote. This needs to be at the start of the line for Discord to format it
263
+ *
264
+ * @param content The content to wrap
265
+ */
266
+ declare function blockQuote<C extends string>(content: C): `>>> ${C}`;
267
+ /**
268
+ * Wraps the URL into `<>`, which stops it from embedding
269
+ *
270
+ * @param url The URL to wrap
271
+ */
272
+ declare function hideLinkEmbed<C extends string>(url: C): `<${C}>`;
273
+ /**
274
+ * Wraps the URL into `<>`, which stops it from embedding
275
+ *
276
+ * @param url The URL to wrap
277
+ */
278
+ declare function hideLinkEmbed(url: URL): `<${string}>`;
279
+ /**
280
+ * Formats the content and the URL into a masked URL
281
+ *
282
+ * @param content The content to display
283
+ * @param url The URL the content links to
284
+ */
285
+ declare function hyperlink<C extends string>(content: C, url: URL): `[${C}](${string})`;
286
+ /**
287
+ * Formats the content and the URL into a masked URL
288
+ *
289
+ * @param content The content to display
290
+ * @param url The URL the content links to
291
+ */
292
+ declare function hyperlink<C extends string, U extends string>(content: C, url: U): `[${C}](${U})`;
293
+ /**
294
+ * Formats the content and the URL into a masked URL
295
+ *
296
+ * @param content The content to display
297
+ * @param url The URL the content links to
298
+ * @param title The title shown when hovering on the masked link
299
+ */
300
+ declare function hyperlink<C extends string, T extends string>(content: C, url: URL, title: T): `[${C}](${string} "${T}")`;
301
+ /**
302
+ * Formats the content and the URL into a masked URL
303
+ *
304
+ * @param content The content to display
305
+ * @param url The URL the content links to
306
+ * @param title The title shown when hovering on the masked link
307
+ */
308
+ declare function hyperlink<C extends string, U extends string, T extends string>(content: C, url: U, title: T): `[${C}](${U} "${T}")`;
309
+ /**
310
+ * Wraps the content inside spoiler (hidden text)
311
+ *
312
+ * @param content The content to wrap
313
+ */
314
+ declare function spoiler<C extends string>(content: C): `||${C}||`;
315
+ /**
316
+ * Formats a user ID into a user mention
317
+ *
318
+ * @param userId The user ID to format
319
+ */
320
+ declare function userMention<C extends Snowflake>(userId: C): `<@${C}>`;
321
+ /**
322
+ * Formats a user ID into a member-nickname mention
323
+ *
324
+ * @param memberId The user ID to format
325
+ */
326
+ declare function memberNicknameMention<C extends Snowflake>(memberId: C): `<@!${C}>`;
327
+ /**
328
+ * Formats a channel ID into a channel mention
329
+ *
330
+ * @param channelId The channel ID to format
331
+ */
332
+ declare function channelMention<C extends Snowflake>(channelId: C): `<#${C}>`;
333
+ /**
334
+ * Formats a role ID into a role mention
335
+ *
336
+ * @param roleId The role ID to format
337
+ */
338
+ declare function roleMention<C extends Snowflake>(roleId: C): `<@&${C}>`;
339
+ /**
340
+ * Formats an emoji ID into a fully qualified emoji identifier
341
+ *
342
+ * @param emojiId The emoji ID to format
343
+ */
344
+ declare function formatEmoji<C extends Snowflake>(emojiId: C, animated?: false): `<:_:${C}>`;
345
+ /**
346
+ * Formats an emoji ID into a fully qualified emoji identifier
347
+ *
348
+ * @param emojiId The emoji ID to format
349
+ * @param animated Whether the emoji is animated or not. Defaults to `false`
350
+ */
351
+ declare function formatEmoji<C extends Snowflake>(emojiId: C, animated?: true): `<a:_:${C}>`;
352
+ /**
353
+ * Formats a date into a short date-time string
354
+ *
355
+ * @param date The date to format, defaults to the current time
356
+ */
357
+ declare function time(date?: Date): `<t:${bigint}>`;
358
+ /**
359
+ * Formats a date given a format style
360
+ *
361
+ * @param date The date to format
362
+ * @param style The style to use
363
+ */
364
+ declare function time<S extends TimestampStylesString>(date: Date, style: S): `<t:${bigint}:${S}>`;
365
+ /**
366
+ * Formats the given timestamp into a short date-time string
367
+ *
368
+ * @param seconds The time to format, represents an UNIX timestamp in seconds
369
+ */
370
+ declare function time<C extends number>(seconds: C): `<t:${C}>`;
371
+ /**
372
+ * Formats the given timestamp into a short date-time string
373
+ *
374
+ * @param seconds The time to format, represents an UNIX timestamp in seconds
375
+ * @param style The style to use
376
+ */
377
+ declare function time<C extends number, S extends TimestampStylesString>(seconds: C, style: S): `<t:${C}:${S}>`;
378
+ /**
379
+ * The [message formatting timestamp styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord
380
+ */
381
+ declare const TimestampStyles: {
382
+ /**
383
+ * Short time format, consisting of hours and minutes, e.g. 16:20
384
+ */
385
+ readonly ShortTime: "t";
386
+ /**
387
+ * Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30
388
+ */
389
+ readonly LongTime: "T";
390
+ /**
391
+ * Short date format, consisting of day, month, and year, e.g. 20/04/2021
392
+ */
393
+ readonly ShortDate: "d";
394
+ /**
395
+ * Long date format, consisting of day, month, and year, e.g. 20 April 2021
396
+ */
397
+ readonly LongDate: "D";
398
+ /**
399
+ * Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20
400
+ */
401
+ readonly ShortDateTime: "f";
402
+ /**
403
+ * Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20
404
+ */
405
+ readonly LongDateTime: "F";
406
+ /**
407
+ * Relative time format, consisting of a relative duration format, e.g. 2 months ago
408
+ */
409
+ readonly RelativeTime: "R";
410
+ };
411
+ /**
412
+ * The possible values, see {@link TimestampStyles} for more information
413
+ */
414
+ declare type TimestampStylesString = typeof TimestampStyles[keyof typeof TimestampStyles];
415
+ /**
416
+ * An enum with all the available faces from Discord's native slash commands
417
+ */
418
+ declare enum Faces {
419
+ /**
420
+ * ¯\\_(ツ)\\_/¯
421
+ */
422
+ Shrug = "\u00AF\\_(\u30C4)\\_/\u00AF",
423
+ /**
424
+ * (╯°□°)╯︵ ┻━┻
425
+ */
426
+ Tableflip = "(\u256F\u00B0\u25A1\u00B0\uFF09\u256F\uFE35 \u253B\u2501\u253B",
427
+ /**
428
+ * ┬─┬ ノ( ゜-゜ノ)
429
+ */
430
+ Unflip = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)"
431
+ }
432
+
433
+ declare class SlashCommandBooleanOption extends SlashCommandOptionBase {
434
+ readonly type: ApplicationCommandOptionType.Boolean;
435
+ constructor();
436
+ }
437
+
438
+ declare abstract class ApplicationCommandOptionWithChannelTypesBase extends SlashCommandOptionBase implements ToAPIApplicationCommandOptions {
439
+ channelTypes?: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[];
440
+ /**
441
+ * Adds a channel type to this option
442
+ *
443
+ * @param channelType The type of channel to allow
444
+ */
445
+ addChannelType(channelType: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>): this;
446
+ /**
447
+ * Adds channel types to this option
448
+ *
449
+ * @param channelTypes The channel types to add
450
+ */
451
+ addChannelTypes(channelTypes: Exclude<ChannelType, ChannelType.DM | ChannelType.GroupDM>[]): this;
452
+ toJSON(): APIApplicationCommandChannelOptions;
453
+ }
454
+
455
+ declare class SlashCommandChannelOption extends ApplicationCommandOptionWithChannelTypesBase {
456
+ readonly type: ApplicationCommandOptionType.Channel;
457
+ constructor();
458
+ }
459
+
460
+ declare abstract class ApplicationCommandOptionWithChoicesBase<T extends string | number> extends SlashCommandOptionBase implements ToAPIApplicationCommandOptions {
461
+ choices?: APIApplicationCommandOptionChoice[];
462
+ /**
463
+ * Adds a choice for this option
464
+ *
465
+ * @param name The name of the choice
466
+ * @param value The value of the choice
467
+ */
468
+ addChoice(name: string, value: T): this;
469
+ /**
470
+ * Adds multiple choices for this option
471
+ *
472
+ * @param choices The choices to add
473
+ */
474
+ addChoices(choices: [name: string, value: T][]): this;
475
+ toJSON(): {
476
+ choices: APIApplicationCommandOptionChoice[] | undefined;
477
+ type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Integer | ApplicationCommandOptionType.Number;
478
+ name: string;
479
+ description: string;
480
+ default?: boolean | undefined;
481
+ required?: boolean | undefined;
482
+ } | {
483
+ choices: APIApplicationCommandOptionChoice[] | undefined;
484
+ type: ApplicationCommandOptionType.Subcommand | ApplicationCommandOptionType.SubcommandGroup;
485
+ options?: discord_api_types_v9.APIApplicationCommandOption[] | undefined;
486
+ name: string;
487
+ description: string;
488
+ default?: boolean | undefined;
489
+ required?: boolean | undefined;
490
+ } | {
491
+ choices: APIApplicationCommandOptionChoice[] | undefined;
492
+ type: ApplicationCommandOptionType.Channel;
493
+ channel_types?: (discord_api_types_v9.ChannelType.GuildText | discord_api_types_v9.ChannelType.GuildVoice | discord_api_types_v9.ChannelType.GuildCategory | discord_api_types_v9.ChannelType.GuildNews | discord_api_types_v9.ChannelType.GuildStore | discord_api_types_v9.ChannelType.GuildNewsThread | discord_api_types_v9.ChannelType.GuildPublicThread | discord_api_types_v9.ChannelType.GuildPrivateThread | discord_api_types_v9.ChannelType.GuildStageVoice)[] | undefined;
494
+ name: string;
495
+ description: string;
496
+ default?: boolean | undefined;
497
+ required?: boolean | undefined;
498
+ } | {
499
+ choices: APIApplicationCommandOptionChoice[] | undefined;
500
+ type: ApplicationCommandOptionType.Boolean | ApplicationCommandOptionType.User | ApplicationCommandOptionType.Role | ApplicationCommandOptionType.Mentionable;
501
+ name: string;
502
+ description: string;
503
+ default?: boolean | undefined;
504
+ required?: boolean | undefined;
505
+ };
506
+ }
507
+
508
+ declare class SlashCommandIntegerOption extends ApplicationCommandOptionWithChoicesBase<number> {
509
+ readonly type: ApplicationCommandOptionType.Integer;
510
+ constructor();
511
+ }
512
+
513
+ declare class SlashCommandMentionableOption extends SlashCommandOptionBase {
514
+ readonly type: ApplicationCommandOptionType.Mentionable;
515
+ constructor();
516
+ }
517
+
518
+ declare class SlashCommandNumberOption extends ApplicationCommandOptionWithChoicesBase<number> {
519
+ readonly type: ApplicationCommandOptionType.Number;
520
+ constructor();
521
+ }
522
+
523
+ declare class SlashCommandRoleOption extends SlashCommandOptionBase {
524
+ readonly type: ApplicationCommandOptionType.Role;
525
+ constructor();
526
+ }
527
+
528
+ declare class SlashCommandStringOption extends ApplicationCommandOptionWithChoicesBase<string> {
529
+ readonly type: ApplicationCommandOptionType.String;
530
+ constructor();
531
+ }
532
+
533
+ declare class SlashCommandUserOption extends SlashCommandOptionBase {
534
+ readonly type: ApplicationCommandOptionType.User;
535
+ constructor();
536
+ }
537
+
538
+ declare class SharedSlashCommandOptions<ShouldOmitSubcommandFunctions = true> {
539
+ readonly options: ToAPIApplicationCommandOptions[];
540
+ /**
541
+ * Adds a boolean option
542
+ *
543
+ * @param input A function that returns an option builder, or an already built builder
544
+ */
545
+ addBooleanOption(input: SlashCommandBooleanOption | ((builder: SlashCommandBooleanOption) => SlashCommandBooleanOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
546
+ /**
547
+ * Adds a user option
548
+ *
549
+ * @param input A function that returns an option builder, or an already built builder
550
+ */
551
+ addUserOption(input: SlashCommandUserOption | ((builder: SlashCommandUserOption) => SlashCommandUserOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
552
+ /**
553
+ * Adds a channel option
554
+ *
555
+ * @param input A function that returns an option builder, or an already built builder
556
+ */
557
+ addChannelOption(input: SlashCommandChannelOption | ((builder: SlashCommandChannelOption) => SlashCommandChannelOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
558
+ /**
559
+ * Adds a role option
560
+ *
561
+ * @param input A function that returns an option builder, or an already built builder
562
+ */
563
+ addRoleOption(input: SlashCommandRoleOption | ((builder: SlashCommandRoleOption) => SlashCommandRoleOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
564
+ /**
565
+ * Adds a mentionable option
566
+ *
567
+ * @param input A function that returns an option builder, or an already built builder
568
+ */
569
+ addMentionableOption(input: SlashCommandMentionableOption | ((builder: SlashCommandMentionableOption) => SlashCommandMentionableOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
570
+ /**
571
+ * Adds a string option
572
+ *
573
+ * @param input A function that returns an option builder, or an already built builder
574
+ */
575
+ addStringOption(input: SlashCommandStringOption | ((builder: SlashCommandStringOption) => SlashCommandStringOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
576
+ /**
577
+ * Adds an integer option
578
+ *
579
+ * @param input A function that returns an option builder, or an already built builder
580
+ */
581
+ addIntegerOption(input: SlashCommandIntegerOption | ((builder: SlashCommandIntegerOption) => SlashCommandIntegerOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
582
+ /**
583
+ * Adds a number option
584
+ *
585
+ * @param input A function that returns an option builder, or an already built builder
586
+ */
587
+ addNumberOption(input: SlashCommandNumberOption | ((builder: SlashCommandNumberOption) => SlashCommandNumberOption)): ShouldOmitSubcommandFunctions extends true ? Omit<this, "addSubcommand" | "addSubcommandGroup"> : this;
588
+ private _sharedAddOptionMethod;
589
+ }
590
+
591
+ declare class SharedNameAndDescription {
592
+ readonly name: string;
593
+ readonly description: string;
594
+ /**
595
+ * Sets the name
596
+ *
597
+ * @param name The name
598
+ */
599
+ setName(name: string): this;
600
+ /**
601
+ * Sets the description
602
+ *
603
+ * @param description The description
604
+ */
605
+ setDescription(description: string): this;
606
+ }
607
+
608
+ /**
609
+ * Represents a folder for subcommands
610
+ *
611
+ * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
612
+ */
613
+ declare class SlashCommandSubcommandGroupBuilder implements ToAPIApplicationCommandOptions {
614
+ /**
615
+ * The name of this subcommand group
616
+ */
617
+ readonly name: string;
618
+ /**
619
+ * The description of this subcommand group
620
+ */
621
+ readonly description: string;
622
+ /**
623
+ * The subcommands part of this subcommand group
624
+ */
625
+ readonly options: ToAPIApplicationCommandOptions[];
626
+ /**
627
+ * Adds a new subcommand to this group
628
+ *
629
+ * @param input A function that returns a subcommand builder, or an already built builder
630
+ */
631
+ addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): this;
632
+ toJSON(): APIApplicationCommandSubCommandOptions;
633
+ }
634
+ interface SlashCommandSubcommandGroupBuilder extends SharedNameAndDescription {
635
+ }
636
+ /**
637
+ * Represents a subcommand
638
+ *
639
+ * For more information, go to https://discord.com/developers/docs/interactions/slash-commands#subcommands-and-subcommand-groups
640
+ */
641
+ declare class SlashCommandSubcommandBuilder implements ToAPIApplicationCommandOptions {
642
+ /**
643
+ * The name of this subcommand
644
+ */
645
+ readonly name: string;
646
+ /**
647
+ * The description of this subcommand
648
+ */
649
+ readonly description: string;
650
+ /**
651
+ * The options of this subcommand
652
+ */
653
+ readonly options: ToAPIApplicationCommandOptions[];
654
+ toJSON(): APIApplicationCommandSubCommandOptions;
655
+ }
656
+ interface SlashCommandSubcommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions<false> {
657
+ }
658
+
659
+ declare class SlashCommandBuilder {
660
+ /**
661
+ * The name of this slash command
662
+ */
663
+ readonly name: string;
664
+ /**
665
+ * The description of this slash command
666
+ */
667
+ readonly description: string;
668
+ /**
669
+ * The options of this slash command
670
+ */
671
+ readonly options: ToAPIApplicationCommandOptions[];
672
+ /**
673
+ * Whether the command is enabled by default when the app is added to a guild
674
+ *
675
+ * @defaultValue true
676
+ */
677
+ readonly defaultPermission: boolean | undefined;
678
+ /**
679
+ * Returns the final data that should be sent to Discord.
680
+ *
681
+ * **Note:** Calling this function will validate required properties based on their conditions.
682
+ */
683
+ toJSON(): RESTPostAPIApplicationCommandsJSONBody;
684
+ /**
685
+ * Sets whether the command is enabled by default when the application is added to a guild.
686
+ *
687
+ * **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.
688
+ *
689
+ * @param value Whether or not to enable this command by default
690
+ *
691
+ * @see https://discord.com/developers/docs/interactions/application-commands#permissions
692
+ */
693
+ setDefaultPermission(value: boolean): this;
694
+ /**
695
+ * Adds a new subcommand group to this command
696
+ *
697
+ * @param input A function that returns a subcommand group builder, or an already built builder
698
+ */
699
+ addSubcommandGroup(input: SlashCommandSubcommandGroupBuilder | ((subcommandGroup: SlashCommandSubcommandGroupBuilder) => SlashCommandSubcommandGroupBuilder)): SlashCommandSubcommandsOnlyBuilder;
700
+ /**
701
+ * Adds a new subcommand to this command
702
+ *
703
+ * @param input A function that returns a subcommand builder, or an already built builder
704
+ */
705
+ addSubcommand(input: SlashCommandSubcommandBuilder | ((subcommandGroup: SlashCommandSubcommandBuilder) => SlashCommandSubcommandBuilder)): SlashCommandSubcommandsOnlyBuilder;
706
+ }
707
+ interface SlashCommandBuilder extends SharedNameAndDescription, SharedSlashCommandOptions {
708
+ }
709
+ interface SlashCommandSubcommandsOnlyBuilder extends SharedNameAndDescription, Pick<SlashCommandBuilder, 'toJSON' | 'addSubcommand' | 'addSubcommandGroup'> {
710
+ }
711
+ interface SlashCommandOptionsOnlyBuilder extends SharedNameAndDescription, SharedSlashCommandOptions, Pick<SlashCommandBuilder, 'toJSON'> {
712
+ }
713
+ interface ToAPIApplicationCommandOptions {
714
+ toJSON(): APIApplicationCommandOption;
715
+ }
716
+
717
+ declare class SlashCommandOptionBase extends SharedNameAndDescription implements ToAPIApplicationCommandOptions {
718
+ required: boolean;
719
+ readonly type: ApplicationCommandOptionType;
720
+ constructor(type: ApplicationCommandOptionType);
721
+ /**
722
+ * Marks the option as required
723
+ *
724
+ * @param required If this option should be required
725
+ */
726
+ setRequired(required: boolean): this;
727
+ toJSON(): APIApplicationCommandOption;
728
+ }
729
+
730
+ declare function validateRequiredParameters$1(name: string, description: string, options: ToAPIApplicationCommandOptions[]): void;
731
+ declare function validateName$1(name: unknown): asserts name is string;
732
+ declare function validateDescription(description: unknown): asserts description is string;
733
+ declare function validateDefaultPermission$1(value: unknown): asserts value is boolean;
734
+ declare function validateMaxOptionsLength(options: unknown): asserts options is ToAPIApplicationCommandOptions[];
735
+ declare function validateMaxChoicesLength(choices: APIApplicationCommandOptionChoice[]): void;
736
+ declare function assertReturnOfBuilder<T extends SlashCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
737
+
738
+ declare const Assertions$1_validateDescription: typeof validateDescription;
739
+ declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLength;
740
+ declare const Assertions$1_validateMaxChoicesLength: typeof validateMaxChoicesLength;
741
+ declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder;
742
+ declare namespace Assertions$1 {
743
+ export {
744
+ validateRequiredParameters$1 as validateRequiredParameters,
745
+ validateName$1 as validateName,
746
+ Assertions$1_validateDescription as validateDescription,
747
+ validateDefaultPermission$1 as validateDefaultPermission,
748
+ Assertions$1_validateMaxOptionsLength as validateMaxOptionsLength,
749
+ Assertions$1_validateMaxChoicesLength as validateMaxChoicesLength,
750
+ Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder,
751
+ };
752
+ }
753
+
754
+ declare class ContextMenuCommandBuilder {
755
+ /**
756
+ * The name of this context menu command
757
+ */
758
+ readonly name: string;
759
+ /**
760
+ * The type of this context menu command
761
+ */
762
+ readonly type: ContextMenuCommandType;
763
+ /**
764
+ * Whether the command is enabled by default when the app is added to a guild
765
+ *
766
+ * @defaultValue true
767
+ */
768
+ readonly defaultPermission: boolean | undefined;
769
+ /**
770
+ * Sets the name
771
+ *
772
+ * @param name The name
773
+ */
774
+ setName(name: string): this;
775
+ /**
776
+ * Sets the type
777
+ *
778
+ * @param type The type
779
+ */
780
+ setType(type: ContextMenuCommandType): this;
781
+ /**
782
+ * Sets whether the command is enabled by default when the application is added to a guild.
783
+ *
784
+ * **Note**: If set to `false`, you will have to later `PUT` the permissions for this command.
785
+ *
786
+ * @param value Whether or not to enable this command by default
787
+ *
788
+ * @see https://discord.com/developers/docs/interactions/application-commands#permissions
789
+ */
790
+ setDefaultPermission(value: boolean): this;
791
+ /**
792
+ * Returns the final data that should be sent to Discord.
793
+ *
794
+ * **Note:** Calling this function will validate required properties based on their conditions.
795
+ */
796
+ toJSON(): RESTPostAPIApplicationCommandsJSONBody;
797
+ }
798
+ declare type ContextMenuCommandType = ApplicationCommandType.User | ApplicationCommandType.Message;
799
+
800
+ declare function validateRequiredParameters(name: string, type: number): void;
801
+ declare function validateName(name: unknown): asserts name is string;
802
+ declare function validateType(type: unknown): asserts type is ContextMenuCommandType;
803
+ declare function validateDefaultPermission(value: unknown): asserts value is boolean;
804
+
805
+ declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
806
+ declare const Assertions_validateName: typeof validateName;
807
+ declare const Assertions_validateType: typeof validateType;
808
+ declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
809
+ declare namespace Assertions {
810
+ export {
811
+ Assertions_validateRequiredParameters as validateRequiredParameters,
812
+ Assertions_validateName as validateName,
813
+ Assertions_validateType as validateType,
814
+ Assertions_validateDefaultPermission as validateDefaultPermission,
815
+ };
816
+ }
817
+
818
+ 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 };