diff --git a/.gitignore b/.gitignore index e86962e..4822008 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ package-lock.json test/ -pas fait/ \ No newline at end of file +pas fait/ +.vscode/ \ No newline at end of file diff --git a/README.md b/README.md index 38e10a9..1810e6b 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,10 @@ bot.login("super_secret_token") ![Jail](https://imgur.com/QslACNo.png) +- ``new DIG.Karaba().getImage(``);`` + +![Karaba](https://imgur.com/4aEZs6v.png) + - ``new DIG.Kiss().getImage(``, ``);`` ![Kiss](https://imgur.com/sSoCAeH.png) @@ -233,6 +237,10 @@ bot.login("super_secret_token") # Changelog +## v1.4.5 +- Added Karaba() +- Fixed some errors returns that were not the same + ## v1.4.0 - Added DiscordBlack() and DiscordBlue() - Added ESLint and fixed all problems diff --git a/package.json b/package.json index 7daab8a..c08b914 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord-image-generation", - "version": "1.4.2", + "version": "1.4.5", "description": "discord-image-generation is a powerfull module that allow you to generate awesome images.", "main": "src/index.js", "scripts": { diff --git a/src/assets/karaba.png b/src/assets/karaba.png new file mode 100644 index 0000000..20b206f Binary files /dev/null and b/src/assets/karaba.png differ diff --git a/src/module/filters/blur.js b/src/module/filters/blur.js index 3123fcd..caba99c 100644 --- a/src/module/filters/blur.js +++ b/src/module/filters/blur.js @@ -7,7 +7,7 @@ module.exports = class Blur { * @param {level} level */ async getImage(image, level) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); image = await jimp.read(image); image.blur(isNaN(level) ? 5 : parseInt(level)); let raw; diff --git a/src/module/filters/gay.js b/src/module/filters/gay.js index b7c3419..800dbd6 100644 --- a/src/module/filters/gay.js +++ b/src/module/filters/gay.js @@ -6,7 +6,7 @@ module.exports = class Gay { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); let bg = await Canvas.loadImage(`${__dirname}/../../assets/gay.png`); let img = await Canvas.loadImage(image); const canvas = Canvas.createCanvas(480, 480); diff --git a/src/module/filters/greyscale.js b/src/module/filters/greyscale.js index d9dc65c..90b974a 100644 --- a/src/module/filters/greyscale.js +++ b/src/module/filters/greyscale.js @@ -6,7 +6,7 @@ module.exports = class Geryscale { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); image = await jimp.read(image); image.greyscale(); let raw; diff --git a/src/module/filters/invert.js b/src/module/filters/invert.js index 41d16a7..e602f41 100644 --- a/src/module/filters/invert.js +++ b/src/module/filters/invert.js @@ -6,7 +6,7 @@ module.exports = class Invert { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); image = await jimp.read(image); image.invert(); let raw; diff --git a/src/module/filters/sepia.js b/src/module/filters/sepia.js index 72089c2..431e032 100644 --- a/src/module/filters/sepia.js +++ b/src/module/filters/sepia.js @@ -6,7 +6,7 @@ module.exports = class Sepia { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); image = await jimp.read(image); image.sepia(); let raw; diff --git a/src/module/gif/triggered.js b/src/module/gif/triggered.js index 82db5b7..39a09d9 100644 --- a/src/module/gif/triggered.js +++ b/src/module/gif/triggered.js @@ -9,7 +9,7 @@ module.exports = class Triggered { * @param {number} timeout */ async getImage(image, timeout = 15) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); if (isNaN(timeout)) throw new Error(`The timeout argument must be a number.`); const base = await Canvas.loadImage(`${__dirname}/../../assets/triggered.png`); const img = await Canvas.loadImage(image); diff --git a/src/module/montage/ad.js b/src/module/montage/ad.js index 939cd3c..5db0930 100644 --- a/src/module/montage/ad.js +++ b/src/module/montage/ad.js @@ -3,10 +3,10 @@ const Canvas = require(`canvas`); module.exports = class Ad { /** * Ad - * @param {image} image1 + * @param {image} image1 */ async getImage(image1) { - if (!image1) throw new Error(`You must provide an image as argument.`); + if (!image1) throw new Error(`You must provide an image as an argument`); const canvas = Canvas.createCanvas(550, 474); const ctx = canvas.getContext(`2d`); image1 = await Canvas.loadImage(image1); @@ -15,4 +15,4 @@ module.exports = class Ad { ctx.drawImage(background, 0, 0, 550, 474); return canvas.toBuffer(); } -}; \ No newline at end of file +}; diff --git a/src/module/montage/affect.js b/src/module/montage/affect.js index f9b6b5f..3622746 100644 --- a/src/module/montage/affect.js +++ b/src/module/montage/affect.js @@ -6,7 +6,7 @@ module.exports = class Affect { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); let base = await jimp.read(`${__dirname}/../../assets/affect.png`); let img = await jimp.read(image); img.resize(200, 157); diff --git a/src/module/montage/beautiful.js b/src/module/montage/beautiful.js index c63a1f9..a2ed674 100644 --- a/src/module/montage/beautiful.js +++ b/src/module/montage/beautiful.js @@ -6,7 +6,7 @@ module.exports = class Beautiful { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); let base = await jimp.read(`${__dirname}/../../assets/beautiful.png`); base.resize(376, 400); let img = await jimp.read(image); diff --git a/src/module/montage/bobross.js b/src/module/montage/bobross.js index 2e89415..f059810 100644 --- a/src/module/montage/bobross.js +++ b/src/module/montage/bobross.js @@ -6,7 +6,7 @@ module.exports = class Bobross { * @param {image} image1 */ async getImage(image1) { - if (!image1) throw new Error(`You must provide an image as argument.`); + if (!image1) throw new Error(`You must provide an image as an argument`); const base = await loadImage(`${__dirname}/../../assets/bobross.png`); const canvas = createCanvas(base.width, base.height); const ctx = canvas.getContext(`2d`); diff --git a/src/module/montage/confusedStonk.js b/src/module/montage/confusedStonk.js index 306e1ca..22e2d16 100644 --- a/src/module/montage/confusedStonk.js +++ b/src/module/montage/confusedStonk.js @@ -3,10 +3,10 @@ const Canvas = require(`canvas`); module.exports = class ConfusedStonk { /** * ConfusedStonk - * @param {image} image1 + * @param {image} image1 */ async getImage(image1) { - if (!image1) throw new Error(`You must provide an image as argument.`); + if (!image1) throw new Error(`You must provide an image as an argument`); const canvas = Canvas.createCanvas(1994, 1296); const ctx = canvas.getContext(`2d`); image1 = await Canvas.loadImage(image1); @@ -15,4 +15,4 @@ module.exports = class ConfusedStonk { ctx.drawImage(background, 0, 0, 1994, 1296); return canvas.toBuffer(); } -}; \ No newline at end of file +}; diff --git a/src/module/montage/delete.js b/src/module/montage/delete.js index 1519449..40a8ae3 100644 --- a/src/module/montage/delete.js +++ b/src/module/montage/delete.js @@ -6,7 +6,7 @@ module.exports = class Delete { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); let bg = await jimp.read(`${__dirname}/../../assets/delete.png`); image = await jimp.read(image); image.resize(195, 195); diff --git a/src/module/montage/discordBlack.js b/src/module/montage/discordBlack.js index ee2c20f..1208d33 100644 --- a/src/module/montage/discordBlack.js +++ b/src/module/montage/discordBlack.js @@ -6,7 +6,7 @@ module.exports = class DiscordBlack { * @param {image} image1 */ async getImage(image1) { - if (!image1) throw new Error(`You must provide an image as argument.`); + if (!image1) throw new Error(`You must provide an image as an argument`); const canvas = Canvas.createCanvas(610, 610); const ctx = canvas.getContext(`2d`); image1 = await Canvas.loadImage(image1); diff --git a/src/module/montage/discordBlue.js b/src/module/montage/discordBlue.js index f4b403c..c7ec0bb 100644 --- a/src/module/montage/discordBlue.js +++ b/src/module/montage/discordBlue.js @@ -6,7 +6,7 @@ module.exports = class DiscordBlue { * @param {image} image1 */ async getImage(image1) { - if (!image1) throw new Error(`You must provide an image as argument.`); + if (!image1) throw new Error(`You must provide an image as an argument`); const canvas = Canvas.createCanvas(610, 610); const ctx = canvas.getContext(`2d`); image1 = await Canvas.loadImage(image1); diff --git a/src/module/montage/facepalm.js b/src/module/montage/facepalm.js index 5cc2a05..96c3d3e 100644 --- a/src/module/montage/facepalm.js +++ b/src/module/montage/facepalm.js @@ -6,7 +6,7 @@ module.exports = class Facepalm { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); let canvas = Canvas.createCanvas(632, 357); let ctx = canvas.getContext(`2d`); ctx.fillStyle = `black`; diff --git a/src/module/montage/hitler.js b/src/module/montage/hitler.js index 7af7fce..7912033 100644 --- a/src/module/montage/hitler.js +++ b/src/module/montage/hitler.js @@ -6,7 +6,7 @@ module.exports = class Hitler { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); let bg = await jimp.read(`${__dirname}/../../assets/hitler.png`); let img = await jimp.read(image); img.resize(140, 140); diff --git a/src/module/montage/jail.js b/src/module/montage/jail.js index d3cb373..269b91e 100644 --- a/src/module/montage/jail.js +++ b/src/module/montage/jail.js @@ -6,7 +6,7 @@ module.exports = class Jail { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); let bg = await Canvas.loadImage(`${__dirname}/../../assets/jail.png`); let img = await Canvas.loadImage(image); const canvas = Canvas.createCanvas(400, 400); diff --git a/src/module/montage/karaba.js b/src/module/montage/karaba.js new file mode 100644 index 0000000..2a213db --- /dev/null +++ b/src/module/montage/karaba.js @@ -0,0 +1,18 @@ +const Canvas = require(`canvas`); + +module.exports = class Mms { + /** + * MMS + * @param {image} image + */ + async getImage(image) { + if (!image) throw new Error(`You must provide an image as an argument`); + let bg = await Canvas.loadImage(`${__dirname}/../../assets/karaba.png`); + let img = await Canvas.loadImage(image); + const canvas = Canvas.createCanvas(bg.width, bg.height); + const ctx = canvas.getContext(`2d`); + ctx.drawImage(img, 130, 44, 130, 130); + ctx.drawImage(bg, 0, 0, bg.width, bg.height); + return canvas.toBuffer(); + } +}; diff --git a/src/module/montage/mms.js b/src/module/montage/mms.js index 42c58d8..4fd00fe 100644 --- a/src/module/montage/mms.js +++ b/src/module/montage/mms.js @@ -6,7 +6,7 @@ module.exports = class Mms { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); let bg = await Canvas.loadImage(`${__dirname}/../../assets/mms.png`); let img = await Canvas.loadImage(image); const canvas = Canvas.createCanvas(400, 400); diff --git a/src/module/montage/notStonk.js b/src/module/montage/notStonk.js index 5daff06..da008fa 100644 --- a/src/module/montage/notStonk.js +++ b/src/module/montage/notStonk.js @@ -3,10 +3,10 @@ const Canvas = require(`canvas`); module.exports = class NotStonk { /** * NotStonk - * @param {image} image1 + * @param {image} image1 */ async getImage(image1) { - if (!image1) throw new Error(`You must provide an image as argument.`); + if (!image1) throw new Error(`You must provide an image as an argument`); const canvas = Canvas.createCanvas(960, 576); const ctx = canvas.getContext(`2d`); image1 = await Canvas.loadImage(image1); @@ -15,4 +15,4 @@ module.exports = class NotStonk { ctx.drawImage(background, 0, 0, 960, 576); return canvas.toBuffer(); } -}; \ No newline at end of file +}; diff --git a/src/module/montage/poutine.js b/src/module/montage/poutine.js index eabc82f..e46b968 100644 --- a/src/module/montage/poutine.js +++ b/src/module/montage/poutine.js @@ -3,10 +3,10 @@ const Canvas = require(`canvas`); module.exports = class Poutine { /** * Ad - * @param {image} image1 + * @param {image} image1 */ async getImage(image1) { - if (!image1) throw new Error(`You must provide an image as argument.`); + if (!image1) throw new Error(`You must provide an image as an argument`); const canvas = Canvas.createCanvas(600, 539); const ctx = canvas.getContext(`2d`); image1 = await Canvas.loadImage(image1); @@ -15,4 +15,4 @@ module.exports = class Poutine { ctx.drawImage(background, 0, 0, 600, 539); return canvas.toBuffer(); } -}; \ No newline at end of file +}; diff --git a/src/module/montage/rip.js b/src/module/montage/rip.js index e891a75..5ddcefa 100644 --- a/src/module/montage/rip.js +++ b/src/module/montage/rip.js @@ -7,7 +7,7 @@ module.exports = class Rip { */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); const canvas = Canvas.createCanvas(720, 405); const ctx = canvas.getContext(`2d`); const background = await Canvas.loadImage(`${__dirname}/../../assets/rip.png`); diff --git a/src/module/montage/stonk.js b/src/module/montage/stonk.js index e926d17..b9a4c34 100644 --- a/src/module/montage/stonk.js +++ b/src/module/montage/stonk.js @@ -3,10 +3,10 @@ const Canvas = require(`canvas`); module.exports = class Stonk { /** * Stonk - * @param {image} image1 + * @param {image} image1 */ async getImage(image1) { - if (!image1) throw new Error(`You must provide an image as argument.`); + if (!image1) throw new Error(`You must provide an image as an argument`); const canvas = Canvas.createCanvas(900, 539); const ctx = canvas.getContext(`2d`); image1 = await Canvas.loadImage(image1); @@ -15,4 +15,4 @@ module.exports = class Stonk { ctx.drawImage(background, 0, 0, 900, 539); return canvas.toBuffer(); } -}; \ No newline at end of file +}; diff --git a/src/module/montage/tatoo.js b/src/module/montage/tatoo.js index 8d0d45d..3eb4e2c 100644 --- a/src/module/montage/tatoo.js +++ b/src/module/montage/tatoo.js @@ -6,7 +6,7 @@ module.exports = class Tatoo { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); const canvas = Canvas.createCanvas(750, 1089); const ctx = canvas.getContext(`2d`); const avatar = await Canvas.loadImage(image); diff --git a/src/module/montage/thomas.js b/src/module/montage/thomas.js index 7f0cec5..8006584 100644 --- a/src/module/montage/thomas.js +++ b/src/module/montage/thomas.js @@ -6,7 +6,7 @@ module.exports = class Thomas { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); const canvas = Canvas.createCanvas(841, 1058); const ctx = canvas.getContext(`2d`); const avatar = await Canvas.loadImage(image); diff --git a/src/module/montage/trash.js b/src/module/montage/trash.js index f9dc7da..147f066 100644 --- a/src/module/montage/trash.js +++ b/src/module/montage/trash.js @@ -6,7 +6,7 @@ module.exports = class Trash { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); let bg = await jimp.read(`${__dirname}/../../assets/trash.png`); image = await jimp.read(image); image.resize(309, 309); diff --git a/src/module/montage/wanted.js b/src/module/montage/wanted.js index 56b6a24..711391d 100644 --- a/src/module/montage/wanted.js +++ b/src/module/montage/wanted.js @@ -9,7 +9,7 @@ module.exports = class Wanted { * @param {image} image */ async getImage(image, currency = `$`) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); if (typeof currency != `string`) throw new Error(`You must provide a string for the currency.`); if (currency.length > 1) throw new Error(`You must provide only one character for the currency.`); var price = Math.floor(Math.random() * 188708) + 329889; diff --git a/src/module/utils/circle.js b/src/module/utils/circle.js index 1e0685d..218c660 100644 --- a/src/module/utils/circle.js +++ b/src/module/utils/circle.js @@ -6,7 +6,7 @@ module.exports = class Circle { * @param {image} image */ async getImage(image) { - if (!image) throw new Error(`You must provide an image.`); + if (!image) throw new Error(`You must provide an image as a first argument.`); image = await jimp.read(image); image.resize(480, 480); image.circle();