From 67be772998e6d70dbc04704a7bc597d4c79a21b9 Mon Sep 17 00:00:00 2001 From: TheEssem Date: Thu, 23 Apr 2020 17:08:53 -0500 Subject: [PATCH] Added freeze --- commands/freeze.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 commands/freeze.js diff --git a/commands/freeze.js b/commands/freeze.js new file mode 100644 index 0000000..6b2358b --- /dev/null +++ b/commands/freeze.js @@ -0,0 +1,19 @@ +const gm = require("gm").subClass({ + imageMagick: true +}); + +exports.run = async (message) => { + message.channel.sendTyping(); + const image = await require("../utils/imagedetect.js")(message); + if (image === undefined) return `${message.author.mention}, you need to provide a GIF to freeze!`; + if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`; + const buffer = await gm(image.path).loop(1).bufferPromise(image.type, image.delay); + return { + file: buffer, + name: `freeze.${image.type}` + }; +}; + +exports.aliases = ["noloop", "once"]; +exports.category = 5; +exports.help = "Makes a GIF only play once"; \ No newline at end of file