Presentation
Zoro API is an API that generates images with filters to enhance your photos !
Installation
npm i --save zoro-api
Configuration
The first step is to import the module in your code.
const Zoro = require("zoro-api");
Then you have to request your image and send it as an attachement.
Be careful, if you want to use animated filters (gifs), you will have to modify the extension of the gif type instead of png.
const Discord = require("discord.js");
const bot = new Discord.Client()
const Zoro = require("zoro-api");
bot.on("ready", () => {
console.log("The robot is online !");
})
bot.on("message", async (message) => {
if (message.content === "!blur") {
let user = message.mentions.users.first() || message.author;
let avatar = user.displayAvatarURL({ size: 512 }).replace(".webp", ".png")
const msg = await message.channel.send("Generating ...")
let img = await Zoro.blur(avatar)
let attachment = new Discord.MessageAttachment(img, "blur.png");
message.channel.send(attachment) && msg.delete();
}
})
bot.login("Token")
Available endpoints
PNG :
- .tv(Avatar)
- .bw(Avatar)
- .ps4(Avatar)
- .gay(Avatar)
- .jail(Avatar)
- .blur(Avatar)
- .trash(Avatar)
- .pixel(Avatar)
- .sepia(Avatar)
- .invert(Avatar)
- .circle(Avatar)
- .ps4pegi(Avatar)
- .contrast(Avatar)
- .convolute(Avatar)
GIFS :
- .error(Avatar)
- .triggered(Avatar)
RANDOM GIFS :
- .cry()
- .hug()
- .kiss()
- .bang()
- .wasted()
RANDOM PICTURES :
CREATE GIFS :
- .cgif(Avatar, "Link of an image")
Advanced
How to generate an image in an embed ? (Example with the blur filter).
bot.on("message", async (message) => {
if (message.content === "!blur") {
let user = message.mentions.users.first() || message.author;
let avatar = user.displayAvatarURL({ size: 512 }).replace(".webp", ".png")
const msg = await message.channel.send("Generating ...")
let img = await Zoro.blur(avatar)
let attachment = new Discord.MessageAttachment(img, "blur.png");
const embed = {
title: `Blur, user ${user.username}`,
image: {
url: 'attachment://blur.png',
},
};
message.channel.send(({ files: [attachment], embed: embed })) && msg.delete();
}
})
How to generate an image with a link ? (Example with the blur filter).
Zoro.blur("Link")
It is also possible to get the link from a command.
Example !blur http://image.png
.
client.on("message", async (message) => {
if (message.content.startsWith("!img")) {
let messageArray = message.content.split(' ');
let args = messageArray.slice(1);
if (!args[0]) return message.channel.send("Please indicate the link of an image !")
const msg = await message.channel.send("Generating ...")
try {
let img = await Zoro.blur(args.join(" "))
let attachment = new Discord.MessageAttachment(img, "blur.png");
message.channel.send(attachment) && msg.delete();
} catch (e) {
console.log(e)
return message.channel.send("An error occured, please check the link of your image !") && msg.delete();
}
}
})
How to design a custom gif ?
Example !cgif http://image.png
.
client.on("message", async (message) => {
if (message.content.startsWith("!cgif")) {
let messageArray = message.content.split(' ');
let args = messageArray.slice(1);
let user = message.mentions.users.first() || message.author;
let avatar = user.displayAvatarURL({ size: 512 }).replace(".webp", ".png")
if (!args[0]) return message.channel.send("Please indicate the link of an image !")
const msg = await message.channel.send("Generating ...")
try {
let img = await Zoro.cgif(avatar, args.join(" "))
let attachment = new Discord.MessageAttachment(img, "cgif.gif");
message.channel.send(attachment) && msg.delete();
} catch (e) {
console.log(e)
return message.channel.send("An error occured, please check the link of your image !") && msg.delete();
}
}
})
Discord server
Do you have a question? Problem? Join the server discord.
Contributors
Thanks to Mr¤KayJayDee for contributing to the project.