Added Karaba() and bug fixes
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@ node_modules/
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
test/
|
test/
|
||||||
pas fait/
|
pas fait/
|
||||||
|
.vscode/
|
@@ -161,6 +161,10 @@ bot.login("super_secret_token")
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
- ``new DIG.Karaba().getImage(`<Avatar>`);``
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
- ``new DIG.Kiss().getImage(`<Avatar>`, `<Avatar2>`);``
|
- ``new DIG.Kiss().getImage(`<Avatar>`, `<Avatar2>`);``
|
||||||
|
|
||||||

|

|
||||||
@@ -233,6 +237,10 @@ bot.login("super_secret_token")
|
|||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v1.4.5
|
||||||
|
- Added Karaba()
|
||||||
|
- Fixed some errors returns that were not the same
|
||||||
|
|
||||||
## v1.4.0
|
## v1.4.0
|
||||||
- Added DiscordBlack() and DiscordBlue()
|
- Added DiscordBlack() and DiscordBlue()
|
||||||
- Added ESLint and fixed all problems
|
- Added ESLint and fixed all problems
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discord-image-generation",
|
"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.",
|
"description": "discord-image-generation is a powerfull module that allow you to generate awesome images.",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
BIN
src/assets/karaba.png
Normal file
BIN
src/assets/karaba.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 186 KiB |
@@ -7,7 +7,7 @@ module.exports = class Blur {
|
|||||||
* @param {level} level
|
* @param {level} level
|
||||||
*/
|
*/
|
||||||
async getImage(image, 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 = await jimp.read(image);
|
||||||
image.blur(isNaN(level) ? 5 : parseInt(level));
|
image.blur(isNaN(level) ? 5 : parseInt(level));
|
||||||
let raw;
|
let raw;
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Gay {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 bg = await Canvas.loadImage(`${__dirname}/../../assets/gay.png`);
|
||||||
let img = await Canvas.loadImage(image);
|
let img = await Canvas.loadImage(image);
|
||||||
const canvas = Canvas.createCanvas(480, 480);
|
const canvas = Canvas.createCanvas(480, 480);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Geryscale {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 = await jimp.read(image);
|
||||||
image.greyscale();
|
image.greyscale();
|
||||||
let raw;
|
let raw;
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Invert {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 = await jimp.read(image);
|
||||||
image.invert();
|
image.invert();
|
||||||
let raw;
|
let raw;
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Sepia {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 = await jimp.read(image);
|
||||||
image.sepia();
|
image.sepia();
|
||||||
let raw;
|
let raw;
|
||||||
|
@@ -9,7 +9,7 @@ module.exports = class Triggered {
|
|||||||
* @param {number} timeout
|
* @param {number} timeout
|
||||||
*/
|
*/
|
||||||
async getImage(image, timeout = 15) {
|
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.`);
|
if (isNaN(timeout)) throw new Error(`The timeout argument must be a number.`);
|
||||||
const base = await Canvas.loadImage(`${__dirname}/../../assets/triggered.png`);
|
const base = await Canvas.loadImage(`${__dirname}/../../assets/triggered.png`);
|
||||||
const img = await Canvas.loadImage(image);
|
const img = await Canvas.loadImage(image);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Ad {
|
|||||||
* @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 an argument`);
|
||||||
const canvas = Canvas.createCanvas(550, 474);
|
const canvas = Canvas.createCanvas(550, 474);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
image1 = await Canvas.loadImage(image1);
|
image1 = await Canvas.loadImage(image1);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Affect {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 base = await jimp.read(`${__dirname}/../../assets/affect.png`);
|
||||||
let img = await jimp.read(image);
|
let img = await jimp.read(image);
|
||||||
img.resize(200, 157);
|
img.resize(200, 157);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Beautiful {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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`);
|
let base = await jimp.read(`${__dirname}/../../assets/beautiful.png`);
|
||||||
base.resize(376, 400);
|
base.resize(376, 400);
|
||||||
let img = await jimp.read(image);
|
let img = await jimp.read(image);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class 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 an 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`);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class ConfusedStonk {
|
|||||||
* @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 an argument`);
|
||||||
const canvas = Canvas.createCanvas(1994, 1296);
|
const canvas = Canvas.createCanvas(1994, 1296);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
image1 = await Canvas.loadImage(image1);
|
image1 = await Canvas.loadImage(image1);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Delete {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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`);
|
let bg = await jimp.read(`${__dirname}/../../assets/delete.png`);
|
||||||
image = await jimp.read(image);
|
image = await jimp.read(image);
|
||||||
image.resize(195, 195);
|
image.resize(195, 195);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class DiscordBlack {
|
|||||||
* @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 an argument`);
|
||||||
const canvas = Canvas.createCanvas(610, 610);
|
const canvas = Canvas.createCanvas(610, 610);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
image1 = await Canvas.loadImage(image1);
|
image1 = await Canvas.loadImage(image1);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class DiscordBlue {
|
|||||||
* @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 an argument`);
|
||||||
const canvas = Canvas.createCanvas(610, 610);
|
const canvas = Canvas.createCanvas(610, 610);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
image1 = await Canvas.loadImage(image1);
|
image1 = await Canvas.loadImage(image1);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Facepalm {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 canvas = Canvas.createCanvas(632, 357);
|
||||||
let ctx = canvas.getContext(`2d`);
|
let ctx = canvas.getContext(`2d`);
|
||||||
ctx.fillStyle = `black`;
|
ctx.fillStyle = `black`;
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Hitler {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 bg = await jimp.read(`${__dirname}/../../assets/hitler.png`);
|
||||||
let img = await jimp.read(image);
|
let img = await jimp.read(image);
|
||||||
img.resize(140, 140);
|
img.resize(140, 140);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Jail {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 bg = await Canvas.loadImage(`${__dirname}/../../assets/jail.png`);
|
||||||
let img = await Canvas.loadImage(image);
|
let img = await Canvas.loadImage(image);
|
||||||
const canvas = Canvas.createCanvas(400, 400);
|
const canvas = Canvas.createCanvas(400, 400);
|
||||||
|
18
src/module/montage/karaba.js
Normal file
18
src/module/montage/karaba.js
Normal file
@@ -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
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 bg = await Canvas.loadImage(`${__dirname}/../../assets/mms.png`);
|
||||||
let img = await Canvas.loadImage(image);
|
let img = await Canvas.loadImage(image);
|
||||||
const canvas = Canvas.createCanvas(400, 400);
|
const canvas = Canvas.createCanvas(400, 400);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class NotStonk {
|
|||||||
* @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 an argument`);
|
||||||
const canvas = Canvas.createCanvas(960, 576);
|
const canvas = Canvas.createCanvas(960, 576);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
image1 = await Canvas.loadImage(image1);
|
image1 = await Canvas.loadImage(image1);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Poutine {
|
|||||||
* @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 an argument`);
|
||||||
const canvas = Canvas.createCanvas(600, 539);
|
const canvas = Canvas.createCanvas(600, 539);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
image1 = await Canvas.loadImage(image1);
|
image1 = await Canvas.loadImage(image1);
|
||||||
|
@@ -7,7 +7,7 @@ module.exports = class Rip {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
async getImage(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(720, 405);
|
const canvas = Canvas.createCanvas(720, 405);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
const background = await Canvas.loadImage(`${__dirname}/../../assets/rip.png`);
|
const background = await Canvas.loadImage(`${__dirname}/../../assets/rip.png`);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Stonk {
|
|||||||
* @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 an argument`);
|
||||||
const canvas = Canvas.createCanvas(900, 539);
|
const canvas = Canvas.createCanvas(900, 539);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
image1 = await Canvas.loadImage(image1);
|
image1 = await Canvas.loadImage(image1);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Tatoo {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 canvas = Canvas.createCanvas(750, 1089);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
const avatar = await Canvas.loadImage(image);
|
const avatar = await Canvas.loadImage(image);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Thomas {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 canvas = Canvas.createCanvas(841, 1058);
|
||||||
const ctx = canvas.getContext(`2d`);
|
const ctx = canvas.getContext(`2d`);
|
||||||
const avatar = await Canvas.loadImage(image);
|
const avatar = await Canvas.loadImage(image);
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Trash {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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`);
|
let bg = await jimp.read(`${__dirname}/../../assets/trash.png`);
|
||||||
image = await jimp.read(image);
|
image = await jimp.read(image);
|
||||||
image.resize(309, 309);
|
image.resize(309, 309);
|
||||||
|
@@ -9,7 +9,7 @@ module.exports = class Wanted {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(image, currency = `$`) {
|
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 (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.`);
|
if (currency.length > 1) throw new Error(`You must provide only one character for the currency.`);
|
||||||
var price = Math.floor(Math.random() * 188708) + 329889;
|
var price = Math.floor(Math.random() * 188708) + 329889;
|
||||||
|
@@ -6,7 +6,7 @@ module.exports = class Circle {
|
|||||||
* @param {image} image
|
* @param {image} image
|
||||||
*/
|
*/
|
||||||
async getImage(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 = await jimp.read(image);
|
||||||
image.resize(480, 480);
|
image.resize(480, 480);
|
||||||
image.circle();
|
image.circle();
|
||||||
|
Reference in New Issue
Block a user