chore(package): mise à jour de la version et des dépendances

- Mise à jour de la version à 1.4.25
- Changement de la description pour corriger une faute d'orthographe
- Modification du script de test pour pointer vers le bon fichier
- Mise à jour des URLs du dépôt et des bugs vers le nouveau domaine
- Mise à jour des dépendances :
  - "canvas" à la version ^2.10.1
  - "jimp" à la version ^0.16.0
- Ajout d'une section "overrides" pour "jimp"
- Ajout de nouvelles fonctionnalités de validation d'URL dans les filtres d'images
- Amélioration de la gestion des erreurs pour les images manquantes ou invalides dans plusieurs modules
- Ajout de nouvelles classes d'images dans les typings
This commit is contained in:
Mr¤KayJayDee
2025-05-28 23:10:38 +02:00
parent 440558b15c
commit dc7ddd4b13
53 changed files with 703 additions and 539 deletions

216
README.md
View File

@@ -6,7 +6,7 @@ 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>
Feel free to report all bugs and glitches by creating an issue in the <a href="https://git.mrkayjaydee.xyz/Mr-KayJayDee/discord-image-generation/issues">issue section.</a>
A correct and understandable issue contains :
- Steps to reproduce
@@ -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
```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");
> 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) => {
// 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(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({ embed: embed, files: [attach])
}
})
// Log in to the bot
bot.login("super_secret_token")
```
## 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("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({ files: [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({ embeds: [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 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
@@ -161,7 +188,7 @@ bot.login("super_secret_token")
## Gifs
- ``new DIG.Blink().getImage(`<Avatar>`, `<Avatar2>`.....);``
- ``new DIG.Blink().getImage(delay (in ms), `<Avatar>`, `<Avatar2>`.....);``
> You can add as many images as you want
@@ -198,10 +225,19 @@ bot.login("super_secret_token")
![Bobross](https://imgur.com/lATDohK.png)
- ``new DIG.Clown().getImage(`<Avatar>`);``
![Clown](https://imgur.com/qXUAAkb.png)
- ``new DIG.ConfusedStonk().getImage(`<Avatar>`);``
![ConfusedStonk](https://imgur.com/b4UB3BE.png)
- ``new DIG.Deepfry().getImage(`<Avatar>`);``
![Deepfry](https://imgur.com/q2ADecK.png)
- ``new DIG.Delete().getImage(`<Avatar>`);``
![Delete](https://imgur.com/6V1IYJp.png)
@@ -222,6 +258,10 @@ bot.login("super_secret_token")
![Facepalm](https://imgur.com/cdPC3P1.png)
- ``new DIG.Heartbreaking().getImage(`<Avatar>`);``
![Heartbreaking](https://imgur.com/P6USTJ3.png)
- ``new DIG.Hitler().getImage(`<Avatar>`);``
![Hitler](https://imgur.com/wK9puxH.png)
@@ -244,6 +284,10 @@ bot.login("super_secret_token")
> Limited to 300char
- ``new DIG.Mikkelsen().getImage(`<Avatar>`);``
![Mikkelsen](https://imgur.com/4p71VGS.png)
(Thanks to sιмση εcεяε#5765)
- ``new DIG.Mms().getImage(`<Avatar>`);``
@@ -265,6 +309,10 @@ bot.login("super_secret_token")
![RIP](https://imgur.com/qhyZKfz.png)
- ``new DIG.Snyder().getImage(`<Avatar>`);``
![Snyder](https://imgur.com/0dFnTcP.png)
- ``new DIG.Spank().getImage(`<Avatar>`, `<Avatar2>`);``
![Spank](https://imgur.com/25gq0es.png)
@@ -304,10 +352,38 @@ bot.login("super_secret_token")
![Color](https://imgur.com/40tMwfe.png)
# Changelog
- ``new DIG.Denoise().getImage(`<Avatar>`, `<Level>`);``
## v1.4.8
- Typings added, thanks to https://github.com/Lioness100
> Level should be a number
- ``new DIG.Mirror().getImage(`<Avatar>`, `true`, `false`);``
![Mirror](https://imgur.com/oaxbVAC.png)
# Changelog
## v1.4.24
- Re added typings
## v1.4.23
- Fixed import issue
- Added Denoise()
- Added Mirror()
## 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 ^^