|
|
@ -330,17 +330,22 @@ class DIG {
|
|
|
|
* Wanted
|
|
|
|
* Wanted
|
|
|
|
* @param {image} image
|
|
|
|
* @param {image} image
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static async wanted(image) {
|
|
|
|
static async wanted(image, currency) {
|
|
|
|
if (!image) throw new Error("You must provide an image as a first argument.");
|
|
|
|
if (!image) throw new Error("You must provide an image as a first argument.");
|
|
|
|
let base = await jimp.read(__dirname + "/assets/wanted.png");
|
|
|
|
if (!currency) currency = "$"
|
|
|
|
let img = await jimp.read(image);
|
|
|
|
if (typeof currency != "string") throw new Error("You must provide a string for the currency.")
|
|
|
|
img.resize(447, 447);
|
|
|
|
if (currency.length > 1) throw new Error("You must provide only one character for the currency.")
|
|
|
|
base.composite(img, 145, 282);
|
|
|
|
var price = Math.floor(Math.random() * 1887088) + 329889
|
|
|
|
let raw;
|
|
|
|
const canvas = Canvas.createCanvas(257, 383);
|
|
|
|
base.getBuffer("image/png", (err, buffer) => {
|
|
|
|
const ctx = canvas.getContext("2d");
|
|
|
|
raw = buffer;
|
|
|
|
const avatar = await Canvas.loadImage(image);
|
|
|
|
});
|
|
|
|
const background = await Canvas.loadImage(__dirname +"/assets/wanted.png");
|
|
|
|
return raw;
|
|
|
|
ctx.drawImage(avatar, 25, 60, 210, 210);
|
|
|
|
|
|
|
|
ctx.drawImage(background, 0, 0, 257, 383);
|
|
|
|
|
|
|
|
ctx.font = 'Bold 35px Times New Roman'
|
|
|
|
|
|
|
|
ctx.fillStyle = "#513d34"
|
|
|
|
|
|
|
|
ctx.fillText(price.toLocaleString() + currency, 55, 310)
|
|
|
|
|
|
|
|
return canvas.toBuffer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -416,6 +421,22 @@ class DIG {
|
|
|
|
ctx.drawImage(bg, 0, 0, 400, 400);
|
|
|
|
ctx.drawImage(bg, 0, 0, 400, 400);
|
|
|
|
return canvas.toBuffer();
|
|
|
|
return canvas.toBuffer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Thomas
|
|
|
|
|
|
|
|
* @param {image} image
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static async thomas(image) {
|
|
|
|
|
|
|
|
if (!image) throw new Error("You must provide an image as a first argument.");
|
|
|
|
|
|
|
|
var price = Math.floor(Math.random() * 1887088) + 329889
|
|
|
|
|
|
|
|
const canvas = Canvas.createCanvas(841, 1058);
|
|
|
|
|
|
|
|
const ctx = canvas.getContext("2d");
|
|
|
|
|
|
|
|
const avatar = await Canvas.loadImage(image);
|
|
|
|
|
|
|
|
const background = await Canvas.loadImage(__dirname +"/assets/thomas.png");
|
|
|
|
|
|
|
|
ctx.drawImage(avatar, 220, 200, 400, 400);
|
|
|
|
|
|
|
|
ctx.drawImage(background, 0, 0, 841, 1058);
|
|
|
|
|
|
|
|
return canvas.toBuffer();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = DIG;
|
|
|
|
module.exports = DIG;
|
|
|
|