You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

236 lines
5.4 KiB
Markdown

<a href="https://nodei.co/npm/discord-image-generation/"><img src="https://nodei.co/npm/discord-image-generation.png?downloads=true&downloadRank=true&stars=true"></a>
<a href="https://discord.gg/qvzwqaM"><img src="https://discord.com/api/guilds/661897530459684865/widget.png" alt="Discord server"/></a>
# 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 <a href="https://github.com/Mr-KayJayDee/discord-image-generation/issues">issue section.</a>
A correct and understandable issue contains :
- Steps to reproduce
- Code that summonned the error
- The complete error
You can also join me on my <a href="https://discord.gg/qvzwqaM">discord server.</a>
# Download
You can download it from <a href="https://www.npmjs.com/package/discord-image-generation">npmjs</a>.
```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.
```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");
5 years ago
> You can also destructure to avoid repeating DIG.
// Listen to the ready event
bot.on("ready", () => {
console.log("ok");
})
// Listen to the message event
bot.on("message", async (message) => {
if (message.content === "*delete") {
5 years ago
// Get the avatarUrl of the user
let avatar = message.author.displayAvatarURL({ dynamic: false, format: 'png' });
// Make the image
5 years ago
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(attach)
}
})
// Log in to the bot
bot.login("super_secret_token")
````
# Available images
5 years ago
## Filters
5 years ago
- ``new DIG.Blur().getImage(`<Avatar>`, `<Level(Number)>`);``
5 years ago
![Blur](https://imgur.com/JqpNFTY.png)
5 years ago
- ``new DIG.Gay().getImage(`<Avatar>`);``
![Gay](https://imgur.com/BDTrXzZ.png)
5 years ago
- ``new DIG.Greyscale().getImage(`<Avatar>`);``
5 years ago
![Greyscale](https://imgur.com/h3ahY7Z.png)
5 years ago
- ``new DIG.Invert().getImage(`<Avatar>`);``
5 years ago
![Invert](https://imgur.com/Rl0wGQM.png)
5 years ago
- ``new DIG.Sepia().getImage(`<Avatar>`);``
5 years ago
![Sepia](https://imgur.com/OTbKVtj.png)
5 years ago
## Gifs
5 years ago
- ``new DIG.Blink().getImage(`<Avatar>`, `<Avatar2>`, <Timeout (Number in ms)>)``
5 years ago
![Blink](https://imgur.com/JjUXmRU.gif)
5 years ago
- ``new DIG.Triggered().getImage(`<Avatar>`);``
5 years ago
![Triggered](https://imgur.com/0QvyYQa.gif)
5 years ago
## Montage
5 years ago
- ``new DIG.Affect().getImage(`<Avatar>`);``
5 years ago
![Affect](https://imgur.com/g4Gaehb.png)
5 years ago
- ``new DIG.Batslap().getImage(`<Avatar>`, `<Avatar2>`);``
5 years ago
![Batslap](https://imgur.com/oYMpa5A.png)
5 years ago
- ``new DIG.Beautiful().getImage(`<Avatar>`);``
5 years ago
![Beautiful](https://imgur.com/HGZkmXo.png)
5 years ago
- ``new DIG.Bed().getImage(`<Avatar>`, `<Avatar2>`);``
5 years ago
![Bed](https://imgur.com/b1idSnr.png)
5 years ago
- ``new DIG.Delete().getImage(`<Avatar>`);``
5 years ago
![Delete](https://imgur.com/6V1IYJp.png)
5 years ago
- ``new DIG.Facepalm().getImage(`<Avatar>`);``
5 years ago
![Facepalm](https://imgur.com/cdPC3P1.png)
5 years ago
- ``new DIG.Hitler().getImage(`<Avatar>`);``
![Hitler](https://imgur.com/wK9puxH.png)
5 years ago
- ``new DIG.Jail().getImage(`<Avatar>`);``
5 years ago
![Jail](https://imgur.com/QslACNo.png)
5 years ago
- ``new DIG.Kiss().getImage(`<Avatar>`, `<Avatar2>`);``
5 years ago
![Kiss](https://imgur.com/sSoCAeH.png)
5 years ago
- ``new DIG.Mms().getImage(`<Avatar>`);``
![LisaPresentation](https://imgur.com/u5cPVVW)
- ``new DIG.LisaPresentation().getImage(`<Text>`);``
4 years ago
(Thanks to sιмση εcεяε#5765)
> Limited to 300char
5 years ago
![MMS](https://imgur.com/nH3URHb.png)
5 years ago
- ``new DIG.Rip().getImage(`<Avatar>`);``
5 years ago
![RIP](https://imgur.com/MgsRH8o.png)
5 years ago
- ``new DIG.Spank().getImage(`<Avatar>`, `<Avatar2>`);``
5 years ago
![Spank](https://imgur.com/VRvogo7.png)
5 years ago
- ``new DIG.Tatoo().getImage(`<Avatar>`)``
5 years ago
![Tatoo](https://imgur.com/wJju4UJ.png)
5 years ago
- ``new DIG.Thomas().getImage(`<Avatar>`);``
5 years ago
![Thomas](https://imgur.com/7R37J2j.png)
5 years ago
- ``new DIG.Trash().getImage(`<Avatar>`);``
5 years ago
![Trash](https://imgur.com/nwAHGgF.png)
5 years ago
- ``new DIG.Wanted().getImage(`<Avatar>`, `<Currency>`);``
> Currency ($, €, ...)
![Wanted](https://imgur.com/SFGRvSK.png)
5 years ago
## Utils
5 years ago
- ``new DIG.Circle().getImage(`<Avatar>`);``
5 years ago
![Circle](https://imgur.com/0Zo8NYS.png)
5 years ago
- ``new DIG.Color().getImage(`<Color>`);``
5 years ago
> An hex color is needed, like "#FF0000"
5 years ago
![Color](https://imgur.com/40tMwfe.png)
5 years ago
# Changelog
## v1.1.5
- Added LisaPresentation
## v1.1.2
- Fixed invalid path
- Moved assets folder
5 years ago
## v1.0.0
- Changed the full structure
- Sorted all files in folders
- Sorted all files in the README
5 years ago
- Fixed new Wanted() text bug
- Added new Blink()
- Added a timeout options for new Triggered()
5 years ago
- 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
5 years ago
## 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
5 years ago
## 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()