Add blink timeout

main
Mr¤KayJayDee 2 years ago
parent d4f3bc9e11
commit 5eacd73fa8

@ -161,7 +161,7 @@ bot.login("super_secret_token")
## Gifs ## 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 > You can add as many images as you want

@ -1,6 +1,6 @@
{ {
"name": "discord-image-generation", "name": "discord-image-generation",
"version": "1.4.14", "version": "1.4.15",
"description": "discord-image-generation is a powerful module that allow you to generate awesome images.", "description": "discord-image-generation is a powerful module that allow you to generate awesome images.",
"main": "src/index.js", "main": "src/index.js",
"types": "typings/index.d.ts", "types": "typings/index.d.ts",

@ -2,14 +2,13 @@ const Canvas = require(`canvas`);
const GIFEncoder = require(`gifencoder`); const GIFEncoder = require(`gifencoder`);
module.exports = class Blink { module.exports = class Blink {
async getImage(delay, ...images) {
async getImage( ...images) {
if (!images || images.length < 2) throw new Error(`You must provide at least two images.`); if (!images || images.length < 2) throw new Error(`You must provide at least two images.`);
const GIF = new GIFEncoder(480, 480); const GIF = new GIFEncoder(480, 480);
GIF.start(); GIF.start();
GIF.setRepeat(0); GIF.setRepeat(0);
GIF.setDelay(1000); GIF.setDelay(delay);
GIF.setTransparent(); GIF.setTransparent();
const canvas = Canvas.createCanvas(480, 480); const canvas = Canvas.createCanvas(480, 480);
@ -25,4 +24,4 @@ module.exports = class Blink {
GIF.finish(); GIF.finish();
return GIF.out.getData(); return GIF.out.getData();
} }
}; };
Loading…
Cancel
Save