From e05ff1b9612ef25992103d7329cbfaa674d9912b Mon Sep 17 00:00:00 2001 From: Wise2006 <45759535+Wise2006@users.noreply.github.com> Date: Thu, 28 Oct 2021 17:52:03 +0300 Subject: [PATCH 1/7] feat: Add `Custom` typedefs. --- package-lock.json | 1 + src/lib/custom.js | 101 +++++++++++++++++++++++++++++----------------- 2 files changed, 65 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1c4b02c..7936a10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "weeby-js", "version": "1.2.0", "license": "AGPL-3.0", "dependencies": { diff --git a/src/lib/custom.js b/src/lib/custom.js index ce042ad..4c57357 100644 --- a/src/lib/custom.js +++ b/src/lib/custom.js @@ -2,10 +2,68 @@ const { get } = require("node-superfetch"); const chalk = require("chalk"); const { version } = require("../../package.json"); +/** +* A list of available fonts. +* Gotham, Stoneserif, Roboto, Arial, Impact, Riffic, Minecraft, Pinkycupid, Paladins, Pokemon, Oldenglish, Chalkduster, Akbar, Nexa, Verdana, Typewriter, Spongebob, Cornerofthesky +* @typedef {String} Fonts +*/ + /** * @class Custom */ class Custom { + /** + * Options for creating a customisable greeting image. + * @typedef {Object} GreetingOptions + * @property {String} icon - The link to an image (.png, .jpg, .gif) + * @property {String} background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) + * @property {String} name - The name of the greeted user. + * @property {String} greet - What should the user be greeted with? + * @property {String} [message] - Provide a message on the bottom of the user's name. + * @property {String} [greetHex] - The color of the greeting text. + * @property {String} [nameHex] - The color of the name text. + * @property {String} [circleHex] - The color of the circle. + * @property {String} [messageHex] - The color of the message text. + * @property {Fonts} [font] - The font of the text. + */ + + /** + * Options for creating a booster image. + * @typedef {Object} BoosterOptions + * @property {String} icon - The link to an image (.png, .jpg, .gif) + * @property {String} background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) + * @property {String} name - The name of the user who boosted the server. + * @property {String} title - The title of the booster card. + * @property {String} [message] - Provide a message on the bottom of the title. + * @property {String} [greetHex] - The color of the greeting text. + * @property {String} [nameHex] - The color of the name text. + * @property {String} [circleHex] - The color of the circle. + * @property {String} [messageHex] - The color of the message text. + * @property {Fonts} [font] - The font of the text. + */ + + /** + * Options for creating a rank card. + * @typedef {Object} RankOptions + * @property {string} avatar - The link to an image (.png, .jpg, .gif) + * @property {string} username - The username to print. + * @property {string} bgColor - The color of the background. + * @property {number} level - The Level the user is currently on. + * @property {number} xp - How much XP the user has. + * @property {Fonts} [font] - The font of the text. + */ + + /** + * Options for creating a level up card. + * @typedef {Object} LevelUpOptions + * @property {string} avatar - The link to an image (.png, .jpg, .gif) + * @property {string} bgColor - The color of the background. (Do not include the hashtag). + * @property {string} borderColor - The color of the avatar border. (Do not include the hashtag). + * @property {number} oldlevel - The old level of the user. + * @property {number} newlevel - The new level of the user. + * @property {Fonts} [font] - The font of the text. + */ + constructor(token, baseURL) { /** * Your Weeby API Token. @@ -23,18 +81,8 @@ class Custom { } /** - * Creates a customisable greeting image with Icon, Name, Greet and Background. Optional parameters can let you customise the color of each element, or let you add a message. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.icon - The link to an image (.png, .jpg, .gif) - * @param {string} options.background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) - * @param {string} options.name - The name of the greeted user. - * @param {string} options.greet - What should the user be greeted with? - * @param {string} [options.message] - Provide a message on the bottom of the user's name. - * @param {string} [options.greetHex=000000] - The color of the greet text. (Do not include the hashtag). - * @param {string} [options.nameHex=000000] - The color of the name text. (Do not include the hashtag). - * @param {string} [options.circleHex=000000] - The color of the avatar border. (Do not include the hashtag). - * @param {string} [options.messageHex=000000] - The color of the message text. (Do not include the hashtag). - * @param {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky')} [options.font=gotham] - The font to use, 'gotham' by default. + * Creates a customisable greeting image. Optional parameters can let you customise the color of each element, or let you add a message. + * @param {GreetingOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async greeting(options = {}) { @@ -63,18 +111,8 @@ class Custom { } /** - * Creates a customisable booster add/remove image with Icon, Name and Background. Optional queries can let you customise the color of each element. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.icon - The link to an image (.png, .jpg, .gif) - * @param {string} options.background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) - * @param {string} options.name - The name of the user who boosted the server. - * @param {string} options.title - The title of the booster card. - * @param {string} [options.message] - Provide a message on the bottom of title. - * @param {string} [options.titleHex =f47fff] - The color of the title text. (Do not include the hashtag). - * @param {string} [options.nameHex=FFFFFF] - The color of the name text. (Do not include the hashtag). - * @param {string} [options.circleHex=9f50a7] - The color of the avatar border. (Do not include the hashtag). - * @param {string} [options.messageHex=9f50a7] - The color of the message text. (Do not include the hashtag). - * @param {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky')} [options.font=nexa] - The font to use, 'nexa' by default. + * Creates a customisable booster add/remove image. Optional queries can let you customise the color of each element. + * @param {BoosterOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async booster(options = {}) { @@ -104,12 +142,7 @@ class Custom { /** * Creates a customisable rank card with Icon, Name, and leveling stats. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.avatar - The link to an image (.png, .jpg, .gif) - * @param {string} options.username - The username to print. - * @param {string} options.bgColor - The color of the background. - * @param {number} options.level - The Level the user is currently on. - * @param {number} options.xp - How much XP the user has. + * @param {RankOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async rank(options = {}) { @@ -134,13 +167,7 @@ class Custom { /** * Creates a customisable level up card. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.avatar - The link to an image (.png, .jpg, .gif) - * @param {string} options.bgColor - The color of the background. (Do not include the hashtag). - * @param {string} options.borderColor - The color of the avatar border. (Do not include the hashtag). - * @param {number} options.oldlevel - The old level of the user. - * @param {number} options.newlevel - The new level of the user. - * @param {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky')} [options.font=nexa] - The font to use, 'nexa' by default. + * @param {LevelUpOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async levelUp(options = {}) { From 2c537f8da87a9a310724833aad597bde2b5bcb83 Mon Sep 17 00:00:00 2001 From: Wise2006 <45759535+Wise2006@users.noreply.github.com> Date: Thu, 28 Oct 2021 18:58:02 +0300 Subject: [PATCH 2/7] feat: Add `Effects` typedefs. --- src/lib/effects.js | 50 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/src/lib/effects.js b/src/lib/effects.js index 4b507fb..602a2db 100644 --- a/src/lib/effects.js +++ b/src/lib/effects.js @@ -9,6 +9,37 @@ const level = require("../../assets/effects/level.json"); * @class Effects */ class Effects { + /** + * The options for general effects. + * @typedef {Object} GeneralOptions + * @property {string} type - The type of effect to apply. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + + /** + * The options for intensity effects. + * @typedef {Object} IntensityOptions + * @property {string} type - The type of effect to apply. + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {number} intensity - The intensity of the effect. + */ + + /** + * The options for level effects. + * @typedef {Object} LevelOptions + * @property {string} type - The type of effect to apply. + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {number} level - The level of the effect. + */ + + /** + * The options for resizing an image. + * @typedef {Object} ResizeOptions + * @property {number} width - The width of the image. (1-2000px) + * @property {number} height - The height of the image. (1-2000px) + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + constructor(token, baseURL) { /** * Your Weeby API Token. @@ -27,9 +58,7 @@ class Effects { /** * Applies an effect to the provided image. Please see https://weebyapi.xyz/api/docs#effects for the available effects. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Effect to use. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) + * @param {GeneralOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async general(options = {}) { @@ -56,10 +85,7 @@ class Effects { /** * Applies an effect to the provided image that can change the level. Please see https://weebyapi.xyz/api/docs#effects for the available effects. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Effect to use. - * @param {number} options.intensity - The intensity of the effect. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) + * @param {IntensityOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async intensity(options = {}) { @@ -90,10 +116,7 @@ class Effects { /** * Applies an effect to the provided image that can change the level. Please see https://weebyapi.xyz/api/docs#effects for the available effects. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Effect to use. - * @param {number} options.level - The level of the effect. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) + * @param {LevelOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async level(options = {}) { @@ -124,10 +147,7 @@ class Effects { /** * Resizes a provided image. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.width - The width of the resized image. (1-2000) - * @param {number} options.height - The height of the resized image. (1-2000) - * @param {string} options.image - The link to an image (.png, .jpg, .gif) + * @param {ResizeOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async resize(options = {}) { From 66803862f79a0e933145cfc4acf97bffef0a99e5 Mon Sep 17 00:00:00 2001 From: Wise2006 <45759535+Wise2006@users.noreply.github.com> Date: Thu, 28 Oct 2021 19:50:22 +0300 Subject: [PATCH 3/7] feat: Add `Generators` typedefs. --- src/lib/custom.js | 2 +- src/lib/generators.js | 172 ++++++++++++++++++++++++++++++------------ 2 files changed, 123 insertions(+), 51 deletions(-) diff --git a/src/lib/custom.js b/src/lib/custom.js index 4c57357..a3fd194 100644 --- a/src/lib/custom.js +++ b/src/lib/custom.js @@ -5,7 +5,7 @@ const { version } = require("../../package.json"); /** * A list of available fonts. * Gotham, Stoneserif, Roboto, Arial, Impact, Riffic, Minecraft, Pinkycupid, Paladins, Pokemon, Oldenglish, Chalkduster, Akbar, Nexa, Verdana, Typewriter, Spongebob, Cornerofthesky -* @typedef {String} Fonts +* @typedef {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky')} Fonts */ /** diff --git a/src/lib/generators.js b/src/lib/generators.js index 732e38d..7bead1f 100644 --- a/src/lib/generators.js +++ b/src/lib/generators.js @@ -11,6 +11,115 @@ const textImage = require("../../assets/generators/textImage.json"); * @class Generators */ class Generators { + /** + * The options for one image generators. + * @typedef {Object} OneImageOptions + * @property {string} type - The type of generator. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + + /** + * The options for two images generators. + * @typedef {Object} TwoImagesOptions + * @property {string} type - The type of generator. + * @property {string} firstImage - The link to the first image (.png, .jpg, .gif) + * @property {string} secondImage - The link to the second image (.png, .jpg, .gif) + */ + + /** + * The options for text generators. + * @typedef {Object} TextOptions + * @property {string} type - The type of generator. + * @property {string} text - The text to be displayed. + */ + + /** + * The options for two texts generators. + * @typedef {Object} TwoTextsOptions + * @property {string} type - The type of generator. + * @property {string} textOne - The first text to be displayed. + * @property {string} textTwo - The second text to be displayed. + */ + + /** + * The options for text image generators. + * @typedef {Object} TextImageOptions + * @property {string} type - The type of generator. + * @property {string} text - The text to be displayed. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + + /** + * The options for the eject generator. + * @typedef {Object} EjectOptions + * @property {string} text - The text to be displayed. + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {('ejected'|'imposter'|'notimposter')} outcome - The outcome of the generator. + */ + + /** + * The options for the friendship generator. + * @typedef {Object} FriendshipOptions + * @property {string} firstImage - The link to the first image (.png, .jpg, .gif) + * @property {string} secondImage - The link to the second image (.png, .jpg, .gif) + * @property {string} firstText - The first text to be displayed. + * @property {string} secondText - The second text to be displayed. + */ + + /** + * The options for the demotivational generator. + * @typedef {Object} DemotivationalOptions + * @property {string} text - The text to be displayed. + * @property {string} title - The title to be displayed. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + + /** + * The options for the RIP generator. + * @typedef {Object} RIPOptions + * @property {string} text - The text to be displayed. + * @property {string} username - The username to be displayed. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + + /** + * The options for the tweet generator. + * @typedef {Object} TweetOptions + * @property {string} username - The username to be displayed. + * @property {string} tweet - The tweet to be displayed. + * @property {string} avatar - The link to an image (.png, .jpg, .gif) + */ + + /** + * The options for the tweetfetch generator. + * @typedef {Object} TweetFetchOptions + * @property {string} username - The username to be displayed. + * @property {string} tweet - The tweet to be displayed. + */ + + /** + * The options for the spotify generator. + * @typedef {Object} SpotifyOptions + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {string} songName - The name of the song to print. + * @property {string} artist - The artist name to print. + * @property {string} userPicks - The user's picks name to print. + */ + + /** + * The options for the triggered generator. + * @typedef {Object} TriggeredOptions + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {boolean} [tint=true] - Whether the generated GIF should have a orange tint. Defaults to true. + */ + + /** + * The options for the currency generator. + * @typedef {Object} CurrencyOptions + * @property {('dollar'|'euro'|'pound'|'yen')} type - The type of currency. + * @property {number} amount - The amount of money to display. + */ + constructor(token, baseURL) { /** * Your Weeby API Token. @@ -29,9 +138,7 @@ class Generators { /** * Draws one image on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Generator. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) + * @param {OneImageOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async oneImage(options = {}) { @@ -58,10 +165,7 @@ class Generators { /** * Draws two images on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Generator. - * @param {string} options.firstImage - The link to the first image (.png, .jpg, .gif) - * @param {string} options.secondImage - The link to the second image (.png, .jpg, .gif) + * @param {TwoImagesOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async twoImages(options = {}) { @@ -90,9 +194,7 @@ class Generators { /** * Prints text on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Generator. - * @param {string} options.text - The text to print. + * @param {TextOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async text(options = {}) { @@ -119,10 +221,7 @@ class Generators { /** * Prints two texts on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Generator. - * @param {string} options.textOne - The first text to print. - * @param {string} options.textTwo - The second text to print. + * @param {TwoTextsOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async twoText(options = {}) { @@ -151,10 +250,7 @@ class Generators { /** * Draws an image and text on a requested generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The type of Generator - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {string} options.text - The text to print. + * @param {TextImageOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async textImage(options = {}) { @@ -181,10 +277,7 @@ class Generators { /** * Draws one image and one text on a Among Us Generator. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {string} options.text - The text to print. - * @param {('ejected'|'imposter'|'notimposter')} options.outcome - The type of outcome to display in the text. + * @param {EjectOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async eject(options = {}) { @@ -209,11 +302,7 @@ class Generators { /** * Prints two images and texts on a friendship banner. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.firstImage - The link to the first image (.png, .jpg, .gif) - * @param {string} options.secondImage - The link to the second image (.png, .jpg, .gif) - * @param {string} options.firstText - The first text to print. - * @param {string} options.secondText - The second text to print. + * @param {FriendshipOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async friendship(options = {}) { @@ -240,10 +329,7 @@ class Generators { /** * Draws an image, title and text on a demotivational poster. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {string} options.title - The title text to print. - * @param {string} options.text - The text to print. + * @param {DemotivationalOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async demotivational(options = {}) { @@ -268,10 +354,7 @@ class Generators { /** * Draws a image, username and message on a Gravestone. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.avatar - The link to an image (.png, .jpg, .gif) - * @param {string} options.username - The username to print. - * @param {string} options.message - The text to print. + * @param {RIPOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async rip(options = {}) { @@ -296,10 +379,7 @@ class Generators { /** * Generates a raw twitter tweet with username, tweet text and avatar. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.username - The username to print. - * @param {string} options.tweet - The text to print. - * @param {string} options.avatar - The link to an image (.png, .jpg, .gif) + * @param {TweetOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async tweet(options = {}) { @@ -324,9 +404,7 @@ class Generators { /** * Generates a twitter tweet with username (fetched from the Twitter API) and the tweet text. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.username - The username to print. - * @param {string} options.tweet - The text to print. + * @param {TweetFetchOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async tweetFetch(options = {}) { @@ -349,11 +427,7 @@ class Generators { /** * Generates a Fake Spotify Now Playing Image. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {string} options.songName - The name of the song to print. - * @param {string} options.artist - The artist name to print. - * @param {string} options.userPicks - The user's picks name to print. + * @param {SpotifyOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async spotifyNp(options = {}) { @@ -380,9 +454,7 @@ class Generators { /** * Draws one image on an animated triggered GIF. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {boolean} [options.tint=true] - Whether the generated GIF should have a orange tint. Defaults to True. + * @param {TriggeredOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async triggered(options = {}) { From 53cdfc109b9b7007bdfeb090ffcff08705fb6ed4 Mon Sep 17 00:00:00 2001 From: Wise2006 <45759535+Wise2006@users.noreply.github.com> Date: Fri, 29 Oct 2021 09:10:02 +0300 Subject: [PATCH 4/7] chore: Apply suggestions from reviews. --- src/lib/custom.js | 144 +++++++++++++------------- src/lib/generators.js | 234 +++++++++++++++++++++--------------------- 2 files changed, 188 insertions(+), 190 deletions(-) diff --git a/src/lib/custom.js b/src/lib/custom.js index 9fd59c4..429b0f7 100644 --- a/src/lib/custom.js +++ b/src/lib/custom.js @@ -6,57 +6,6 @@ const { version } = require("../../package.json"); * @class Custom */ class Custom { - /** - * Options for creating a customisable greeting image. - * @typedef {Object} GreetingOptions - * @param {string} icon - The link to an image (.png, .jpg, .gif) - * @param {string} background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) - * @param {string} name - The name of the greeted user. - * @param {string} greet - What should the user be greeted with? - * @param {string} [message] - Provide a message on the bottom of the user's name. - * @param {string} [greetHex=000000] - The color of the greet text. - * @param {string} [nameHex=000000] - The color of the name text. - * @param {string} [circleHex=000000] - The color of the avatar border. - * @param {string} [messageHex=000000] - The color of the message text. - * @param {FontType} [font=gotham] - The font to use, 'gotham' by default. - */ - - /** - * Options for creating a booster image. - * @typedef {Object} BoosterOptions - * @property {string} icon - The link to an image (.png, .jpg, .gif) - * @property {string} background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) - * @property {string} name - The name of the user who boosted the server. - * @property {string} title - The title of the booster card. - * @property {string} [message] - Provide a message on the bottom of title. - * @property {string} [titleHex =f47fff] - The color of the title text. (Do not include the hashtag). - * @property {string} [nameHex=FFFFFF] - The color of the name text. (Do not include the hashtag). - * @property {string} [circleHex=9f50a7] - The color of the avatar border. (Do not include the hashtag). - * @property {string} [messageHex=9f50a7] - The color of the message text. (Do not include the hashtag). - * @property {FontType} [font=nexa] - The font to use, 'nexa' by default. - */ - - /** - * Options for creating a rank card. - * @typedef {Object} RankOptions - * @property {string} avatar - The link to an image (.png, .jpg, .gif) - * @property {string} username - The username to print. - * @property {string} bgColor - The color of the background. - * @property {number} level - The level the user is currently on. - * @property {number} xp - How much XP the user has. - */ - - /** - * Options for creating a level up card. - * @typedef {Object} LevelUpOptions - * @property {string} avatar - The link to an image (.png, .jpg, .gif) - * @property {string} bgColor - The color of the background. (Do not include the hashtag). - * @property {string} borderColor - The color of the avatar border. (Do not include the hashtag). - * @property {number} oldlevel - The old level of the user. - * @property {number} newlevel - The new level of the user. - * @property {FontType} [font=nexa] - The font to use, 'nexa' by default. - */ - constructor(token, baseURL) { /** * Your Weeby API Token. @@ -189,24 +138,75 @@ class Custom { module.exports = Custom; /** -* A list of all available fonts -* * Gotham -* * Stoneserif -* * Roboto -* * Arial -* * Impact -* * Riffic -* * Minecraft -* * Pinkycupid -* * Paladins -* * Pokemon -* * Oldenglish -* * Chalkduster -* * Akbar -* * Nexa -* * Verdana -* * Typewriter -* * Spongebob -* * Cornerofthesky -* @typedef {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky'|'breesh')} FontType -*/ \ No newline at end of file + * A list of all available fonts + * * Gotham + * * Stoneserif + * * Roboto + * * Arial + * * Impact + * * Riffic + * * Minecraft + * * Pinkycupid + * * Paladins + * * Pokemon + * * Oldenglish + * * Chalkduster + * * Akbar + * * Nexa + * * Verdana + * * Typewriter + * * Spongebob + * * Cornerofthesky + * @typedef {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky'|'breesh')} FontType + */ + +/** + * Options for creating a customisable greeting image. + * @typedef {Object} GreetingOptions + * @param {string} icon - The link to an image (.png, .jpg, .gif) + * @param {string} background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) + * @param {string} name - The name of the greeted user. + * @param {string} greet - What should the user be greeted with? + * @param {string} [message] - Provide a message on the bottom of the user's name. + * @param {string} [greetHex=000000] - The color of the greet text. + * @param {string} [nameHex=000000] - The color of the name text. + * @param {string} [circleHex=000000] - The color of the avatar border. + * @param {string} [messageHex=000000] - The color of the message text. + * @param {FontType} [font=gotham] - The font to use, 'gotham' by default. + */ + +/** + * Options for creating a booster image. + * @typedef {Object} BoosterOptions + * @property {string} icon - The link to an image (.png, .jpg, .gif) + * @property {string} background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) + * @property {string} name - The name of the user who boosted the server. + * @property {string} title - The title of the booster card. + * @property {string} [message] - Provide a message on the bottom of title. + * @property {string} [titleHex =f47fff] - The color of the title text. (Do not include the hashtag). + * @property {string} [nameHex=FFFFFF] - The color of the name text. (Do not include the hashtag). + * @property {string} [circleHex=9f50a7] - The color of the avatar border. (Do not include the hashtag). + * @property {string} [messageHex=9f50a7] - The color of the message text. (Do not include the hashtag). + * @property {FontType} [font=nexa] - The font to use, 'nexa' by default. + */ + +/** + * Options for creating a rank card. + * @typedef {Object} RankOptions + * @property {string} avatar - The link to an image (.png, .jpg, .gif) + * @property {string} username - The username to print. + * @property {string} bgColor - The color of the background. + * @property {number} level - The level the user is currently on. + * @property {number} xp - How much XP the user has. + */ + +/** + * Options for creating a level up card. + * @typedef {Object} LevelUpOptions + * @property {string} avatar - The link to an image (.png, .jpg, .gif) + * @property {string} bgColor - The color of the background. (Do not include the hashtag). + * @property {string} borderColor - The color of the avatar border. (Do not include the hashtag). + * @property {number} oldlevel - The old level of the user. + * @property {number} newlevel - The new level of the user. + * @property {FontType} [font=nexa] - The font to use, 'nexa' by default. + */ \ No newline at end of file diff --git a/src/lib/generators.js b/src/lib/generators.js index d8ab420..4311828 100644 --- a/src/lib/generators.js +++ b/src/lib/generators.js @@ -11,115 +11,6 @@ const textImage = require("../../assets/generators/textImage.json"); * @class Generators */ class Generators { - /** - * The options for one image generators. - * @typedef {Object} OneImageOptions - * @property {string} type - The type of generator. - * @property {string} image - The link to an image (.png, .jpg, .gif) - */ - - /** - * The options for two images generators. - * @typedef {Object} TwoImagesOptions - * @property {string} type - The type of generator. - * @property {string} firstImage - The link to the first image (.png, .jpg, .gif) - * @property {string} secondImage - The link to the second image (.png, .jpg, .gif) - */ - - /** - * The options for text generators. - * @typedef {Object} TextOptions - * @property {string} type - The type of generator. - * @property {string} text - The text to be displayed. - */ - - /** - * The options for two texts generators. - * @typedef {Object} TwoTextsOptions - * @property {string} type - The type of generator. - * @property {string} textOne - The first text to be displayed. - * @property {string} textTwo - The second text to be displayed. - */ - - /** - * The options for text image generators. - * @typedef {Object} TextImageOptions - * @property {string} type - The type of generator. - * @property {string} text - The text to be displayed. - * @property {string} image - The link to an image (.png, .jpg, .gif) - */ - - /** - * The options for the eject generator. - * @typedef {Object} EjectOptions - * @property {string} text - The text to be displayed. - * @property {string} image - The link to an image (.png, .jpg, .gif) - * @property {EjectOutcomes} outcome - The outcome of the generator. - */ - - /** - * The options for the friendship generator. - * @typedef {Object} FriendshipOptions - * @property {string} firstImage - The link to the first image (.png, .jpg, .gif) - * @property {string} secondImage - The link to the second image (.png, .jpg, .gif) - * @property {string} firstText - The first text to be displayed. - * @property {string} secondText - The second text to be displayed. - */ - - /** - * The options for the demotivational generator. - * @typedef {Object} DemotivationalOptions - * @property {string} text - The text to be displayed. - * @property {string} title - The title to be displayed. - * @property {string} image - The link to an image (.png, .jpg, .gif) - */ - - /** - * The options for the RIP generator. - * @typedef {Object} RIPOptions - * @property {string} message - The text to be displayed. - * @property {string} username - The username to be displayed. - * @property {string} image - The link to an image (.png, .jpg, .gif) - */ - - /** - * The options for the tweet generator. - * @typedef {Object} TweetOptions - * @property {string} username - The username to be displayed. - * @property {string} tweet - The tweet to be displayed. - * @property {string} avatar - The link to an image (.png, .jpg, .gif) - */ - - /** - * The options for the tweetfetch generator. - * @typedef {Object} TweetFetchOptions - * @property {string} username - The username to be displayed. - * @property {string} tweet - The tweet to be displayed. - */ - - /** - * The options for the spotify generator. - * @typedef {Object} SpotifyOptions - * @param {string} image - The link to an image (.png, .jpg, .gif) - * @param {string} title - The name of the song to be displayed. - * @param {string} artist - The artist name to be displayed. - * @param {string} album - The album name to be displayed. - */ - - /** - * The options for the triggered generator. - * @typedef {Object} TriggeredOptions - * @property {string} image - The link to an image (.png, .jpg, .gif) - * @property {boolean} [tint=true] - Whether the generated GIF should have a orange tint. Defaults to true. - */ - - /** - * The options for the currency generator. - * @typedef {Object} CurrencyOptions - * @property {('dollar'|'euro'|'pound'|'yen')} type - The type of currency. - * @property {number} amount - The amount of money to display. - */ - constructor(token, baseURL) { /** * Your Weeby API Token. @@ -504,9 +395,7 @@ class Generators { /** * Generates a image with the specified currency and its amount. - * @param {Object} options - The options that contain the required parameters. - * @param {CurrencyType} type - The type of currency. - * @param {number} amount - The amount of money to display. + * @param {CurrencyOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async currency({ type, amount }) { @@ -552,11 +441,120 @@ class Generators { module.exports = Generators; /** -* All available Eject Outcomes: -* @typedef {('ejected'|'imposter'|'notimposter')} EjectOutcomes -*/ + * All available eject Outcomes: + * @typedef {('ejected'|'imposter'|'notimposter')} EjectOutcomes + */ + +/** + * All available currency types: + * @typedef {('dollar'|'euro'|'pound'|'yen')} CurrencyType + */ + +/** + * The options for one image generators. + * @typedef {Object} OneImageOptions + * @property {string} type - The type of generator. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + +/** + * The options for two images generators. + * @typedef {Object} TwoImagesOptions + * @property {string} type - The type of generator. + * @property {string} firstImage - The link to the first image (.png, .jpg, .gif) + * @property {string} secondImage - The link to the second image (.png, .jpg, .gif) + */ + +/** + * The options for text generators. + * @typedef {Object} TextOptions + * @property {string} type - The type of generator. + * @property {string} text - The text to be displayed. + */ + +/** + * The options for two texts generators. + * @typedef {Object} TwoTextsOptions + * @property {string} type - The type of generator. + * @property {string} textOne - The first text to be displayed. + * @property {string} textTwo - The second text to be displayed. + */ + +/** + * The options for text image generators. + * @typedef {Object} TextImageOptions + * @property {string} type - The type of generator. + * @property {string} text - The text to be displayed. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + +/** + * The options for the eject generator. + * @typedef {Object} EjectOptions + * @property {string} text - The text to be displayed. + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {EjectOutcomes} outcome - The outcome of the generator. + */ + +/** + * The options for the friendship generator. + * @typedef {Object} FriendshipOptions + * @property {string} firstImage - The link to the first image (.png, .jpg, .gif) + * @property {string} secondImage - The link to the second image (.png, .jpg, .gif) + * @property {string} firstText - The first text to be displayed. + * @property {string} secondText - The second text to be displayed. + */ + +/** + * The options for the demotivational generator. + * @typedef {Object} DemotivationalOptions + * @property {string} text - The text to be displayed. + * @property {string} title - The title to be displayed. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + +/** + * The options for the RIP generator. + * @typedef {Object} RIPOptions + * @property {string} message - The text to be displayed. + * @property {string} username - The username to be displayed. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + +/** + * The options for the tweet generator. + * @typedef {Object} TweetOptions + * @property {string} username - The username to be displayed. + * @property {string} tweet - The tweet to be displayed. + * @property {string} avatar - The link to an image (.png, .jpg, .gif) + */ + +/** + * The options for the tweetfetch generator. + * @typedef {Object} TweetFetchOptions + * @property {string} username - The username to be displayed. + * @property {string} tweet - The tweet to be displayed. + */ + +/** + * The options for the spotify generator. + * @typedef {Object} SpotifyOptions + * @param {string} image - The link to an image (.png, .jpg, .gif) + * @param {string} title - The name of the song to be displayed. + * @param {string} artist - The artist name to be displayed. + * @param {string} album - The album name to be displayed. + */ + +/** + * The options for the triggered generator. + * @typedef {Object} TriggeredOptions + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {boolean} [tint=true] - Whether the generated GIF should have a orange tint. Defaults to true. + */ /** -* All available currency types: -* @typedef {('dollar'|'euro'|'pound'|'yen')} CurrencyType -*/ \ No newline at end of file + * The options for the currency generator. + * @typedef {Object} CurrencyOptions + * @property {CurrencyType} type - The type of currency. + * @property {number} amount - The amount of money to display. + */ \ No newline at end of file From df451fda5baf39a20e85e9723cf91adf91bf9332 Mon Sep 17 00:00:00 2001 From: Wise2006 <45759535+Wise2006@users.noreply.github.com> Date: Fri, 29 Oct 2021 09:15:59 +0300 Subject: [PATCH 5/7] feat: Move `FontType` typedef to seperate file. --- src/lib/custom.js | 23 ----------------------- src/lib/typedefs.js | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) create mode 100644 src/lib/typedefs.js diff --git a/src/lib/custom.js b/src/lib/custom.js index 429b0f7..da5f44f 100644 --- a/src/lib/custom.js +++ b/src/lib/custom.js @@ -137,29 +137,6 @@ class Custom { module.exports = Custom; -/** - * A list of all available fonts - * * Gotham - * * Stoneserif - * * Roboto - * * Arial - * * Impact - * * Riffic - * * Minecraft - * * Pinkycupid - * * Paladins - * * Pokemon - * * Oldenglish - * * Chalkduster - * * Akbar - * * Nexa - * * Verdana - * * Typewriter - * * Spongebob - * * Cornerofthesky - * @typedef {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky'|'breesh')} FontType - */ - /** * Options for creating a customisable greeting image. * @typedef {Object} GreetingOptions diff --git a/src/lib/typedefs.js b/src/lib/typedefs.js new file mode 100644 index 0000000..0ec47f5 --- /dev/null +++ b/src/lib/typedefs.js @@ -0,0 +1,22 @@ +/** + * A list of all available fonts + * * Gotham + * * Stoneserif + * * Roboto + * * Arial + * * Impact + * * Riffic + * * Minecraft + * * Pinkycupid + * * Paladins + * * Pokemon + * * Oldenglish + * * Chalkduster + * * Akbar + * * Nexa + * * Verdana + * * Typewriter + * * Spongebob + * * Cornerofthesky + * @typedef {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky'|'breesh')} FontType + */ \ No newline at end of file From 274fcfba31d7dddf0aeb8ded58c3b63560f67c63 Mon Sep 17 00:00:00 2001 From: Wise2006 <45759535+Wise2006@users.noreply.github.com> Date: Fri, 29 Oct 2021 11:58:46 +0300 Subject: [PATCH 6/7] feat: Fix all issues and update typings. --- package.json | 1 + src/lib/generators.js | 22 +- src/lib/json.js | 87 ++++---- src/lib/overlays.js | 11 +- src/lib/utility.js | 90 +++++--- typings/index.d.ts | 60 +++++- typings/lib/custom.d.ts | 150 +++++++++++++ typings/lib/effects.d.ts | 118 ++++++++++ typings/lib/generators.d.ts | 369 ++++++++++++++++++++++++++++++++ typings/{src => }/lib/gif.d.ts | 18 +- typings/{src => }/lib/json.d.ts | 158 ++++++++------ typings/lib/overlays.d.ts | 38 ++++ typings/lib/typedefs.d.ts | 22 ++ typings/lib/utility.d.ts | 225 +++++++++++++++++++ typings/src/lib/custom.d.ts | 101 --------- typings/src/lib/effects.d.ts | 61 ------ typings/src/lib/generators.d.ts | 193 ----------------- typings/src/lib/overlays.d.ts | 22 -- 18 files changed, 1199 insertions(+), 547 deletions(-) create mode 100644 typings/lib/custom.d.ts create mode 100644 typings/lib/effects.d.ts create mode 100644 typings/lib/generators.d.ts rename typings/{src => }/lib/gif.d.ts (65%) rename typings/{src => }/lib/json.d.ts (68%) create mode 100644 typings/lib/overlays.d.ts create mode 100644 typings/lib/typedefs.d.ts create mode 100644 typings/lib/utility.d.ts delete mode 100644 typings/src/lib/custom.d.ts delete mode 100644 typings/src/lib/effects.d.ts delete mode 100644 typings/src/lib/generators.d.ts delete mode 100644 typings/src/lib/overlays.d.ts diff --git a/package.json b/package.json index 1ad8a33..1e49ed3 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "start": "node .", "docs": "docgen --source src --custom docs/index.yml --output docs/docs.json", "docs:test": "docgen --source src --custom docs/index.yml", + "types": "tsc", "test": "eslint --ignore-path .eslintignore .", "lint": "eslint --fix --ignore-path .eslintignore ." }, diff --git a/src/lib/generators.js b/src/lib/generators.js index 4311828..aacdd1b 100644 --- a/src/lib/generators.js +++ b/src/lib/generators.js @@ -345,9 +345,7 @@ class Generators { /** * Generates an Image, Text and Color on the This Is Spotify Meme. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {string} image - The link to an image (.png, .jpg, .gif) - * @param {string} text - The text to print. - * @param {string} color - The hex color of the background. + * @param {ThisIsSpotifyOptions} options - The options that contain the required parameters. * @returns {Promise} The generated image in a buffer. */ async thisIsSpotify({ image, text, color } = {}) { @@ -518,7 +516,7 @@ module.exports = Generators; * @typedef {Object} RIPOptions * @property {string} message - The text to be displayed. * @property {string} username - The username to be displayed. - * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {string} avatar - The link to an image (.png, .jpg, .gif) */ /** @@ -539,10 +537,10 @@ module.exports = Generators; /** * The options for the spotify generator. * @typedef {Object} SpotifyOptions - * @param {string} image - The link to an image (.png, .jpg, .gif) - * @param {string} title - The name of the song to be displayed. - * @param {string} artist - The artist name to be displayed. - * @param {string} album - The album name to be displayed. + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {string} title - The name of the song to be displayed. + * @property {string} artist - The artist name to be displayed. + * @property {string} album - The album name to be displayed. */ /** @@ -552,6 +550,14 @@ module.exports = Generators; * @property {boolean} [tint=true] - Whether the generated GIF should have a orange tint. Defaults to true. */ +/** + * The options for the this is spotify generator. + * @typedef {Object} ThisIsSpotifyOptions + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {string} text - The text to print. + * @property {string} color - The hex color of the background. + */ + /** * The options for the currency generator. * @typedef {Object} CurrencyOptions diff --git a/src/lib/json.js b/src/lib/json.js index b8e544f..e28655f 100644 --- a/src/lib/json.js +++ b/src/lib/json.js @@ -104,8 +104,7 @@ class JSON { /** * Formats the provided text into a different style. - * @param {string} type - The type of text formatter. - * @param {string} text - The text to format. + * @param {TextFormatterOptions} options - The options to use. * @returns {Promise} The response in a string. */ async textFormat({ type, text } = {}) { @@ -160,51 +159,57 @@ module.exports = JSON; /** * @typedef {Object} LyricsResponse - The response object for lyrics. -* @prop {number} id - The ID of the song. -* @prop {string} url - The Genius Lyrics URL. -* @prop {Object} track - The track object. -* @prop {string} track.name - The name of the song. -* @prop {string} track.thumbnail - The thumbnail of the song. -* @prop {string} track.media - The URL of the song. -* @prop {Object} artist - The artist object. -* @prop {string} artist.name - The name of the artist. -* @prop {string} artist.thumbnail - The thumbnail of the artist. -* @prop {number} artist.id - The ID of the artist. -* @prop {Object} artist - The artist object. -* @prop {Object} album - The album object. -* @prop {string} album.name - The name of the album. -* @prop {string} album.thumbnail - The thumbnail of the album. -* @prop {number} album.id - The ID of the album. -* @prop {Object} colors - The colors object. -* @prop {string} colors.songArtPrimary - The primary color of the song art. -* @prop {string} colors.songArtSecondary - The secondary color of the song art. -* @prop {string} colors.songArtText - The text color of the song art. -* @prop {Object} stats - The stats object. -* @prop {boolean} stats.hot - The number of views. -* @prop {number} stats.pageViews - The number of page views. -* @prop {number} stats.contributors - The number of contributors. -* @prop {number} stats.transcribers - The number of transcribers. -* @prop {number} stats.accepted_annotations - The number of accepted annotations. -* @prop {recordingLocation} album.recordingLocation - The recording location of the song/album. -* @prop {string} album.releaseDate - The release date of the song. -* @prop {string} album.formattedReleaseDate - The formatted version of the release date. -* @prop {string} lyrics - The lyrics of the song. +* @property {number} id - The ID of the song. +* @property {string} url - The Genius Lyrics URL. +* @property {Object} track - The track object. +* @property {string} track.name - The name of the song. +* @property {string} track.thumbnail - The thumbnail of the song. +* @property {string} track.media - The URL of the song. +* @property {Object} artist - The artist object. +* @property {string} artist.name - The name of the artist. +* @property {string} artist.thumbnail - The thumbnail of the artist. +* @property {number} artist.id - The ID of the artist. +* @property {Object} artist - The artist object. +* @property {Object} album - The album object. +* @property {string} album.name - The name of the album. +* @property {string} album.thumbnail - The thumbnail of the album. +* @property {number} album.id - The ID of the album. +* @property {Object} colors - The colors object. +* @property {string} colors.songArtPrimary - The primary color of the song art. +* @property {string} colors.songArtSecondary - The secondary color of the song art. +* @property {string} colors.songArtText - The text color of the song art. +* @property {Object} stats - The stats object. +* @property {boolean} stats.hot - The number of views. +* @property {number} stats.pageViews - The number of page views. +* @property {number} stats.contributors - The number of contributors. +* @property {number} stats.transcribers - The number of transcribers. +* @property {number} stats.accepted_annotations - The number of accepted annotations. +* @property {recordingLocation} album.recordingLocation - The recording location of the song/album. +* @property {string} album.releaseDate - The release date of the song. +* @property {string} album.formattedReleaseDate - The formatted version of the release date. +* @property {string} lyrics - The lyrics of the song. */ /** * @typedef {Object} MemeResponse - The Meme Response object. -* @prop {string} subreddit - The name of the Subreddit. -* @prop {string} subredditURL - The URL of the Subreddit. -* @prop {string} url - The image URL of the post. -* @prop {string} permaURL - The URL of of the post. -* @prop {string} title - The title of the post. -* @prop {string} author - The author of the post. -* @prop {string} date - The date the post was created. -* @prop {number} score - The number of scores the post earned. -* @prop {number} comments - The number of comments on the post. -* @prop {number} awards - The number of awards given on the post. +* @property {string} subreddit - The name of the Subreddit. +* @property {string} subredditURL - The URL of the Subreddit. +* @property {string} url - The image URL of the post. +* @property {string} permaURL - The URL of of the post. +* @property {string} title - The title of the post. +* @property {string} author - The author of the post. +* @property {string} date - The date the post was created. +* @property {number} score - The number of scores the post earned. +* @property {number} comments - The number of comments on the post. +* @property {number} awards - The number of awards given on the post. */ +/** + * @typedef {Object} TextFormatterOptions - The options object for the text formatter. + * @property {string} type - The type of text formatter. + * @property {string} text - The text to format. + */ + /** * All available Meme Categories: * @typedef {('meme'|'memes'|'wholesomememes'|'dankmemes')} MemeCategory diff --git a/src/lib/overlays.js b/src/lib/overlays.js index 79c39ab..b0f96c8 100644 --- a/src/lib/overlays.js +++ b/src/lib/overlays.js @@ -25,8 +25,7 @@ class Overlays { /** * Draws one image on a requested image overlay. Please see https://weebyapi.xyz/api/docs#overlays for the available overlays. - * @param {string} type - The Type of Overlay. - * @param {string} image - The link to an image (.png, .jpg, .gif) + * @param {OverlaysOptions} options The options for the request * @returns {Promise} The generated image in a buffer. */ async fetch({ type, image }) { @@ -53,4 +52,10 @@ class Overlays { } } -module.exports = Overlays; \ No newline at end of file +module.exports = Overlays; + +/** + * @typedef {Object} OverlaysOptions + * @property {string} type - The type of overlay. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ \ No newline at end of file diff --git a/src/lib/utility.js b/src/lib/utility.js index 34f9012..c1a3254 100644 --- a/src/lib/utility.js +++ b/src/lib/utility.js @@ -24,8 +24,7 @@ class Utility { /** * Checks if a user has voted for a bot on Top.gg - * @param {string} botID - The ID of the Bot. - * @param {string} userID - The ID of the User. + * @param {TopGGVoteCheckerOptions} options - The options you want to use. * @returns {Promise} */ async topGGVoteChecker({ botID, userID }) { @@ -48,9 +47,7 @@ class Utility { /** * Converts the provided currency to a different currency. - * @param {string} from - A valid ISO 4217 code of the currency (i.e. USD). Refer to this: https://www.xe.com/iso4217.php - * @param {string} to - A valid ISO 4217 code of the currency (i.e. USD). Refer to this: https://www.xe.com/iso4217.php - * @param {number} amount - The amount you want to have converted. + * @param {CurrencyConverterOptions} options - The options you want to use. * @returns {Promise} */ async currencyConverter({ from, to, amount } = {}) { @@ -75,9 +72,7 @@ class Utility { /** * Translate the provided text to another language. - * @param {string} from - A valid ISO language code. Refer to this: http://www.lingoes.net/en/translator/langcode.htm - * @param {string} to - A valid ISO language code. Refer to this: http://www.lingoes.net/en/translator/langcode.htm - * @param {number} text - The text to translate. + * @param {TranslatorOptions} options - The options you want to use. * @returns {Promise} */ async translate({ from, to, text } = {}) { @@ -102,8 +97,7 @@ class Utility { /** * Returns the weather for the provided location. - * @param {string} location - The location you want to get the weather for. - * @param {string} degreeType - The degree type you want to get the weather in. + * @param {WeatherOptions} options - The options you want to use. * @returns {Promise} */ async weather({ location, degreeType } = {}) { @@ -127,6 +121,12 @@ class Utility { module.exports = Utility; +/** + * @typedef {Object} TopGGVoteCheckerOptions - The options for the TopGGVoteChecker. + * @property {string} botID - The ID of the bot you want to check. + * @property {string} userID - The ID of the user you want to check. + */ + /** * @typedef {Object} TopGGVoteCheckerResponse - The response from the Top.gg Vote Checker method. * @property {string} userID - The ID of the user. @@ -138,39 +138,59 @@ module.exports = Utility; * @property {boolean} isWeekend - Whether the user voted on a weekend or not. */ +/** + * @typedef {Object} TranslateOptions - The options for the Translate method. + * @property {string} from - A valid ISO language code. Refer to this: http://www.lingoes.net/en/translator/langcode.htm + * @property {string} to - A valid ISO language code. Refer to this: http://www.lingoes.net/en/translator/langcode.htm + * @property {number} text - The text to translate. + */ + /** * @typedef {Object} TranslateResponse - The response of the translate method. - * @prop {Object} from - The language the text was translated from. - * @prop {string} from.language - The language code. - * @prop {string} from.text - The text before translation. - * @prop {Object} to - The language the text was translated to. - * @prop {string} to.language - The language code. - * @prop {string} to.text - The text that was translated. + * @property {Object} from - The language the text was translated from. + * @property {string} from.language - The language code. + * @property {string} from.text - The text before translation. + * @property {Object} to - The language the text was translated to. + * @property {string} to.language - The language code. + * @property {string} to.text - The text that was translated. + */ + +/** + * @typedef {Object} CurrencyConverterOptions - The options for the Currency Converter. + * @property {string} from - A valid ISO 4217 code of the currency (i.e. USD). Refer to this: https://www.xe.com/iso4217.php + * @property {string} to - A valid ISO 4217 code of the currency (i.e. USD). Refer to this: https://www.xe.com/iso4217.php + * @property {number} amount - The amount you want to have converted. */ /** * @typedef {Object} CurrencyConverterResponse - The response of the currency converter method. - * @prop {Object} from - The language the text was translated from. - * @prop {string} from.type - The currency type the amount was converted from. - * @prop {string} from.amount - The currency amount before conversion. - * @prop {Object} to - The language the text was translated to. - * @prop {string} to.type - The currency type the amount was converted to. - * @prop {string} to.amount - The currency amount after conversion. + * @property {Object} from - The language the text was translated from. + * @property {string} from.type - The currency type the amount was converted from. + * @property {string} from.amount - The currency amount before conversion. + * @property {Object} to - The language the text was translated to. + * @property {string} to.type - The currency type the amount was converted to. + * @property {string} to.amount - The currency amount after conversion. + */ + +/** + * @typedef {Object} WeatherOptions - The options for the Weather method. + * @param {string} location - The location you want to get the weather for. + * @param {string} degreeType - The degree type you want to get the weather in. */ /** * @typedef {Object} WeatherResponse - The response for the Weather method. - * @prop {string} observationPoint - The location being observed. - * @prop {string} conditions - The current conditions. - * @prop {string} conditionsImageURL - The URL for the current conditions image. - * @prop {string} degreeType - The degree type being used. - * @prop {string} temperature - The current temperature. - * @prop {string} feelsLike - The current feels like temperature. - * @prop {string} windSpeed - The current wind speed, in km/h. - * @prop {string} windDisplay - The current wind display, in km/h. - * @prop {string} humidity - The current humidity. - * @prop {string} day - Today's day. - * @prop {string} date - Today's date. - * @prop {string} latitude - The latitude of the location. - * @prop {string} longitude - The longitude of the location. + * @property {string} observationPoint - The location being observed. + * @property {string} conditions - The current conditions. + * @property {string} conditionsImageURL - The URL for the current conditions image. + * @property {string} degreeType - The degree type being used. + * @property {string} temperature - The current temperature. + * @property {string} feelsLike - The current feels like temperature. + * @property {string} windSpeed - The current wind speed, in km/h. + * @property {string} windDisplay - The current wind display, in km/h. + * @property {string} humidity - The current humidity. + * @property {string} day - Today's day. + * @property {string} date - Today's date. + * @property {string} latitude - The latitude of the location. + * @property {string} longitude - The longitude of the location. */ \ No newline at end of file diff --git a/typings/index.d.ts b/typings/index.d.ts index b1cba59..a6e39a0 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -5,27 +5,65 @@ export = WeebyAPI; /** +* Weeby-JS - The official JavaScript wrapper for Weeby API, developed by NTM Development. Click [here](https://weebyapi.xyz/) for the website. * @class Client -* @classdesc weeby-js - The official JavaScript wrapper for Weeby API, developed by NTM Development. Website: https://weebyapi.xyz/ */ declare class WeebyAPI { /** - * @constructor - * @param {string} token - Your Weeby API Token. Get this by applying through the Weeby API bot on the Discord Server. https://discord.com/invite/G2rb53z - */ + * @constructor + * @param {string} token - Your Weeby API Token. + */ constructor(token: string); + /** + * The base URL. + * @type {string} + */ baseURL: string; - version: any; + /** + * The wrapper version. + * @type {string} + */ + version: string; + /** + * The generators module. + * @type {Generators} + */ generators: Generators; + /** + * The GIF module. + * @type {GIF} + */ gif: GIF; + /** + * The overlays module. + * @type {Overlays} + */ overlays: Overlays; + /** + * The effects module. + * @type {Effects} + */ effects: Effects; + /** + * The JSON module. + * @type {JSON} + */ json: JSON; + /** + * The custom module. + * @type {Custom} + */ custom: Custom; + /** + * The utility module. + * @type {Utility} + */ + utility: Utility; } -import Generators = require("./src/lib/generators"); -import GIF = require("./src/lib/gif"); -import Overlays = require("./src/lib/overlays"); -import Effects = require("./src/lib/effects"); -import JSON = require("./src/lib/json"); -import Custom = require("./src/lib/custom"); \ No newline at end of file +import Generators = require("./lib/generators"); +import GIF = require("./lib/gif"); +import Overlays = require("./lib/overlays"); +import Effects = require("./lib/effects"); +import JSON = require("./lib/json"); +import Custom = require("./lib/custom"); +import Utility = require("./lib/utility"); diff --git a/typings/lib/custom.d.ts b/typings/lib/custom.d.ts new file mode 100644 index 0000000..0318590 --- /dev/null +++ b/typings/lib/custom.d.ts @@ -0,0 +1,150 @@ +import './typedefs'; +export = Custom; +/** +* @class Custom +*/ +declare class Custom { + constructor(token: any, baseURL: any); + /** + * Your Weeby API Token. + * @type {string} + * @private + */ + private token; + /** + * The base URL. + * @type {string} + * @private + */ + private baseURL; + /** + * Creates a customisable greeting image. Optional parameters can let you customise the color of each element, or let you add a message. + * @param {GreetingOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + greeting({ icon, background, name, greet, message, greetHex, nameHex, circleHex, messageHex, font }?: GreetingOptions): Promise; + /** + * Creates a customisable booster add/remove image. Optional queries can let you customise the color of each element. + * @param {BoosterOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + booster({ icon, background, name, title, message, titleHex, nameHex, circleHex, messageHex, font }?: BoosterOptions): Promise; + /** + * Creates a customisable rank card with icon, name, and leveling stats. + * @param {RankOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + rank({ avatar, username, bgColor, level, xp }?: RankOptions): Promise; + /** + * Creates a customisable level up card. + * @param {LevelUpOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + levelUp({ avatar, bgColor, borderColor, oldlevel, newlevel, font }?: LevelUpOptions): Promise; +} +declare namespace Custom { + export { GreetingOptions, BoosterOptions, RankOptions, LevelUpOptions }; +} +/** + * Options for creating a customisable greeting image. + */ +type GreetingOptions = any; +/** + * Options for creating a booster image. + */ +type BoosterOptions = { + /** + * - The link to an image (.png, .jpg, .gif) + */ + icon: string; + /** + * - The link to an image (.png, .jpg, .gif) (1024x470 recommended) + */ + background: string; + /** + * - The name of the user who boosted the server. + */ + name: string; + /** + * - The title of the booster card. + */ + title: string; + /** + * - Provide a message on the bottom of title. + */ + message?: string; + /** + * - The color of the title text. (Do not include the hashtag). + */ + titleHex?: string; + /** + * - The color of the name text. (Do not include the hashtag). + */ + nameHex?: string; + /** + * f50a7] - The color of the avatar border. (Do not include the hashtag). + */ + circleHex?: string; + /** + * f50a7] - The color of the message text. (Do not include the hashtag). + */ + messageHex?: string; + /** + * - The font to use, 'nexa' by default. + */ + font?: FontType; +}; +/** + * Options for creating a rank card. + */ +type RankOptions = { + /** + * - The link to an image (.png, .jpg, .gif) + */ + avatar: string; + /** + * - The username to print. + */ + username: string; + /** + * - The color of the background. + */ + bgColor: string; + /** + * - The level the user is currently on. + */ + level: number; + /** + * - How much XP the user has. + */ + xp: number; +}; +/** + * Options for creating a level up card. + */ +type LevelUpOptions = { + /** + * - The link to an image (.png, .jpg, .gif) + */ + avatar: string; + /** + * - The color of the background. (Do not include the hashtag). + */ + bgColor: string; + /** + * - The color of the avatar border. (Do not include the hashtag). + */ + borderColor: string; + /** + * - The old level of the user. + */ + oldlevel: number; + /** + * - The new level of the user. + */ + newlevel: number; + /** + * - The font to use, 'nexa' by default. + */ + font?: FontType; +}; diff --git a/typings/lib/effects.d.ts b/typings/lib/effects.d.ts new file mode 100644 index 0000000..b6f605f --- /dev/null +++ b/typings/lib/effects.d.ts @@ -0,0 +1,118 @@ +export = Effects; +/** + * @class Effects +*/ +declare class Effects { + /** + * The options for general effects. + * @typedef {Object} GeneralOptions + * @property {string} type - The type of effect to apply. + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + /** + * The options for intensity effects. + * @typedef {Object} IntensityOptions + * @property {string} type - The type of effect to apply. + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {number} intensity - The intensity of the effect. + */ + /** + * The options for level effects. + * @typedef {Object} LevelOptions + * @property {string} type - The type of effect to apply. + * @property {string} image - The link to an image (.png, .jpg, .gif) + * @property {number} level - The level of the effect. + */ + /** + * The options for resizing an image. + * @typedef {Object} ResizeOptions + * @property {number} width - The width of the image. (1-2000px) + * @property {number} height - The height of the image. (1-2000px) + * @property {string} image - The link to an image (.png, .jpg, .gif) + */ + constructor(token: any, baseURL: any); + /** + * Your Weeby API Token. + * @type {string} + * @private + */ + private token; + /** + * The base URL. + * @type {string} + * @private + */ + private baseURL; + /** + * Applies an effect to the provided image. Please see https://weebyapi.xyz/api/docs#effects for the available effects. + * @param {GeneralOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + general(options?: { + /** + * - The type of effect to apply. + */ + type: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; + }): Promise; + /** + * Applies an effect to the provided image that can change the level. Please see https://weebyapi.xyz/api/docs#effects for the available effects. + * @param {IntensityOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + intensity(options?: { + /** + * - The type of effect to apply. + */ + type: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; + /** + * - The intensity of the effect. + */ + intensity: number; + }): Promise; + /** + * Applies an effect to the provided image that can change the level. Please see https://weebyapi.xyz/api/docs#effects for the available effects. + * @param {LevelOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + level(options?: { + /** + * - The type of effect to apply. + */ + type: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; + /** + * - The level of the effect. + */ + level: number; + }): Promise; + /** + * Resizes a provided image. + * @param {ResizeOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + resize(options?: { + /** + * - The width of the image. (1-2000px) + */ + width: number; + /** + * - The height of the image. (1-2000px) + */ + height: number; + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; + }): Promise; +} diff --git a/typings/lib/generators.d.ts b/typings/lib/generators.d.ts new file mode 100644 index 0000000..bb496d1 --- /dev/null +++ b/typings/lib/generators.d.ts @@ -0,0 +1,369 @@ +export = Generators; +/** +* @class Generators +*/ +declare class Generators { + constructor(token: any, baseURL: any); + /** + * Your Weeby API Token. + * @type {string} + * @private + */ + private token; + /** + * The base URL. + * @type {string} + * @private + */ + private baseURL; + /** + * Draws one image on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {OneImageOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + oneImage({ type, image }?: OneImageOptions): Promise; + /** + * Draws two images on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {TwoImagesOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + twoImages({ type, firstImage, secondImage }: TwoImagesOptions): Promise; + /** + * Prints text on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {TextOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + text({ type, text }: TextOptions): Promise; + /** + * Prints two texts on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {TwoTextsOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + twoText({ type, textOne, textTwo }: TwoTextsOptions): Promise; + /** + * Draws an image and text on a requested generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {TextImageOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + textImage({ type, image, text }: TextImageOptions): Promise; + /** + * Draws one image and one text on a Among Us Generator. + * @param {EjectOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + eject({ image, text, outcome }: EjectOptions): Promise; + /** + * Prints two images and texts on a friendship banner. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {FriendshipOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + friendship({ firstImage, secondImage, firstText, secondText }: FriendshipOptions): Promise; + /** + * Draws an image, title and text on a demotivational poster. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {DemotivationalOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + demotivational({ image, title, text }: DemotivationalOptions): Promise; + /** + * Draws a image, username and message on a Gravestone. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {RIPOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + rip({ avatar, username, message }: RIPOptions): Promise; + /** + * Generates a raw twitter tweet with username, tweet text and avatar. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {TweetOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + tweet({ username, tweet, avatar }: TweetOptions): Promise; + /** + * Generates a twitter tweet with username (fetched from the Twitter API) and the tweet text. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {TweetFetchOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + tweetFetch({ username, tweet }: TweetFetchOptions): Promise; + /** + * Generates a Fake Spotify Now Playing Image. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {SpotifyOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + spotifyNp({ image, title, artist, album }: SpotifyOptions): Promise; + /** + * Generates an Image, Text and Color on the This Is Spotify Meme. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {ThisIsSpotifyOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + thisIsSpotify({ image, text, color }?: ThisIsSpotifyOptions): Promise; + /** + * Draws one image on an animated triggered GIF. + * @param {TriggeredOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + triggered({ image, tint }: TriggeredOptions): Promise; + /** + * Generates a image with the specified currency and its amount. + * @param {CurrencyOptions} options - The options that contain the required parameters. + * @returns {Promise} The generated image in a buffer. + */ + currency({ type, amount }: CurrencyOptions): Promise; + /** + * Returns the colour in a Image (Buffer) format. Please see https://weebyapi.xyz/api/docs#generators for the available generators. + * @param {string} hex - The hex color (Do not include the hashtag). + * @returns {Promise} The generated image in a buffer. + */ + color(hex: string): Promise; +} +declare namespace Generators { + export { EjectOutcomes, CurrencyType, OneImageOptions, TwoImagesOptions, TextOptions, TwoTextsOptions, TextImageOptions, EjectOptions, FriendshipOptions, DemotivationalOptions, RIPOptions, TweetOptions, TweetFetchOptions, SpotifyOptions, TriggeredOptions, ThisIsSpotifyOptions, CurrencyOptions }; +} +/** + * The options for one image generators. + */ +type OneImageOptions = { + /** + * - The type of generator. + */ + type: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; +}; +/** + * The options for two images generators. + */ +type TwoImagesOptions = { + /** + * - The type of generator. + */ + type: string; + /** + * - The link to the first image (.png, .jpg, .gif) + */ + firstImage: string; + /** + * - The link to the second image (.png, .jpg, .gif) + */ + secondImage: string; +}; +/** + * The options for text generators. + */ +type TextOptions = { + /** + * - The type of generator. + */ + type: string; + /** + * - The text to be displayed. + */ + text: string; +}; +/** + * The options for two texts generators. + */ +type TwoTextsOptions = { + /** + * - The type of generator. + */ + type: string; + /** + * - The first text to be displayed. + */ + textOne: string; + /** + * - The second text to be displayed. + */ + textTwo: string; +}; +/** + * The options for text image generators. + */ +type TextImageOptions = { + /** + * - The type of generator. + */ + type: string; + /** + * - The text to be displayed. + */ + text: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; +}; +/** + * The options for the eject generator. + */ +type EjectOptions = { + /** + * - The text to be displayed. + */ + text: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; + /** + * - The outcome of the generator. + */ + outcome: EjectOutcomes; +}; +/** + * The options for the friendship generator. + */ +type FriendshipOptions = { + /** + * - The link to the first image (.png, .jpg, .gif) + */ + firstImage: string; + /** + * - The link to the second image (.png, .jpg, .gif) + */ + secondImage: string; + /** + * - The first text to be displayed. + */ + firstText: string; + /** + * - The second text to be displayed. + */ + secondText: string; +}; +/** + * The options for the demotivational generator. + */ +type DemotivationalOptions = { + /** + * - The text to be displayed. + */ + text: string; + /** + * - The title to be displayed. + */ + title: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; +}; +/** + * The options for the RIP generator. + */ +type RIPOptions = { + /** + * - The text to be displayed. + */ + message: string; + /** + * - The username to be displayed. + */ + username: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + avatar: string; +}; +/** + * The options for the tweet generator. + */ +type TweetOptions = { + /** + * - The username to be displayed. + */ + username: string; + /** + * - The tweet to be displayed. + */ + tweet: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + avatar: string; +}; +/** + * The options for the tweetfetch generator. + */ +type TweetFetchOptions = { + /** + * - The username to be displayed. + */ + username: string; + /** + * - The tweet to be displayed. + */ + tweet: string; +}; +/** + * The options for the spotify generator. + */ +type SpotifyOptions = { + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; + /** + * - The name of the song to be displayed. + */ + title: string; + /** + * - The artist name to be displayed. + */ + artist: string; + /** + * - The album name to be displayed. + */ + album: string; +}; +/** + * The options for the this is spotify generator. + */ +type ThisIsSpotifyOptions = { + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; + /** + * - The text to print. + */ + text: string; + /** + * - The hex color of the background. + */ + color: string; +}; +/** + * The options for the triggered generator. + */ +type TriggeredOptions = { + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; + /** + * - Whether the generated GIF should have a orange tint. Defaults to true. + */ + tint?: boolean; +}; +/** + * The options for the currency generator. + */ +type CurrencyOptions = { + /** + * - The type of currency. + */ + type: CurrencyType; + /** + * - The amount of money to display. + */ + amount: number; +}; +/** + * All available eject Outcomes: + */ +type EjectOutcomes = ('ejected' | 'imposter' | 'notimposter'); +/** + * All available currency types: + */ +type CurrencyType = ('dollar' | 'euro' | 'pound' | 'yen'); diff --git a/typings/src/lib/gif.d.ts b/typings/lib/gif.d.ts similarity index 65% rename from typings/src/lib/gif.d.ts rename to typings/lib/gif.d.ts index 7aedd2c..da94c18 100644 --- a/typings/src/lib/gif.d.ts +++ b/typings/lib/gif.d.ts @@ -4,14 +4,22 @@ export = GIF; */ declare class GIF { constructor(token: any, baseURL: any); - /** @access private */ - token: any; - /** @access private */ - baseURL: any; + /** + * Your Weeby API Token. + * @type {string} + * @private + */ + private token; + /** + * The base URL. + * @type {string} + * @private + */ + private baseURL; /** * Returns a random GIF image of the type provided. * @param {string} type - The Type of GIF. See https://weebyapi.xyz/api/docs#gif for all the GIFs. * @returns {Promise} The Formatted GIF URL. */ fetch(type: string): Promise; -} \ No newline at end of file +} diff --git a/typings/src/lib/json.d.ts b/typings/lib/json.d.ts similarity index 68% rename from typings/src/lib/json.d.ts rename to typings/lib/json.d.ts index 7a8a91e..75e62dd 100644 --- a/typings/src/lib/json.d.ts +++ b/typings/lib/json.d.ts @@ -4,10 +4,18 @@ export = JSON; */ declare class JSON { constructor(token: any, baseURL: any); - /** @access private */ - token: any; - /** @access private */ - baseURL: any; + /** + * Your Weeby API Token. + * @type {string} + * @private + */ + private token; + /** + * The base URL. + * @type {string} + * @private + */ + private baseURL; /** * Returns a random word. (list endpoint not supported) * @param {string} type - The Type of JSON response to request. See https://weebyapi.xyz/api/docs#json for all the JSON endpoints. @@ -20,43 +28,105 @@ declare class JSON { * @returns {Promise} The response in a string. */ response(type: string): Promise; + /** + * Returns a random Animal image of the type provided. + * @param {string} type - The Type of Animal. See https://weebyapi.xyz/api/docs#json for all the JSON endpoints. + * @returns {Promise} The Formatted Animal Image URL. + */ + animalImage(type: string): Promise; /** * Returns a random SFW Meme from a Subreddit. - * @param {('meme'|'memes'|'wholesomememes'|'dankmemes')} category - The name of the category. - * @returns {Promise} The returned JSON object. + * @param {MemeCategory} category - The name of the category. + * @returns {Promise} The returned JSON object. */ - meme(category: string): Promise; + meme(category: MemeCategory): Promise; /** * Formats the provided text into a different style. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The type of text formatter. - * @param {string} options.text - The text to format. + * @param {TextFormatterOptions} options - The options to use. * @returns {Promise} The response in a string. */ - textFormat(options?: { - type: string; - text: string; - }): Promise; + textFormat({ type, text }?: TextFormatterOptions): Promise; /** * Fetches lyrics from the Genius API. * @param {string} query - The lyrics to search. See https://weebyapi.xyz/api/docs#json for all the JSON endpoints. - * @returns {Promise} The lyrics and its informtation. + * @returns {Promise} The lyrics and its information. */ - lyrics(query: string): Promise; + lyrics(query: string): Promise; /** * Fetches Weeby API's current statistics. * @returns {Promise} The statistics returned in a object. */ - stats(): Promise; + stats(): Promise; } declare namespace JSON { - export { lyricsResponse }; - export { memeResponse }; + export { LyricsResponse, MemeResponse, TextFormatterOptions, MemeCategory }; } /** - * - The response for json.lyrics + * All available Meme Categories: + */ +type MemeCategory = ('meme' | 'memes' | 'wholesomememes' | 'dankmemes'); +/** + * - The Meme Response object. + */ +type MemeResponse = { + /** + * - The name of the Subreddit. + */ + subreddit: string; + /** + * - The URL of the Subreddit. + */ + subredditURL: string; + /** + * - The image URL of the post. + */ + url: string; + /** + * - The URL of of the post. + */ + permaURL: string; + /** + * - The title of the post. + */ + title: string; + /** + * - The author of the post. + */ + author: string; + /** + * - The date the post was created. + */ + date: string; + /** + * - The number of scores the post earned. + */ + score: number; + /** + * - The number of comments on the post. + */ + comments: number; + /** + * - The number of awards given on the post. + */ + awards: number; +}; +/** + * - The options object for the text formatter. */ -type lyricsResponse = { +type TextFormatterOptions = { + /** + * - The type of text formatter. + */ + type: string; + /** + * - The text to format. + */ + text: string; +}; +/** + * - The response object for lyrics. + */ +type LyricsResponse = { /** * - The ID of the song. */ @@ -124,49 +194,3 @@ type lyricsResponse = { */ lyrics: string; }; - -/** - * - The response for json.meme - */ -type memeResponse = { - /** - * - The name of the Subreddit. - */ - subreddit: string; - /** - * - The URL of the Subreddit. - */ - subredditURL: string; - /** - * - The image URL of the post. - */ - url: string; - /** - * - The URL of of the post. - */ - permaURL: string; - /** - * - The title of the post. - */ - title: string; - /** - * - The author of the post. - */ - author: string; - /** - * - The date the post was created. - */ - date: string; - /** - * - The number of scores the post earned. - */ - score: number; - /** - * - The number of comments on the post. - */ - comments: number; - /** - * - The number of awards given on the post. - */ - awards: number; -}; \ No newline at end of file diff --git a/typings/lib/overlays.d.ts b/typings/lib/overlays.d.ts new file mode 100644 index 0000000..6901b5f --- /dev/null +++ b/typings/lib/overlays.d.ts @@ -0,0 +1,38 @@ +export = Overlays; +/** +* @class Overlays +*/ +declare class Overlays { + constructor(token: any, baseURL: any); + /** + * Your Weeby API Token. + * @type {string} + * @private + */ + private token; + /** + * The base URL. + * @type {string} + * @private + */ + private baseURL; + /** + * Draws one image on a requested image overlay. Please see https://weebyapi.xyz/api/docs#overlays for the available overlays. + * @param {OverlaysOptions} options The options for the request + * @returns {Promise} The generated image in a buffer. + */ + fetch({ type, image }: OverlaysOptions): Promise; +} +declare namespace Overlays { + export { OverlaysOptions }; +} +type OverlaysOptions = { + /** + * - The type of overlay. + */ + type: string; + /** + * - The link to an image (.png, .jpg, .gif) + */ + image: string; +}; diff --git a/typings/lib/typedefs.d.ts b/typings/lib/typedefs.d.ts new file mode 100644 index 0000000..4ad12eb --- /dev/null +++ b/typings/lib/typedefs.d.ts @@ -0,0 +1,22 @@ +/** + * A list of all available fonts + * * Gotham + * * Stoneserif + * * Roboto + * * Arial + * * Impact + * * Riffic + * * Minecraft + * * Pinkycupid + * * Paladins + * * Pokemon + * * Oldenglish + * * Chalkduster + * * Akbar + * * Nexa + * * Verdana + * * Typewriter + * * Spongebob + * * Cornerofthesky + */ +type FontType = ('gotham' | 'stoneserif' | 'roboto' | 'arial' | 'impact' | 'riffic' | 'minecraft' | 'pinkycupid' | 'paladins' | 'pokemon' | 'oldenglish' | 'chalkduster' | 'akbar' | 'nexa' | 'verdana' | 'typewriter' | 'spongebob' | 'cornerofthesky' | 'breesh'); diff --git a/typings/lib/utility.d.ts b/typings/lib/utility.d.ts new file mode 100644 index 0000000..cfe70ef --- /dev/null +++ b/typings/lib/utility.d.ts @@ -0,0 +1,225 @@ +export = Utility; +/** +* @class Utility +*/ +declare class Utility { + constructor(token: any, baseURL: any); + /** + * Your Weeby API Token. + * @type {string} + * @private + */ + private token; + /** + * The base URL. + * @type {string} + * @private + */ + private baseURL; + /** + * Checks if a user has voted for a bot on Top.gg + * @param {TopGGVoteCheckerOptions} options - The options you want to use. + * @returns {Promise} + */ + topGGVoteChecker({ botID, userID }: TopGGVoteCheckerOptions): Promise; + /** + * Converts the provided currency to a different currency. + * @param {CurrencyConverterOptions} options - The options you want to use. + * @returns {Promise} + */ + currencyConverter({ from, to, amount }?: CurrencyConverterOptions): Promise; + /** + * Translate the provided text to another language. + * @param {TranslatorOptions} options - The options you want to use. + * @returns {Promise} + */ + translate({ from, to, text }?: any): Promise; + /** + * Returns the weather for the provided location. + * @param {WeatherOptions} options - The options you want to use. + * @returns {Promise} + */ + weather({ location, degreeType }?: WeatherOptions): Promise; +} +declare namespace Utility { + export { TopGGVoteCheckerOptions, TopGGVoteCheckerResponse, TranslateOptions, TranslateResponse, CurrencyConverterOptions, CurrencyConverterResponse, WeatherOptions, WeatherResponse }; +} +/** + * - The options for the TopGGVoteChecker. + */ +type TopGGVoteCheckerOptions = { + /** + * - The ID of the bot you want to check. + */ + botID: string; + /** + * - The ID of the user you want to check. + */ + userID: string; +}; +/** + * - The response from the Top.gg Vote Checker method. + */ +type TopGGVoteCheckerResponse = { + /** + * - The ID of the user. + */ + userID: string; + /** + * - The ID of the bot. + */ + botID: string; + /** + * - The date the user voted (Unix Timestamp) + */ + dateVoted: number; + /** + * - The current expiry of the vote (12 Hours - Unix Timestamp) + */ + currentVoteExpiry: number; + /** + * - The amount of times the user has voted lifetime for the bot. + */ + timesVoted: number; + /** + * - Whether the user has voted or not. + */ + hasVoted: boolean; + /** + * - Whether the user voted on a weekend or not. + */ + isWeekend: boolean; +}; +/** + * - The options for the Currency Converter. + */ +type CurrencyConverterOptions = { + /** + * - A valid ISO 4217 code of the currency (i.e. USD). Refer to this: https://www.xe.com/iso4217.php + */ + from: string; + /** + * - A valid ISO 4217 code of the currency (i.e. USD). Refer to this: https://www.xe.com/iso4217.php + */ + to: string; + /** + * - The amount you want to have converted. + */ + amount: number; +}; +/** + * - The response of the currency converter method. + */ +type CurrencyConverterResponse = { + /** + * - The language the text was translated from. + */ + from: { + type: string; + amount: string; + }; + /** + * - The language the text was translated to. + */ + to: { + type: string; + amount: string; + }; +}; +/** + * - The response of the translate method. + */ +type TranslateResponse = { + /** + * - The language the text was translated from. + */ + from: { + language: string; + text: string; + }; + /** + * - The language the text was translated to. + */ + to: { + language: string; + text: string; + }; +}; +/** + * - The options for the Weather method. + */ +type WeatherOptions = any; +/** + * - The response for the Weather method. + */ +type WeatherResponse = { + /** + * - The location being observed. + */ + observationPoint: string; + /** + * - The current conditions. + */ + conditions: string; + /** + * - The URL for the current conditions image. + */ + conditionsImageURL: string; + /** + * - The degree type being used. + */ + degreeType: string; + /** + * - The current temperature. + */ + temperature: string; + /** + * - The current feels like temperature. + */ + feelsLike: string; + /** + * - The current wind speed, in km/h. + */ + windSpeed: string; + /** + * - The current wind display, in km/h. + */ + windDisplay: string; + /** + * - The current humidity. + */ + humidity: string; + /** + * - Today's day. + */ + day: string; + /** + * - Today's date. + */ + date: string; + /** + * - The latitude of the location. + */ + latitude: string; + /** + * - The longitude of the location. + */ + longitude: string; +}; +/** + * - The options for the Translate method. + */ +type TranslateOptions = { + /** + * - A valid ISO language code. Refer to this: http://www.lingoes.net/en/translator/langcode.htm + */ + from: string; + /** + * - A valid ISO language code. Refer to this: http://www.lingoes.net/en/translator/langcode.htm + */ + to: string; + /** + * - The text to translate. + */ + text: number; +}; diff --git a/typings/src/lib/custom.d.ts b/typings/src/lib/custom.d.ts deleted file mode 100644 index a285c78..0000000 --- a/typings/src/lib/custom.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -export = Custom; -/** -* @class Custom -*/ -declare class Custom { - constructor(token: any, baseURL: any); - /** @access private */ - token: any; - /** @access private */ - baseURL: any; - /** - * Creates a customisable greeting image with Icon, Name, Greet and Background. Optional parameters can let you customise the color of each element, or let you add a message. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.icon - The link to an image (.png, .jpg, .gif) - * @param {string} options.background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) - * @param {string} options.name - The name of the greeted user. - * @param {string} options.greet - What should the user be greeted with? - * @param {string} [options.message] - Provide a message on the bottom of the user's name. - * @param {string} [options.greetHex=000000] - The color of the greet text. (Do not include the hashtag). - * @param {string} [options.nameHex=000000] - The color of the name text. (Do not include the hashtag). - * @param {string} [options.circleHex=000000] - The color of the avatar border. (Do not include the hashtag). - * @param {string} [options.messageHex=000000] - The color of the message text. (Do not include the hashtag). - * @param {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky')} [options.font=gotham] - The font to use, 'gotham' by default. - * @returns {Promise} The generated image in a buffer. - */ - greeting(options?: { - icon: string; - background: string; - name: string; - greet: string; - message?: string; - greetHex?: string; - nameHex?: string; - circleHex?: string; - messageHex?: string; - font?: string; - }): Promise; - /** - * Creates a customisable booster add/remove image with Icon, Name and Background. Optional queries can let you customise the color of each element. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.icon - The link to an image (.png, .jpg, .gif) - * @param {string} options.background - The link to an image (.png, .jpg, .gif) (1024x470 recommended) - * @param {string} options.name - The name of the user who boosted the server. - * @param {string} options.title - The title of the booster card. - * @param {string} [options.message] - Provide a message on the bottom of title. - * @param {string} [options.titleHex =f47fff] - The color of the title text. (Do not include the hashtag). - * @param {string} [options.nameHex=FFFFFF] - The color of the name text. (Do not include the hashtag). - * @param {string} [options.circleHex=9f50a7] - The color of the avatar border. (Do not include the hashtag). - * @param {string} [options.messageHex=9f50a7] - The color of the message text. (Do not include the hashtag). - * @param {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky')} [options.font=nexa] - The font to use, 'nexa' by default. - * @returns {Promise} The generated image in a buffer. - */ - booster(options?: { - icon: string; - background: string; - name: string; - title: string; - message?: string; - titleHex?: string; - nameHex?: string; - circleHex?: string; - messageHex?: string; - font?: string; - }): Promise; - /** - * Creates a customisable rank card with Icon, Name, and leveling stats. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.avatar - The link to an image (.png, .jpg, .gif) - * @param {string} options.username - The username to print. - * @param {string} options.bgColor - The color of the background. - * @param {number} options.level - The Level the user is currently on. - * @param {number} options.xp - How much XP the user has. - * @returns {Promise} The generated image in a buffer. - */ - rank(options?: { - avatar: string; - username: string; - bgColor: string; - level: number; - xp: number; - }): Promise; - /** - * Creates a customisable level up card. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.avatar - The link to an image (.png, .jpg, .gif) - * @param {string} options.bgColor - The color of the background. (Do not include the hashtag). - * @param {string} options.borderColor - The color of the avatar border. (Do not include the hashtag). - * @param {number} options.oldlevel - The old level of the user. - * @param {number} options.newlevel - The new level of the user. - * @param {('gotham'|'stoneserif'|'roboto'|'arial'|'impact'|'riffic'|'minecraft'|'pinkycupid'|'paladins'|'pokemon'|'oldenglish'|'chalkduster'|'akbar'|'nexa'|'verdana'|'typewriter'|'spongebob'|'cornerofthesky')} [options.font=nexa] - The font to use, 'nexa' by default. - * @returns {Promise} The generated image in a buffer. - */ - levelUp(options?: { - avatar: string; - bgColor: string; - borderColor: string; - oldlevel: number; - newlevel: number; - font?: string; - }): Promise; -} \ No newline at end of file diff --git a/typings/src/lib/effects.d.ts b/typings/src/lib/effects.d.ts deleted file mode 100644 index 651a1e3..0000000 --- a/typings/src/lib/effects.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -export = Effects; -/** - * @class Effects -*/ -declare class Effects { - constructor(token: any, baseURL: any); - /** @access private */ - token: any; - /** @access private */ - baseURL: any; - /** - * Applies an effect to the provided image. Please see https://weebyapi.xyz/api/docs#effects for the available effects. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Effect to use. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @returns {Promise} The generated image in a buffer. - */ - general(options?: { - type: string; - image: string; - }): Promise; - /** - * Applies an effect to the provided image that can change the level. Please see https://weebyapi.xyz/api/docs#effects for the available effects. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Effect to use. - * @param {number} options.intensity - The intensity of the effect. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @returns {Promise} The generated image in a buffer. - */ - intensity(options?: { - type: string; - intensity: number; - image: string; - }): Promise; - /** - * Applies an effect to the provided image that can change the level. Please see https://weebyapi.xyz/api/docs#effects for the available effects. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Effect to use. - * @param {number} options.level - The level of the effect. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @returns {Promise} The generated image in a buffer. - */ - level(options?: { - type: string; - level: number; - image: string; - }): Promise; - /** - * Resizes a provided image. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.width - The width of the resized image. (1-2000) - * @param {number} options.height - The height of the resized image. (1-2000) - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @returns {Promise} The generated image in a buffer. - */ - resize(options?: { - width: string; - height: number; - image: string; - }): Promise; -} \ No newline at end of file diff --git a/typings/src/lib/generators.d.ts b/typings/src/lib/generators.d.ts deleted file mode 100644 index 4f10fa7..0000000 --- a/typings/src/lib/generators.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -export = Generators; -/** -* @class Generators -*/ -declare class Generators { - constructor(token: any, baseURL: any); - /** @access private */ - token: any; - /** @access private */ - baseURL: any; - /** - * Draws one image on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Generator. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @returns {Promise} The generated image in a buffer. - */ - oneImage(options?: { - type: string; - image: string; - }): Promise; - /** - * Draws two images on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Generator. - * @param {string} options.firstImage - The link to the first image (.png, .jpg, .gif) - * @param {string} options.secondImage - The link to the second image (.png, .jpg, .gif) - * @returns {Promise} The generated image in a buffer. - */ - twoImages(options?: { - type: string; - firstImage: string; - secondImage: string; - }): Promise; - /** - * Prints text on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Generator. - * @param {string} options.text - The text to print. - * @returns {Promise} The generated image in a buffer. - */ - text(options?: { - type: string; - text: string; - }): Promise; - /** - * Prints two texts on a requested image generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Generator. - * @param {string} options.textOne - The first text to print. - * @param {string} options.textTwo - The second text to print. - * @returns {Promise} The generated image in a buffer. - */ - twoText(options?: { - type: string; - textOne: string; - textTwo: string; - }): Promise; - /** - * Draws an image and text on a requested generator. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The type of Generator - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {string} options.text - The text to print. - * @returns {Promise} The generated image in a buffer. - */ - textImage(options?: { - type: string; - image: string; - text: string; - }): Promise; - /** - * Draws one image and one text on a Among Us Generator. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {string} options.text - The text to print. - * @param {('ejected'|'imposter'|'notimposter')} options.outcome - The type of outcome to display in the text. - * @returns {Promise} The generated image in a buffer. - */ - eject(options?: { - image: string; - text: string; - outcome: ('ejected' | 'imposter' | 'notimposter'); - }): Promise; - /** - * Prints two images and texts on a friendship banner. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.firstImage - The link to the first image (.png, .jpg, .gif) - * @param {string} options.secondImage - The link to the second image (.png, .jpg, .gif) - * @param {string} options.firstText - The first text to print. - * @param {string} options.secondText - The second text to print. - * @returns {Promise} The generated image in a buffer. - */ - friendship(options?: { - firstImage: string; - secondImage: string; - firstText: string; - secondText: string; - }): Promise; - /** - * Draws an image, title and text on a demotivational poster. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {string} options.title - The title text to print. - * @param {string} options.text - The text to print. - * @returns {Promise} The generated image in a buffer. - */ - demotivational(options?: { - image: string; - title: string; - text: string; - }): Promise; - /** - * Draws a image, username and message on a Gravestone. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.avatar - The link to an image (.png, .jpg, .gif) - * @param {string} options.username - The username to print. - * @param {string} options.message - The text to print. - * @returns {Promise} The generated image in a buffer. - */ - rip(options?: { - avatar: string; - username: string; - message: string; - }): Promise; - /** - * Generates a raw twitter tweet with username, tweet text and avatar. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.username - The username to print. - * @param {string} options.tweet - The text to print. - * @param {string} options.avatar - The link to an image (.png, .jpg, .gif) - * @returns {Promise} The generated image in a buffer. - */ - tweet(options?: { - username: string; - tweet: string; - avatar: string; - }): Promise; - /** - * Generates a twitter tweet with username (fetched from the Twitter API) and the tweet text. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.username - The username to print. - * @param {string} options.tweet - The text to print. - * @returns {Promise} The generated image in a buffer. - */ - tweetFetch(options?: { - username: string; - tweet: string; - }): Promise; - /** - * Generates a Fake Spotify Now Playing Image. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {string} options.songName - The name of the song to print. - * @param {string} options.artist - The artist name to print. - * @param {string} options.userPicks - The user's picks name to print. - * @returns {Promise} The generated image in a buffer. - */ - spotifyNp(options?: { - image: string; - songName: string; - artist: string; - userPicks: string; - }): Promise; - /** - * Draws one image on an animated triggered GIF. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @param {boolean} [options.tint=true] - Whether the generated GIF should have a orange tint. Defaults to True. - * @returns {Promise} The generated image in a buffer. - */ - triggered(options?: { - image: string; - tint?: boolean; - }): Promise; - /** - * Generates a image with the specified currency and its amount. - * @param {Object} options - The options that contain the required parameters. - * @param {('dollar'|'euro'|'pound'|'yen')} options.type - The type of currency. - * @param {number} options.amount - The amount of money to display. - * @returns {Promise} The generated image in a buffer. - */ - currency(options?: { - type: ('dollar' | 'euro' | 'pound' | 'yen'); - amount: number; - }): Promise; - /** - * Returns the colour in a Image (Buffer) format. Please see https://weebyapi.xyz/api/docs#generators for the available generators. - * @param {string} hex - The hex color (Do not include the hashtag). - * @returns {Promise} The generated image in a buffer. - */ - color(hex: string): Promise; -} \ No newline at end of file diff --git a/typings/src/lib/overlays.d.ts b/typings/src/lib/overlays.d.ts deleted file mode 100644 index 388e40c..0000000 --- a/typings/src/lib/overlays.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export = Overlays; -/** -* @class Overlays -*/ -declare class Overlays { - constructor(token: any, baseURL: any); - /** @access private */ - token: any; - /** @access private */ - baseURL: any; - /** - * Draws one image on a requested image overlay. Please see https://weebyapi.xyz/api/docs#overlays for the available overlays. - * @param {Object} options - The options that contain the required parameters. - * @param {string} options.type - The Type of Overlay. - * @param {string} options.image - The link to an image (.png, .jpg, .gif) - * @returns {Promise} The generated image in a buffer. - */ - fetch(options?: { - type: string; - image: string; - }): Promise; -} \ No newline at end of file From 92bdbf1c230ee3ad6aa0ec2a6f021a0ac23a87d1 Mon Sep 17 00:00:00 2001 From: Wise2006 <45759535+Wise2006@users.noreply.github.com> Date: Fri, 29 Oct 2021 14:48:59 +0300 Subject: [PATCH 7/7] chore: Apply suggestions from reviews. --- src/lib/custom.js | 8 ++++---- typings/lib/custom.d.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/custom.js b/src/lib/custom.js index da5f44f..35826dd 100644 --- a/src/lib/custom.js +++ b/src/lib/custom.js @@ -160,10 +160,10 @@ module.exports = Custom; * @property {string} name - The name of the user who boosted the server. * @property {string} title - The title of the booster card. * @property {string} [message] - Provide a message on the bottom of title. - * @property {string} [titleHex =f47fff] - The color of the title text. (Do not include the hashtag). - * @property {string} [nameHex=FFFFFF] - The color of the name text. (Do not include the hashtag). - * @property {string} [circleHex=9f50a7] - The color of the avatar border. (Do not include the hashtag). - * @property {string} [messageHex=9f50a7] - The color of the message text. (Do not include the hashtag). + * @property {string} [titleHex ='F47FFF'] - The color of the title text. (Do not include the hashtag). + * @property {string} [nameHex='FFFFFF'] - The color of the name text. (Do not include the hashtag). + * @property {string} [circleHex='9F50A7'] - The color of the avatar border. (Do not include the hashtag). + * @property {string} [messageHex='9F50A7'] - The color of the message text. (Do not include the hashtag). * @property {FontType} [font=nexa] - The font to use, 'nexa' by default. */ diff --git a/typings/lib/custom.d.ts b/typings/lib/custom.d.ts index 0318590..cee58e0 100644 --- a/typings/lib/custom.d.ts +++ b/typings/lib/custom.d.ts @@ -82,11 +82,11 @@ type BoosterOptions = { */ nameHex?: string; /** - * f50a7] - The color of the avatar border. (Do not include the hashtag). + * - The color of the avatar border. (Do not include the hashtag). */ circleHex?: string; /** - * f50a7] - The color of the message text. (Do not include the hashtag). + * - The color of the message text. (Do not include the hashtag). */ messageHex?: string; /**