From d65e6b89c5cf05914d73b23b037b3878d7bd09ce Mon Sep 17 00:00:00 2001 From: loicbersier Date: Fri, 12 Oct 2018 15:45:28 +0200 Subject: [PATCH] handle error --- commands/fun/face.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/fun/face.js b/commands/fun/face.js index c72b2ac8..b10cece5 100644 --- a/commands/fun/face.js +++ b/commands/fun/face.js @@ -23,7 +23,10 @@ module.exports = class faceappCommand extends Command { async run(message, { type }) { let Attachment = (message.attachments).array(); - + console.log(Attachment) + if(!Attachment[0]) { + return message.say("You need to send an image") + } else { let face = type.toLowerCase(); let { body } = await superagent.get(Attachment[0].url) let image = await faceapp.process(body, face) @@ -32,4 +35,5 @@ module.exports = class faceappCommand extends Command { console.error(error) }) message.channel.sendFile(image) + } }}; \ No newline at end of file