From dc4cf18c918633e587ce5e8afa941257e3cec0c0 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Fri, 20 Oct 2017 21:15:40 +0000 Subject: [PATCH] Fix thesaurus --- commands/search/thesaurus.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/search/thesaurus.js b/commands/search/thesaurus.js index 7e12926a..903dedb9 100644 --- a/commands/search/thesaurus.js +++ b/commands/search/thesaurus.js @@ -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!`);