|
|
@ -1,12 +1,12 @@
|
|
|
|
const Jimp = require('jimp');
|
|
|
|
const Jimp = require('jimp');
|
|
|
|
const { validateURL } = require(`../functions`);
|
|
|
|
const { validateURL } = require(`../functions`);
|
|
|
|
module.exports = class DiscordBlack {
|
|
|
|
module.exports = class DiscordBlack {
|
|
|
|
async getImage(img1) {
|
|
|
|
async getImage(image) {
|
|
|
|
if (!img1) return console.error(`You must provide an image as an argument`);
|
|
|
|
if (!image) return console.error(`You must provide an image as an argument`);
|
|
|
|
let isValid = await validateURL(img1);
|
|
|
|
let isValid = await validateURL(image);
|
|
|
|
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
|
|
if (!isValid) return console.error(`You must provide a valid image URL or buffer.`);
|
|
|
|
const background = await Jimp.read(`${__dirname}/../../assets/discordblack.png`);
|
|
|
|
const background = await Jimp.read(`${__dirname}/../../assets/discordblack.png`);
|
|
|
|
const image1 = await Jimp.read(img1);
|
|
|
|
const image1 = await Jimp.read(image);
|
|
|
|
image1.resize(background.getWidth(), background.getHeight());
|
|
|
|
image1.resize(background.getWidth(), background.getHeight());
|
|
|
|
const compositeImage = new Jimp(background.getWidth(), background.getHeight(), 0xFFFFFFFF);
|
|
|
|
const compositeImage = new Jimp(background.getWidth(), background.getHeight(), 0xFFFFFFFF);
|
|
|
|
compositeImage.composite(image1, 0, 0);
|
|
|
|
compositeImage.composite(image1, 0, 0);
|
|
|
|