Added .thomas(), added option to .wanted()
This commit is contained in:
@@ -330,17 +330,22 @@ class DIG {
|
||||
* Wanted
|
||||
* @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.");
|
||||
let base = await jimp.read(__dirname + "/assets/wanted.png");
|
||||
let img = await jimp.read(image);
|
||||
img.resize(447, 447);
|
||||
base.composite(img, 145, 282);
|
||||
let raw;
|
||||
base.getBuffer("image/png", (err, buffer) => {
|
||||
raw = buffer;
|
||||
});
|
||||
return raw;
|
||||
if (!currency) currency = "$"
|
||||
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() * 1887088) + 329889
|
||||
const canvas = Canvas.createCanvas(257, 383);
|
||||
const ctx = canvas.getContext("2d");
|
||||
const avatar = await Canvas.loadImage(image);
|
||||
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 = '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);
|
||||
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;
|
||||
|
BIN
src/module/assets/thomas.png
Normal file
BIN
src/module/assets/thomas.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 468 KiB |
Binary file not shown.
Before Width: | Height: | Size: 455 KiB After Width: | Height: | Size: 119 KiB |
Reference in New Issue
Block a user