Fixed path errors

main
Killian' Dal-Cin 5 years ago
parent 492ad845fa
commit 0dd47ed181

@ -1,6 +1,6 @@
{ {
"name": "discord-image-generation", "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.", "description": "discord-image-generation is a powerfull module that allow you to generate awesome images.",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {

@ -7,7 +7,7 @@ module.exports = class Gay {
*/ */
async getImage(image) { async getImage(image) {
if (!image) throw new Error(`You must provide an 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); let img = await Canvas.loadImage(image);
const canvas = Canvas.createCanvas(480, 480); const canvas = Canvas.createCanvas(480, 480);
const ctx = canvas.getContext(`2d`); const ctx = canvas.getContext(`2d`);

@ -11,7 +11,7 @@ module.exports = class Triggered {
async getImage(image, timeout = 15) { 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.`);
if (isNaN(timeout)) throw new Error(`The timeout argument must be a number.`) 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 img = await Canvas.loadImage(image);
const GIF = new GIFEncoder(256, 310) const GIF = new GIFEncoder(256, 310)
GIF.start(); GIF.start();

@ -7,7 +7,7 @@ module.exports = class Affect {
*/ */
async getImage(image) { async getImage(image) {
if (!image) throw new Error("You must provide an 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); let img = await jimp.read(image);
img.resize(200, 157); img.resize(200, 157);
base.composite(img, 180, 383); base.composite(img, 180, 383);

@ -9,7 +9,7 @@ module.exports = class Batslap {
async getImage(image1, image2) { async getImage(image1, image2) {
if (!image1) throw new Error("You must provide an image as a first argument."); 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."); 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); image1 = await jimp.read(image1);
image2 = await jimp.read(image2); image2 = await jimp.read(image2);
image1.circle(); image1.circle();

@ -7,7 +7,7 @@ module.exports = class Beautiful {
*/ */
async getImage(image) { async getImage(image) {
if (!image) throw new Error("You must provide an 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); base.resize(376, 400);
let img = await jimp.read(image); let img = await jimp.read(image);
img.resize(84, 95); img.resize(84, 95);

@ -9,7 +9,7 @@ module.exports = class Bed {
async getImage(image1, image2) { async getImage(image1, image2) {
if (!image1) throw new Error(`You must provide an image as a first argument.`); 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.`); 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); image1 = await jimp.read(image1);
image2 = await jimp.read(image2); image2 = await jimp.read(image2);
image1.circle(); image1.circle();

@ -7,7 +7,7 @@ module.exports = class Delete {
*/ */
async getImage(image) { async getImage(image) {
if (!image) throw new Error(`You must provide an 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 = await jimp.read(image);
image.resize(195, 195); image.resize(195, 195);
bg.composite(image, 120, 135); bg.composite(image, 120, 135);

@ -13,7 +13,7 @@ module.exports = class Facepalm {
ctx.fillRect(0, 0, 632, 357); ctx.fillRect(0, 0, 632, 357);
let avatar = await Canvas.loadImage(image); let avatar = await Canvas.loadImage(image);
ctx.drawImage(avatar, 199, 112, 235, 235); 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); ctx.drawImage(layer, 0, 0, 632, 357);
return canvas.toBuffer(); return canvas.toBuffer();
} }

@ -7,7 +7,7 @@ module.exports = class Hitler {
*/ */
async getImage(image) { async getImage(image) {
if (!image) throw new Error(`You must provide an 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); let img = await jimp.read(image);
img.resize(140, 140); img.resize(140, 140);
bg.composite(img, 46, 43); bg.composite(img, 46, 43);

@ -7,7 +7,7 @@ module.exports = class Jail {
*/ */
async getImage(image) { async getImage(image) {
if (!image) throw new Error(`You must provide an 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); let img = await Canvas.loadImage(image);
const canvas = Canvas.createCanvas(400, 400); const canvas = Canvas.createCanvas(400, 400);
const ctx = canvas.getContext(`2d`); const ctx = canvas.getContext(`2d`);

@ -9,7 +9,7 @@ module.exports = class Kiss {
async getImage(image1, image2) { async getImage(image1, image2) {
if (!image1) throw new Error(`You must provide an image as a first argument.`); 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.`); 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); image1 = await jimp.read(image1);
image2 = await jimp.read(image2); image2 = await jimp.read(image2);
image1.circle(); image1.circle();

@ -7,7 +7,7 @@ module.exports = class Mms {
*/ */
async getImage(image) { async getImage(image) {
if (!image) throw new Error(`You must provide an 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); let img = await Canvas.loadImage(image);
const canvas = Canvas.createCanvas(400, 400); const canvas = Canvas.createCanvas(400, 400);
const ctx = canvas.getContext(`2d`); const ctx = canvas.getContext(`2d`);

@ -11,7 +11,7 @@ module.exports = class Rip {
if (!image) throw new Error(`You must provide an image.`); if (!image) throw new Error(`You must provide an image.`);
const canvas = Canvas.createCanvas(244, 253); const canvas = Canvas.createCanvas(244, 253);
const ctx = canvas.getContext(`2d`); 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); ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
const avatar = await Canvas.loadImage(image); const avatar = await Canvas.loadImage(image);
ctx.drawImage(avatar, 63, 110, 90, 90); ctx.drawImage(avatar, 63, 110, 90, 90);

@ -9,7 +9,7 @@ module.exports = class Spank {
async getImage(image1, image2) { async getImage(image1, image2) {
if (!image1) throw new Error(`You must provide an image as a first argument.`); 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.`); 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); image1 = await jimp.read(image1);
image2 = await jimp.read(image2); image2 = await jimp.read(image2);
image1.circle(); image1.circle();

@ -10,7 +10,7 @@ module.exports = class Tatoo {
const canvas = Canvas.createCanvas(750, 1089); const canvas = Canvas.createCanvas(750, 1089);
const ctx = canvas.getContext(`2d`); const ctx = canvas.getContext(`2d`);
const avatar = await Canvas.loadImage(image); 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(avatar, 145, 575, 400, 400);
ctx.drawImage(background, 0, 0, 750, 1089); ctx.drawImage(background, 0, 0, 750, 1089);
return canvas.toBuffer(); return canvas.toBuffer();

@ -10,7 +10,7 @@ module.exports = class Thomas {
const canvas = Canvas.createCanvas(841, 1058); const canvas = Canvas.createCanvas(841, 1058);
const ctx = canvas.getContext(`2d`); const ctx = canvas.getContext(`2d`);
const avatar = await Canvas.loadImage(image); 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(avatar, 220, 190, 400, 400);
ctx.drawImage(background, 0, 0, 841, 1058); ctx.drawImage(background, 0, 0, 841, 1058);
return canvas.toBuffer(); return canvas.toBuffer();

@ -7,7 +7,7 @@ module.exports = class Trash {
*/ */
async getImage(image) { async getImage(image) {
if (!image) throw new Error(`You must provide an 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 = await jimp.read(image);
image.resize(309, 309); image.resize(309, 309);
image.blur(5); image.blur(5);

@ -16,7 +16,7 @@ module.exports = class Wanted {
const canvas = Canvas.createCanvas(257, 383); const canvas = Canvas.createCanvas(257, 383);
const ctx = canvas.getContext(`2d`); const ctx = canvas.getContext(`2d`);
const avatar = await Canvas.loadImage(image); 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(avatar, 25, 60, 210, 210);
ctx.drawImage(background, 0, 0, 257, 383); ctx.drawImage(background, 0, 0, 257, 383);
ctx.font = applyText(canvas, price.toLocaleString() + currency, 40, 200, "Times New Roman"); ctx.font = applyText(canvas, price.toLocaleString() + currency, 40, 200, "Times New Roman");

Loading…
Cancel
Save