Added Karaba() and bug fixes

main
Killian 4 years ago
parent 47c121ec40
commit 4be539163d

1
.gitignore vendored

@ -2,3 +2,4 @@ node_modules/
package-lock.json
test/
pas fait/
.vscode/

@ -161,6 +161,10 @@ bot.login("super_secret_token")
![Jail](https://imgur.com/QslACNo.png)
- ``new DIG.Karaba().getImage(`<Avatar>`);``
![Karaba](https://imgur.com/4aEZs6v.png)
- ``new DIG.Kiss().getImage(`<Avatar>`, `<Avatar2>`);``
![Kiss](https://imgur.com/sSoCAeH.png)
@ -233,6 +237,10 @@ bot.login("super_secret_token")
# Changelog
## v1.4.5
- Added Karaba()
- Fixed some errors returns that were not the same
## v1.4.0
- Added DiscordBlack() and DiscordBlue()
- Added ESLint and fixed all problems

@ -1,6 +1,6 @@
{
"name": "discord-image-generation",
"version": "1.4.2",
"version": "1.4.5",
"description": "discord-image-generation is a powerfull module that allow you to generate awesome images.",
"main": "src/index.js",
"scripts": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

@ -7,7 +7,7 @@ module.exports = class Blur {
* @param {level} level
*/
async getImage(image, level) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
image = await jimp.read(image);
image.blur(isNaN(level) ? 5 : parseInt(level));
let raw;

@ -6,7 +6,7 @@ module.exports = class Gay {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
let bg = await Canvas.loadImage(`${__dirname}/../../assets/gay.png`);
let img = await Canvas.loadImage(image);
const canvas = Canvas.createCanvas(480, 480);

@ -6,7 +6,7 @@ module.exports = class Geryscale {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
image = await jimp.read(image);
image.greyscale();
let raw;

@ -6,7 +6,7 @@ module.exports = class Invert {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
image = await jimp.read(image);
image.invert();
let raw;

@ -6,7 +6,7 @@ module.exports = class Sepia {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
image = await jimp.read(image);
image.sepia();
let raw;

@ -9,7 +9,7 @@ module.exports = class Triggered {
* @param {number} timeout
*/
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 as a first argument.`);
if (isNaN(timeout)) throw new Error(`The timeout argument must be a number.`);
const base = await Canvas.loadImage(`${__dirname}/../../assets/triggered.png`);
const img = await Canvas.loadImage(image);

@ -6,7 +6,7 @@ module.exports = class Ad {
* @param {image} 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 an argument`);
const canvas = Canvas.createCanvas(550, 474);
const ctx = canvas.getContext(`2d`);
image1 = await Canvas.loadImage(image1);

@ -6,7 +6,7 @@ module.exports = class Affect {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
let base = await jimp.read(`${__dirname}/../../assets/affect.png`);
let img = await jimp.read(image);
img.resize(200, 157);

@ -6,7 +6,7 @@ module.exports = class Beautiful {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
let base = await jimp.read(`${__dirname}/../../assets/beautiful.png`);
base.resize(376, 400);
let img = await jimp.read(image);

@ -6,7 +6,7 @@ module.exports = class Bobross {
* @param {image} 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 an argument`);
const base = await loadImage(`${__dirname}/../../assets/bobross.png`);
const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext(`2d`);

@ -6,7 +6,7 @@ module.exports = class ConfusedStonk {
* @param {image} 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 an argument`);
const canvas = Canvas.createCanvas(1994, 1296);
const ctx = canvas.getContext(`2d`);
image1 = await Canvas.loadImage(image1);

@ -6,7 +6,7 @@ module.exports = class Delete {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
let bg = await jimp.read(`${__dirname}/../../assets/delete.png`);
image = await jimp.read(image);
image.resize(195, 195);

@ -6,7 +6,7 @@ module.exports = class DiscordBlack {
* @param {image} 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 an argument`);
const canvas = Canvas.createCanvas(610, 610);
const ctx = canvas.getContext(`2d`);
image1 = await Canvas.loadImage(image1);

@ -6,7 +6,7 @@ module.exports = class DiscordBlue {
* @param {image} 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 an argument`);
const canvas = Canvas.createCanvas(610, 610);
const ctx = canvas.getContext(`2d`);
image1 = await Canvas.loadImage(image1);

@ -6,7 +6,7 @@ module.exports = class Facepalm {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
let canvas = Canvas.createCanvas(632, 357);
let ctx = canvas.getContext(`2d`);
ctx.fillStyle = `black`;

@ -6,7 +6,7 @@ module.exports = class Hitler {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
let bg = await jimp.read(`${__dirname}/../../assets/hitler.png`);
let img = await jimp.read(image);
img.resize(140, 140);

@ -6,7 +6,7 @@ module.exports = class Jail {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
let bg = await Canvas.loadImage(`${__dirname}/../../assets/jail.png`);
let img = await Canvas.loadImage(image);
const canvas = Canvas.createCanvas(400, 400);

@ -0,0 +1,18 @@
const Canvas = require(`canvas`);
module.exports = class Mms {
/**
* MMS
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image as an argument`);
let bg = await Canvas.loadImage(`${__dirname}/../../assets/karaba.png`);
let img = await Canvas.loadImage(image);
const canvas = Canvas.createCanvas(bg.width, bg.height);
const ctx = canvas.getContext(`2d`);
ctx.drawImage(img, 130, 44, 130, 130);
ctx.drawImage(bg, 0, 0, bg.width, bg.height);
return canvas.toBuffer();
}
};

@ -6,7 +6,7 @@ module.exports = class Mms {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
let bg = await Canvas.loadImage(`${__dirname}/../../assets/mms.png`);
let img = await Canvas.loadImage(image);
const canvas = Canvas.createCanvas(400, 400);

@ -6,7 +6,7 @@ module.exports = class NotStonk {
* @param {image} 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 an argument`);
const canvas = Canvas.createCanvas(960, 576);
const ctx = canvas.getContext(`2d`);
image1 = await Canvas.loadImage(image1);

@ -6,7 +6,7 @@ module.exports = class Poutine {
* @param {image} 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 an argument`);
const canvas = Canvas.createCanvas(600, 539);
const ctx = canvas.getContext(`2d`);
image1 = await Canvas.loadImage(image1);

@ -7,7 +7,7 @@ module.exports = class Rip {
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
const canvas = Canvas.createCanvas(720, 405);
const ctx = canvas.getContext(`2d`);
const background = await Canvas.loadImage(`${__dirname}/../../assets/rip.png`);

@ -6,7 +6,7 @@ module.exports = class Stonk {
* @param {image} 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 an argument`);
const canvas = Canvas.createCanvas(900, 539);
const ctx = canvas.getContext(`2d`);
image1 = await Canvas.loadImage(image1);

@ -6,7 +6,7 @@ module.exports = class Tatoo {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
const canvas = Canvas.createCanvas(750, 1089);
const ctx = canvas.getContext(`2d`);
const avatar = await Canvas.loadImage(image);

@ -6,7 +6,7 @@ module.exports = class Thomas {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
const canvas = Canvas.createCanvas(841, 1058);
const ctx = canvas.getContext(`2d`);
const avatar = await Canvas.loadImage(image);

@ -6,7 +6,7 @@ module.exports = class Trash {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
let bg = await jimp.read(`${__dirname}/../../assets/trash.png`);
image = await jimp.read(image);
image.resize(309, 309);

@ -9,7 +9,7 @@ module.exports = class Wanted {
* @param {image} image
*/
async getImage(image, currency = `$`) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
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() * 188708) + 329889;

@ -6,7 +6,7 @@ module.exports = class Circle {
* @param {image} image
*/
async getImage(image) {
if (!image) throw new Error(`You must provide an image.`);
if (!image) throw new Error(`You must provide an image as a first argument.`);
image = await jimp.read(image);
image.resize(480, 480);
image.circle();

Loading…
Cancel
Save