# discord-image-generation
A powerfull module that allow you to generate awesome images.
# Bugs and glitches
Feel free to report all bugs and glitches by creating an issue in the issue section.
A correct and understandable issue contains :
- Steps to reproduce
- Code that summonned the error
- The complete error
Please join [this](https://discord.gg/5ZSGFYtnqw) community server to follow all my projects or if you need help.
# Links:
### Support Server Community
### Xinko Discord Bot Support Server
# Download
You can download it from npmjs.
```cli
npm i discord-image-generation
```
# Configuration
The first step is to import the module in your code.
```js
const DIG = require("discord-image-generation");
```
Then you have to request your image and send it as an attachement.
## Discord.js v13
```js
// Import the discord.js library.
const Discord = require("discord.js");
// Create a new discord.js client.
const bot = new Discord.Client();
const DIG = require("discord-image-generation");
// Listen to the ready event
bot.on("ready", () => {
console.log("Bot is online");
});
// Listen to the message event
bot.on("messageCreate", async (message) => {
// Send the image in a simple message
if (message.content === "*delete") {
// Get the avatarUrl of the user
let avatar = message.author.displayAvatarURL({
dynamic: false,
format: 'png'
});
// Make the image
let img = await new DIG.Delete().getImage(avatar);
// Add the image as an attachement
let attach = new Discord.MessageAttachment(img, "delete.png");
message.channel.send({
files: [attach]
});
}
// Send the message with the image attached to an embed
if (message.content === "*blur") {
// Get the avatarUrl of the user
let avatar = message.author.displayAvatarURL({
dynamic: false,
format: 'png'
});
// Make the image
let img = await new DIG.Blur().getImage(avatar);
// Add the image as an attachement
let embed = new Discord.MessageEmbed()
.setTitle("Blur")
.setImage("attachment://delete.png");
let attach = new Discord.MessageAttachment(img, "blur.png");
message.channel.send({
embeds: [embed],
files: [attach]
});
}
});
// Log in to the bot
bot.login("super_secret_token");
```
## Discord.js v14
```js
// Import the required elements from the discord.js library.
const { Client, GatewayIntentBits, AttachmentBuilder, EmbedBuilder } = require("discord.js");
// Create a new discord.js client.
const bot = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});
const DIG = require("discord-image-generation");
// Listen to the ready event
bot.on("ready", () => {
console.log("Bot is online");
});
// Listen to the message event
bot.on("messageCreate", async (message) => {
// Send the image in a simple message
if (message.content === "*delete") {
// Get the avatarUrl of the user
let avatar = message.author.displayAvatarURL({
forceStatic: true,
extension: 'png'
});
// Make the image
let img = await new DIG.Delete().getImage(avatar);
// Add the image as an attachement
let attach = new AttachmentBuilder(img).setName("delete.png");
message.channel.send({
files: [attach]
});
}
// Send the message with the image attached to an embed
if (message.content === "*blur") {
// Get the avatarUrl of the user
let avatar = message.author.displayAvatarURL({
forceStatic: true,
extension: 'png'
});
// Make the image
let img = await new DIG.Blur().getImage(avatar);
// Add the image as an attachement
let embed = new EmbedBuilder()
.setTitle("Blur")
.setImage("attachment://blur.png");
let attach = new AttachmentBuilder(img).setName("blur.png");
message.channel.send({
embeds: [embed],
files: [attach]
});
}
});
// Log in to the bot
bot.login("super_secret_token");
```
# Available images
## Filters
- ``new DIG.Blur().getImage(``, ``);``
![Blur](https://imgur.com/JqpNFTY.png)
- ``new DIG.Gay().getImage(``);``
![Gay](https://imgur.com/BDTrXzZ.png)
- ``new DIG.Greyscale().getImage(``);``
![Greyscale](https://imgur.com/h3ahY7Z.png)
- ``new DIG.Invert().getImage(``);``
![Invert](https://imgur.com/Rl0wGQM.png)
- ``new DIG.Sepia().getImage(``);``
![Sepia](https://imgur.com/OTbKVtj.png)
## Gifs
- ``new DIG.Blink().getImage(delay (in ms), ``, ``.....);``
> You can add as many images as you want
![Blink](https://imgur.com/JjUXmRU.gif)
- ``new DIG.Triggered().getImage(``);``
![Triggered](https://imgur.com/0QvyYQa.gif)
## Montage
- ``new DIG.Ad().getImage(``);``
![Ad](https://imgur.com/H7FvUtZ.png)
- ``new DIG.Affect().getImage(``);``
![Affect](https://imgur.com/g4Gaehb.png)
- ``new DIG.Batslap().getImage(``, ``);``
![Batslap](https://imgur.com/oYMpa5A.png)
- ``new DIG.Beautiful().getImage(``);``
![Beautiful](https://imgur.com/HGZkmXo.png)
- ``new DIG.Bed().getImage(``, ``);``
![Bed](https://imgur.com/b1idSnr.png)
- ``new DIG.Bobross().getImage(``);``
![Bobross](https://imgur.com/lATDohK.png)
- ``new DIG.Clown().getImage(``);``
![Clown](https://imgur.com/qXUAAkb.png)
- ``new DIG.ConfusedStonk().getImage(``);``
![ConfusedStonk](https://imgur.com/b4UB3BE.png)
- ``new DIG.Deepfry().getImage(``);``
![Deepfry](https://imgur.com/q2ADecK.png)
- ``new DIG.Delete().getImage(``);``
![Delete](https://imgur.com/6V1IYJp.png)
- ``new DIG.DiscordBlack().getImage(``)``
![DiscordBlack](https://imgur.com/dTX3wta.png)
- ``new DIG.DiscordBlue().getImage(``)``
![DiscordBlue](https://imgur.com/q1bRGrx.png)
- ``new DIG.DoubleStonk().getImage(``)``
![DoubleStonk](https://imgur.com/HbuuUC6.png)
- ``new DIG.Facepalm().getImage(``);``
![Facepalm](https://imgur.com/cdPC3P1.png)
- ``new DIG.Hearbreaking().getImage(``);``
![Hearbreaking](https://imgur.com/P6USTJ3.png)
- ``new DIG.Hitler().getImage(``);``
![Hitler](https://imgur.com/wK9puxH.png)
- ``new DIG.Jail().getImage(``);``
![Jail](https://imgur.com/QslACNo.png)
- ``new DIG.Karaba().getImage(``);``
![Karaba](https://imgur.com/4aEZs6v.png)
- ``new DIG.Kiss().getImage(``, ``);``
![Kiss](https://imgur.com/sSoCAeH.png)
- ``new DIG.LisaPresentation().getImage(``);``
![LisaPresentation](https://imgur.com/u5cPVVW.png)
> Limited to 300char
- ``new DIG.Mikkelsen().getImage(``);``
![Mikkelsen](https://imgur.com/4p71VGS.png)
(Thanks to sιмση ℓεcℓεяε#5765)
- ``new DIG.Mms().getImage(``);``
![MMS](https://imgur.com/nH3URHb.png)
- ``new DIG.NotStonk().getImage(``);``
![NotStonk](https://imgur.com/NJ2Svtj.png)
- ``new DIG.Podium().getImage(`, , , , , `);``
![Podium](https://imgur.com/bQoKf0a.png)
- ``new DIG.Poutine().getImage(``);``
![Poutine](https://imgur.com/UpQJHzM.png)
- ``new DIG.Rip().getImage(``);``
![RIP](https://imgur.com/qhyZKfz.png)
- ``new DIG.Snyder().getImage(``);``
![Snyder](https://imgur.com/0dFnTcP.png)
- ``new DIG.Spank().getImage(``, ``);``
![Spank](https://imgur.com/25gq0es.png)
- ``new DIG.Stonk().getImage(``);``
![Stonk](https://imgur.com/oAVgevR.png)
- ``new DIG.Tatoo().getImage(``)``
![Tatoo](https://imgur.com/wJju4UJ.png)
- ``new DIG.Thomas().getImage(``);``
![Thomas](https://imgur.com/7R37J2j.png)
- ``new DIG.Trash().getImage(``);``
![Trash](https://imgur.com/nwAHGgF.png)
- ``new DIG.Wanted().getImage(``, ``);``
> Currency ($, €, ...)
![Wanted](https://imgur.com/NJfzJeN.png)
## Utils
- ``new DIG.Circle().getImage(``);``
![Circle](https://imgur.com/0Zo8NYS.png)
- ``new DIG.Color().getImage(``);``
> An hex color is needed, like "#FF0000"
![Color](https://imgur.com/40tMwfe.png)
# Changelog
## v1.4.22
- Fixed some bugs
## v1.4.21
- Added discord.js V14 usage example
- Removed discord.js V12 usage example
## v1.4.20
- Some fixes
- Added Clown() (thanks to Retrojection#1937)
- Added Deepfry() (thanks to Retrojection#1937)
- Added Heartbreaking() (thanks to Retrojection#1937)
- Added Mikkelsen() (thanks to Retrojection#1937)
- Added Snyder() (thanks to Retrojection#1937)
## v1.4.7
- Improved Blink() generation, now supports adding an insane amount of images ^^
## 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
- Use of the function file in LisaPresentation() instead of an in file function
## v1.3.9
- Edited links in README
- Bumped jimp from 0.14.0 to 0.16.1
## v1.3.8
- Edited the Rip() image
- Fixed the Spank() colors
## v1.3.4
- Added bobross()
## v1.3.2
- Added Stonk()
- Added NotStonk()
- Added DoubleStonk()
- Added ConfusedStonk()
## v1.2.12
- Optimized src/index.js (thanks to https://github.com/Pyrojs)
## v1.2.9
- Added Podium()
- Added Ad()
- Added Poutine()
- Fixed Wanted()
- Bumped jimp from ^0.13.0 to ^0.14.0
## v1.1.5
- Added LisaPresentation
## v1.1.2
- Fixed invalid path
- Moved assets folder
## v1.0.0
- Changed the full structure
- Sorted all files in folders
- Sorted all files in the README
- Fixed new Wanted() text bug
- Added new Blink()
- Added a timeout options for new Triggered()
- Fixed the triggered example not animated
- Added some keywords
- Bumped jimp from ^0.12.1 to ^0.13.0
- Added workflow to auto publish to npm and github packages on push
## v0.1.14
- Updated .thomas() example
## v0.1.13
- Added example for .tatoo()
- Fixed the litle hole at the top of the users pic on .thomas()
## v0.1.12
- Saved all examples to imgur
## v0.1.11
- Added .tatoo()
- Updated JSDoc
## v0.1.9
- Added options for the wanted.
- The base image has been updated
- There is now a random price diplayed
- You can now configure a currency
- Added .thomas()
Thanks to Alex15#0010 for the big help ! ❤