Fixed GIF commands for real (lol)

This commit is contained in:
TheEssem 2020-10-19 20:24:53 -05:00
parent 5e34e45ac4
commit a03d3a5e79
9 changed files with 35 additions and 20 deletions

View file

@ -4,12 +4,13 @@ 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, type } = await magick.run({
cmd: "freeze",
path: image.path,
loop: false
loop: false,
onlyGIF: true
});
if (buffer === "nogif") return `${message.author.mention}, that isn't a GIF!`;
return {
file: buffer,
name: `freeze.${type}`

View file

@ -4,12 +4,13 @@ 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 loop!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const { buffer, type } = await magick.run({
cmd: "freeze",
path: image.path,
loop: true
loop: true,
onlyGIF: true
});
if (buffer === "nogif") return `${message.author.mention}, that isn't a GIF!`;
return {
file: buffer,
name: `loop.${type}`

View file

@ -4,15 +4,16 @@ 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 reverse!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const { buffer, type } = await magick.run({
cmd: "reverse",
path: image.path,
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0,
onlyGIF: true
});
if (buffer === "nogif") return `${message.author.mention}, that isn't a GIF!`;
return {
file: buffer,
name: "reverse.gif"
name: `reverse.${type}`
};
};

View file

@ -1,19 +1,19 @@
const magick = require("../utils/image.js");
const { promisify } = require("util");
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 slow down!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const { buffer, type } = await magick.run({
cmd: "speed",
path: image.path,
slow: true
slow: true,
onlyGIF: true
});
if (buffer === "nogif") return `${message.author.mention}, that isn't a GIF!`;
return {
file: buffer,
name: "slow.gif"
name: `slow.${type}`
};
};

View file

@ -4,16 +4,17 @@ 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 loop!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const { buffer, type } = await magick.run({
cmd: "reverse",
path: image.path,
soos: true,
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0,
onlyGIF: true
});
if (buffer === "nogif") return `${message.author.mention}, that isn't a GIF!`;
return {
file: buffer,
name: "soos.gif"
name: `soos.${type}`
};
};

View file

@ -4,14 +4,15 @@ 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 speed up!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const { buffer, type } = await magick.run({
cmd: "speed",
path: image.path
path: image.path,
onlyGIF: true
});
if (buffer === "nogif") return `${message.author.mention}, that isn't a GIF!`;
return {
file: buffer,
name: "speed.gif"
name: `speed.${type}`
};
};