@discordjs/builders 0.4.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 (69) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +28 -8
  3. package/dist/index.d.ts +818 -12
  4. package/dist/index.js +4 -16
  5. package/dist/index.js.map +7 -1
  6. package/dist/index.mjs +4 -32
  7. package/dist/index.mjs.map +7 -0
  8. package/package.json +65 -53
  9. package/dist/index.d.ts.map +0 -1
  10. package/dist/interactions/slashCommands/Assertions.d.ts +0 -11
  11. package/dist/interactions/slashCommands/Assertions.d.ts.map +0 -1
  12. package/dist/interactions/slashCommands/Assertions.js +0 -58
  13. package/dist/interactions/slashCommands/Assertions.js.map +0 -1
  14. package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts +0 -50
  15. package/dist/interactions/slashCommands/SlashCommandBuilder.d.ts.map +0 -1
  16. package/dist/interactions/slashCommands/SlashCommandBuilder.js +0 -96
  17. package/dist/interactions/slashCommands/SlashCommandBuilder.js.map +0 -1
  18. package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts +0 -64
  19. package/dist/interactions/slashCommands/SlashCommandSubcommands.d.ts.map +0 -1
  20. package/dist/interactions/slashCommands/SlashCommandSubcommands.js +0 -123
  21. package/dist/interactions/slashCommands/SlashCommandSubcommands.js.map +0 -1
  22. package/dist/interactions/slashCommands/mixins/CommandOptionBase.d.ts +0 -20
  23. package/dist/interactions/slashCommands/mixins/CommandOptionBase.d.ts.map +0 -1
  24. package/dist/interactions/slashCommands/mixins/CommandOptionBase.js +0 -48
  25. package/dist/interactions/slashCommands/mixins/CommandOptionBase.js.map +0 -1
  26. package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.d.ts +0 -25
  27. package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.d.ts.map +0 -1
  28. package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.js +0 -59
  29. package/dist/interactions/slashCommands/mixins/CommandOptionWithChoices.js.map +0 -1
  30. package/dist/interactions/slashCommands/mixins/CommandOptions.d.ts +0 -48
  31. package/dist/interactions/slashCommands/mixins/CommandOptions.d.ts.map +0 -1
  32. package/dist/interactions/slashCommands/mixins/CommandOptions.js +0 -83
  33. package/dist/interactions/slashCommands/mixins/CommandOptions.js.map +0 -1
  34. package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts +0 -15
  35. package/dist/interactions/slashCommands/mixins/NameAndDescription.d.ts.map +0 -1
  36. package/dist/interactions/slashCommands/mixins/NameAndDescription.js +0 -42
  37. package/dist/interactions/slashCommands/mixins/NameAndDescription.js.map +0 -1
  38. package/dist/interactions/slashCommands/options/boolean.d.ts +0 -7
  39. package/dist/interactions/slashCommands/options/boolean.d.ts.map +0 -1
  40. package/dist/interactions/slashCommands/options/boolean.js +0 -18
  41. package/dist/interactions/slashCommands/options/boolean.js.map +0 -1
  42. package/dist/interactions/slashCommands/options/channel.d.ts +0 -7
  43. package/dist/interactions/slashCommands/options/channel.d.ts.map +0 -1
  44. package/dist/interactions/slashCommands/options/channel.js +0 -18
  45. package/dist/interactions/slashCommands/options/channel.js.map +0 -1
  46. package/dist/interactions/slashCommands/options/integer.d.ts +0 -7
  47. package/dist/interactions/slashCommands/options/integer.d.ts.map +0 -1
  48. package/dist/interactions/slashCommands/options/integer.js +0 -18
  49. package/dist/interactions/slashCommands/options/integer.js.map +0 -1
  50. package/dist/interactions/slashCommands/options/mentionable.d.ts +0 -7
  51. package/dist/interactions/slashCommands/options/mentionable.d.ts.map +0 -1
  52. package/dist/interactions/slashCommands/options/mentionable.js +0 -18
  53. package/dist/interactions/slashCommands/options/mentionable.js.map +0 -1
  54. package/dist/interactions/slashCommands/options/role.d.ts +0 -7
  55. package/dist/interactions/slashCommands/options/role.d.ts.map +0 -1
  56. package/dist/interactions/slashCommands/options/role.js +0 -18
  57. package/dist/interactions/slashCommands/options/role.js.map +0 -1
  58. package/dist/interactions/slashCommands/options/string.d.ts +0 -7
  59. package/dist/interactions/slashCommands/options/string.d.ts.map +0 -1
  60. package/dist/interactions/slashCommands/options/string.js +0 -18
  61. package/dist/interactions/slashCommands/options/string.js.map +0 -1
  62. package/dist/interactions/slashCommands/options/user.d.ts +0 -7
  63. package/dist/interactions/slashCommands/options/user.d.ts.map +0 -1
  64. package/dist/interactions/slashCommands/options/user.js +0 -18
  65. package/dist/interactions/slashCommands/options/user.js.map +0 -1
  66. package/dist/messages/formatters.d.ts +0 -207
  67. package/dist/messages/formatters.d.ts.map +0 -1
  68. package/dist/messages/formatters.js +0 -184
  69. package/dist/messages/formatters.js.map +0 -1
@@ -1,207 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Snowflake } from 'discord-api-types/globals';
3
- import type { URL } from 'url';
4
- /**
5
- * Wraps the content inside a codeblock with no language.
6
- * @param content The content to wrap.
7
- * @returns The formatted content.
8
- */
9
- export declare function codeBlock<C extends string>(content: C): `\`\`\`\n${C}\`\`\``;
10
- /**
11
- * Wraps the content inside a codeblock with the specified language.
12
- * @param language The language for the codeblock.
13
- * @param content The content to wrap.
14
- * @returns The formatted content.
15
- */
16
- export declare function codeBlock<L extends string, C extends string>(language: L, content: C): `\`\`\`${L}\n${C}\`\`\``;
17
- /**
18
- * Wraps the content inside an inline code.
19
- * @param content The content to wrap.
20
- * @returns The formatted content.
21
- */
22
- export declare function inlineCode<C extends string>(content: C): `\`${C}\``;
23
- /**
24
- * Formats the content into italic text.
25
- * @param content The content to wrap.
26
- * @returns The formatted content.
27
- */
28
- export declare function italic<C extends string>(content: C): `_${C}_`;
29
- /**
30
- * Formats the content into bold text.
31
- * @param content The content to wrap.
32
- * @returns The formatted content.
33
- */
34
- export declare function bold<C extends string>(content: C): `**${C}**`;
35
- /**
36
- * Formats the content into underscored text.
37
- * @param content The content to wrap.
38
- * @returns The formatted content.
39
- */
40
- export declare function underscore<C extends string>(content: C): `__${C}__`;
41
- /**
42
- * Formats the content into strikethrough text.
43
- * @param content The content to wrap.
44
- * @returns The formatted content.
45
- */
46
- export declare function strikethrough<C extends string>(content: C): `~~${C}~~`;
47
- /**
48
- * Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
49
- * @param content The content to wrap.
50
- * @returns The formatted content.
51
- */
52
- export declare function quote<C extends string>(content: C): `> ${C}`;
53
- /**
54
- * Formats the content into a block quote. This needs to be at the start of the line for Discord to format it.
55
- * @param content The content to wrap.
56
- * @returns The formatted content.
57
- */
58
- export declare function blockQuote<C extends string>(content: C): `>>> ${C}`;
59
- /**
60
- * Formats the URL into `<>`, which stops it from embedding.
61
- * @param url The URL to wrap.
62
- * @returns The formatted content.
63
- */
64
- export declare function hideLinkEmbed<C extends string>(url: C): `<${C}>`;
65
- /**
66
- * Formats the URL into `<>`, which stops it from embedding.
67
- * @param url The URL to wrap.
68
- * @returns The formatted content.
69
- */
70
- export declare function hideLinkEmbed(url: URL): `<${string}>`;
71
- /**
72
- * Formats the content and the URL into a masked URL.
73
- * @param content The content to display.
74
- * @param url The URL the content links to.
75
- * @returns The formatted content.
76
- */
77
- export declare function hyperlink<C extends string>(content: C, url: URL): `[${C}](${string})`;
78
- /**
79
- * Formats the content and the URL into a masked URL.
80
- * @param content The content to display.
81
- * @param url The URL the content links to.
82
- * @returns The formatted content.
83
- */
84
- export declare function hyperlink<C extends string, U extends string>(content: C, url: U): `[${C}](${U})`;
85
- /**
86
- * Formats the content and the URL into a masked URL.
87
- * @param content The content to display.
88
- * @param url The URL the content links to.
89
- * @param title The title shown when hovering on the masked link.
90
- * @returns The formatted content.
91
- */
92
- export declare function hyperlink<C extends string, T extends string>(content: C, url: URL, title: T): `[${C}](${string} "${T}")`;
93
- /**
94
- * Formats the content and the URL into a masked URL.
95
- * @param content The content to display.
96
- * @param url The URL the content links to.
97
- * @param title The title shown when hovering on the masked link.
98
- * @returns The formatted content.
99
- */
100
- export declare function hyperlink<C extends string, U extends string, T extends string>(content: C, url: U, title: T): `[${C}](${U} "${T}")`;
101
- /**
102
- * Wraps the content inside spoiler (hidden text).
103
- * @param content The content to wrap.
104
- * @returns The formatted content.
105
- */
106
- export declare function spoiler<C extends string>(content: C): `||${C}||`;
107
- /**
108
- * Formats the user ID into a user mention.
109
- * @param userId The user ID to format.
110
- * @returns The formatted user mention.
111
- */
112
- export declare function userMention<C extends Snowflake>(userId: C): `<@${C}>`;
113
- /**
114
- * Formats the user ID into a member-nickname mention.
115
- * @param memberId The user ID to format.
116
- * @returns The formatted member-nickname mention.
117
- */
118
- export declare function memberNicknameMention<C extends Snowflake>(memberId: C): `<@!${C}>`;
119
- /**
120
- * Formats the channel ID into a channel mention.
121
- * @param channelId The channel ID to format.
122
- * @returns The formatted channel mention.
123
- */
124
- export declare function channelMention<C extends Snowflake>(channelId: C): `<#${C}>`;
125
- /**
126
- * Formats the role ID into a role mention.
127
- * @param roleId The role ID to format.
128
- * @returns The formatted role mention.
129
- */
130
- export declare function roleMention<C extends Snowflake>(roleId: C): `<@&${C}>`;
131
- /**
132
- * Formats a date into a short date-time string.
133
- * @param date The date to format, defaults to the current time.
134
- */
135
- export declare function time(date?: Date): `<t:${bigint}>`;
136
- /**
137
- * Formats a date given a format style.
138
- * @param date The date to format.
139
- * @param style The style to use.
140
- */
141
- export declare function time<S extends TimestampStylesString>(date: Date, style: S): `<t:${bigint}:${S}>`;
142
- /**
143
- * Formats the given timestamp into a short date-time string.
144
- * @param seconds The time to format, represents an UNIX timestamp in seconds.
145
- */
146
- export declare function time<C extends number>(seconds: C): `<t:${C}>`;
147
- /**
148
- * Formats the given timestamp into a short date-time string.
149
- * @param seconds The time to format, represents an UNIX timestamp in seconds.
150
- * @param style The style to use.
151
- */
152
- export declare function time<C extends number, S extends TimestampStylesString>(seconds: C, style: S): `<t:${C}:${S}>`;
153
- /**
154
- * The [message formatting timestamp styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.
155
- */
156
- export declare const TimestampStyles: {
157
- /**
158
- * Short time format, consisting of hours and minutes, e.g. 16:20.
159
- */
160
- readonly ShortTime: "t";
161
- /**
162
- * Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.
163
- */
164
- readonly LongTime: "T";
165
- /**
166
- * Short date format, consisting of day, month, and year, e.g. 20/04/2021.
167
- */
168
- readonly ShortDate: "d";
169
- /**
170
- * Long date format, consisting of day, month, and year, e.g. 20 April 2021.
171
- */
172
- readonly LongDate: "D";
173
- /**
174
- * Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.
175
- */
176
- readonly ShortDateTime: "f";
177
- /**
178
- * Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.
179
- */
180
- readonly LongDateTime: "F";
181
- /**
182
- * Relative time format, consisting of a relative duration format, e.g. 2 months ago.
183
- */
184
- readonly RelativeTime: "R";
185
- };
186
- /**
187
- * The possible values, see {@link TimestampStyles} for more information.
188
- */
189
- export declare type TimestampStylesString = typeof TimestampStyles[keyof typeof TimestampStyles];
190
- /**
191
- * An enum with all the available faces from Discord's native slash commands
192
- */
193
- export declare enum Faces {
194
- /**
195
- * ¯\\_(ツ)\\_/¯
196
- */
197
- Shrug = "\u00AF\\_(\u30C4)\\_/\u00AF",
198
- /**
199
- * (╯°□°)╯︵ ┻━┻
200
- */
201
- Tableflip = "(\u256F\u00B0\u25A1\u00B0\uFF09\u256F\uFE35 \u253B\u2501\u253B",
202
- /**
203
- * ┬─┬ ノ( ゜-゜ノ)
204
- */
205
- Unflip = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)"
206
- }
207
- //# sourceMappingURL=formatters.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatters.d.ts","sourceRoot":"/","sources":["messages/formatters.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GA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AAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG,CAEtE;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,MAAM,GAAG,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,qBAAqB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC;AAElG;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAS/G;;GAEG;AACH,eAAO,MAAM,eAAe;IAC3B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEM,CAAC;AAEX;;GAEG;AACH,oBAAY,qBAAqB,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEzF;;GAEG;AACH,oBAAY,KAAK;IAChB;;OAEG;IACH,KAAK,gCAAiB;IAEtB;;OAEG;IACH,SAAS,mEAAiB;IAE1B;;OAEG;IACH,MAAM,oDAAiB;CACvB"}
@@ -1,184 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Faces = exports.TimestampStyles = exports.time = exports.roleMention = exports.channelMention = exports.memberNicknameMention = exports.userMention = exports.spoiler = exports.hyperlink = exports.hideLinkEmbed = exports.blockQuote = exports.quote = exports.strikethrough = exports.underscore = exports.bold = exports.italic = exports.inlineCode = exports.codeBlock = void 0;
4
- function codeBlock(language, content) {
5
- return typeof content === 'undefined' ? `\`\`\`\n${language}\`\`\`` : `\`\`\`${language}\n${content}\`\`\``;
6
- }
7
- exports.codeBlock = codeBlock;
8
- /**
9
- * Wraps the content inside an inline code.
10
- * @param content The content to wrap.
11
- * @returns The formatted content.
12
- */
13
- function inlineCode(content) {
14
- return `\`${content}\``;
15
- }
16
- exports.inlineCode = inlineCode;
17
- /**
18
- * Formats the content into italic text.
19
- * @param content The content to wrap.
20
- * @returns The formatted content.
21
- */
22
- function italic(content) {
23
- return `_${content}_`;
24
- }
25
- exports.italic = italic;
26
- /**
27
- * Formats the content into bold text.
28
- * @param content The content to wrap.
29
- * @returns The formatted content.
30
- */
31
- function bold(content) {
32
- return `**${content}**`;
33
- }
34
- exports.bold = bold;
35
- /**
36
- * Formats the content into underscored text.
37
- * @param content The content to wrap.
38
- * @returns The formatted content.
39
- */
40
- function underscore(content) {
41
- return `__${content}__`;
42
- }
43
- exports.underscore = underscore;
44
- /**
45
- * Formats the content into strikethrough text.
46
- * @param content The content to wrap.
47
- * @returns The formatted content.
48
- */
49
- function strikethrough(content) {
50
- return `~~${content}~~`;
51
- }
52
- exports.strikethrough = strikethrough;
53
- /**
54
- * Formats the content into a quote. This needs to be at the start of the line for Discord to format it.
55
- * @param content The content to wrap.
56
- * @returns The formatted content.
57
- */
58
- function quote(content) {
59
- return `> ${content}`;
60
- }
61
- exports.quote = quote;
62
- /**
63
- * Formats the content into a block quote. This needs to be at the start of the line for Discord to format it.
64
- * @param content The content to wrap.
65
- * @returns The formatted content.
66
- */
67
- function blockQuote(content) {
68
- return `>>> ${content}`;
69
- }
70
- exports.blockQuote = blockQuote;
71
- function hideLinkEmbed(url) {
72
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
73
- return `<${url}>`;
74
- }
75
- exports.hideLinkEmbed = hideLinkEmbed;
76
- function hyperlink(content, url, title) {
77
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
78
- return title ? `[${content}](${url} "${title}")` : `[${content}](${url})`;
79
- }
80
- exports.hyperlink = hyperlink;
81
- /**
82
- * Wraps the content inside spoiler (hidden text).
83
- * @param content The content to wrap.
84
- * @returns The formatted content.
85
- */
86
- function spoiler(content) {
87
- return `||${content}||`;
88
- }
89
- exports.spoiler = spoiler;
90
- /**
91
- * Formats the user ID into a user mention.
92
- * @param userId The user ID to format.
93
- * @returns The formatted user mention.
94
- */
95
- function userMention(userId) {
96
- return `<@${userId}>`;
97
- }
98
- exports.userMention = userMention;
99
- /**
100
- * Formats the user ID into a member-nickname mention.
101
- * @param memberId The user ID to format.
102
- * @returns The formatted member-nickname mention.
103
- */
104
- function memberNicknameMention(memberId) {
105
- return `<@!${memberId}>`;
106
- }
107
- exports.memberNicknameMention = memberNicknameMention;
108
- /**
109
- * Formats the channel ID into a channel mention.
110
- * @param channelId The channel ID to format.
111
- * @returns The formatted channel mention.
112
- */
113
- function channelMention(channelId) {
114
- return `<#${channelId}>`;
115
- }
116
- exports.channelMention = channelMention;
117
- /**
118
- * Formats the role ID into a role mention.
119
- * @param roleId The role ID to format.
120
- * @returns The formatted role mention.
121
- */
122
- function roleMention(roleId) {
123
- return `<@&${roleId}>`;
124
- }
125
- exports.roleMention = roleMention;
126
- function time(timeOrSeconds, style) {
127
- if (typeof timeOrSeconds !== 'number') {
128
- timeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1000);
129
- }
130
- return typeof style === 'string' ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;
131
- }
132
- exports.time = time;
133
- /**
134
- * The [message formatting timestamp styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.
135
- */
136
- exports.TimestampStyles = {
137
- /**
138
- * Short time format, consisting of hours and minutes, e.g. 16:20.
139
- */
140
- ShortTime: 't',
141
- /**
142
- * Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.
143
- */
144
- LongTime: 'T',
145
- /**
146
- * Short date format, consisting of day, month, and year, e.g. 20/04/2021.
147
- */
148
- ShortDate: 'd',
149
- /**
150
- * Long date format, consisting of day, month, and year, e.g. 20 April 2021.
151
- */
152
- LongDate: 'D',
153
- /**
154
- * Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.
155
- */
156
- ShortDateTime: 'f',
157
- /**
158
- * Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.
159
- */
160
- LongDateTime: 'F',
161
- /**
162
- * Relative time format, consisting of a relative duration format, e.g. 2 months ago.
163
- */
164
- RelativeTime: 'R',
165
- };
166
- /**
167
- * An enum with all the available faces from Discord's native slash commands
168
- */
169
- var Faces;
170
- (function (Faces) {
171
- /**
172
- * ¯\\_(ツ)\\_/¯
173
- */
174
- Faces["Shrug"] = "\u00AF\\_(\u30C4)\\_/\u00AF";
175
- /**
176
- * (╯°□°)╯︵ ┻━┻
177
- */
178
- Faces["Tableflip"] = "(\u256F\u00B0\u25A1\u00B0\uFF09\u256F\uFE35 \u253B\u2501\u253B";
179
- /**
180
- * ┬─┬ ノ( ゜-゜ノ)
181
- */
182
- Faces["Unflip"] = "\u252C\u2500\u252C \u30CE( \u309C-\u309C\u30CE)";
183
- })(Faces = exports.Faces || (exports.Faces = {}));
184
- //# sourceMappingURL=formatters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formatters.js","sourceRoot":"/","sources":["messages/formatters.ts"],"names":[],"mappings":";;;AAiBA,SAAgB,SAAS,CAAC,QAAgB,EAAE,OAAgB;IAC3D,OAAO,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,QAAQ,QAAQ,CAAC,CAAC,CAAC,SAAS,QAAQ,KAAK,OAAO,QAAQ,CAAC;AAC7G,CAAC;AAFD,8BAEC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAmB,OAAU;IACtD,OAAO,KAAK,OAAO,IAAI,CAAC;AACzB,CAAC;AAFD,gCAEC;AAED;;;;GAIG;AACH,SAAgB,MAAM,C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,QAAQ,GAAG,CAAC;AAC1B,CAAC;AAFD,sDAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAsB,SAAY;IAC/D,OAAO,KAAK,SAAS,GAAG,CAAC;AAC1B,CAAC;AAFD,wCAEC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAsB,MAAS;IACzD,OAAO,MAAM,MAAM,GAAG,CAAC;AACxB,CAAC;AAFD,kCAEC;AA2BD,SAAgB,IAAI,CAAC,aAA6B,EAAE,KAA6B;IAChF,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE;QACtC,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;KAC5E;IAED,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,aAAa,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,aAAa,GAAG,CAAC;AAC7F,CAAC;AAND,oBAMC;AAED;;GAEG;AACU,QAAA,eAAe,GAAG;IAC9B;;OAEG;IACH,SAAS,EAAE,GAAG;IAEd;;OAEG;IACH,QAAQ,EAAE,GAAG;IAEb;;OAEG;IACH,SAAS,EAAE,GAAG;IAEd;;OAEG;IACH,QAAQ,EAAE,GAAG;IAEb;;OAEG;IACH,aAAa,EAAE,GAAG;IAElB;;OAEG;IACH,YAAY,EAAE,GAAG;IAEjB;;OAEG;IACH,YAAY,EAAE,GAAG;CACR,CAAC;AAOX;;GAEG;AACH,IAAY,KAeX;AAfD,WAAY,KAAK;IAChB;;OAEG;IACH,8CAAsB,CAAA;IAEtB;;OAEG;IACH,qFAA0B,CAAA;IAE1B;;OAEG;IACH,mEAAuB,CAAA;AACxB,CAAC,EAfW,KAAK,GAAL,aAAK,KAAL,aAAK,QAehB","sourcesContent":["import type { Snowflake } from 'discord-api-types/globals';\nimport type { URL } from 'url';\n\n/**\n * Wraps the content inside a codeblock with no language.\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function codeBlock<C extends string>(content: C): `\\`\\`\\`\\n${C}\\`\\`\\``;\n\n/**\n * Wraps the content inside a codeblock with the specified language.\n * @param language The language for the codeblock.\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function codeBlock<L extends string, C extends string>(language: L, content: C): `\\`\\`\\`${L}\\n${C}\\`\\`\\``;\nexport function codeBlock(language: string, content?: string): string {\n\treturn typeof content === 'undefined' ? `\\`\\`\\`\\n${language}\\`\\`\\`` : `\\`\\`\\`${language}\\n${content}\\`\\`\\``;\n}\n\n/**\n * Wraps the content inside an inline code.\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function inlineCode<C extends string>(content: C): `\\`${C}\\`` {\n\treturn `\\`${content}\\``;\n}\n\n/**\n * Formats the content into italic text.\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function italic<C extends string>(content: C): `_${C}_` {\n\treturn `_${content}_`;\n}\n\n/**\n * Formats the content into bold text.\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function bold<C extends string>(content: C): `**${C}**` {\n\treturn `**${content}**`;\n}\n\n/**\n * Formats the content into underscored text.\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function underscore<C extends string>(content: C): `__${C}__` {\n\treturn `__${content}__`;\n}\n\n/**\n * Formats the content into strikethrough text.\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function strikethrough<C extends string>(content: C): `~~${C}~~` {\n\treturn `~~${content}~~`;\n}\n\n/**\n * Formats the content into a quote. This needs to be at the start of the line for Discord to format it.\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function quote<C extends string>(content: C): `> ${C}` {\n\treturn `> ${content}`;\n}\n\n/**\n * Formats the content into a block quote. This needs to be at the start of the line for Discord to format it.\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function blockQuote<C extends string>(content: C): `>>> ${C}` {\n\treturn `>>> ${content}`;\n}\n\n/**\n * Formats the URL into `<>`, which stops it from embedding.\n * @param url The URL to wrap.\n * @returns The formatted content.\n */\nexport function hideLinkEmbed<C extends string>(url: C): `<${C}>`;\n\n/**\n * Formats the URL into `<>`, which stops it from embedding.\n * @param url The URL to wrap.\n * @returns The formatted content.\n */\nexport function hideLinkEmbed(url: URL): `<${string}>`;\nexport function hideLinkEmbed(url: string | URL) {\n\t// eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n\treturn `<${url}>`;\n}\n\n/**\n * Formats the content and the URL into a masked URL.\n * @param content The content to display.\n * @param url The URL the content links to.\n * @returns The formatted content.\n */\nexport function hyperlink<C extends string>(content: C, url: URL): `[${C}](${string})`;\n\n/**\n * Formats the content and the URL into a masked URL.\n * @param content The content to display.\n * @param url The URL the content links to.\n * @returns The formatted content.\n */\nexport function hyperlink<C extends string, U extends string>(content: C, url: U): `[${C}](${U})`;\n\n/**\n * Formats the content and the URL into a masked URL.\n * @param content The content to display.\n * @param url The URL the content links to.\n * @param title The title shown when hovering on the masked link.\n * @returns The formatted content.\n */\nexport function hyperlink<C extends string, T extends string>(\n\tcontent: C,\n\turl: URL,\n\ttitle: T,\n): `[${C}](${string} \"${T}\")`;\n\n/**\n * Formats the content and the URL into a masked URL.\n * @param content The content to display.\n * @param url The URL the content links to.\n * @param title The title shown when hovering on the masked link.\n * @returns The formatted content.\n */\nexport function hyperlink<C extends string, U extends string, T extends string>(\n\tcontent: C,\n\turl: U,\n\ttitle: T,\n): `[${C}](${U} \"${T}\")`;\nexport function hyperlink(content: string, url: string | URL, title?: string) {\n\t// eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n\treturn title ? `[${content}](${url} \"${title}\")` : `[${content}](${url})`;\n}\n\n/**\n * Wraps the content inside spoiler (hidden text).\n * @param content The content to wrap.\n * @returns The formatted content.\n */\nexport function spoiler<C extends string>(content: C): `||${C}||` {\n\treturn `||${content}||`;\n}\n\n/**\n * Formats the user ID into a user mention.\n * @param userId The user ID to format.\n * @returns The formatted user mention.\n */\nexport function userMention<C extends Snowflake>(userId: C): `<@${C}>` {\n\treturn `<@${userId}>`;\n}\n\n/**\n * Formats the user ID into a member-nickname mention.\n * @param memberId The user ID to format.\n * @returns The formatted member-nickname mention.\n */\nexport function memberNicknameMention<C extends Snowflake>(memberId: C): `<@!${C}>` {\n\treturn `<@!${memberId}>`;\n}\n\n/**\n * Formats the channel ID into a channel mention.\n * @param channelId The channel ID to format.\n * @returns The formatted channel mention.\n */\nexport function channelMention<C extends Snowflake>(channelId: C): `<#${C}>` {\n\treturn `<#${channelId}>`;\n}\n\n/**\n * Formats the role ID into a role mention.\n * @param roleId The role ID to format.\n * @returns The formatted role mention.\n */\nexport function roleMention<C extends Snowflake>(roleId: C): `<@&${C}>` {\n\treturn `<@&${roleId}>`;\n}\n\n/**\n * Formats a date into a short date-time string.\n * @param date The date to format, defaults to the current time.\n */\nexport function time(date?: Date): `<t:${bigint}>`;\n\n/**\n * Formats a date given a format style.\n * @param date The date to format.\n * @param style The style to use.\n */\nexport function time<S extends TimestampStylesString>(date: Date, style: S): `<t:${bigint}:${S}>`;\n\n/**\n * Formats the given timestamp into a short date-time string.\n * @param seconds The time to format, represents an UNIX timestamp in seconds.\n */\nexport function time<C extends number>(seconds: C): `<t:${C}>`;\n\n/**\n * Formats the given timestamp into a short date-time string.\n * @param seconds The time to format, represents an UNIX timestamp in seconds.\n * @param style The style to use.\n */\nexport function time<C extends number, S extends TimestampStylesString>(seconds: C, style: S): `<t:${C}:${S}>`;\nexport function time(timeOrSeconds?: number | Date, style?: TimestampStylesString): string {\n\tif (typeof timeOrSeconds !== 'number') {\n\t\ttimeOrSeconds = Math.floor((timeOrSeconds?.getTime() ?? Date.now()) / 1000);\n\t}\n\n\treturn typeof style === 'string' ? `<t:${timeOrSeconds}:${style}>` : `<t:${timeOrSeconds}>`;\n}\n\n/**\n * The [message formatting timestamp styles](https://discord.com/developers/docs/reference#message-formatting-timestamp-styles) supported by Discord.\n */\nexport const TimestampStyles = {\n\t/**\n\t * Short time format, consisting of hours and minutes, e.g. 16:20.\n\t */\n\tShortTime: 't',\n\n\t/**\n\t * Long time format, consisting of hours, minutes, and seconds, e.g. 16:20:30.\n\t */\n\tLongTime: 'T',\n\n\t/**\n\t * Short date format, consisting of day, month, and year, e.g. 20/04/2021.\n\t */\n\tShortDate: 'd',\n\n\t/**\n\t * Long date format, consisting of day, month, and year, e.g. 20 April 2021.\n\t */\n\tLongDate: 'D',\n\n\t/**\n\t * Short date-time format, consisting of short date and short time formats, e.g. 20 April 2021 16:20.\n\t */\n\tShortDateTime: 'f',\n\n\t/**\n\t * Long date-time format, consisting of long date and short time formats, e.g. Tuesday, 20 April 2021 16:20.\n\t */\n\tLongDateTime: 'F',\n\n\t/**\n\t * Relative time format, consisting of a relative duration format, e.g. 2 months ago.\n\t */\n\tRelativeTime: 'R',\n} as const;\n\n/**\n * The possible values, see {@link TimestampStyles} for more information.\n */\nexport type TimestampStylesString = typeof TimestampStyles[keyof typeof TimestampStyles];\n\n/**\n * An enum with all the available faces from Discord's native slash commands\n */\nexport enum Faces {\n\t/**\n\t * ¯\\\\_(ツ)\\\\_/¯\n\t */\n\tShrug = '¯\\\\_(ツ)\\\\_/¯',\n\n\t/**\n\t * (╯°□°)╯︵ ┻━┻\n\t */\n\tTableflip = '(╯°□°)╯︵ ┻━┻',\n\n\t/**\n\t * ┬─┬ ノ( ゜-゜ノ)\n\t */\n\tUnflip = '┬─┬ ノ( ゜-゜ノ)',\n}\n"]}