forked from Supositware/Haha-Yes
handle error
This commit is contained in:
parent
5cee8a33c1
commit
d65e6b89c5
1 changed files with 5 additions and 1 deletions
|
@ -23,7 +23,10 @@ module.exports = class faceappCommand extends Command {
|
||||||
async run(message, { type }) {
|
async run(message, { type }) {
|
||||||
|
|
||||||
let Attachment = (message.attachments).array();
|
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 face = type.toLowerCase();
|
||||||
let { body } = await superagent.get(Attachment[0].url)
|
let { body } = await superagent.get(Attachment[0].url)
|
||||||
let image = await faceapp.process(body, face)
|
let image = await faceapp.process(body, face)
|
||||||
|
@ -32,4 +35,5 @@ module.exports = class faceappCommand extends Command {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
})
|
})
|
||||||
message.channel.sendFile(image)
|
message.channel.sendFile(image)
|
||||||
|
}
|
||||||
}};
|
}};
|
Loading…
Reference in a new issue