Change Variable Names, Remove Useless Commands

This commit is contained in:
Daniel Odendahl Jr
2017-04-29 19:53:01 +00:00
parent 3c773a8952
commit 988912f471
52 changed files with 236 additions and 312 deletions
+6 -7
View File
@@ -10,10 +10,10 @@ module.exports = class DefineCommand extends Command {
memberName: 'define',
description: 'Defines a word.',
args: [{
key: 'word',
key: 'query',
prompt: 'What would you like to define?',
type: 'string',
parse: text => encodeURIComponent(text)
parse: query => encodeURIComponent(query)
}]
});
}
@@ -22,15 +22,14 @@ module.exports = class DefineCommand extends Command {
if (message.channel.type !== 'dm')
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return message.say('This Command requires the `Embed Links` Permission.');
const { word } = args;
const { query } = args;
try {
const { body } = await request
.get(`http://api.wordnik.com:80/v4/word.json/${word}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`);
const data = body[0];
.get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`);
const embed = new RichEmbed()
.setColor(0x9797FF)
.setTitle(data.word)
.setDescription(data.text);
.setTitle(body[0].word)
.setDescription(body[0].text);
return message.embed(embed);
} catch (err) {
return message.say('An Error Occurred. The word may not have been found.');