canvacord
Advanced tools
Comparing version 5.0.7 to 5.0.8
@@ -34,3 +34,3 @@ // Created and maintained by Snowflake Studio ❄ | ||
Plugins: require("./src/Plugins"), | ||
Util: require("./plugins/Util"), | ||
Util: require("./src/Util"), | ||
Assets: require("@canvacord/assets"), | ||
@@ -37,0 +37,0 @@ MSX: { |
{ | ||
"name": "canvacord", | ||
"version": "5.0.7", | ||
"version": "5.0.8", | ||
"description": "Powerful image manipulation package for beginners.", | ||
"main": "index.js", | ||
"scripts": { | ||
"docsgen": "jsdoc --configure .jsdoc.json --verbose", | ||
"docs": "docgen --source src --custom docs/index.yml --output docs/docs.json", | ||
"docs:test": "docgen --source src --custom docs/index.yml", | ||
"test": "cd test && node ." | ||
@@ -12,3 +13,3 @@ }, | ||
"type": "git", | ||
"url": "git+https://github.com/Snowflake107/Canvacord.git" | ||
"url": "git+https://github.com/DevSnowflake/Canvacord.git" | ||
}, | ||
@@ -32,3 +33,3 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/Snowflake107/Canvacord/issues" | ||
"url": "https://github.com/DevSnowflake/Canvacord/issues" | ||
}, | ||
@@ -48,5 +49,4 @@ "homepage": "https://canvacord.js.org", | ||
"discord-canvas": "github:snowflake107/discord-canvas", | ||
"jsdoc": "^3.6.6", | ||
"jsdoc-skyceil": "github:zyrouge/jsdoc-skyceil" | ||
"discord.js-docgen": "github:discordjs/docgen" | ||
} | ||
} |
@@ -7,3 +7,3 @@ # Canvacord | ||
```sh | ||
npm i canvacord | ||
$ npm i canvacord | ||
``` | ||
@@ -10,0 +10,0 @@ |
const assets = require("@canvacord/assets"); | ||
/** | ||
* Canvacord assets | ||
*/ | ||
module.exports = assets; |
@@ -15,3 +15,3 @@ const Trigger = require("../libs/Trigger"); | ||
const round = require("../plugins/round"); | ||
const Util = require("../plugins/Util"); | ||
const Util = require("./Util"); | ||
@@ -376,2 +376,3 @@ | ||
* @param {any[]} fontArray Font array | ||
* @returns {Promise<void>} | ||
*/ | ||
@@ -1165,2 +1166,3 @@ static async registerFonts(fontArray = []) { | ||
* @param {boolean} [ops.dark=false] Dark mode? | ||
* @returns {Promise<Buffer>} | ||
*/ | ||
@@ -1260,2 +1262,3 @@ static async youtube(ops = { username: null, content: null, avatar: null, dark: false }) { | ||
* Canvacord assets | ||
* @type {CanvacordAssets} | ||
* @private | ||
@@ -1277,4 +1280,13 @@ */ | ||
/** | ||
* Canvacord convolution matrix | ||
* @typedef {object} ConvolutionMatrix | ||
* @property {number[]} EDGES Edges Matrix | ||
* @property {number[]} BLUR Blur Matrix | ||
* @property {number[]} SHARPEN Sharpen Matrix | ||
* @property {number[]} BURN Burn Matrix | ||
*/ | ||
/** | ||
* Matrix data for **Canvacord.convolute()** | ||
* @ignore | ||
* @type {ConvolutionMatrix} | ||
*/ | ||
@@ -1292,2 +1304,3 @@ static get CONVOLUTION_MATRIX() { | ||
* Canvacord utils | ||
* @type {Util} | ||
*/ | ||
@@ -1294,0 +1307,0 @@ static get Util() { |
const { Base } = require("discord-canvas"); | ||
const Util = require("../plugins/Util"); | ||
const Util = require("./Util"); | ||
@@ -23,4 +23,18 @@ class Leaver extends Base { | ||
/** | ||
* Title created with Canvacord | ||
* @type {string} | ||
*/ | ||
this.textTitle = "GOODBYE"; | ||
/** | ||
* Text message created with Canvacord | ||
* @type {string} | ||
*/ | ||
this.textMessage = "We will miss you!"; | ||
/** | ||
* Title color created with canvacord | ||
* @type {string} | ||
*/ | ||
this.colorTitle = "#03A9F4"; | ||
@@ -34,2 +48,3 @@ | ||
* Updates default state | ||
* @returns {void} | ||
* @private | ||
@@ -56,2 +71,3 @@ * @ignore | ||
* @param {string} color HTML5 color code | ||
* @returns {Leaver} | ||
*/ | ||
@@ -66,2 +82,3 @@ setColor(id, color) { | ||
* @param {number|string} memberCount Guild member count | ||
* @returns {Leaver} | ||
*/ | ||
@@ -68,0 +85,0 @@ setMemberCount(memberCount = 100) { |
/** | ||
* @typedef Plugins | ||
* @typedef {object} Plugins | ||
* @property {Function} circle Circle plugin | ||
@@ -4,0 +4,0 @@ * @property {Function} convolute Convolute plugin |
const Canvas = require("canvas"); | ||
const Util = require("../plugins/Util"); | ||
const Util = require("./Util"); | ||
const assets = require("./Assets"); | ||
/** | ||
* @typedef {object} CanvacordRankData | ||
* @property {number} width Rank card width | ||
* @property {number} height Rank card height | ||
* @property {object} background Rank card background data | ||
* @property {"image"|"color"} [background.type="color"] Background type | ||
* @property {string|Buffer} [background.image="#23272A"] Background image (or color) | ||
* @property {object} progressBar Progressbar data | ||
* @property {boolean} [progressBar.rounded=true] If the progressbar should be rounded | ||
* @property {number} [progressBar.x=275.5] Progressbar X | ||
* @property {number} [progressBar.y=183.75] Progressbar Y | ||
* @property {number} [progressBar.height=37.5] Progressbar height | ||
* @property {number} [progressBar.width=596.5] Progressbar width | ||
* @property {object} [progressBar.track] Progressbar track | ||
* @property {string} [progressBar.track.color="#484b4E"] Progressbar track color | ||
* @property {object} [progressBar.bar] Progressbar bar data | ||
* @property {"color"|"gradient"} [progressBar.bar.type="color"] Progressbar bar type | ||
* @property {string|string[]} [progressBar.bar.color="#FFFFFF"] Progressbar bar color | ||
* @property {object} overlay Progressbar overlay | ||
* @property {boolean} [overlay.display=true] If it should display overlay | ||
* @property {number} [overlay.level=0.5] Overlay opacity level | ||
* @property {string} [overlay.color="#333640"] Overlay bg color | ||
* @property {object} avatar Rank card avatar data | ||
* @property {string|Buffer} [avatar.source=null] Avatar source | ||
* @property {number} [avatar.x=70] X | ||
* @property {number} [avatar.y=50] Y | ||
* @property {number} [avatar.height=180] height | ||
* @property {number} [avatar.width=180] width | ||
* @property {object} status Rank card status | ||
* @property {number} [status.width=5] Status width | ||
* @property {"online"|"dnd"|"idle"|"offline"|"streaming"} [status.type] Status type | ||
* @property {string} [status.color="#43B581"] Status color | ||
* @property {boolean} [status.circle=false] Circualr status? | ||
* @property {object} rank Rank card rank data | ||
* @property {boolean} [rank.display=true] If it should display rank | ||
* @property {number} [rank.data=1] The Rank | ||
* @property {string} [rank.textColor="#FFFFFF"] Rank text color | ||
* @property {string} [rank.color="#F3F3F3"] Rank color | ||
* @property {string} [rank.displayText="RANK"] Rank display text | ||
* @property {object} level Rank card level data | ||
* @property {boolean} [level.display=true] If it should display level | ||
* @property {number} [level.data=1] The level | ||
* @property {string} [level.textColor="#FFFFFF"] level text color | ||
* @property {string} [level.color="#F3F3F3"] level color | ||
* @property {string} [level.displayText="LEVEL"] level display text | ||
* @property {object} currentXP Rank card current xp | ||
* @property {number} [currentXP.data=0] Current xp | ||
* @property {string} [currentXP.color="#FFFFFF"] Rank card current xp color | ||
* @property {object} requiredXP Rank card required xp | ||
* @property {number} [requiredXP.data=0] required xp | ||
* @property {string} [requiredXP.color="#FFFFFF"] Rank card required xp color | ||
* @property {object} discriminator Rank card discriminator | ||
* @property {number|string} [discriminator.discrim=null] The discriminator | ||
* @property {string} [discriminator.color="rgba(255, 255, 255, 0.4)"] Rank card discriminator color | ||
* @property {object} username Username Data | ||
* @property {string} [username.name=null] Rank card username | ||
* @property {string} [username.color="#FFFFFF"] Rank card username color | ||
* @property {boolean} [renderEmojis=false] If it should render emojis | ||
*/ | ||
class Rank { | ||
@@ -28,2 +88,3 @@ | ||
* Rank card data | ||
* @type {CanvacordRankData} | ||
*/ | ||
@@ -109,2 +170,3 @@ this.data = { | ||
* @param {any[]} fontArray Font array | ||
* @returns {Rank} | ||
*/ | ||
@@ -139,2 +201,3 @@ registerFonts(fontArray = []) { | ||
* @param {boolean} [apply=false] Set it to `true` to render emojis. | ||
* @returns {Rank} | ||
*/ | ||
@@ -150,2 +213,3 @@ renderEmojis(apply = false) { | ||
* @param {string} color Username color | ||
* @returns {Rank} | ||
*/ | ||
@@ -163,2 +227,3 @@ setUsername(name, color = "#FFFFFF") { | ||
* @param {string} color Discriminator color | ||
* @returns {Rank} | ||
*/ | ||
@@ -176,2 +241,3 @@ setDiscriminator(discriminator, color = "rgba(255, 255, 255, 0.4)") { | ||
* @param {boolean} [rounded=true] If progressbar should have rounded edges | ||
* @returns {Rank} | ||
*/ | ||
@@ -204,2 +270,3 @@ setProgressBar(color, fillType = "COLOR", rounded = true) { | ||
* @param {string} color Track color | ||
* @returns {Rank} | ||
*/ | ||
@@ -218,2 +285,3 @@ setProgressBarTrack(color) { | ||
* @param {boolean} [display=true] IF it should display overlay | ||
* @returns {Rank} | ||
*/ | ||
@@ -232,2 +300,3 @@ setOverlay(color, level = 0.5, display = true) { | ||
* @param {string} color Color | ||
* @returns {Rank} | ||
*/ | ||
@@ -245,2 +314,3 @@ setRequiredXP(data, color = "#FFFFFF") { | ||
* @param {string} color Color | ||
* @returns {Rank} | ||
*/ | ||
@@ -259,2 +329,3 @@ setCurrentXP(data, color = "#FFFFFF") { | ||
* @param {boolean} [display=true] If it should display rank | ||
* @returns {Rank} | ||
*/ | ||
@@ -275,2 +346,3 @@ setRank(data, text = "RANK", display = true) { | ||
* @param {string} number Number color | ||
* @returns {Rank} | ||
*/ | ||
@@ -289,2 +361,3 @@ setRankColor(text = "#FFFFFF", number = "#FFFFFF") { | ||
* @param {string} number number color | ||
* @returns {Rank} | ||
*/ | ||
@@ -304,2 +377,3 @@ setLevelColor(text = "#FFFFFF", number = "#FFFFFF") { | ||
* @param {boolean} [display=true] If it should display level | ||
* @returns {Rank} | ||
*/ | ||
@@ -319,2 +393,3 @@ setLevel(data, text = "LEVEL", display = true) { | ||
* @param {string} color Color to set | ||
* @returns {Rank} | ||
*/ | ||
@@ -332,2 +407,3 @@ setCustomStatusColor(color) { | ||
* @param {number|boolean} width Status width | ||
* @returns {Rank} | ||
*/ | ||
@@ -371,2 +447,3 @@ setStatus(status, circle = false, width = 5) { | ||
* @param {string|Buffer} [data] Background color or image | ||
* @returns {Rank} | ||
*/ | ||
@@ -394,2 +471,3 @@ setBackground(type, data) { | ||
* @param {string|Buffer} data Avatar data | ||
* @returns {Rank} | ||
*/ | ||
@@ -451,3 +529,4 @@ setAvatar(data) { | ||
// draw discriminator | ||
const discrim = this.data.discriminator.discrim; | ||
if (!this.data.discriminator.discrim) throw new Error("Missing discriminator!"); | ||
const discrim = `${this.data.discriminator.discrim}`; | ||
if (discrim) { | ||
@@ -457,3 +536,3 @@ ctx.font = `36px ${ops.fontY}`; | ||
ctx.textAlign = "center"; | ||
ctx.fillText(`#${discrim}`, ctx.measureText(name).width + 20 + 335, 164); | ||
ctx.fillText(`#${discrim.substr(0, 4)}`, ctx.measureText(name).width + 20 + 335, 164); | ||
} | ||
@@ -465,3 +544,3 @@ | ||
ctx.fillStyle = this.data.level.textColor; | ||
ctx.fillText(this.data.level.displayText, 800 - ctx.measureText(this.data.level.data).width, 82); | ||
ctx.fillText(this.data.level.displayText, 800 - ctx.measureText(Util.toAbbrev(parseInt(this.data.level.data))).width, 82); | ||
@@ -471,3 +550,3 @@ ctx.font = `bold 32px ${ops.fontX}`; | ||
ctx.textAlign = "end"; | ||
ctx.fillText(this.data.level.data, 860, 82); | ||
ctx.fillText(Util.toAbbrev(parseInt(this.data.level.data)), 860, 82); | ||
} | ||
@@ -479,3 +558,3 @@ | ||
ctx.fillStyle = this.data.rank.textColor; | ||
ctx.fillText(this.data.rank.displayText, 800 - ctx.measureText(this.data.level.data || "-").width - 7 - ctx.measureText(this.data.level.displayText).width - 7 - ctx.measureText(this.data.rank.data || "-").width, 82); | ||
ctx.fillText(this.data.rank.displayText, 800 - ctx.measureText(Util.toAbbrev(parseInt(this.data.level.data)) || "-").width - 7 - ctx.measureText(this.data.level.displayText).width - 7 - ctx.measureText(Util.toAbbrev(parseInt(this.data.rank.data)) || "-").width, 82); | ||
@@ -485,3 +564,3 @@ ctx.font = `bold 32px ${ops.fontX}`; | ||
ctx.textAlign = "end"; | ||
ctx.fillText(Util.toAbbrev(parseInt(this.data.rank.data)), 790 - ctx.measureText(this.data.level.data || "-").width - 7 - ctx.measureText(this.data.level.displayText).width, 82); | ||
ctx.fillText(Util.toAbbrev(parseInt(this.data.rank.data)), 790 - ctx.measureText(Util.toAbbrev(parseInt(this.data.level.data)) || "-").width - 7 - ctx.measureText(this.data.level.displayText).width, 82); | ||
} | ||
@@ -572,2 +651,3 @@ | ||
* Calculates progress | ||
* @type {number} | ||
* @private | ||
@@ -574,0 +654,0 @@ * @ignore |
const Canvas = require("canvas"); | ||
const Util = require("../plugins/Util"); | ||
const Util = require("./Util"); | ||
const assets = require("./Assets"); | ||
@@ -65,3 +65,10 @@ | ||
/** | ||
* @typedef {object} SpotifyDataBG | ||
* @property {number} type Background type | ||
* @property {string|Buffer} data Background data | ||
*/ | ||
/** | ||
* Background | ||
* @type {SpotifyDataBG} | ||
*/ | ||
@@ -74,3 +81,10 @@ this.background = { | ||
/** | ||
* @typedef {object} SpotifyProgressBarData | ||
* @property {string} bgColor Progressbar bg color | ||
* @property {string} color Progressbar bg color | ||
*/ | ||
/** | ||
* Progressbar details | ||
* @type {SpotifyProgressBarData} | ||
*/ | ||
@@ -87,2 +101,3 @@ this.progressBar = { | ||
* Register fonts | ||
* @returns {void} | ||
* @ignore | ||
@@ -111,2 +126,3 @@ * @private | ||
* @param {string} color Color to set | ||
* @returns {Spotify} | ||
*/ | ||
@@ -132,2 +148,3 @@ setProgressBar(type, color) { | ||
* @param {string} title Title to set | ||
* @returns {Spotify} | ||
*/ | ||
@@ -143,2 +160,3 @@ setTitle(title) { | ||
* @param {string|Buffer|Canvas.Image} source Image source | ||
* @returns {Spotify} | ||
*/ | ||
@@ -154,2 +172,3 @@ setImage(source) { | ||
* @param {string} name Artist name | ||
* @returns {Spotify} | ||
*/ | ||
@@ -165,2 +184,3 @@ setAuthor(name) { | ||
* @param {string} name Album name | ||
* @returns {Spotify} | ||
*/ | ||
@@ -176,2 +196,3 @@ setAlbum(name) { | ||
* @param {Date|number} time Timestamp | ||
* @returns {Spotify} | ||
*/ | ||
@@ -188,2 +209,3 @@ setStartTimestamp(time) { | ||
* @param {Date|number} time Timestamp | ||
* @returns {Spotify} | ||
*/ | ||
@@ -201,2 +223,3 @@ setEndTimestamp(time) { | ||
* @param {string|Buffer|Canvas.Image} data Background data | ||
* @returns {Spotify} | ||
*/ | ||
@@ -296,2 +319,3 @@ setBackground(type = "COLOR", data = "#2F3136") { | ||
* Returns progress | ||
* @type {number} | ||
* @private | ||
@@ -298,0 +322,0 @@ * @ignore |
const { Base } = require("discord-canvas"); | ||
const Util = require("../plugins/Util"); | ||
const Util = require("./Util"); | ||
@@ -23,4 +23,18 @@ class Welcomer extends Base { | ||
/** | ||
* Title created with Canvacord | ||
* @type {string} | ||
*/ | ||
this.textTitle = "WELCOME"; | ||
/** | ||
* Text message created with Canvacord | ||
* @type {string} | ||
*/ | ||
this.textMessage = "Welcome to {server}"; | ||
/** | ||
* Title color created with canvacord | ||
* @type {string} | ||
*/ | ||
this.colorTitle = "#03A9F4"; | ||
@@ -55,2 +69,3 @@ | ||
* @param {string} color HTML5 color code | ||
* @returns {Welcomer} | ||
*/ | ||
@@ -65,2 +80,3 @@ setColor(id, color) { | ||
* @param {number|string} memberCount Guild member count | ||
* @returns {Welcomer} | ||
*/ | ||
@@ -67,0 +83,0 @@ setMemberCount(memberCount = 100) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143391
4
28
2617
17167