@discordeno/utils 19.0.0-next.a196e22 → 19.0.0-next.a26c7c0

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 (50) hide show
  1. package/README.md +1 -1
  2. package/dist/bucket.d.ts +3 -1
  3. package/dist/bucket.d.ts.map +1 -1
  4. package/dist/bucket.js +24 -11
  5. package/dist/bucket.js.map +1 -1
  6. package/dist/builders/embeds.d.ts +146 -0
  7. package/dist/builders/embeds.d.ts.map +1 -0
  8. package/dist/builders/embeds.js +295 -0
  9. package/dist/builders/embeds.js.map +1 -0
  10. package/dist/builders.d.ts +4 -0
  11. package/dist/builders.d.ts.map +1 -0
  12. package/dist/builders.js +5 -0
  13. package/dist/builders.js.map +1 -0
  14. package/dist/casing.d.ts.map +1 -1
  15. package/dist/casing.js.map +1 -1
  16. package/dist/colors.d.ts.map +1 -1
  17. package/dist/colors.js +1 -5
  18. package/dist/colors.js.map +1 -1
  19. package/dist/images.js +1 -1
  20. package/dist/images.js.map +1 -1
  21. package/dist/index.d.ts +3 -2
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +3 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/logger.d.ts.map +1 -1
  26. package/dist/logger.js +1 -1
  27. package/dist/logger.js.map +1 -1
  28. package/dist/oauth2.d.ts +58 -0
  29. package/dist/oauth2.d.ts.map +1 -0
  30. package/dist/oauth2.js +16 -0
  31. package/dist/oauth2.js.map +1 -0
  32. package/dist/token.d.ts +1 -1
  33. package/dist/token.d.ts.map +1 -1
  34. package/dist/token.js +8 -3
  35. package/dist/token.js.map +1 -1
  36. package/dist/typeguards.d.ts +2 -1
  37. package/dist/typeguards.d.ts.map +1 -1
  38. package/dist/typeguards.js +3 -0
  39. package/dist/typeguards.js.map +1 -1
  40. package/dist/urlToBase64.d.ts.map +1 -1
  41. package/dist/urlToBase64.js +0 -1
  42. package/dist/urlToBase64.js.map +1 -1
  43. package/dist/utils.d.ts.map +1 -1
  44. package/dist/utils.js +2 -1
  45. package/dist/utils.js.map +1 -1
  46. package/package.json +3 -3
  47. package/dist/files.d.ts +0 -4
  48. package/dist/files.d.ts.map +0 -1
  49. package/dist/files.js +0 -41
  50. package/dist/files.js.map +0 -1
package/README.md CHANGED
@@ -149,6 +149,6 @@ and unofficial templates:
149
149
 
150
150
  ## Links
151
151
 
152
- - [Website](https://discordeno.github.io/discordeno/)
152
+ - [Website](https://discordeno.js.org/)
153
153
  - [Documentation](https://doc.deno.land/https/deno.land/x/discordeno/mod.ts)
154
154
  - [Discord](https://discord.com/invite/5vBgXk3UcZ)
package/dist/bucket.d.ts CHANGED
@@ -9,13 +9,15 @@ export declare class LeakyBucket implements LeakyBucketOptions {
9
9
  queue: Array<(value: void | PromiseLike<void>) => void>;
10
10
  /** Whether or not the queue is already processing. */
11
11
  processing: boolean;
12
- /** The timeout id for the timer to reduce the used amount by the refill amount. */
12
+ /** The timeout id for the timer to reduce the used amount by the refill amount. */
13
13
  timeoutId?: NodeJS.Timeout;
14
14
  /** The timestamp in milliseconds when the next refill is scheduled. */
15
15
  refillsAt?: number;
16
16
  constructor(options?: LeakyBucketOptions);
17
17
  /** The amount of requests that still remain. */
18
18
  get remaining(): number;
19
+ /** Refills the bucket as needed. */
20
+ refillBucket(): void;
19
21
  /** Begin processing the queue. */
20
22
  processQueue(): Promise<void>;
21
23
  /** Pauses the execution until the request is available to be made. */
@@ -1 +1 @@
1
- {"version":3,"file":"bucket.d.ts","sourceRoot":"","sources":["../src/bucket.ts"],"names":[],"mappings":";AAGA,qBAAa,WAAY,YAAW,kBAAkB;IACpD,GAAG,EAAE,MAAM,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IAEpB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAI;IAChB,4FAA4F;IAC5F,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,CAA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oC;IACpC,YAAY,IAAI,IAAI;IAkBpB,kCAAkC;IAC5B,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAmDnC,sEAAsE;IAChE,OAAO,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAWrD;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB"}
package/dist/bucket.js CHANGED
@@ -12,13 +12,27 @@ export class LeakyBucket {
12
12
  /** The amount of requests that still remain. */ get remaining() {
13
13
  return this.max < this.used ? 0 : this.max - this.used;
14
14
  }
15
+ /** Refills the bucket as needed. */ refillBucket() {
16
+ logger.debug(`[LeakyBucket] Timeout for leaky bucket requests executed. Refilling bucket.`);
17
+ // Lower the used amount by the refill amount
18
+ this.used = this.refillAmount > this.used ? 0 : this.used - this.refillAmount;
19
+ // Reset the refillsAt timestamp since it just got refilled
20
+ this.refillsAt = undefined;
21
+ // Reset the timeoutId
22
+ clearTimeout(this.timeoutId);
23
+ this.timeoutId = undefined;
24
+ if (this.used > 0) {
25
+ this.timeoutId = setTimeout(()=>{
26
+ this.refillBucket();
27
+ }, this.refillInterval);
28
+ this.refillsAt = Date.now() + this.refillInterval;
29
+ }
30
+ }
15
31
  /** Begin processing the queue. */ async processQueue() {
16
- logger.debug('[Gateway] Processing queue');
32
+ logger.debug('[LeakyBucket] Processing queue');
17
33
  // There is already a queue that is processing
18
- if (this.processing) {
19
- logger.debug('[Gateway] Queue is already processing.');
20
- return;
21
- }
34
+ if (this.processing) return logger.debug('[LeakyBucket] Queue is already processing.');
35
+ this.processing = true;
22
36
  // Begin going through the queue.
23
37
  while(this.queue.length){
24
38
  if (this.remaining) {
@@ -31,11 +45,7 @@ export class LeakyBucket {
31
45
  if (!this.timeoutId) {
32
46
  logger.debug(`[LeakyBucket] Creating new timeout for leaky bucket requests.`);
33
47
  this.timeoutId = setTimeout(()=>{
34
- logger.debug(`[LeakyBucket] Timeout for leaky bucket requests executed. Refilling bucket.`);
35
- // Lower the used amount by the refill amount
36
- this.used -= this.refillAmount;
37
- // Reset the refillsAt timestamp since it just got refilled
38
- this.refillsAt = undefined;
48
+ this.refillBucket();
39
49
  }, this.refillInterval);
40
50
  // Set the time for when this refill will occur.
41
51
  this.refillsAt = Date.now() + this.refillInterval;
@@ -47,6 +57,9 @@ export class LeakyBucket {
47
57
  logger.debug(`[LeakyBucket] Delaying execution of leaky bucket requests for ${this.refillsAt - now}ms`);
48
58
  await delay(this.refillsAt - now);
49
59
  logger.debug(`[LeakyBucket] Resuming execution`);
60
+ } else {
61
+ logger.debug(`[LeakyBucket] Delaying execution of leaky bucket requests for 1000ms`);
62
+ await delay(1000);
50
63
  }
51
64
  }
52
65
  }
@@ -58,7 +71,7 @@ export class LeakyBucket {
58
71
  // High priority requests get added to the start of the queue
59
72
  if (highPriority) this.queue.unshift(resolve);
60
73
  else this.queue.push(resolve);
61
- // Each request should trigger the queue to be processesd.
74
+ // Each request should trigger the queue to be processed.
62
75
  void this.processQueue();
63
76
  });
64
77
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/bucket.ts"],"sourcesContent":["import logger from './logger.js'\nimport { delay } from './utils.js'\n\nexport class LeakyBucket implements LeakyBucketOptions {\n max: number\n refillInterval: number\n refillAmount: number\n\n /** The amount of requests that have been used up already. */\n used: number = 0\n /** The queue of requests to acquire an available request. Mapped by <shardId, resolve()> */\n queue: Array<(value: void | PromiseLike<void>) => void> = []\n /** Whether or not the queue is already processing. */\n processing: boolean = false\n /** The timeout id for the timer to reduce the used amount by the refill amount. */\n timeoutId?: NodeJS.Timeout\n /** The timestamp in milliseconds when the next refill is scheduled. */\n refillsAt?: number\n\n constructor(options?: LeakyBucketOptions) {\n this.max = options?.max ?? 1\n this.refillAmount = options?.refillAmount ? (options.refillAmount > this.max ? this.max : options.refillAmount) : 1\n this.refillInterval = options?.refillInterval ?? 5000\n }\n\n /** The amount of requests that still remain. */\n get remaining(): number {\n return this.max < this.used ? 0 : this.max - this.used\n }\n\n /** Begin processing the queue. */\n async processQueue(): Promise<void> {\n logger.debug('[Gateway] Processing queue')\n // There is already a queue that is processing\n if (this.processing) {\n logger.debug('[Gateway] Queue is already processing.')\n return\n }\n\n // Begin going through the queue.\n while (this.queue.length) {\n if (this.remaining) {\n logger.debug(`[LeakyBucket] Processing queue. Remaining: ${this.remaining} Length: ${this.queue.length}`)\n // Resolves the promise allowing the paused execution of this request to resolve and continue.\n this.queue.shift()?.()\n // A request can be made\n this.used++\n\n // Create a new timeout for this request if none exists.\n if (!this.timeoutId) {\n logger.debug(`[LeakyBucket] Creating new timeout for leaky bucket requests.`)\n this.timeoutId = setTimeout(() => {\n logger.debug(`[LeakyBucket] Timeout for leaky bucket requests executed. Refilling bucket.`)\n // Lower the used amount by the refill amount\n this.used -= this.refillAmount\n // Reset the refillsAt timestamp since it just got refilled\n this.refillsAt = undefined\n }, this.refillInterval)\n // Set the time for when this refill will occur.\n this.refillsAt = Date.now() + this.refillInterval\n }\n }\n\n // Check if a refill is scheduled, since we have used up all available requests\n else if (this.refillsAt) {\n const now = Date.now()\n // If there is time left until next refill, just delay execution.\n if (this.refillsAt > now) {\n logger.debug(`[LeakyBucket] Delaying execution of leaky bucket requests for ${this.refillsAt - now}ms`)\n await delay(this.refillsAt - now)\n logger.debug(`[LeakyBucket] Resuming execution`)\n }\n }\n }\n\n // Loop has ended mark false so it can restart later when needed\n this.processing = false\n }\n\n /** Pauses the execution until the request is available to be made. */\n async acquire(highPriority?: boolean): Promise<void> {\n return await new Promise((resolve) => {\n // High priority requests get added to the start of the queue\n if (highPriority) this.queue.unshift(resolve)\n // All other requests get pushed to the end.\n else this.queue.push(resolve)\n\n // Each request should trigger the queue to be processesd.\n void this.processQueue()\n })\n }\n}\n\nexport interface LeakyBucketOptions {\n /**\n * Max requests allowed at once.\n * @default 1\n */\n max?: number\n /**\n * Interval in milliseconds between refills.\n * @default 5000\n */\n refillInterval?: number\n /**\n * Amount of requests to refill at each interval.\n * @default 1\n */\n refillAmount?: number\n}\n"],"names":["logger","delay","LeakyBucket","constructor","options","used","queue","processing","max","refillAmount","refillInterval","remaining","processQueue","debug","length","shift","timeoutId","setTimeout","refillsAt","undefined","Date","now","acquire","highPriority","Promise","resolve","unshift","push"],"mappings":"AAAA,OAAOA,YAAY,cAAa;AAChC,SAASC,KAAK,QAAQ,aAAY;AAElC,OAAO,MAAMC;IAgBXC,YAAYC,OAA4B,CAAE;QAX1C,2DAA2D,QAC3DC,OAAe;QACf,0FAA0F,QAC1FC,QAA0D,EAAE;QAC5D,oDAAoD,QACpDC,aAAsB,KAAK;QAOzB,IAAI,CAACC,GAAG,GAAGJ,SAASI,OAAO;QAC3B,IAAI,CAACC,YAAY,GAAGL,SAASK,eAAgBL,QAAQK,YAAY,GAAG,IAAI,CAACD,GAAG,GAAG,IAAI,CAACA,GAAG,GAAGJ,QAAQK,YAAY,GAAI,CAAC;QACnH,IAAI,CAACC,cAAc,GAAGN,SAASM,kBAAkB;IACnD;IAEA,8CAA8C,GAC9C,IAAIC,YAAoB;QACtB,OAAO,IAAI,CAACH,GAAG,GAAG,IAAI,CAACH,IAAI,GAAG,IAAI,IAAI,CAACG,GAAG,GAAG,IAAI,CAACH,IAAI;IACxD;IAEA,gCAAgC,GAChC,MAAMO,eAA8B;QAClCZ,OAAOa,KAAK,CAAC;QACb,8CAA8C;QAC9C,IAAI,IAAI,CAACN,UAAU,EAAE;YACnBP,OAAOa,KAAK,CAAC;YACb;QACF,CAAC;QAED,iCAAiC;QACjC,MAAO,IAAI,CAACP,KAAK,CAACQ,MAAM,CAAE;YACxB,IAAI,IAAI,CAACH,SAAS,EAAE;gBAClBX,OAAOa,KAAK,CAAC,CAAC,2CAA2C,EAAE,IAAI,CAACF,SAAS,CAAC,SAAS,EAAE,IAAI,CAACL,KA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AAI,CAACb,YAAY;QACxB;IACF;AACF,CAAC"}
1
+ {"version":3,"sources":["../src/bucket.ts"],"sourcesContent":["import logger from './logger.js'\nimport { delay } from './utils.js'\n\nexport class LeakyBucket implements LeakyBucketOptions {\n max: number\n refillInterval: number\n refillAmount: number\n\n /** The amount of requests that have been used up already. */\n used: number = 0\n /** The queue of requests to acquire an available request. Mapped by <shardId, resolve()> */\n queue: Array<(value: void | PromiseLike<void>) => void> = []\n /** Whether or not the queue is already processing. */\n processing: boolean = false\n /** The timeout id for the timer to reduce the used amount by the refill amount. */\n timeoutId?: NodeJS.Timeout\n /** The timestamp in milliseconds when the next refill is scheduled. */\n refillsAt?: number\n\n constructor(options?: LeakyBucketOptions) {\n this.max = options?.max ?? 1\n this.refillAmount = options?.refillAmount ? (options.refillAmount > this.max ? this.max : options.refillAmount) : 1\n this.refillInterval = options?.refillInterval ?? 5000\n }\n\n /** The amount of requests that still remain. */\n get remaining(): number {\n return this.max < this.used ? 0 : this.max - this.used\n }\n\n /** Refills the bucket as needed. */\n refillBucket(): void {\n logger.debug(`[LeakyBucket] Timeout for leaky bucket requests executed. Refilling bucket.`)\n // Lower the used amount by the refill amount\n this.used = this.refillAmount > this.used ? 0 : this.used - this.refillAmount\n // Reset the refillsAt timestamp since it just got refilled\n this.refillsAt = undefined\n // Reset the timeoutId\n clearTimeout(this.timeoutId)\n this.timeoutId = undefined\n\n if (this.used > 0) {\n this.timeoutId = setTimeout(() => {\n this.refillBucket()\n }, this.refillInterval)\n this.refillsAt = Date.now() + this.refillInterval\n }\n }\n\n /** Begin processing the queue. */\n async processQueue(): Promise<void> {\n logger.debug('[LeakyBucket] Processing queue')\n\n // There is already a queue that is processing\n if (this.processing) return logger.debug('[LeakyBucket] Queue is already processing.')\n\n this.processing = true\n\n // Begin going through the queue.\n while (this.queue.length) {\n if (this.remaining) {\n logger.debug(`[LeakyBucket] Processing queue. Remaining: ${this.remaining} Length: ${this.queue.length}`)\n // Resolves the promise allowing the paused execution of this request to resolve and continue.\n this.queue.shift()?.()\n // A request can be made\n this.used++\n\n // Create a new timeout for this request if none exists.\n if (!this.timeoutId) {\n logger.debug(`[LeakyBucket] Creating new timeout for leaky bucket requests.`)\n\n this.timeoutId = setTimeout(() => {\n this.refillBucket()\n }, this.refillInterval)\n // Set the time for when this refill will occur.\n this.refillsAt = Date.now() + this.refillInterval\n }\n }\n\n // Check if a refill is scheduled, since we have used up all available requests\n else if (this.refillsAt) {\n const now = Date.now()\n // If there is time left until next refill, just delay execution.\n if (this.refillsAt > now) {\n logger.debug(`[LeakyBucket] Delaying execution of leaky bucket requests for ${this.refillsAt - now}ms`)\n await delay(this.refillsAt - now)\n logger.debug(`[LeakyBucket] Resuming execution`)\n }\n\n // If the refillsAt has passed but the timeout didn't yet execute delay the execution\n else {\n logger.debug(`[LeakyBucket] Delaying execution of leaky bucket requests for 1000ms`)\n await delay(1000)\n }\n }\n }\n\n // Loop has ended mark false so it can restart later when needed\n this.processing = false\n }\n\n /** Pauses the execution until the request is available to be made. */\n async acquire(highPriority?: boolean): Promise<void> {\n return await new Promise((resolve) => {\n // High priority requests get added to the start of the queue\n if (highPriority) this.queue.unshift(resolve)\n // All other requests get pushed to the end.\n else this.queue.push(resolve)\n\n // Each request should trigger the queue to be processed.\n void this.processQueue()\n })\n }\n}\n\nexport interface LeakyBucketOptions {\n /**\n * Max requests allowed at once.\n * @default 1\n */\n max?: number\n /**\n * Interval in milliseconds between refills.\n * @default 5000\n */\n refillInterval?: number\n /**\n * Amount of requests to refill at each interval.\n * @default 1\n */\n refillAmount?: number\n}\n"],"names":["logger","delay","LeakyBucket","constructor","options","used","queue","processing","max","refillAmount","refillInterval","remaining","refillBucket","debug","refillsAt","undefined","clearTimeout","timeoutId","setTimeout","Date","now","processQueue","length","shift","acquire","highPriority","Promise","resolve","unshift","push"],"mappings":"AAAA,OAAOA,YAAY,cAAa;AAChC,SAASC,KAAK,QAAQ,aAAY;AAElC,OAAO,MAAMC;IAgBXC,YAAYC,OAA4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AACC,UAAY;YACpC,6DAA6D;YAC7D,IAAIF,cAAc,IAAI,CAACnB,KAAK,CAACsB,OAAO,CAACD;iBAEhC,IAAI,CAACrB,KAAK,CAACuB,IAAI,CAACF;YAErB,yDAAyD;YACzD,KAAK,IAAI,CAACN,YAAY;QACxB;IACF;AACF,CAAC"}
@@ -0,0 +1,146 @@
1
+ import type { DiscordEmbed, DiscordEmbedAuthor, DiscordEmbedField, DiscordEmbedFooter, DiscordEmbedImage, DiscordEmbedThumbnail, DiscordEmbedVideo } from '@discordeno/types';
2
+ /**
3
+ * A builder to help create Discord embeds.
4
+ *
5
+ * @export
6
+ * @class EmbedsBuilder
7
+ * @typedef {EmbedsBuilder}
8
+ * @extends {Array<DiscordEmbed>}
9
+ * @example
10
+ * const embeds = new EmbedBuilder()
11
+ * .setTitle('My Embed')
12
+ * .setDescription('This is my new embed')
13
+ * .newEmbed()
14
+ * .setTitle('My Second Embed')
15
+ */
16
+ export declare class EmbedsBuilder extends Array<DiscordEmbed> {
17
+ #private;
18
+ /**
19
+ * Adds a new field to the embed fields array.
20
+ *
21
+ * @param {string} name - Field name
22
+ * @param {string} value - Field value
23
+ * @param {?boolean} [inline=false] - Field should be inline or not.
24
+ * @returns {EmbedsBuilder}
25
+ */
26
+ addField(name: string, value: string, inline?: boolean): EmbedsBuilder;
27
+ /**
28
+ * Creates a blank embed.
29
+ *
30
+ * @returns {EmbedsBuilder}
31
+ */
32
+ newEmbed(): EmbedsBuilder;
33
+ /**
34
+ * Set the current embed author.
35
+ *
36
+ * @param {string} name - Name of the author
37
+ * @param {?Omit<DiscordEmbedAuthor, 'name'>} [options] - Extra author options
38
+ * @returns {EmbedsBuilder}
39
+ */
40
+ setAuthor(name: string, options?: Omit<DiscordEmbedAuthor, 'name'>): EmbedsBuilder;
41
+ /**
42
+ * Set the color on the side of the current embed.
43
+ *
44
+ * @param {(number | string)} color - The color, in base16 or hex color code
45
+ * @returns {EmbedsBuilder}
46
+ */
47
+ setColor(color: number | string): EmbedsBuilder;
48
+ /**
49
+ * Set the current embed to a different index.
50
+ *
51
+ * 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.
52
+ *
53
+ * @param {?number} [index] - The index of the embed in the EmbedsBuilder array
54
+ * @returns {EmbedsBuilder}
55
+ */
56
+ setCurrentEmbed(index?: number): EmbedsBuilder;
57
+ /**
58
+ * Set the description of the current embed.
59
+ *
60
+ * @param {string} description - Description
61
+ * @returns {EmbedsBuilder}
62
+ */
63
+ setDescription(description: string): EmbedsBuilder;
64
+ /**
65
+ * Overwrite all fields on the current embed.
66
+ *
67
+ * @param {DiscordEmbedField[]} fields
68
+ * @returns {EmbedsBuilder}
69
+ */
70
+ setFields(fields: DiscordEmbedField[]): EmbedsBuilder;
71
+ /**
72
+ * Set the footer in the current embed.
73
+ *
74
+ * @param {string} text - The text to display in the footer
75
+ * @param {?Omit<DiscordEmbedFooter, 'text'>} [options]
76
+ * @returns {EmbedsBuilder}
77
+ */
78
+ setFooter(text: string, options?: Omit<DiscordEmbedFooter, 'text'>): EmbedsBuilder;
79
+ /**
80
+ * Set the image in the current embed.
81
+ *
82
+ * @param {string} url - URL of the image
83
+ * @param {?Omit<DiscordEmbedImage, 'url'>} [options]
84
+ * @returns {EmbedsBuilder}
85
+ */
86
+ setImage(url: string, options?: Omit<DiscordEmbedImage, 'url'>): EmbedsBuilder;
87
+ /**
88
+ * Set the provider of the current embed.
89
+ *
90
+ * @param {string} name
91
+ * @param {?string} [url]
92
+ * @returns {EmbedsBuilder}
93
+ */
94
+ setProvider(name: string, url?: string): EmbedsBuilder;
95
+ /**
96
+ * Set the color of the current embed to a random value.
97
+ *
98
+ * @returns {EmbedsBuilder}
99
+ */
100
+ setRandomColor(): EmbedsBuilder;
101
+ /**
102
+ * Set the title of the current embed.
103
+ *
104
+ * @param {string} title
105
+ * @param {?string} [url]
106
+ * @returns {EmbedsBuilder}
107
+ */
108
+ setTitle(title: string, url?: string): EmbedsBuilder;
109
+ /**
110
+ * Set the timestamp of the current embed.
111
+ *
112
+ * @param {?(string | number | Date)} [timestamp]
113
+ * @returns {EmbedsBuilder}
114
+ */
115
+ setTimestamp(timestamp?: string | number | Date): EmbedsBuilder;
116
+ /**
117
+ * Set the thumbnail of the current embed.
118
+ *
119
+ * @param {string} url - URL of the image
120
+ * @param {?Omit<DiscordEmbedThumbnail, 'url'>} [options]
121
+ * @returns {EmbedsBuilder}
122
+ */
123
+ setThumbnail(url: string, options?: Omit<DiscordEmbedThumbnail, 'url'>): EmbedsBuilder;
124
+ /**
125
+ * Set the URL of the current embed title.
126
+ *
127
+ * @param {string} url
128
+ * @returns {EmbedsBuilder}
129
+ */
130
+ setUrl(url: string): EmbedsBuilder;
131
+ /**
132
+ * Set the video of the current embed.
133
+ *
134
+ * @param {string} url
135
+ * @param {?Omit<DiscordEmbedVideo, 'url'>} [options]
136
+ * @returns {EmbedsBuilder}
137
+ */
138
+ setVideo(url: string, options?: Omit<DiscordEmbedVideo, 'url'>): EmbedsBuilder;
139
+ /**
140
+ * Validate all embeds available against current known Discord limits to help prevent bad requests.
141
+ *
142
+ * @returns {EmbedsBuilder}
143
+ */
144
+ validate(): EmbedsBuilder;
145
+ }
146
+ //# sourceMappingURL=embeds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeds.d.ts","sourceRoot":"","sources":["../../src/builders/embeds.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,mBAAmB,CAAA;AAE1B;;;;;;;;;;;;;GAaG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,YAAY,CAAC;;IAGpD;;;;;;;OAOG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa;IActE;;;;OAIG;IACH,QAAQ,IAAI,aA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,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,GAAG,aAAa;IAU9E;;;;OAIG;IACH,QAAQ,IAAI,aAAa;CA4F1B"}
@@ -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,M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AAI,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,4 @@
1
+ import { EmbedsBuilder } from './builders/embeds.js';
2
+ export * from './builders/embeds.js';
3
+ export declare const createEmbeds: () => EmbedsBuilder;
4
+ //# sourceMappingURL=builders.d.ts.map
@@ -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"}
@@ -0,0 +1,5 @@
1
+ import { EmbedsBuilder } from './builders/embeds.js';
2
+ export * from './builders/embeds.js';
3
+ export const createEmbeds = ()=>new EmbedsBuilder();
4
+
5
+ //# sourceMappingURL=builders.js.map
@@ -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"}
@@ -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,CAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAcnD;AAED,wBAAgB,SAAS,CAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAcrD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAepD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAapD"}
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"}