From 8c3f19316365e355fce561cd4e66f8a7bfd1df1e Mon Sep 17 00:00:00 2001 From: loicbersier Date: Fri, 21 Feb 2020 18:39:05 +0100 Subject: [PATCH] catch error in format --- commands/images/poster.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/commands/images/poster.js b/commands/images/poster.js index 7f534b62..eb7edab0 100644 --- a/commands/images/poster.js +++ b/commands/images/poster.js @@ -71,6 +71,9 @@ class posterCommand extends Command { const PADDING = 40; img.format(function(err, format) { + if (err) { + return message.channel.send('An error has occured, is it an image?'); + } let output = `${os.tmpdir()}/poster${message.id}.${format.toLocaleLowerCase()}`; // Get the image size to calculate top and bottom text positions img.size(function(err, value) {