From 0dd47ed181296f425a1f307b0a13e8d2237d5b99 Mon Sep 17 00:00:00 2001 From: Killian Date: Tue, 16 Jun 2020 11:23:41 +0200 Subject: [PATCH] Fixed path errors --- package.json | 2 +- src/module/filters/gay.js | 2 +- src/module/gif/triggered.js | 2 +- src/module/montage/affect.js | 2 +- src/module/montage/batslap.js | 2 +- src/module/montage/beautiful.js | 2 +- src/module/montage/bed.js | 2 +- src/module/montage/delete.js | 2 +- src/module/montage/facepalm.js | 2 +- src/module/montage/hitler.js | 2 +- src/module/montage/jail.js | 2 +- src/module/montage/kiss.js | 2 +- src/module/montage/mms.js | 2 +- src/module/montage/rip.js | 2 +- src/module/montage/spank.js | 2 +- src/module/montage/tatoo.js | 2 +- src/module/montage/thomas.js | 2 +- src/module/montage/trash.js | 2 +- src/module/montage/wanted.js | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index f9660ff..74e2cf2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord-image-generation", - "version": "1.1.2", + "version": "1.1.3", "description": "discord-image-generation is a powerfull module that allow you to generate awesome images.", "main": "src/index.js", "scripts": { diff --git a/src/module/filters/gay.js b/src/module/filters/gay.js index 04dde5b..bae12d5 100644 --- a/src/module/filters/gay.js +++ b/src/module/filters/gay.js @@ -7,7 +7,7 @@ module.exports = class Gay { */ async getImage(image) { if (!image) throw new Error(`You must provide an image.`); - let bg = await Canvas.loadImage(`../src/assets/gay.png`); + let bg = await Canvas.loadImage(`${__dirname}/../../assets/gay.png`); let img = await Canvas.loadImage(image); const canvas = Canvas.createCanvas(480, 480); const ctx = canvas.getContext(`2d`); diff --git a/src/module/gif/triggered.js b/src/module/gif/triggered.js index 361469f..737342f 100644 --- a/src/module/gif/triggered.js +++ b/src/module/gif/triggered.js @@ -11,7 +11,7 @@ module.exports = class Triggered { async getImage(image, timeout = 15) { if (!image) throw new Error(`You must provide an image.`); if (isNaN(timeout)) throw new Error(`The timeout argument must be a number.`) - const base = await Canvas.loadImage(`../src/assets/triggered.png`); + const base = await Canvas.loadImage(`${__dirname}/../../assets/triggered.png`); const img = await Canvas.loadImage(image); const GIF = new GIFEncoder(256, 310) GIF.start(); diff --git a/src/module/montage/affect.js b/src/module/montage/affect.js index 5804486..187cb26 100644 --- a/src/module/montage/affect.js +++ b/src/module/montage/affect.js @@ -7,7 +7,7 @@ module.exports = class Affect { */ async getImage(image) { if (!image) throw new Error("You must provide an image."); - let base = await jimp.read(`../src/assets/affect.png`); + let base = await jimp.read(`${__dirname}/../../assets/affect.png`); let img = await jimp.read(image); img.resize(200, 157); base.composite(img, 180, 383); diff --git a/src/module/montage/batslap.js b/src/module/montage/batslap.js index b15e8db..545a06b 100644 --- a/src/module/montage/batslap.js +++ b/src/module/montage/batslap.js @@ -9,7 +9,7 @@ module.exports = class Batslap { async getImage(image1, image2) { if (!image1) throw new Error("You must provide an image as a first argument."); if (!image2) throw new Error("You must provide an image as a second argument."); - let base = await jimp.read(`../src/assets/batslap.png`); + let base = await jimp.read(`${__dirname}/../../assets/batslap.png`); image1 = await jimp.read(image1); image2 = await jimp.read(image2); image1.circle(); diff --git a/src/module/montage/beautiful.js b/src/module/montage/beautiful.js index 1c26a05..3d0daec 100644 --- a/src/module/montage/beautiful.js +++ b/src/module/montage/beautiful.js @@ -7,7 +7,7 @@ module.exports = class Beautiful { */ async getImage(image) { if (!image) throw new Error("You must provide an image."); - let base = await jimp.read(`../src/assets/beautiful.png`); + let base = await jimp.read(`${__dirname}/../../assets/beautiful.png`); base.resize(376, 400); let img = await jimp.read(image); img.resize(84, 95); diff --git a/src/module/montage/bed.js b/src/module/montage/bed.js index cf40d97..d349b0e 100644 --- a/src/module/montage/bed.js +++ b/src/module/montage/bed.js @@ -9,7 +9,7 @@ module.exports = class Bed { async getImage(image1, image2) { if (!image1) throw new Error(`You must provide an image as a first argument.`); if (!image2) throw new Error(`You must provide an image as a second argument.`); - let bg = await jimp.read(`../src/assets/bed.png`); + let bg = await jimp.read(`${__dirname}/../../assets/bed.png`); image1 = await jimp.read(image1); image2 = await jimp.read(image2); image1.circle(); diff --git a/src/module/montage/delete.js b/src/module/montage/delete.js index 55330ee..508f19f 100644 --- a/src/module/montage/delete.js +++ b/src/module/montage/delete.js @@ -7,7 +7,7 @@ module.exports = class Delete { */ async getImage(image) { if (!image) throw new Error(`You must provide an image.`); - let bg = await jimp.read(`../src/assets/delete.png`); + let bg = await jimp.read(`${__dirname}/../../assets/delete.png`); image = await jimp.read(image); image.resize(195, 195); bg.composite(image, 120, 135); diff --git a/src/module/montage/facepalm.js b/src/module/montage/facepalm.js index d4fd22c..24a8fd6 100644 --- a/src/module/montage/facepalm.js +++ b/src/module/montage/facepalm.js @@ -13,7 +13,7 @@ module.exports = class Facepalm { ctx.fillRect(0, 0, 632, 357); let avatar = await Canvas.loadImage(image); ctx.drawImage(avatar, 199, 112, 235, 235); - let layer = await Canvas.loadImage(`../src/assets/facepalm.png`); + let layer = await Canvas.loadImage(`${__dirname}/../../assets/facepalm.png`); ctx.drawImage(layer, 0, 0, 632, 357); return canvas.toBuffer(); } diff --git a/src/module/montage/hitler.js b/src/module/montage/hitler.js index 18454d6..8df408e 100644 --- a/src/module/montage/hitler.js +++ b/src/module/montage/hitler.js @@ -7,7 +7,7 @@ module.exports = class Hitler { */ async getImage(image) { if (!image) throw new Error(`You must provide an image.`); - let bg = await jimp.read(`../src/assets/hitler.png`); + let bg = await jimp.read(`${__dirname}/../../assets/hitler.png`); let img = await jimp.read(image); img.resize(140, 140); bg.composite(img, 46, 43); diff --git a/src/module/montage/jail.js b/src/module/montage/jail.js index 5250557..f1fdf6b 100644 --- a/src/module/montage/jail.js +++ b/src/module/montage/jail.js @@ -7,7 +7,7 @@ module.exports = class Jail { */ async getImage(image) { if (!image) throw new Error(`You must provide an image.`); - let bg = await Canvas.loadImage(`../src/assets/jail.png`); + let bg = await Canvas.loadImage(`${__dirname}/../../assets/jail.png`); let img = await Canvas.loadImage(image); const canvas = Canvas.createCanvas(400, 400); const ctx = canvas.getContext(`2d`); diff --git a/src/module/montage/kiss.js b/src/module/montage/kiss.js index 2de5154..e24ca51 100644 --- a/src/module/montage/kiss.js +++ b/src/module/montage/kiss.js @@ -9,7 +9,7 @@ module.exports = class Kiss { async getImage(image1, image2) { if (!image1) throw new Error(`You must provide an image as a first argument.`); if (!image2) throw new Error(`You must provide an image as a second argument.`); - let base = await jimp.read(`../src/assets/kiss.png`); + let base = await jimp.read(`${__dirname}/../../assets/kiss.png`); image1 = await jimp.read(image1); image2 = await jimp.read(image2); image1.circle(); diff --git a/src/module/montage/mms.js b/src/module/montage/mms.js index 0f8e95c..c683ec7 100644 --- a/src/module/montage/mms.js +++ b/src/module/montage/mms.js @@ -7,7 +7,7 @@ module.exports = class Mms { */ async getImage(image) { if (!image) throw new Error(`You must provide an image.`); - let bg = await Canvas.loadImage(`../src/assets/mms.png`); + let bg = await Canvas.loadImage(`${__dirname}/../../assets/mms.png`); let img = await Canvas.loadImage(image); const canvas = Canvas.createCanvas(400, 400); const ctx = canvas.getContext(`2d`); diff --git a/src/module/montage/rip.js b/src/module/montage/rip.js index 75861ca..e903946 100644 --- a/src/module/montage/rip.js +++ b/src/module/montage/rip.js @@ -11,7 +11,7 @@ module.exports = class Rip { if (!image) throw new Error(`You must provide an image.`); const canvas = Canvas.createCanvas(244, 253); const ctx = canvas.getContext(`2d`); - const background = await Canvas.loadImage(`../src/assets/rip.png`); + const background = await Canvas.loadImage(`${__dirname}/../../assets/rip.png`); ctx.drawImage(background, 0, 0, canvas.width, canvas.height); const avatar = await Canvas.loadImage(image); ctx.drawImage(avatar, 63, 110, 90, 90); diff --git a/src/module/montage/spank.js b/src/module/montage/spank.js index e5f769c..f410113 100644 --- a/src/module/montage/spank.js +++ b/src/module/montage/spank.js @@ -9,7 +9,7 @@ module.exports = class Spank { async getImage(image1, image2) { if (!image1) throw new Error(`You must provide an image as a first argument.`); if (!image2) throw new Error(`You must provide an image as a second argument.`); - let bg = await jimp.read(`../src/assets/spank.png`); + let bg = await jimp.read(`${__dirname}/../../assets/spank.png`); image1 = await jimp.read(image1); image2 = await jimp.read(image2); image1.circle(); diff --git a/src/module/montage/tatoo.js b/src/module/montage/tatoo.js index 268fa5a..a2dc8c4 100644 --- a/src/module/montage/tatoo.js +++ b/src/module/montage/tatoo.js @@ -10,7 +10,7 @@ module.exports = class Tatoo { const canvas = Canvas.createCanvas(750, 1089); const ctx = canvas.getContext(`2d`); const avatar = await Canvas.loadImage(image); - const background = await Canvas.loadImage(`../src/assets/tatoo.png`); + const background = await Canvas.loadImage(`${__dirname}/../../assets/tatoo.png`); ctx.drawImage(avatar, 145, 575, 400, 400); ctx.drawImage(background, 0, 0, 750, 1089); return canvas.toBuffer(); diff --git a/src/module/montage/thomas.js b/src/module/montage/thomas.js index 55d47b0..5fd0a77 100644 --- a/src/module/montage/thomas.js +++ b/src/module/montage/thomas.js @@ -10,7 +10,7 @@ module.exports = class Thomas { const canvas = Canvas.createCanvas(841, 1058); const ctx = canvas.getContext(`2d`); const avatar = await Canvas.loadImage(image); - const background = await Canvas.loadImage(`../src/assets/thomas.png`); + const background = await Canvas.loadImage(`${__dirname}/../../assets/thomas.png`); ctx.drawImage(avatar, 220, 190, 400, 400); ctx.drawImage(background, 0, 0, 841, 1058); return canvas.toBuffer(); diff --git a/src/module/montage/trash.js b/src/module/montage/trash.js index d8e369f..46778f2 100644 --- a/src/module/montage/trash.js +++ b/src/module/montage/trash.js @@ -7,7 +7,7 @@ module.exports = class Trash { */ async getImage(image) { if (!image) throw new Error(`You must provide an image.`); - let bg = await jimp.read(`../src/assets/trash.png`); + let bg = await jimp.read(`${__dirname}/../../assets/trash.png`); image = await jimp.read(image); image.resize(309, 309); image.blur(5); diff --git a/src/module/montage/wanted.js b/src/module/montage/wanted.js index 5e28c29..aa74f25 100644 --- a/src/module/montage/wanted.js +++ b/src/module/montage/wanted.js @@ -16,7 +16,7 @@ module.exports = class Wanted { const canvas = Canvas.createCanvas(257, 383); const ctx = canvas.getContext(`2d`); const avatar = await Canvas.loadImage(image); - const background = await Canvas.loadImage(`../src/assets/wanted.png`); + const background = await Canvas.loadImage(`${__dirname}/../../assets/wanted.png`); ctx.drawImage(avatar, 25, 60, 210, 210); ctx.drawImage(background, 0, 0, 257, 383); ctx.font = applyText(canvas, price.toLocaleString() + currency, 40, 200, "Times New Roman");