Version 1.4.0
parent
afa32e0211
commit
10fcffd6b6
@ -0,0 +1,22 @@
|
|||||||
|
module.exports = {
|
||||||
|
"rules": {
|
||||||
|
"no-console": `off`,
|
||||||
|
"indent": [`error`, 4],
|
||||||
|
"semi": [`error`, `always`],
|
||||||
|
"quotes": [`error`, `backtick`],
|
||||||
|
"keyword-spacing": [
|
||||||
|
`error`,
|
||||||
|
{
|
||||||
|
"before": true, "after": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"extends": `eslint:recommended`,
|
||||||
|
"env": {
|
||||||
|
"es6": true,
|
||||||
|
"node": true,
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2020
|
||||||
|
},
|
||||||
|
};
|
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -1,22 +1,20 @@
|
|||||||
const { createCanvas, loadImage } = require("canvas");
|
const { createCanvas, loadImage } = require(`canvas`);
|
||||||
|
|
||||||
module.exports = class Bobross {
|
module.exports = class Bobross {
|
||||||
/**
|
/**
|
||||||
* Bobross
|
* Bobross
|
||||||
* @param {image} image1
|
* @param {image} image1
|
||||||
*/
|
*/
|
||||||
async getImage(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 argument.`);
|
||||||
const base = await loadImage(`${__dirname}/../../assets/bobross.png`);
|
const base = await loadImage(`${__dirname}/../../assets/bobross.png`);
|
||||||
const canvas = createCanvas(base.width, base.height);
|
const canvas = createCanvas(base.width, base.height);
|
||||||
const ctx = canvas.getContext("2d");
|
const ctx = canvas.getContext(`2d`);
|
||||||
image1 = await loadImage(image1);
|
image1 = await loadImage(image1);
|
||||||
ctx.fillStyle = "white";
|
ctx.fillStyle = `white`;
|
||||||
ctx.fillRect(0, 0, base.width, base.height);
|
ctx.fillRect(0, 0, base.width, base.height);
|
||||||
ctx.drawImage(image1, 15, 20, 440, 440);
|
ctx.drawImage(image1, 15, 20, 440, 440);
|
||||||
ctx.drawImage(base, 0, 0);
|
ctx.drawImage(base, 0, 0);
|
||||||
return canvas.toBuffer()
|
return canvas.toBuffer();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// -N²O Pyro ;)
|
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
const Canvas = require(`canvas`);
|
||||||
|
|
||||||
|
module.exports = class DiscordBlack {
|
||||||
|
/**
|
||||||
|
* Bobross
|
||||||
|
* @param {image} image1
|
||||||
|
*/
|
||||||
|
async getImage(image1) {
|
||||||
|
if (!image1) throw new Error(`You must provide an image as argument.`);
|
||||||
|
const canvas = Canvas.createCanvas(610, 610);
|
||||||
|
const ctx = canvas.getContext(`2d`);
|
||||||
|
image1 = await Canvas.loadImage(image1);
|
||||||
|
const background = await Canvas.loadImage(`${__dirname}/../../assets/discordblack.png`);
|
||||||
|
ctx.drawImage(image1, 0, 0, 610, 610);
|
||||||
|
ctx.drawImage(background, 0, 0, 610, 610);
|
||||||
|
return canvas.toBuffer();
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,18 @@
|
|||||||
|
const Canvas = require(`canvas`);
|
||||||
|
|
||||||
|
module.exports = class DiscordBlue {
|
||||||
|
/**
|
||||||
|
* Bobross
|
||||||
|
* @param {image} image1
|
||||||
|
*/
|
||||||
|
async getImage(image1) {
|
||||||
|
if (!image1) throw new Error(`You must provide an image as argument.`);
|
||||||
|
const canvas = Canvas.createCanvas(610, 610);
|
||||||
|
const ctx = canvas.getContext(`2d`);
|
||||||
|
image1 = await Canvas.loadImage(image1);
|
||||||
|
const background = await Canvas.loadImage(`${__dirname}/../../assets/discordblue.png`);
|
||||||
|
ctx.drawImage(image1, 0, 0, 610, 610);
|
||||||
|
ctx.drawImage(background, 0, 0, 610, 610);
|
||||||
|
return canvas.toBuffer();
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue