return and await

This commit is contained in:
Daniel Odendahl Jr
2017-03-23 13:16:59 +00:00
parent cea110ce4b
commit 7c0a39ec5c
83 changed files with 295 additions and 264 deletions
+4 -3
View File
@@ -26,7 +26,7 @@ module.exports = class DefineCommand extends commando.Command {
}
console.log(`[Command] ${message.content}`);
let defineThis = encodeURI(message.content.split(" ").slice(1).join(" "));
request
await request
.get(`http://api.wordnik.com:80/v4/word.json/${defineThis}/definitions`)
.query({
limit: 1,
@@ -40,9 +40,10 @@ module.exports = class DefineCommand extends commando.Command {
.setColor(0x9797FF)
.setTitle(response.body[0].word)
.setDescription(response.body[0].text);
message.channel.sendEmbed(embed).catch(console.error);
return message.channel.sendEmbed(embed).catch(console.error);
}).catch(function(err) {
message.channel.send(":x: Error! Word not Found!");
console.log(err);
return message.channel.send(":x: Error! Word not Found!");
});
}
};