Fixed oversight in snowflake, reject image if width is over 10000 in wide

This commit is contained in:
TheEssem 2020-01-07 09:38:13 -06:00
parent 7a698d1837
commit d97496ef25
2 changed files with 2 additions and 0 deletions

View file

@ -1,4 +1,5 @@
exports.run = async (message, args) => {
if (!args[0]) return `${message.author.mention}, you need to provide a snowflake ID!`;
if (!args[0].match(/^\d+$/) && args[0] < 21154535154122752) return `${message.author.mention}, that's not a valid snowflake!`;
return new Date((args[0] / 4194304) + 1420070400000).toUTCString();
};

View file

@ -9,6 +9,7 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
gm(image.data).size(async (error, size) => {
if (error) throw error;
if (size.width > 10000) return `${message.author.mention}, this image is too wide!`;
const data = gm(image.data).resize(`${(size.width * 19) / 2}x${size.height / 2}!`);
const resultBuffer = await gmToBuffer(data);
return message.channel.createMessage("", {