📌 Added discord example
This commit is contained in:
32
README.md
32
README.md
@@ -33,6 +33,38 @@ The first step is to import the module in your code.
|
|||||||
const DIG = require("discord-image-generation");
|
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");
|
||||||
|
|
||||||
|
// 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") {
|
||||||
|
// Get the avatarUrl of the user
|
||||||
|
let avatar = message.author.displayAvatarURL({ dynamic: false, format: 'png' });
|
||||||
|
// Make the image
|
||||||
|
let img = await DIG.delete(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
|
# Available images
|
||||||
|
|
||||||
- .blur(`<Avatar>`, `<Level(Number)>`);
|
- .blur(`<Avatar>`, `<Level(Number)>`);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discord-image-generation",
|
"name": "discord-image-generation",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"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": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user