Fix thesaurus

This commit is contained in:
Daniel Odendahl Jr
2017-10-20 21:15:40 +00:00
parent 15d5ff0be1
commit dc4cf18c91
+4 -4
View File
@@ -32,12 +32,12 @@ module.exports = class ThesaurusCommand extends Command {
api_key: WORDNIK_KEY
});
if (!body.length) return msg.say('Could not find any results.');
const synonyms = body.filter(word => word.relationshipType === 'synonym');
const antonyms = body.filter(word => word.relationshipType === 'antonym');
const synonyms = body.find(words => words.relationshipType === 'synonym');
const antonyms = body.find(words => words.relationshipType === 'antonym');
return msg.say(stripIndents`
**${query}**
__Synonyms:__ ${synonyms.length ? synonyms.words.join(', ') : 'N/A'}
__Antonyms:__ ${antonyms.length ? antonyms.words.join(', ') : 'N/A'}
__Synonyms:__ ${synonyms ? synonyms.words.join(', ') : 'N/A'}
__Antonyms:__ ${antonyms ? antonyms.words.join(', ') : 'N/A'}
`);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);