catch error in format

This commit is contained in:
loicbersier 2020-02-21 18:39:05 +01:00
parent bb6f0590cf
commit 8c3f193163

View file

@ -71,6 +71,9 @@ class posterCommand extends Command {
const PADDING = 40; const PADDING = 40;
img.format(function(err, format) { 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()}`; let output = `${os.tmpdir()}/poster${message.id}.${format.toLocaleLowerCase()}`;
// Get the image size to calculate top and bottom text positions // Get the image size to calculate top and bottom text positions
img.size(function(err, value) { img.size(function(err, value) {