|
|
|
@ -18,10 +18,10 @@ Please join [this](https://discord.gg/5ZSGFYtnqw) community server to follow all
|
|
|
|
|
# Links:
|
|
|
|
|
|
|
|
|
|
### Support Server Community
|
|
|
|
|
<a href="https://discord.gg/5ZSGFYtnqw"><img src="https://discord.com/api/guilds/833309512412299276/widget.png" alt="Amandine support server"/></a>
|
|
|
|
|
<a href="https://discord.gg/5ZSGFYtnqw"><img src="https://discord.com/api/guilds/833309512412299276/widget.png" alt="Coding support server"/></a>
|
|
|
|
|
|
|
|
|
|
### Amandine Discord Bot Support Server
|
|
|
|
|
<a href="https://discord.gg/Uqd2sQP"><img src="https://discord.com/api/guilds/527836578912010251/widget.png" alt="Amandine support server"/></a>
|
|
|
|
|
### Xinko Discord Bot Support Server
|
|
|
|
|
<a href="https://discord.gg/Uqd2sQP"><img src="https://discord.com/api/guilds/527836578912010251/widget.png" alt="Xinko support server"/></a>
|
|
|
|
|
|
|
|
|
|
# Download
|
|
|
|
|
|
|
|
|
@ -41,96 +41,123 @@ const DIG = require("discord-image-generation");
|
|
|
|
|
|
|
|
|
|
Then you have to request your image and send it as an attachement.
|
|
|
|
|
|
|
|
|
|
## Discord.js v12
|
|
|
|
|
## Discord.js v13
|
|
|
|
|
```js
|
|
|
|
|
// Import the discord.js library.
|
|
|
|
|
const Discord = require("discord.js")
|
|
|
|
|
const Discord = require("discord.js");
|
|
|
|
|
// Create a new discord.js client.
|
|
|
|
|
const bot = new Discord.Client()
|
|
|
|
|
const bot = new Discord.Client();
|
|
|
|
|
|
|
|
|
|
const DIG = require("discord-image-generation");
|
|
|
|
|
> You can also destructure to avoid repeating DIG.
|
|
|
|
|
|
|
|
|
|
// Listen to the ready event
|
|
|
|
|
bot.on("ready", () => {
|
|
|
|
|
console.log("ok");
|
|
|
|
|
})
|
|
|
|
|
console.log("Bot is online");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Listen to the message event
|
|
|
|
|
bot.on("message", async (message) => {
|
|
|
|
|
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' });
|
|
|
|
|
let avatar = message.author.displayAvatarURL({
|
|
|
|
|
dynamic: false,
|
|
|
|
|
format: 'png'
|
|
|
|
|
});
|
|
|
|
|
// Make the image
|
|
|
|
|
let img = await new DIG.Delete().getImage(avatar)
|
|
|
|
|
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)
|
|
|
|
|
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' });
|
|
|
|
|
let avatar = message.author.displayAvatarURL({
|
|
|
|
|
dynamic: false,
|
|
|
|
|
format: 'png'
|
|
|
|
|
});
|
|
|
|
|
// Make the image
|
|
|
|
|
let img = await new DIG.Blur().getImage(avatar)
|
|
|
|
|
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({ embed: embed, files: [attach])
|
|
|
|
|
.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")
|
|
|
|
|
bot.login("super_secret_token");
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Discord.js v13
|
|
|
|
|
## Discord.js v14
|
|
|
|
|
```js
|
|
|
|
|
// Import the discord.js library.
|
|
|
|
|
const Discord = require("discord.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 Discord.Client()
|
|
|
|
|
const bot = new Client({
|
|
|
|
|
intents: [
|
|
|
|
|
GatewayIntentBits.Guilds,
|
|
|
|
|
GatewayIntentBits.GuildMembers,
|
|
|
|
|
GatewayIntentBits.GuildMessages,
|
|
|
|
|
GatewayIntentBits.MessageContent,
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const DIG = require("discord-image-generation");
|
|
|
|
|
> You can also destructure to avoid repeating DIG.
|
|
|
|
|
|
|
|
|
|
// Listen to the ready event
|
|
|
|
|
bot.on("ready", () => {
|
|
|
|
|
console.log("ok");
|
|
|
|
|
})
|
|
|
|
|
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' });
|
|
|
|
|
let avatar = message.author.displayAvatarURL({
|
|
|
|
|
forceStatic: true,
|
|
|
|
|
extension: 'png'
|
|
|
|
|
});
|
|
|
|
|
// Make the image
|
|
|
|
|
let img = await new DIG.Delete().getImage(avatar)
|
|
|
|
|
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] })
|
|
|
|
|
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({ dynamic: false, format: 'png' });
|
|
|
|
|
let avatar = message.author.displayAvatarURL({
|
|
|
|
|
forceStatic: true,
|
|
|
|
|
extension: 'png'
|
|
|
|
|
});
|
|
|
|
|
// Make the image
|
|
|
|
|
let img = await new DIG.Blur().getImage(avatar)
|
|
|
|
|
let img = await new DIG.Blur().getImage(avatar);
|
|
|
|
|
// Add the image as an attachement
|
|
|
|
|
let embed = new Discord.MessageEmbed()
|
|
|
|
|
let embed = new EmbedBuilder()
|
|
|
|
|
.setTitle("Blur")
|
|
|
|
|
.setImage("attachment://delete.png")
|
|
|
|
|
let attach = new Discord.MessageAttachment(img, "blur.png");;
|
|
|
|
|
message.channel.send({ embeds: [embed], files: [attach])
|
|
|
|
|
.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")
|
|
|
|
|
bot.login("super_secret_token");
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# Available images
|
|
|
|
@ -209,7 +236,7 @@ bot.login("super_secret_token")
|
|
|
|
|
|
|
|
|
|
- ``new DIG.Deepfry().getImage(`<Avatar>`);``
|
|
|
|
|
|
|
|
|
|
![Deepfry](https://imgur.com/beAiPNv.png)
|
|
|
|
|
![Deepfry](https://imgur.com/q2ADecK.png)
|
|
|
|
|
|
|
|
|
|
- ``new DIG.Delete().getImage(`<Avatar>`);``
|
|
|
|
|
|
|
|
|
@ -327,6 +354,10 @@ bot.login("super_secret_token")
|
|
|
|
|
|
|
|
|
|
# Changelog
|
|
|
|
|
|
|
|
|
|
## 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)
|
|
|
|
|