@discordeno/utils 19.0.0-next.c32e90e → 19.0.0-next.c460c88
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/README.md +1 -1
- package/dist/bucket.d.ts +36 -48
- package/dist/bucket.d.ts.map +1 -1
- package/dist/bucket.js +72 -72
- package/dist/bucket.js.map +1 -1
- package/dist/builders/embeds.d.ts +146 -0
- package/dist/builders/embeds.d.ts.map +1 -0
- package/dist/builders/embeds.js +295 -0
- package/dist/builders/embeds.js.map +1 -0
- package/dist/builders.d.ts +4 -0
- package/dist/builders.d.ts.map +1 -0
- package/dist/builders.js +5 -0
- package/dist/builders.js.map +1 -0
- package/dist/casing.d.ts.map +1 -1
- package/dist/casing.js +2 -2
- package/dist/casing.js.map +1 -1
- package/dist/colors.d.ts.map +1 -1
- package/dist/colors.js +1 -5
- package/dist/colors.js.map +1 -1
- package/dist/images.js +2 -2
- package/dist/images.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +8 -8
- package/dist/logger.js.map +1 -1
- package/dist/oauth2.d.ts +58 -0
- package/dist/oauth2.d.ts.map +1 -0
- package/dist/oauth2.js +16 -0
- package/dist/oauth2.js.map +1 -0
- package/dist/token.d.ts +1 -1
- package/dist/token.d.ts.map +1 -1
- package/dist/token.js +8 -3
- package/dist/token.js.map +1 -1
- package/dist/typeguards.d.ts +2 -1
- package/dist/typeguards.d.ts.map +1 -1
- package/dist/typeguards.js +3 -0
- package/dist/typeguards.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/package.json +13 -12
- package/dist/files.d.ts +0 -4
- package/dist/files.d.ts.map +0 -1
- package/dist/files.js +0 -41
- package/dist/files.js.map +0 -1
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A builder to help create Discord embeds.
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @class EmbedsBuilder
|
|
6
|
+
* @typedef {EmbedsBuilder}
|
|
7
|
+
* @extends {Array<DiscordEmbed>}
|
|
8
|
+
* @example
|
|
9
|
+
* const embeds = new EmbedBuilder()
|
|
10
|
+
* .setTitle('My Embed')
|
|
11
|
+
* .setDescription('This is my new embed')
|
|
12
|
+
* .newEmbed()
|
|
13
|
+
* .setTitle('My Second Embed')
|
|
14
|
+
*/ export class EmbedsBuilder extends Array {
|
|
15
|
+
#currentEmbedIndex;
|
|
16
|
+
/**
|
|
17
|
+
* Adds a new field to the embed fields array.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} name - Field name
|
|
20
|
+
* @param {string} value - Field value
|
|
21
|
+
* @param {?boolean} [inline=false] - Field should be inline or not.
|
|
22
|
+
* @returns {EmbedsBuilder}
|
|
23
|
+
*/ addField(name, value, inline) {
|
|
24
|
+
if (this.#currentEmbed.fields === undefined) {
|
|
25
|
+
this.#currentEmbed.fields = [];
|
|
26
|
+
}
|
|
27
|
+
this.#currentEmbed.fields.push({
|
|
28
|
+
name,
|
|
29
|
+
value,
|
|
30
|
+
inline
|
|
31
|
+
});
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates a blank embed.
|
|
36
|
+
*
|
|
37
|
+
* @returns {EmbedsBuilder}
|
|
38
|
+
*/ newEmbed() {
|
|
39
|
+
if (this.length >= 10) {
|
|
40
|
+
throw new Error('Maximum embed count exceeded. You can not have more than 10 embeds.');
|
|
41
|
+
}
|
|
42
|
+
this.push({});
|
|
43
|
+
this.setCurrentEmbed();
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Set the current embed author.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} name - Name of the author
|
|
50
|
+
* @param {?Omit<DiscordEmbedAuthor, 'name'>} [options] - Extra author options
|
|
51
|
+
* @returns {EmbedsBuilder}
|
|
52
|
+
*/ setAuthor(name, options) {
|
|
53
|
+
this.#currentEmbed.author = {
|
|
54
|
+
...this.#currentEmbed.author,
|
|
55
|
+
...options,
|
|
56
|
+
name
|
|
57
|
+
};
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Set the color on the side of the current embed.
|
|
62
|
+
*
|
|
63
|
+
* @param {(number | string)} color - The color, in base16 or hex color code
|
|
64
|
+
* @returns {EmbedsBuilder}
|
|
65
|
+
*/ setColor(color) {
|
|
66
|
+
if (typeof color === 'string') {
|
|
67
|
+
const convertedValue = parseInt(color.replace('#', ''), 16);
|
|
68
|
+
color = Number.isNaN(convertedValue) ? 0 : convertedValue;
|
|
69
|
+
}
|
|
70
|
+
this.#currentEmbed.color = color;
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Set the current embed to a different index.
|
|
75
|
+
*
|
|
76
|
+
* WARNING: Only use this method if you know what you're doing. Make sure to set it back to the latest when you're done.
|
|
77
|
+
*
|
|
78
|
+
* @param {?number} [index] - The index of the embed in the EmbedsBuilder array
|
|
79
|
+
* @returns {EmbedsBuilder}
|
|
80
|
+
*/ setCurrentEmbed(index) {
|
|
81
|
+
if (index === undefined) {
|
|
82
|
+
this.#currentEmbedIndex = this.length - 1;
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
if (index >= this.length || index < 0) {
|
|
86
|
+
throw new Error('Can not set the current embed to a index out of bounds.');
|
|
87
|
+
}
|
|
88
|
+
this.#currentEmbedIndex = index;
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Set the description of the current embed.
|
|
93
|
+
*
|
|
94
|
+
* @param {string} description - Description
|
|
95
|
+
* @returns {EmbedsBuilder}
|
|
96
|
+
*/ setDescription(description) {
|
|
97
|
+
this.#currentEmbed.description = description;
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Overwrite all fields on the current embed.
|
|
102
|
+
*
|
|
103
|
+
* @param {DiscordEmbedField[]} fields
|
|
104
|
+
* @returns {EmbedsBuilder}
|
|
105
|
+
*/ setFields(fields) {
|
|
106
|
+
this.#currentEmbed.fields = fields;
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Set the footer in the current embed.
|
|
111
|
+
*
|
|
112
|
+
* @param {string} text - The text to display in the footer
|
|
113
|
+
* @param {?Omit<DiscordEmbedFooter, 'text'>} [options]
|
|
114
|
+
* @returns {EmbedsBuilder}
|
|
115
|
+
*/ setFooter(text, options) {
|
|
116
|
+
this.#currentEmbed.footer = {
|
|
117
|
+
...this.#currentEmbed.footer,
|
|
118
|
+
...options,
|
|
119
|
+
text
|
|
120
|
+
};
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Set the image in the current embed.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} url - URL of the image
|
|
127
|
+
* @param {?Omit<DiscordEmbedImage, 'url'>} [options]
|
|
128
|
+
* @returns {EmbedsBuilder}
|
|
129
|
+
*/ setImage(url, options) {
|
|
130
|
+
this.#currentEmbed.image = {
|
|
131
|
+
...this.#currentEmbed.image,
|
|
132
|
+
...options,
|
|
133
|
+
url
|
|
134
|
+
};
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Set the provider of the current embed.
|
|
139
|
+
*
|
|
140
|
+
* @param {string} name
|
|
141
|
+
* @param {?string} [url]
|
|
142
|
+
* @returns {EmbedsBuilder}
|
|
143
|
+
*/ setProvider(name, url) {
|
|
144
|
+
this.#currentEmbed.provider = {
|
|
145
|
+
name,
|
|
146
|
+
url
|
|
147
|
+
};
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Set the color of the current embed to a random value.
|
|
152
|
+
*
|
|
153
|
+
* @returns {EmbedsBuilder}
|
|
154
|
+
*/ setRandomColor() {
|
|
155
|
+
return this.setColor(Math.floor(Math.random() * (0xffffff + 1)));
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Set the title of the current embed.
|
|
159
|
+
*
|
|
160
|
+
* @param {string} title
|
|
161
|
+
* @param {?string} [url]
|
|
162
|
+
* @returns {EmbedsBuilder}
|
|
163
|
+
*/ setTitle(title, url) {
|
|
164
|
+
this.#currentEmbed.title = title;
|
|
165
|
+
if (url) {
|
|
166
|
+
this.setUrl(url);
|
|
167
|
+
}
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Set the timestamp of the current embed.
|
|
172
|
+
*
|
|
173
|
+
* @param {?(string | number | Date)} [timestamp]
|
|
174
|
+
* @returns {EmbedsBuilder}
|
|
175
|
+
*/ setTimestamp(timestamp) {
|
|
176
|
+
this.#currentEmbed.timestamp = new Date(timestamp).toISOString();
|
|
177
|
+
return this;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Set the thumbnail of the current embed.
|
|
181
|
+
*
|
|
182
|
+
* @param {string} url - URL of the image
|
|
183
|
+
* @param {?Omit<DiscordEmbedThumbnail, 'url'>} [options]
|
|
184
|
+
* @returns {EmbedsBuilder}
|
|
185
|
+
*/ setThumbnail(url, options) {
|
|
186
|
+
this.#currentEmbed.thumbnail = {
|
|
187
|
+
...this.#currentEmbed.thumbnail,
|
|
188
|
+
...options,
|
|
189
|
+
url
|
|
190
|
+
};
|
|
191
|
+
return this;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Set the URL of the current embed title.
|
|
195
|
+
*
|
|
196
|
+
* @param {string} url
|
|
197
|
+
* @returns {EmbedsBuilder}
|
|
198
|
+
*/ setUrl(url) {
|
|
199
|
+
this.#currentEmbed.url = url;
|
|
200
|
+
return this;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Set the video of the current embed.
|
|
204
|
+
*
|
|
205
|
+
* @param {string} url
|
|
206
|
+
* @param {?Omit<DiscordEmbedVideo, 'url'>} [options]
|
|
207
|
+
* @returns {EmbedsBuilder}
|
|
208
|
+
*/ setVideo(url, options) {
|
|
209
|
+
this.#currentEmbed.video = {
|
|
210
|
+
...this.#currentEmbed.video,
|
|
211
|
+
...options,
|
|
212
|
+
url
|
|
213
|
+
};
|
|
214
|
+
return this;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Validate all embeds available against current known Discord limits to help prevent bad requests.
|
|
218
|
+
*
|
|
219
|
+
* @returns {EmbedsBuilder}
|
|
220
|
+
*/ validate() {
|
|
221
|
+
let totalCharacters = 0;
|
|
222
|
+
if (this.length > 10) {
|
|
223
|
+
throw new Error('You can not have more than 10 embeds on a single message.');
|
|
224
|
+
}
|
|
225
|
+
this.forEach(({ author , description , fields , footer , title }, index)=>{
|
|
226
|
+
if (title) {
|
|
227
|
+
const trimmedTitle = title.trim();
|
|
228
|
+
if (trimmedTitle.length > 256) {
|
|
229
|
+
throw new Error(`Title of embed ${index} can not be longer than 256 characters.`);
|
|
230
|
+
}
|
|
231
|
+
totalCharacters += trimmedTitle.length;
|
|
232
|
+
}
|
|
233
|
+
if (description) {
|
|
234
|
+
const trimmedDescription = description.trim();
|
|
235
|
+
if (trimmedDescription.length > 4096) {
|
|
236
|
+
throw new Error(`Description of embed ${index} can not be longer than 4096 characters.`);
|
|
237
|
+
}
|
|
238
|
+
totalCharacters += trimmedDescription.length;
|
|
239
|
+
}
|
|
240
|
+
if (fields) {
|
|
241
|
+
if (fields.length > 25) {
|
|
242
|
+
throw new Error(`embed ${index} can not have more than 25 fields.`);
|
|
243
|
+
}
|
|
244
|
+
fields.forEach(({ name , value }, fieldIndex)=>{
|
|
245
|
+
const trimmedName = name.trim();
|
|
246
|
+
const trimmedValue = value.trim();
|
|
247
|
+
if (trimmedName.length > 256) {
|
|
248
|
+
throw new Error(`Name of field ${fieldIndex} on embed ${index} can not be longer than 256 characters.`);
|
|
249
|
+
}
|
|
250
|
+
if (trimmedValue.length > 4096) {
|
|
251
|
+
throw new Error(`Value of field ${fieldIndex} on embed ${index} can not be longer than 1024 characters.`);
|
|
252
|
+
}
|
|
253
|
+
totalCharacters += trimmedName.length;
|
|
254
|
+
totalCharacters += trimmedValue.length;
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
if (footer) {
|
|
258
|
+
const trimmedFooterText = footer.text.trim();
|
|
259
|
+
if (trimmedFooterText.length > 2048) {
|
|
260
|
+
throw new Error(`Footer text of embed ${index} can not be longer than 2048 characters.`);
|
|
261
|
+
}
|
|
262
|
+
totalCharacters += trimmedFooterText.length;
|
|
263
|
+
}
|
|
264
|
+
if (author) {
|
|
265
|
+
const trimmedAuthorName = author.name.trim();
|
|
266
|
+
if (trimmedAuthorName.length > 256) {
|
|
267
|
+
throw new Error(`Author name of embed ${index} can not be longer than 256 characters.`);
|
|
268
|
+
}
|
|
269
|
+
totalCharacters += trimmedAuthorName.length;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
if (totalCharacters > 6000) {
|
|
273
|
+
throw new Error('Total character length of all embeds can not exceed 6000 characters.');
|
|
274
|
+
}
|
|
275
|
+
return this;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Returns the current embed.
|
|
279
|
+
*
|
|
280
|
+
* @readonly
|
|
281
|
+
* @type {DiscordEmbed}
|
|
282
|
+
*/ get #currentEmbed() {
|
|
283
|
+
if (this.length === 0) {
|
|
284
|
+
this.newEmbed();
|
|
285
|
+
this.setCurrentEmbed();
|
|
286
|
+
}
|
|
287
|
+
return this[this.#currentEmbedIndex];
|
|
288
|
+
}
|
|
289
|
+
constructor(...args){
|
|
290
|
+
super(...args);
|
|
291
|
+
this.#currentEmbedIndex = 0;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
//# sourceMappingURL=embeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/builders/embeds.ts"],"sourcesContent":["import type {\n DiscordEmbed,\n DiscordEmbedAuthor,\n DiscordEmbedField,\n DiscordEmbedFooter,\n DiscordEmbedImage,\n DiscordEmbedThumbnail,\n DiscordEmbedVideo,\n} from '@discordeno/types'\n\n/**\n * A builder to help create Discord embeds.\n *\n * @export\n * @class EmbedsBuilder\n * @typedef {EmbedsBuilder}\n * @extends {Array<DiscordEmbed>}\n * @example\n * const embeds = new EmbedBuilder()\n * .setTitle('My Embed')\n * .setDescription('This is my new embed')\n * .newEmbed()\n * .setTitle('My Second Embed')\n */\nexport class EmbedsBuilder extends Array<DiscordEmbed> {\n #currentEmbedIndex: number = 0\n\n /**\n * Adds a new field to the embed fields array.\n *\n * @param {string} name - Field name\n * @param {string} value - Field value\n * @param {?boolean} [inline=false] - Field should be inline or not.\n * @returns {EmbedsBuilder}\n */\n addField(name: string, value: string, inline?: boolean): EmbedsBuilder {\n if (this.#currentEmbed.fields === undefined) {\n this.#currentEmbed.fields = []\n }\n\n this.#currentEmbed.fields.push({\n name,\n value,\n inline,\n })\n\n return this\n }\n\n /**\n * Creates a blank embed.\n *\n * @returns {EmbedsBuilder}\n */\n newEmbed(): EmbedsBuilder {\n if (this.length >= 10) {\n throw new Error('Maximum embed count exceeded. You can not have more than 10 embeds.')\n }\n\n this.push({})\n this.setCurrentEmbed()\n\n return this\n }\n\n /**\n * Set the current embed author.\n *\n * @param {string} name - Name of the author\n * @param {?Omit<DiscordEmbedAuthor, 'name'>} [options] - Extra author options\n * @returns {EmbedsBuilder}\n */\n setAuthor(name: string, options?: Omit<DiscordEmbedAuthor, 'name'>): EmbedsBuilder {\n this.#currentEmbed.author = {\n ...this.#currentEmbed.author,\n ...options,\n name,\n }\n\n return this\n }\n\n /**\n * Set the color on the side of the current embed.\n *\n * @param {(number | string)} color - The color, in base16 or hex color code\n * @returns {EmbedsBuilder}\n */\n setColor(color: number | string): EmbedsBuilder {\n if (typeof color === 'string') {\n const convertedValue = parseInt(color.replace('#', ''), 16)\n color = Number.isNaN(convertedValue) ? 0 : convertedValue\n }\n\n this.#currentEmbed.color = color\n\n return this\n }\n\n /**\n * Set the current embed to a different index.\n *\n * WARNING: Only use this method if you know what you're doing. Make sure to set it back to the latest when you're done.\n *\n * @param {?number} [index] - The index of the embed in the EmbedsBuilder array\n * @returns {EmbedsBuilder}\n */\n setCurrentEmbed(index?: number): EmbedsBuilder {\n if (index === undefined) {\n this.#currentEmbedIndex = this.length - 1\n\n return this\n }\n\n if (index >= this.length || index < 0) {\n throw new Error('Can not set the current embed to a index out of bounds.')\n }\n\n this.#currentEmbedIndex = index\n\n return this\n }\n\n /**\n * Set the description of the current embed.\n *\n * @param {string} description - Description\n * @returns {EmbedsBuilder}\n */\n setDescription(description: string): EmbedsBuilder {\n this.#currentEmbed.description = description\n\n return this\n }\n\n /**\n * Overwrite all fields on the current embed.\n *\n * @param {DiscordEmbedField[]} fields\n * @returns {EmbedsBuilder}\n */\n setFields(fields: DiscordEmbedField[]): EmbedsBuilder {\n this.#currentEmbed.fields = fields\n\n return this\n }\n\n /**\n * Set the footer in the current embed.\n *\n * @param {string} text - The text to display in the footer\n * @param {?Omit<DiscordEmbedFooter, 'text'>} [options]\n * @returns {EmbedsBuilder}\n */\n setFooter(text: string, options?: Omit<DiscordEmbedFooter, 'text'>): EmbedsBuilder {\n this.#currentEmbed.footer = {\n ...this.#currentEmbed.footer,\n ...options,\n text,\n }\n\n return this\n }\n\n /**\n * Set the image in the current embed.\n *\n * @param {string} url - URL of the image\n * @param {?Omit<DiscordEmbedImage, 'url'>} [options]\n * @returns {EmbedsBuilder}\n */\n setImage(url: string, options?: Omit<DiscordEmbedImage, 'url'>): EmbedsBuilder {\n this.#currentEmbed.image = {\n ...this.#currentEmbed.image,\n ...options,\n url,\n }\n\n return this\n }\n\n /**\n * Set the provider of the current embed.\n *\n * @param {string} name\n * @param {?string} [url]\n * @returns {EmbedsBuilder}\n */\n setProvider(name: string, url?: string): EmbedsBuilder {\n this.#currentEmbed.provider = {\n name,\n url,\n }\n\n return this\n }\n\n /**\n * Set the color of the current embed to a random value.\n *\n * @returns {EmbedsBuilder}\n */\n setRandomColor(): EmbedsBuilder {\n return this.setColor(Math.floor(Math.random() * (0xffffff + 1)))\n }\n\n /**\n * Set the title of the current embed.\n *\n * @param {string} title\n * @param {?string} [url]\n * @returns {EmbedsBuilder}\n */\n setTitle(title: string, url?: string): EmbedsBuilder {\n this.#currentEmbed.title = title\n\n if (url) {\n this.setUrl(url)\n }\n\n return this\n }\n\n /**\n * Set the timestamp of the current embed.\n *\n * @param {?(string | number | Date)} [timestamp]\n * @returns {EmbedsBuilder}\n */\n setTimestamp(timestamp?: string | number | Date): EmbedsBuilder {\n this.#currentEmbed.timestamp = new Date(timestamp!).toISOString()\n\n return this\n }\n\n /**\n * Set the thumbnail of the current embed.\n *\n * @param {string} url - URL of the image\n * @param {?Omit<DiscordEmbedThumbnail, 'url'>} [options]\n * @returns {EmbedsBuilder}\n */\n setThumbnail(url: string, options?: Omit<DiscordEmbedThumbnail, 'url'>): EmbedsBuilder {\n this.#currentEmbed.thumbnail = {\n ...this.#currentEmbed.thumbnail,\n ...options,\n url,\n }\n\n return this\n }\n\n /**\n * Set the URL of the current embed title.\n *\n * @param {string} url\n * @returns {EmbedsBuilder}\n */\n setUrl(url: string): EmbedsBuilder {\n this.#currentEmbed.url = url\n\n return this\n }\n\n /**\n * Set the video of the current embed.\n *\n * @param {string} url\n * @param {?Omit<DiscordEmbedVideo, 'url'>} [options]\n * @returns {EmbedsBuilder}\n */\n setVideo(url: string, options?: Omit<DiscordEmbedVideo, 'url'>): EmbedsBuilder {\n this.#currentEmbed.video = {\n ...this.#currentEmbed.video,\n ...options,\n url,\n }\n\n return this\n }\n\n /**\n * Validate all embeds available against current known Discord limits to help prevent bad requests.\n *\n * @returns {EmbedsBuilder}\n */\n validate(): EmbedsBuilder {\n let totalCharacters = 0\n\n if (this.length > 10) {\n throw new Error('You can not have more than 10 embeds on a single message.')\n }\n\n this.forEach(({ author, description, fields, footer, title }, index) => {\n if (title) {\n const trimmedTitle = title.trim()\n\n if (trimmedTitle.length > 256) {\n throw new Error(`Title of embed ${index} can not be longer than 256 characters.`)\n }\n\n totalCharacters += trimmedTitle.length\n }\n\n if (description) {\n const trimmedDescription = description.trim()\n\n if (trimmedDescription.length > 4096) {\n throw new Error(`Description of embed ${index} can not be longer than 4096 characters.`)\n }\n\n totalCharacters += trimmedDescription.length\n }\n\n if (fields) {\n if (fields.length > 25) {\n throw new Error(`embed ${index} can not have more than 25 fields.`)\n }\n\n fields.forEach(({ name, value }, fieldIndex) => {\n const trimmedName = name.trim()\n const trimmedValue = value.trim()\n\n if (trimmedName.length > 256) {\n throw new Error(`Name of field ${fieldIndex} on embed ${index} can not be longer than 256 characters.`)\n }\n\n if (trimmedValue.length > 4096) {\n throw new Error(`Value of field ${fieldIndex} on embed ${index} can not be longer than 1024 characters.`)\n }\n\n totalCharacters += trimmedName.length\n totalCharacters += trimmedValue.length\n })\n }\n\n if (footer) {\n const trimmedFooterText = footer.text.trim()\n\n if (trimmedFooterText.length > 2048) {\n throw new Error(`Footer text of embed ${index} can not be longer than 2048 characters.`)\n }\n\n totalCharacters += trimmedFooterText.length\n }\n\n if (author) {\n const trimmedAuthorName = author.name.trim()\n\n if (trimmedAuthorName.length > 256) {\n throw new Error(`Author name of embed ${index} can not be longer than 256 characters.`)\n }\n\n totalCharacters += trimmedAuthorName.length\n }\n })\n\n if (totalCharacters > 6000) {\n throw new Error('Total character length of all embeds can not exceed 6000 characters.')\n }\n\n return this\n }\n\n /**\n * Returns the current embed.\n *\n * @readonly\n * @type {DiscordEmbed}\n */\n get #currentEmbed(): DiscordEmbed {\n if (this.length === 0) {\n this.newEmbed()\n this.setCurrentEmbed()\n }\n\n return this[this.#currentEmbedIndex]\n }\n}\n"],"names":["EmbedsBuilder","Array","currentEmbedIndex","addField","name","value","inline","currentEmbed","fields","undefined","push","newEmbed","length","Error","setCurrentEmbed","setAuthor","options","author","setColor","color","convertedValue","parseInt","replace","Number","isNaN","index","setDescription","description","setFields","setFooter","text","footer","setImage","url","image","setProvider","provider","setRandomColor","Math","floor","random","setTitle","title","setUrl","setTimestamp","timestamp","Date","toISOString","setThumbnail","thumbnail","setVideo","video","validate","totalCharacters","forEach","trimmedTitle","trim","trimmedDescription","fieldIndex","trimmedName","trimmedValue","trimmedFooterText","trimmedAuthorName"],"mappings":"AAUA;;;;;;;;;;;;;CAaC,GACD,OAAO,MAAMA,sBAAsBC;IACjC,CAACC,iBAAiB,CAAY;IAE9B;;;;;;;GAOC,GACDC,SAASC,IAAY,EAAEC,KAAa,EAAEC,MAAgB,EAAiB;QACrE,IAAI,IAAI,CAAC,CAACC,YAAY,CAACC,MAAM,KAAKC,WAAW;YAC3C,IAAI,CAAC,CAACF,YAAY,CAACC,MAAM,GAAG,EAAE;QAChC,CAAC;QAED,IAAI,CAAC,CAACD,YAAY,CAACC,MAAM,CAACE,IAAI,CAAC;YAC7BN;YACAC;YACAC;QACF;QAEA,OAAO,IAAI;IACb;IAEA;;;;GAIC,GACDK,WAA0B;QACxB,IAAI,IAAI,CAACC,MAAM,IAAI,IAAI;YACrB,MAAM,IAAIC,MAAM,uEAAsE;QACxF,CAAC;QAED,IAAI,CAACH,IAAI,CAAC,CAAC;QACX,IAAI,CAACI,eAAe;QAEpB,OAAO,IAAI;IACb;IAEA;;;;;;GAMC,GACDC,UAAUX,IAAY,EAAEY,OAA0C,EAAiB;QACjF,IAAI,CAAC,CAACT,YAAY,CAACU,MAAM,GAAG;YAC1B,GAAG,IAAI,CAAC,CAACV,YAAY,CAACU,MAAM;YAC5B,GAAGD,OAAO;YACVZ;QACF;QAEA,OAAO,IAAI;IACb;IAEA;;;;;GAKC,GACDc,SAASC,KAAsB,EAAiB;QAC9C,IAAI,OAAOA,UAAU,UAAU;YAC7B,MAAMC,iBAAiBC,SAASF,MAAMG,OAAO,CAAC,KAAK,KAAK;YACxDH,QAAQI,OAAOC,KAAK,CAACJ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AmBO,aAAahD,MAAM;gBACxC;YACF,CAAC;YAED,IAAImB,QAAQ;gBACV,MAAM8B,oBAAoB9B,OAAOD,IAAI,CAAC0B,IAAI;gBAE1C,IAAIK,kBAAkBjD,MAAM,GAAG,MAAM;oBACnC,MAAM,IAAIC,MAAM,CAAC,qBAAqB,EAAEY,MAAM,wCAAwC,CAAC,EAAC;gBAC1F,CAAC;gBAED4B,mBAAmBQ,kBAAkBjD,MAAM;YAC7C,CAAC;YAED,IAAIK,QAAQ;gBACV,MAAM6C,oBAAoB7C,OAAOb,IAAI,CAACoD,IAAI;gBAE1C,IAAIM,kBAAkBlD,MAAM,GAAG,KAAK;oBAClC,MAAM,IAAIC,MAAM,CAAC,qBAAqB,EAAEY,MAAM,uCAAuC,CAAC,EAAC;gBACzF,CAAC;gBAED4B,mBAAmBS,kBAAkBlD,MAAM;YAC7C,CAAC;QACH;QAEA,IAAIyC,kBAAkB,MAAM;YAC1B,MAAM,IAAIxC,MAAM,wEAAuE;QACzF,CAAC;QAED,OAAO,IAAI;IACb;IAEA;;;;;GAKC,GACD,IAAI,CAACN,YAAY,GAAiB;QAChC,IAAI,IAAI,CAACK,MAAM,KAAK,GAAG;YACrB,IAAI,CAACD,QAAQ;YACb,IAAI,CAACG,eAAe;QACtB,CAAC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC,CAACZ,iBAAiB,CAAC;IACtC;;;aAhWA,CAACA,iBAAiB,GAAW;;AAiW/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,cAAc,sBAAsB,CAAA;AAEpC,eAAO,MAAM,YAAY,QAAO,aAAoC,CAAA"}
|
package/dist/builders.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/builders.ts"],"sourcesContent":["import { EmbedsBuilder } from './builders/embeds.js'\n\nexport * from './builders/embeds.js'\n\nexport const createEmbeds = (): EmbedsBuilder => new EmbedsBuilder()\n"],"names":["EmbedsBuilder","createEmbeds"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAsB;AAEpD,cAAc,uBAAsB;AAEpC,OAAO,MAAMC,eAAe,IAAqB,IAAID,gBAAe"}
|
package/dist/casing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"casing.d.ts","sourceRoot":"","sources":["../src/casing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE5D,wBAAgB,QAAQ,
|
|
1
|
+
{"version":3,"file":"casing.d.ts","sourceRoot":"","sources":["../src/casing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAE5D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAclD;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAcpD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAepD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAapD"}
|
package/dist/casing.js
CHANGED
|
@@ -5,7 +5,7 @@ export function camelize(object) {
|
|
|
5
5
|
if (typeof object === 'object' && object !== null) {
|
|
6
6
|
const obj = {};
|
|
7
7
|
Object.keys(object).forEach((key)=>{
|
|
8
|
-
obj[
|
|
8
|
+
obj[snakeToCamelCase(key)] = camelize(object[key]);
|
|
9
9
|
});
|
|
10
10
|
return obj;
|
|
11
11
|
}
|
|
@@ -18,7 +18,7 @@ export function snakelize(object) {
|
|
|
18
18
|
if (typeof object === 'object' && object !== null) {
|
|
19
19
|
const obj = {};
|
|
20
20
|
Object.keys(object).forEach((key)=>{
|
|
21
|
-
obj[
|
|
21
|
+
obj[camelToSnakeCase(key)] = snakelize(object[key]);
|
|
22
22
|
});
|
|
23
23
|
return obj;
|
|
24
24
|
}
|
package/dist/casing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/casing.ts"],"sourcesContent":["import type { Camelize, Snakelize } from '@discordeno/types'\n\nexport function camelize
|
|
1
|
+
{"version":3,"sources":["../src/casing.ts"],"sourcesContent":["import type { Camelize, Snakelize } from '@discordeno/types'\n\nexport function camelize<T>(object: T): Camelize<T> {\n if (Array.isArray(object)) {\n return object.map((element) => camelize(element)) as Camelize<T>\n }\n\n if (typeof object === 'object' && object !== null) {\n const obj = {} as Camelize<T>\n ;(Object.keys(object) as Array<keyof T>).forEach((key) => {\n // @ts-expect-error js hack\n ;(obj[snakeToCamelCase(key)] as Camelize<(T & object)[keyof T]>) = camelize(object[key])\n })\n return obj\n }\n return object as Camelize<T>\n}\n\nexport function snakelize<T>(object: T): Snakelize<T> {\n if (Array.isArray(object)) {\n return object.map((element) => snakelize(element)) as Snakelize<T>\n }\n\n if (typeof object === 'object' && object !== null) {\n const obj = {} as Snakelize<T>\n ;(Object.keys(object) as Array<keyof T>).forEach((key) => {\n // @ts-expect-error js hack\n ;(obj[camelToSnakeCase(key)] as Snakelize<(T & object)[keyof T]>) = snakelize(object[key])\n })\n return obj\n }\n return object as Snakelize<T>\n}\n\nexport function snakeToCamelCase(str: string): string {\n if (!str.includes('_')) return str\n\n let result = ''\n for (let i = 0, len = str.length; i < len; ++i) {\n if (str[i] === '_') {\n result += str[++i].toUpperCase()\n\n continue\n }\n\n result += str[i]\n }\n\n return result\n}\n\nexport function camelToSnakeCase(str: string): string {\n let result = ''\n for (let i = 0, len = str.length; i < len; ++i) {\n if (str[i] >= 'A' && str[i] <= 'Z') {\n result += `_${str[i].toLowerCase()}`\n\n continue\n }\n\n result += str[i]\n }\n\n return result\n}\n"],"names":["camelize","object","Array","isArray","map","element","obj","Object","keys","forEach","key","snakeToCamelCase","snakelize","camelToSnakeCase","str","includes","result","i","len","length","toUpperCase","toLowerCase"],"mappings":"AAEA,OAAO,SAASA,SAAYC,MAAS,EAAe;IAClD,IAAIC,MAAMC,OAAO,CAACF,SAAS;QACzB,OAAOA,OAAOG,GAAG,CAAC,CAACC,UAAYL,SAASK;IAC1C,CAAC;IAED,IAAI,OAAOJ,WAAW,YAAYA,WAAW,IAAI,EAAE;QACjD,MAAMK,MAAM,CAAC;QACXC,OAAOC,IAAI,CAACP,QAA2BQ,OAAO,CAAC,CAACC,MAAQ;YAEtDJ,GAAG,CAACK,iBAAiBD,KAAK,GAAuCV,SAASC,MAAM,CAACS,IAAI;QACzF;QACA,OAAOJ;IACT,CAAC;IACD,OAAOL;AACT,CAAC;AAED,OAAO,SAASW,UAAaX,MAAS,EAAgB;IACpD,IAAIC,MAAMC,OAAO,CAACF,SAAS;QACzB,OAAOA,OAAOG,GAAG,CAAC,CAACC,UAAYO,UAAUP;IAC3C,CAAC;IAED,IAAI,OAAOJ,WAAW,YAAYA,WAAW,IAAI,EAAE;QACjD,MAAMK,MAAM,CAAC;QACXC,OAAOC,IAAI,CAACP,QAA2BQ,OAAO,CAAC,CAACC,MAAQ;YAEtDJ,GAAG,CAACO,iBAAiBH,KAAK,GAAwCE,UAAUX,MAAM,CAACS,IAAI;QAC3F;QACA,OAAOJ;IACT,CAAC;IACD,OAAOL;AACT,CAAC;AAED,OAAO,SAASU,iBAAiBG,GAAW,EAAU;IACpD,IAAI,CAACA,IAAIC,QAAQ,CAAC,MAAM,OAAOD;IAE/B,IAAIE,SAAS;IACb,IAAK,IAAIC,IAAI,GAAGC,MAAMJ,IAAIK,MAAM,EAAEF,IAAIC,KAAK,EAAED,EAAG;QAC9C,IAAIH,GAAG,CAACG,EAAE,KAAK,KAAK;YAClBD,UAAUF,GAAG,CAAC,EAAEG,EAAE,CAACG,WAAW;YAE9B,QAAQ;QACV,CAAC;QAEDJ,UAAUF,GAAG,CAACG,EAAE;IAClB;IAEA,OAAOD;AACT,CAAC;AAED,OAAO,SAASH,iBAAiBC,GAAW,EAAU;IACpD,IAAIE,SAAS;IACb,IAAK,IAAIC,IAAI,GAAGC,MAAMJ,IAAIK,MAAM,EAAEF,IAAIC,KAAK,EAAED,EAAG;QAC9C,IAAIH,GAAG,CAACG,EAAE,IAAI,OAAOH,GAAG,CAACG,EAAE,IAAI,KAAK;YAClCD,UAAU,CAAC,CAAC,EAAEF,GAAG,CAACG,EAAE,CAACI,WAAW,GAAG,CAAC;YAEpC,QAAQ;QACV,CAAC;QAEDL,UAAUF,GAAG,CAACG,EAAE;IAClB;IAEA,OAAOD;AACT,CAAC"}
|
package/dist/colors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qEAAqE;AACrE,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,QAE7C;AAED,4DAA4D;AAC5D,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAwBD;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzC;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExC;AAED;;;GAGG;AACH,wBAAgB,GAAG,CAAC,GAA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GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAcD;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAK9D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAKhE;AAWD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
package/dist/colors.js
CHANGED
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
// A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
|
|
3
3
|
// on npm.
|
|
4
4
|
// https://deno.land/std@0.153.0/fmt/colors.ts?source
|
|
5
|
-
|
|
6
|
-
let enabled = !noColor;
|
|
5
|
+
let enabled = true;
|
|
7
6
|
/**
|
|
8
7
|
* Set changing text color to enabled or disabled
|
|
9
8
|
* @param value
|
|
10
9
|
*/ export function setColorEnabled(value) {
|
|
11
|
-
if (noColor) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
10
|
enabled = value;
|
|
15
11
|
}
|
|
16
12
|
/** Get whether text color change is enabled or disabled. */ export function getColorEnabled() {
|
package/dist/colors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/colors.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\n// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.\n// A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors\n// on npm.\n// https://deno.land/std@0.153.0/fmt/colors.ts?source\n\nconst noColor = false\n\nexport interface Code {\n open: string\n close: string\n regexp: RegExp\n}\n\n/** RGB 8-bits per channel. Each in range `0->255` or `0x00->0xff` */\nexport interface Rgb {\n r: number\n g: number\n b: number\n}\n\nlet enabled = !noColor\n\n/**\n * Set changing text color to enabled or disabled\n * @param value\n */\nexport function setColorEnabled(value: boolean) {\n if (noColor) {\n return\n }\n\n enabled = value\n}\n\n/** Get whether text color change is enabled or disabled. */\nexport function getColorEnabled(): boolean {\n return enabled\n}\n\n/**\n * Builds color code\n * @param open\n * @param close\n */\nfunction code(open: number[], close: number): Code {\n return {\n open: `\\x1b[${open.join(';')}m`,\n close: `\\x1b[${close}m`,\n regexp: new RegExp(`\\\\x1b\\\\[${close}m`, 'g'),\n }\n}\n\n/**\n * Applies color and background based on color code and its associated text\n * @param str text to apply color settings to\n * @param code color code to apply\n */\nfunction run(str: string, code: Code): string {\n return enabled ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` : str\n}\n\n/**\n * Reset the text modified\n * @param str text to reset\n */\nexport function reset(str: string): string {\n return run(str, code([0], 0))\n}\n\n/**\n * Make the text bold.\n * @param str text to make bold\n */\nexport function bold(str: string): string {\n return run(str, code([1], 22))\n}\n\n/**\n * The text emits only a small amount of light.\n * @param str text to dim\n */\nexport function dim(str: string): string {\n return run(str, code([2], 22))\n}\n\n/**\n * Make the text italic.\n * @param str text to make italic\n */\nexport function italic(str: string): string {\n return run(str, code([3], 23))\n}\n\n/**\n * Make the text underline.\n * @param str text to underline\n */\nexport function underline(str: string): string {\n return run(str, code([4], 24))\n}\n\n/**\n * Invert background color and text color.\n * @param str text to invert its color\n */\nexport function inverse(str: string): string {\n return run(str, code([7], 27))\n}\n\n/**\n * Make the text hidden.\n * @param str text to hide\n */\nexport function hidden(str: string): string {\n return run(str, code([8], 28))\n}\n\n/**\n * Put horizontal line through the center of the text.\n * @param str text to strike through\n */\nexport function strikethrough(str: string): string {\n return run(str, code([9], 29))\n}\n\n/**\n * Set text color to black.\n * @param str text to make black\n */\nexport function black(str: string): string {\n return run(str, code([30], 39))\n}\n\n/**\n * Set text color to red.\n * @param str text to make red\n */\nexport function red(str: string): string {\n return run(str, code([31], 39))\n}\n\n/**\n * Set text color to green.\n * @param str text to make green\n */\nexport function green(str: string): string {\n return run(str, code([32], 39))\n}\n\n/**\n * Set text color to yellow.\n * @param str text to make yellow\n */\nexport function yellow(str: string): string {\n return run(str, code([33], 39))\n}\n\n/**\n * Set text color to blue.\n * @param str text to make blue\n */\nexport function blue(str: string): string {\n return run(str, code([34], 39))\n}\n\n/**\n * Set text color to magenta.\n * @param str text to make magenta\n */\nexport function magenta(str: string): string {\n return run(str, code([35], 39))\n}\n\n/**\n * Set text color to cyan.\n * @param str text to make cyan\n */\nexport function cyan(str: string): string {\n return run(str, code([36], 39))\n}\n\n/**\n * Set text color to white.\n * @param str text to make white\n */\nexport function white(str: string): string {\n return run(str, code([37], 39))\n}\n\n/**\n * Set text color to gray.\n * @param str text to make gray\n */\nexport function gray(str: string): string {\n return brightBlack(str)\n}\n\n/**\n * Set text color to bright black.\n * @param str text to make bright-black\n */\nexport function brightBlack(str: string): string {\n return run(str, code([90], 39))\n}\n\n/**\n * Set text color to bright red.\n * @param str text to make bright-red\n */\nexport function brightRed(str: string): string {\n return run(str, code([91], 39))\n}\n\n/**\n * Set text color to bright green.\n * @param str text to make bright-green\n */\nexport function brightGreen(str: string): string {\n return run(str, code([92], 39))\n}\n\n/**\n * Set text color to bright yellow.\n * @param str text to make bright-yellow\n */\nexport function brightYellow(str: string): string {\n return run(str, code([93], 39))\n}\n\n/**\n * Set text color to bright blue.\n * @param str text to make bright-blue\n */\nexport function brightBlue(str: string): string {\n return run(str, code([94], 39))\n}\n\n/**\n * Set text color to bright magenta.\n * @param str text to make bright-magenta\n */\nexport function brightMagenta(str: string): string {\n return run(str, code([95], 39))\n}\n\n/**\n * Set text color to bright cyan.\n * @param str text to make bright-cyan\n */\nexport function brightCyan(str: string): string {\n return run(str, code([96], 39))\n}\n\n/**\n * Set text color to bright white.\n * @param str text to make bright-white\n */\nexport function brightWhite(str: string): string {\n return run(str, code([97], 39))\n}\n\n/**\n * Set background color to black.\n * @param str text to make its background black\n */\nexport function bgBlack(str: string): string {\n return run(str, code([40], 49))\n}\n\n/**\n * Set background color to red.\n * @param str text to make its background red\n */\nexport function bgRed(str: string): string {\n return run(str, code([41], 49))\n}\n\n/**\n * Set background color to green.\n * @param str text to make its background green\n */\nexport function bgGreen(str: string): string {\n return run(str, code([42], 49))\n}\n\n/**\n * Set background color to yellow.\n * @param str text to make its background yellow\n */\nexport function bgYellow(str: string): string {\n return run(str, code([43], 49))\n}\n\n/**\n * Set background color to blue.\n * @param str text to make its background blue\n */\nexport function bgBlue(str: string): string {\n return run(str, code([44], 49))\n}\n\n/**\n * Set background color to magenta.\n * @param str text to make its background magenta\n */\nexport function bgMagenta(str: string): string {\n return run(str, code([45], 49))\n}\n\n/**\n * Set background color to cyan.\n * @param str text to make its background cyan\n */\nexport function bgCyan(str: string): string {\n return run(str, code([46], 49))\n}\n\n/**\n * Set background color to white.\n * @param str text to make its background white\n */\nexport function bgWhite(str: string): string {\n return run(str, code([47], 49))\n}\n\n/**\n * Set background color to bright black.\n * @param str text to make its background bright-black\n */\nexport function bgBrightBlack(str: string): string {\n return run(str, code([100], 49))\n}\n\n/**\n * Set background color to bright red.\n * @param str text to make its background bright-red\n */\nexport function bgBrightRed(str: string): string {\n return run(str, code([101], 49))\n}\n\n/**\n * Set background color to bright green.\n * @param str text to make its background bright-green\n */\nexport function bgBrightGreen(str: string): string {\n return run(str, code([102], 49))\n}\n\n/**\n * Set background color to bright yellow.\n * @param str text to make its background bright-yellow\n */\nexport function bgBrightYellow(str: string): string {\n return run(str, code([103], 49))\n}\n\n/**\n * Set background color to bright blue.\n * @param str text to make its background bright-blue\n */\nexport function bgBrightBlue(str: string): string {\n return run(str, code([104], 49))\n}\n\n/**\n * Set background color to bright magenta.\n * @param str text to make its background bright-magenta\n */\nexport function bgBrightMagenta(str: string): string {\n return run(str, code([105], 49))\n}\n\n/**\n * Set background color to bright cyan.\n * @param str text to make its background bright-cyan\n */\nexport function bgBrightCyan(str: string): string {\n return run(str, code([106], 49))\n}\n\n/**\n * Set background color to bright white.\n * @param str text to make its background bright-white\n */\nexport function bgBrightWhite(str: string): string {\n return run(str, code([107], 49))\n}\n\n/* Special Color Sequences */\n\n/**\n * Clam and truncate color codes\n * @param n\n * @param max number to truncate to\n * @param min number to truncate from\n */\nfunction clampAndTruncate(n: number, max = 255, min = 0): number {\n return Math.trunc(Math.max(Math.min(n, max), min))\n}\n\n/**\n * Set text color using paletted 8bit colors.\n * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit\n * @param str text color to apply paletted 8bit colors to\n * @param color code\n */\nexport function rgb8(str: string, color: number): string {\n return run(str, code([38, 5, clampAndTruncate(color)], 39))\n}\n\n/**\n * Set background color using paletted 8bit colors.\n * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit\n * @param str text color to apply paletted 8bit background colors to\n * @param color code\n */\nexport function bgRgb8(str: string, color: number): string {\n return run(str, code([48, 5, clampAndTruncate(color)], 49))\n}\n\n/**\n * Set text color using 24bit rgb.\n * `color` can be a number in range `0x000000` to `0xffffff` or\n * an `Rgb`.\n *\n * To produce the color magenta:\n *\n * ```ts\n * import { rgb24 } from \"./colors.ts\";\n * rgb24(\"foo\", 0xff00ff);\n * rgb24(\"foo\", {r: 255, g: 0, b: 255});\n * ```\n * @param str text color to apply 24bit rgb to\n * @param color code\n */\nexport function rgb24(str: string, color: number | Rgb): string {\n if (typeof color === 'number') {\n return run(str, code([38, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 39))\n }\n return run(str, code([38, 2, clampAndTruncate(color.r), clampAndTruncate(color.g), clampAndTruncate(color.b)], 39))\n}\n\n/**\n * Set background color using 24bit rgb.\n * `color` can be a number in range `0x000000` to `0xffffff` or\n * an `Rgb`.\n *\n * To produce the color magenta:\n *\n * ```ts\n * import { bgRgb24 } from \"./colors.ts\";\n * bgRgb24(\"foo\", 0xff00ff);\n * bgRgb24(\"foo\", {r: 255, g: 0, b: 255});\n * ```\n * @param str text color to apply 24bit rgb to\n * @param color code\n */\nexport function bgRgb24(str: string, color: number | Rgb): string {\n if (typeof color === 'number') {\n return run(str, code([48, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 49))\n }\n return run(str, code([48, 2, clampAndTruncate(color.r), clampAndTruncate(color.g), clampAndTruncate(color.b)], 49))\n}\n\n// https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js\nconst ANSI_PATTERN = new RegExp(\n [\n '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)',\n '(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))',\n ].join('|'),\n 'g',\n)\n\n/**\n * Remove ANSI escape codes from the string.\n * @param string to remove ANSI escape codes from\n */\nexport function stripColor(string: string): string {\n return string.replace(ANSI_PATTERN, '')\n}\n"],"names":["noColor","enabled","setColorEnabled","value","getColorEnabled","code","open","close","join","regexp","RegExp","run","str","replace","reset","bold","dim","italic","underline","inverse","hidden","strikethrough","black","red","green","yellow","blue","magenta","cyan","white","gray","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite","bgBlack","bgRed","bgGreen","bgYellow","bgBlue","bgMagenta","bgCyan","bgWhite","bgBrightBlack","bgBrightRed","bgBrightGreen","bgBrightYellow","bgBrightBlue","bgBrightMagenta","bgBrightCyan","bgBrightWhite","clampAndTruncate","n","max","min","Math","trunc","rgb8","color","bgRgb8","rgb24","r","g","b","bgRgb24","ANSI_PATTERN","stripColor","string"],"mappings":"AAAA,mEAAmE,GAEnE,0EAA0E;AAC1E,+EAA+E;AAC/E,UAAU;AACV,qDAAqD;AAErD,MAAMA,UAAU,KAAK;AAerB,IAAIC,UAAU,CAACD;AAEf;;;CAGC,GACD,OAAO,SAASE,gBAAgBC,KAAc,EAAE;IAC9C,IAAIH,SAAS;QACX;IACF,CAAC;IAEDC,UAAUE;AACZ,CAAC;AAED,0DAA0D,GAC1D,OAAO,SAASC,kBAA2B;IACzC,OAAOH;AACT,CAAC;AAED;;;;CAIC,GACD,SAASI,KAAKC,IAAc,EAAEC,KAAa,EAAQ;IACjD,OAAO;QACLD,MAAM,CAAC,KAAK,EAAEA,KAAKE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/BD,OAAO,CAAC,KAAK,EAAEA,MAAM,CAAC,CAAC;QACvBE,QAAQ,IAAIC,OAAO,CAAC,QAAQ,EAAEH,MAAM,CAAC,CAAC,EAAE;IAC1C;AACF;AAEA;;;;CAIC,GACD,SAASI,IAAIC,GAAW,EAAEP,IAAU,EAAU;IAC5C,OAAOJ,UAAU,CAAC,EAAEI,KAAKC,IAAI,CAAC,EAAEM,IAAIC,OAAO,CAACR,KAAKI,MAAM,EAAEJ,KAAKC,IAAI,EAAE,EAAED,KAAKE,KAAK,CAAC,CAAC,GAAGK,GA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AI,CAAC,MACP;AAGF;;;CAGC,GACD,OAAO,SAAS8D,WAAWC,MAAc,EAAU;IACjD,OAAOA,OAAO1D,OAAO,CAACwD,cAAc;AACtC,CAAC"}
|
|
1
|
+
{"version":3,"sources":["../src/colors.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\n\n// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.\n// A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors\n// on npm.\n// https://deno.land/std@0.153.0/fmt/colors.ts?source\n\nexport interface Code {\n open: string\n close: string\n regexp: RegExp\n}\n\n/** RGB 8-bits per channel. Each in range `0->255` or `0x00->0xff` */\nexport interface Rgb {\n r: number\n g: number\n b: number\n}\n\nlet enabled = true\n\n/**\n * Set changing text color to enabled or disabled\n * @param value\n */\nexport function setColorEnabled(value: boolean) {\n enabled = value\n}\n\n/** Get whether text color change is enabled or disabled. */\nexport function getColorEnabled(): boolean {\n return enabled\n}\n\n/**\n * Builds color code\n * @param open\n * @param close\n */\nfunction code(open: number[], close: number): Code {\n return {\n open: `\\x1b[${open.join(';')}m`,\n close: `\\x1b[${close}m`,\n regexp: new RegExp(`\\\\x1b\\\\[${close}m`, 'g'),\n }\n}\n\n/**\n * Applies color and background based on color code and its associated text\n * @param str text to apply color settings to\n * @param code color code to apply\n */\nfunction run(str: string, code: Code): string {\n return enabled ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` : str\n}\n\n/**\n * Reset the text modified\n * @param str text to reset\n */\nexport function reset(str: string): string {\n return run(str, code([0], 0))\n}\n\n/**\n * Make the text bold.\n * @param str text to make bold\n */\nexport function bold(str: string): string {\n return run(str, code([1], 22))\n}\n\n/**\n * The text emits only a small amount of light.\n * @param str text to dim\n */\nexport function dim(str: string): string {\n return run(str, code([2], 22))\n}\n\n/**\n * Make the text italic.\n * @param str text to make italic\n */\nexport function italic(str: string): string {\n return run(str, code([3], 23))\n}\n\n/**\n * Make the text underline.\n * @param str text to underline\n */\nexport function underline(str: string): string {\n return run(str, code([4], 24))\n}\n\n/**\n * Invert background color and text color.\n * @param str text to invert its color\n */\nexport function inverse(str: string): string {\n return run(str, code([7], 27))\n}\n\n/**\n * Make the text hidden.\n * @param str text to hide\n */\nexport function hidden(str: string): string {\n return run(str, code([8], 28))\n}\n\n/**\n * Put horizontal line through the center of the text.\n * @param str text to strike through\n */\nexport function strikethrough(str: string): string {\n return run(str, code([9], 29))\n}\n\n/**\n * Set text color to black.\n * @param str text to make black\n */\nexport function black(str: string): string {\n return run(str, code([30], 39))\n}\n\n/**\n * Set text color to red.\n * @param str text to make red\n */\nexport function red(str: string): string {\n return run(str, code([31], 39))\n}\n\n/**\n * Set text color to green.\n * @param str text to make green\n */\nexport function green(str: string): string {\n return run(str, code([32], 39))\n}\n\n/**\n * Set text color to yellow.\n * @param str text to make yellow\n */\nexport function yellow(str: string): string {\n return run(str, code([33], 39))\n}\n\n/**\n * Set text color to blue.\n * @param str text to make blue\n */\nexport function blue(str: string): string {\n return run(str, code([34], 39))\n}\n\n/**\n * Set text color to magenta.\n * @param str text to make magenta\n */\nexport function magenta(str: string): string {\n return run(str, code([35], 39))\n}\n\n/**\n * Set text color to cyan.\n * @param str text to make cyan\n */\nexport function cyan(str: string): string {\n return run(str, code([36], 39))\n}\n\n/**\n * Set text color to white.\n * @param str text to make white\n */\nexport function white(str: string): string {\n return run(str, code([37], 39))\n}\n\n/**\n * Set text color to gray.\n * @param str text to make gray\n */\nexport function gray(str: string): string {\n return brightBlack(str)\n}\n\n/**\n * Set text color to bright black.\n * @param str text to make bright-black\n */\nexport function brightBlack(str: string): string {\n return run(str, code([90], 39))\n}\n\n/**\n * Set text color to bright red.\n * @param str text to make bright-red\n */\nexport function brightRed(str: string): string {\n return run(str, code([91], 39))\n}\n\n/**\n * Set text color to bright green.\n * @param str text to make bright-green\n */\nexport function brightGreen(str: string): string {\n return run(str, code([92], 39))\n}\n\n/**\n * Set text color to bright yellow.\n * @param str text to make bright-yellow\n */\nexport function brightYellow(str: string): string {\n return run(str, code([93], 39))\n}\n\n/**\n * Set text color to bright blue.\n * @param str text to make bright-blue\n */\nexport function brightBlue(str: string): string {\n return run(str, code([94], 39))\n}\n\n/**\n * Set text color to bright magenta.\n * @param str text to make bright-magenta\n */\nexport function brightMagenta(str: string): string {\n return run(str, code([95], 39))\n}\n\n/**\n * Set text color to bright cyan.\n * @param str text to make bright-cyan\n */\nexport function brightCyan(str: string): string {\n return run(str, code([96], 39))\n}\n\n/**\n * Set text color to bright white.\n * @param str text to make bright-white\n */\nexport function brightWhite(str: string): string {\n return run(str, code([97], 39))\n}\n\n/**\n * Set background color to black.\n * @param str text to make its background black\n */\nexport function bgBlack(str: string): string {\n return run(str, code([40], 49))\n}\n\n/**\n * Set background color to red.\n * @param str text to make its background red\n */\nexport function bgRed(str: string): string {\n return run(str, code([41], 49))\n}\n\n/**\n * Set background color to green.\n * @param str text to make its background green\n */\nexport function bgGreen(str: string): string {\n return run(str, code([42], 49))\n}\n\n/**\n * Set background color to yellow.\n * @param str text to make its background yellow\n */\nexport function bgYellow(str: string): string {\n return run(str, code([43], 49))\n}\n\n/**\n * Set background color to blue.\n * @param str text to make its background blue\n */\nexport function bgBlue(str: string): string {\n return run(str, code([44], 49))\n}\n\n/**\n * Set background color to magenta.\n * @param str text to make its background magenta\n */\nexport function bgMagenta(str: string): string {\n return run(str, code([45], 49))\n}\n\n/**\n * Set background color to cyan.\n * @param str text to make its background cyan\n */\nexport function bgCyan(str: string): string {\n return run(str, code([46], 49))\n}\n\n/**\n * Set background color to white.\n * @param str text to make its background white\n */\nexport function bgWhite(str: string): string {\n return run(str, code([47], 49))\n}\n\n/**\n * Set background color to bright black.\n * @param str text to make its background bright-black\n */\nexport function bgBrightBlack(str: string): string {\n return run(str, code([100], 49))\n}\n\n/**\n * Set background color to bright red.\n * @param str text to make its background bright-red\n */\nexport function bgBrightRed(str: string): string {\n return run(str, code([101], 49))\n}\n\n/**\n * Set background color to bright green.\n * @param str text to make its background bright-green\n */\nexport function bgBrightGreen(str: string): string {\n return run(str, code([102], 49))\n}\n\n/**\n * Set background color to bright yellow.\n * @param str text to make its background bright-yellow\n */\nexport function bgBrightYellow(str: string): string {\n return run(str, code([103], 49))\n}\n\n/**\n * Set background color to bright blue.\n * @param str text to make its background bright-blue\n */\nexport function bgBrightBlue(str: string): string {\n return run(str, code([104], 49))\n}\n\n/**\n * Set background color to bright magenta.\n * @param str text to make its background bright-magenta\n */\nexport function bgBrightMagenta(str: string): string {\n return run(str, code([105], 49))\n}\n\n/**\n * Set background color to bright cyan.\n * @param str text to make its background bright-cyan\n */\nexport function bgBrightCyan(str: string): string {\n return run(str, code([106], 49))\n}\n\n/**\n * Set background color to bright white.\n * @param str text to make its background bright-white\n */\nexport function bgBrightWhite(str: string): string {\n return run(str, code([107], 49))\n}\n\n/* Special Color Sequences */\n\n/**\n * Clam and truncate color codes\n * @param n\n * @param max number to truncate to\n * @param min number to truncate from\n */\nfunction clampAndTruncate(n: number, max = 255, min = 0): number {\n return Math.trunc(Math.max(Math.min(n, max), min))\n}\n\n/**\n * Set text color using paletted 8bit colors.\n * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit\n * @param str text color to apply paletted 8bit colors to\n * @param color code\n */\nexport function rgb8(str: string, color: number): string {\n return run(str, code([38, 5, clampAndTruncate(color)], 39))\n}\n\n/**\n * Set background color using paletted 8bit colors.\n * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit\n * @param str text color to apply paletted 8bit background colors to\n * @param color code\n */\nexport function bgRgb8(str: string, color: number): string {\n return run(str, code([48, 5, clampAndTruncate(color)], 49))\n}\n\n/**\n * Set text color using 24bit rgb.\n * `color` can be a number in range `0x000000` to `0xffffff` or\n * an `Rgb`.\n *\n * To produce the color magenta:\n *\n * ```ts\n * import { rgb24 } from \"./colors.ts\";\n * rgb24(\"foo\", 0xff00ff);\n * rgb24(\"foo\", {r: 255, g: 0, b: 255});\n * ```\n * @param str text color to apply 24bit rgb to\n * @param color code\n */\nexport function rgb24(str: string, color: number | Rgb): string {\n if (typeof color === 'number') {\n return run(str, code([38, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 39))\n }\n return run(str, code([38, 2, clampAndTruncate(color.r), clampAndTruncate(color.g), clampAndTruncate(color.b)], 39))\n}\n\n/**\n * Set background color using 24bit rgb.\n * `color` can be a number in range `0x000000` to `0xffffff` or\n * an `Rgb`.\n *\n * To produce the color magenta:\n *\n * ```ts\n * import { bgRgb24 } from \"./colors.ts\";\n * bgRgb24(\"foo\", 0xff00ff);\n * bgRgb24(\"foo\", {r: 255, g: 0, b: 255});\n * ```\n * @param str text color to apply 24bit rgb to\n * @param color code\n */\nexport function bgRgb24(str: string, color: number | Rgb): string {\n if (typeof color === 'number') {\n return run(str, code([48, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 49))\n }\n return run(str, code([48, 2, clampAndTruncate(color.r), clampAndTruncate(color.g), clampAndTruncate(color.b)], 49))\n}\n\n// https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js\nconst ANSI_PATTERN = new RegExp(\n [\n '[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]+)*|[a-zA-Z\\\\d]+(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)',\n '(?:(?:\\\\d{1,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]))',\n ].join('|'),\n 'g',\n)\n\n/**\n * Remove ANSI escape codes from the string.\n * @param string to remove ANSI escape codes from\n */\nexport function stripColor(string: string): string {\n return string.replace(ANSI_PATTERN, '')\n}\n"],"names":["enabled","setColorEnabled","value","getColorEnabled","code","open","close","join","regexp","RegExp","run","str","replace","reset","bold","dim","italic","underline","inverse","hidden","strikethrough","black","red","green","yellow","blue","magenta","cyan","white","gray","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite","bgBlack","bgRed","bgGreen","bgYellow","bgBlue","bgMagenta","bgCyan","bgWhite","bgBrightBlack","bgBrightRed","bgBrightGreen","bgBrightYellow","bgBrightBlue","bgBrightMagenta","bgBrightCyan","bgBrightWhite","clampAndTruncate","n","max","min","Math","trunc","rgb8","color","bgRgb8","rgb24","r","g","b","bgRgb24","ANSI_PATTERN","stripColor","string"],"mappings":"AAAA,mEAAmE,GAEnE,0EAA0E;AAC1E,+EAA+E;AAC/E,UAAU;AACV,qDAAqD;AAerD,IAAIA,UAAU,IAAI;AAElB;;;CAGC,GACD,OAAO,SAASC,gBAAgBC,KAAc,EAAE;IAC9CF,UAAUE;AACZ,CAAC;AAED,0DAA0D,GAC1D,OAAO,SAASC,kBAA2B;IACzC,OAAOH;AACT,CAAC;AAED;;;;CAIC,GACD,SAASI,KAAKC,IAAc,EAAEC,KAAa,EAAQ;IACjD,OAAO;QACLD,MAAM,CAAC,KAAK,EAAEA,KAAKE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/BD,OAAO,CAAC,KAAK,EAAEA,MAAM,CAAC,CAAC;QACvBE,QAAQ,IAAIC,OAAO,CAAC,QAAQ,EAAEH,MAAM,CAAC,CAAC,EAAE;IAC1C;AACF;AAEA;;;;CAIC,GACD,SAASI,IAAIC,GAAW,EAAEP,IAAU,EAAU;IAC5C,OAAOJ,UAAU,CAAC,EAAEI,KAAKC,IAAI,CAAC,EAAEM,IAAIC,OAAO,CAACR,KAAKI,MAAM,EAAEJ,KAAKC,IAAI,EAAE,EAAED,KAAKE,KAAK,CAAC,CAAC,GAAGK,GAAG;AAC1F;AAEA;;;CAGC,GACD,OAAO,SAASE,MAAMF,GAAW,EAAU;IACzC,OAAOD,IAAIC,KAAKP,KAAK;QAAC;KAAE,EAAE;AAC5B,CAAC;AAED;;;CAGC,GACD,OAAO,SAASU,KAAKH,GAAW,EAAU;IACxC,OAAOD,IAAIC,KAAKP,KAAK;QAAC;KAAE,EAAE;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,OAAO,SAASC,OAAOnD,GAAW,EAAEkD,KAAa,EAAU;IACzD,OAAOnD,IAAIC,KAAKP,KAAK;QAAC;QAAI;QAAGkD,iBAAiBO;KAAO,EAAE;AACzD,CAAC;AAED;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASE,MAAMpD,GAAW,EAAEkD,KAAmB,EAAU;IAC9D,IAAI,OAAOA,UAAU,UAAU;QAC7B,OAAOnD,IAAIC,KAAKP,KAAK;YAAC;YAAI;YAAIyD,SAAS,KAAM;YAAOA,SAAS,IAAK;YAAMA,QAAQ;SAAK,EAAE;IACzF,CAAC;IACD,OAAOnD,IAAIC,KAAKP,KAAK;QAAC;QAAI;QAAGkD,iBAAiBO,MAAMG,CAAC;QAAGV,iBAAiBO,MAAMI,CAAC;QAAGX,iBAAiBO,MAAMK,CAAC;KAAE,EAAE;AACjH,CAAC;AAED;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASC,QAAQxD,GAAW,EAAEkD,KAAmB,EAAU;IAChE,IAAI,OAAOA,UAAU,UAAU;QAC7B,OAAOnD,IAAIC,KAAKP,KAAK;YAAC;YAAI;YAAIyD,SAAS,KAAM;YAAOA,SAAS,IAAK;YAAMA,QAAQ;SAAK,EAAE;IACzF,CAAC;IACD,OAAOnD,IAAIC,KAAKP,KAAK;QAAC;QAAI;QAAGkD,iBAAiBO,MAAMG,CAAC;QAAGV,iBAAiBO,MAAMI,CAAC;QAAGX,iBAAiBO,MAAMK,CAAC;KAAE,EAAE;AACjH,CAAC;AAED,6FAA6F;AAC7F,MAAME,eAAe,IAAI3D,OACvB;IACE;IACA;CACD,CAACF,IAAI,CAAC,MACP;AAGF;;;CAGC,GACD,OAAO,SAAS8D,WAAWC,MAAc,EAAU;IACjD,OAAOA,OAAO1D,OAAO,CAACwD,cAAc;AACtC,CAAC"}
|
package/dist/images.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* @param options - The parameters for the building of the URL.
|
|
20
20
|
* @returns The link to the resource.
|
|
21
21
|
*/ export function avatarUrl(userId, discriminator, options) {
|
|
22
|
-
return options?.avatar ? formatImageUrl(`https://cdn.discordapp.com/avatars/${userId}/${typeof options
|
|
22
|
+
return options?.avatar ? formatImageUrl(`https://cdn.discordapp.com/avatars/${userId}/${typeof options.avatar === 'string' ? options.avatar : iconBigintToHash(options.avatar)}`, options?.size ?? 128, options?.format) : `https://cdn.discordapp.com/embed/avatars/${discriminator === '0' ? (BigInt(userId) >> BigInt(22)) % BigInt(6) : Number(discriminator) % 5}.png`;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Builds a URL to the guild banner stored in the Discord CDN.
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* @param options - The parameters for the building of the URL.
|
|
57
57
|
* @returns The link to the resource.
|
|
58
58
|
*/ export function getWidgetImageUrl(guildId, options) {
|
|
59
|
-
let url = `https://
|
|
59
|
+
let url = `https://discordapp.com/api/guilds/${guildId}/widget.png`;
|
|
60
60
|
if (options?.style) {
|
|
61
61
|
url += `?style=${options.style}`;
|
|
62
62
|
}
|
package/dist/images.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/images.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-template-expressions */\nimport type { BigString, GetGuildWidgetImageQuery, ImageFormat, ImageSize } from '@discordeno/types'\nimport { iconBigintToHash } from './hash.js'\n\n/** Help format an image url. */\nexport function formatImageUrl(url: string, size: ImageSize = 128, format?: ImageFormat): string {\n return `${url}.${format ?? (url.includes('/a_') ? 'gif' : 'jpg')}?size=${size}`\n}\n\n/**\n * Get the url for an emoji.\n *\n * @param emojiId The id of the emoji\n * @param animated Whether or not the emoji is animated\n * @returns string\n */\nexport function emojiUrl(emojiId: BigString, animated = false): string {\n return `https://cdn.discordapp.com/emojis/${emojiId}.${animated ? 'gif' : 'png'}`\n}\n\n/**\n * Builds a URL to a user's avatar stored in the Discord CDN.\n *\n * @param userId - The ID of the user to get the avatar of.\n * @param discriminator - The user's discriminator. (4-digit tag after the hashtag.)\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource.\n */\nexport function avatarUrl(\n userId: BigString,\n discriminator: string,\n options?: {\n avatar: BigString | undefined\n size?: ImageSize\n format?: ImageFormat\n },\n): string {\n return options?.avatar\n ? formatImageUrl(\n `https://cdn.discordapp.com/avatars/${userId}/${typeof options
|
|
1
|
+
{"version":3,"sources":["../src/images.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-template-expressions */\nimport type { BigString, GetGuildWidgetImageQuery, ImageFormat, ImageSize } from '@discordeno/types'\nimport { iconBigintToHash } from './hash.js'\n\n/** Help format an image url. */\nexport function formatImageUrl(url: string, size: ImageSize = 128, format?: ImageFormat): string {\n return `${url}.${format ?? (url.includes('/a_') ? 'gif' : 'jpg')}?size=${size}`\n}\n\n/**\n * Get the url for an emoji.\n *\n * @param emojiId The id of the emoji\n * @param animated Whether or not the emoji is animated\n * @returns string\n */\nexport function emojiUrl(emojiId: BigString, animated = false): string {\n return `https://cdn.discordapp.com/emojis/${emojiId}.${animated ? 'gif' : 'png'}`\n}\n\n/**\n * Builds a URL to a user's avatar stored in the Discord CDN.\n *\n * @param userId - The ID of the user to get the avatar of.\n * @param discriminator - The user's discriminator. (4-digit tag after the hashtag.)\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource.\n */\nexport function avatarUrl(\n userId: BigString,\n discriminator: string,\n options?: {\n avatar: BigString | undefined\n size?: ImageSize\n format?: ImageFormat\n },\n): string {\n return options?.avatar\n ? formatImageUrl(\n `https://cdn.discordapp.com/avatars/${userId}/${typeof options.avatar === 'string' ? options.avatar : iconBigintToHash(options.avatar)}`,\n options?.size ?? 128,\n options?.format,\n )\n : `https://cdn.discordapp.com/embed/avatars/${discriminator === '0' ? (BigInt(userId) >> BigInt(22)) % BigInt(6) : Number(discriminator) % 5}.png`\n}\n\n/**\n * Builds a URL to the guild banner stored in the Discord CDN.\n *\n * @param guildId - The ID of the guild to get the link to the banner for.\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource or `undefined` if no banner has been set.\n */\nexport function guildBannerUrl(\n guildId: BigString,\n options: {\n banner?: string | bigint\n size?: ImageSize\n format?: ImageFormat\n },\n): string | undefined {\n return options.banner\n ? formatImageUrl(\n `https://cdn.discordapp.com/banners/${guildId}/${typeof options.banner === 'string' ? options.banner : iconBigintToHash(options.banner)}`,\n options.size ?? 128,\n options.format,\n )\n : undefined\n}\n\n/**\n * Builds a URL to the guild icon stored in the Discord CDN.\n *\n * @param guildId - The ID of the guild to get the link to the banner for.\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource or `undefined` if no banner has been set.\n */\nexport function guildIconUrl(\n guildId: BigString,\n imageHash: BigString | undefined,\n options?: {\n size?: ImageSize\n format?: ImageFormat\n },\n): string | undefined {\n return imageHash\n ? formatImageUrl(\n `https://cdn.discordapp.com/icons/${guildId}/${typeof imageHash === 'string' ? imageHash : iconBigintToHash(imageHash)}`,\n options?.size ?? 128,\n options?.format,\n )\n : undefined\n}\n\n/**\n * Builds the URL to a guild splash stored in the Discord CDN.\n *\n * @param guildId - The ID of the guild to get the splash of.\n * @param imageHash - The hash identifying the splash image.\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource or `undefined` if the guild does not have a splash image set.\n */\nexport function guildSplashUrl(\n guildId: BigString,\n imageHash: BigString | undefined,\n options?: {\n size?: ImageSize\n format?: ImageFormat\n },\n): string | undefined {\n return imageHash\n ? formatImageUrl(\n `https://cdn.discordapp.com/splashes/${guildId}/${typeof imageHash === 'string' ? imageHash : iconBigintToHash(imageHash)}`,\n options?.size ?? 128,\n options?.format,\n )\n : undefined\n}\n\n/**\n * Builds a URL to the guild widget image stored in the Discord CDN.\n *\n * @param guildId - The ID of the guild to get the link to the widget image for.\n * @param options - The parameters for the building of the URL.\n * @returns The link to the resource.\n */\nexport function getWidgetImageUrl(guildId: BigString, options?: GetGuildWidgetImageQuery): string {\n let url = `https://discordapp.com/api/guilds/${guildId}/widget.png`\n\n if (options?.style) {\n url += `?style=${options.style}`\n }\n\n return url\n}\n"],"names":["iconBigintToHash","formatImageUrl","url","size","format","includes","emojiUrl","emojiId","animated","avatarUrl","userId","discriminator","options","avatar","BigInt","Number","guildBannerUrl","guildId","banner","undefined","guildIconUrl","imageHash","guildSplashUrl","getWidgetImageUrl","style"],"mappings":"AAAA,mEAAmE,GAEnE,SAASA,gBAAgB,QAAQ,YAAW;AAE5C,8BAA8B,GAC9B,OAAO,SAASC,eAAeC,GAAW,EAAEC,OAAkB,GAAG,EAAEC,MAAoB,EAAU;IAC/F,OAAO,CAAC,EAAEF,IAAI,CAAC,EAAEE,UAAWF,CAAAA,IAAIG,QAAQ,CAAC,SAAS,QAAQ,KAAK,AAAD,EAAG,MAAM,EAAEF,KAAK,CAAC;AACjF,CAAC;AAED;;;;;;CAMC,GACD,OAAO,SAASG,SAASC,OAAkB,EAAEC,WAAW,KAAK,EAAU;IACrE,OAAO,CAAC,kCAAkC,EAAED,QAAQ,CAAC,EAAEC,WAAW,QAAQ,KAAK,CAAC,CAAC;AACnF,CAAC;AAED;;;;;;;CAOC,GACD,OAAO,SAASC,UACdC,MAAiB,EACjBC,aAAqB,EACrBC,OAIC,EACO;IACR,OAAOA,SAASC,SACZZ,eACE,CAAC,mCAAmC,EAAES,OAAO,CAAC,EAAE,OAAOE,QAAQC,MAAM,KAAK,WAAWD,QAAQC,MAAM,GAAGb,iBAAiBY,QAAQC,MAAM,CAAC,CAAC,CAAC,EACxID,SAAST,QAAQ,KACjBS,SAASR,UAEX,CAAC,yCAAyC,EAAEO,kBAAkB,MAAM,AAACG,CAAAA,OAAOJ,WAAWI,OAAO,GAAE,IAAKA,OAAO,KAAKC,OAAOJ,iBAAiB,CAAC,CAAC,IAAI,CAAC;AACtJ,CAAC;AAED;;;;;;CAMC,GACD,OAAO,SAASK,eACdC,OAAkB,EAClBL,OAIC,EACmB;IACpB,OAAOA,QAAQM,MAAM,GACjBjB,eACE,CAAC,mCAAmC,EAAEgB,QAAQ,CAAC,EAAE,OAAOL,QAAQM,MAAM,KAAK,WAAWN,QAAQM,MAAM,GAAGlB,iBAAiBY,QAAQM,MAAM,CAAC,CAAC,CAAC,EACzIN,QAAQT,IAAI,IAAI,KAChBS,QAAQR,MAAM,IAEhBe,SAAS;AACf,CAAC;AAED;;;;;;CAMC,GACD,OAAO,SAASC,aACdH,OAAkB,EAClBI,SAAgC,EAChCT,OAGC,EACmB;IACpB,OAAOS,YACHpB,eACE,CAAC,iCAAiC,EAAEgB,QAAQ,CAAC,EAAE,OAAOI,cAAc,WAAWA,YAAYrB,iBAAiBqB,UAAU,CAAC,CAAC,EACxHT,SAAST,QAAQ,KACjBS,SAASR,UAEXe,SAAS;AACf,CAAC;AAED;;;;;;;CAOC,GACD,OAAO,SAASG,eACdL,OAAkB,EAClBI,SAAgC,EAChCT,OAGC,EACmB;IACpB,OAAOS,YACHpB,eACE,CAAC,oCAAoC,EAAEgB,QAAQ,CAAC,EAAE,OAAOI,cAAc,WAAWA,YAAYrB,iBAAiBqB,UAAU,CAAC,CAAC,EAC3HT,SAAST,QAAQ,KACjBS,SAASR,UAEXe,SAAS;AACf,CAAC;AAED;;;;;;CAMC,GACD,OAAO,SAASI,kBAAkBN,OAAkB,EAAEL,OAAkC,EAAU;IAChG,IAAIV,MAAM,CAAC,kCAAkC,EAAEe,QAAQ,WAAW,CAAC;IAEnE,IAAIL,SAASY,OAAO;QAClBtB,OAAO,CAAC,OAAO,EAAEU,QAAQY,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,OAAOtB;AACT,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
export * from './Collection.js';
|
|
1
2
|
export * from './base64.js';
|
|
2
3
|
export * from './bucket.js';
|
|
4
|
+
export * from './builders.js';
|
|
3
5
|
export * from './casing.js';
|
|
4
|
-
export * from './Collection.js';
|
|
5
6
|
export * from './colors.js';
|
|
6
|
-
export * from './files.js';
|
|
7
7
|
export * from './hash.js';
|
|
8
8
|
export * from './images.js';
|
|
9
9
|
export * from './logger.js';
|
|
10
|
+
export * from './oauth2.js';
|
|
10
11
|
export * from './permissions.js';
|
|
11
12
|
export * from './reactions.js';
|
|
12
13
|
export * from './token.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
export * from './Collection.js';
|
|
1
2
|
export * from './base64.js';
|
|
2
3
|
export * from './bucket.js';
|
|
4
|
+
export * from './builders.js';
|
|
3
5
|
export * from './casing.js';
|
|
4
|
-
export * from './Collection.js';
|
|
5
6
|
export * from './colors.js';
|
|
6
|
-
export * from './files.js';
|
|
7
7
|
export * from './hash.js';
|
|
8
8
|
export * from './images.js';
|
|
9
9
|
export * from './logger.js';
|
|
10
|
+
export * from './oauth2.js';
|
|
10
11
|
export * from './permissions.js';
|
|
11
12
|
export * from './reactions.js';
|
|
12
13
|
export * from './token.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './Collection.js'\nexport * from './base64.js'\nexport * from './bucket.js'\nexport * from './builders.js'\nexport * from './casing.js'\nexport * from './colors.js'\nexport * from './hash.js'\nexport * from './images.js'\nexport * from './logger.js'\nexport * from './oauth2.js'\nexport * from './permissions.js'\nexport * from './reactions.js'\nexport * from './token.js'\nexport * from './typeguards.js'\nexport * from './urlToBase64.js'\nexport * from './utils.js'\n"],"names":[],"mappings":"AAAA,cAAc,kBAAiB;AAC/B,cAAc,cAAa;AAC3B,cAAc,cAAa;AAC3B,cAAc,gBAAe;AAC7B,cAAc,cAAa;AAC3B,cAAc,cAAa;AAC3B,cAAc,YAAW;AACzB,cAAc,cAAa;AAC3B,cAAc,cAAa;AAC3B,cAAc,cAAa;AAC3B,cAAc,mBAAkB;AAChC,cAAc,iBAAgB;AAC9B,cAAc,aAAY;AAC1B,cAAc,kBAAiB;AAC/B,cAAc,mBAAkB;AAChC,cAAc,aAAY"}
|