Send error message when link dosent work

This commit is contained in:
Loïc Bersier 2019-06-15 21:44:49 +02:00
parent 2a857938af
commit 29a4b7bb73

View file

@ -34,6 +34,10 @@ class memeCommand extends Command {
let Attachment = (message.attachments).array(); let Attachment = (message.attachments).array();
if (args.ImageURL) { if (args.ImageURL) {
fetch(args.ImageURL) fetch(args.ImageURL)
.catch(err => {
console.error(err);
return message.channel.send('An error has occured, is your link valid?');
})
.then(res => { .then(res => {
const dest = fs.createWriteStream('./img/memeInput.gif'); const dest = fs.createWriteStream('./img/memeInput.gif');
res.body.pipe(dest); res.body.pipe(dest);