DIE EMBEDS

This commit is contained in:
Daniel Odendahl Jr
2017-09-28 18:09:06 +00:00
parent 92d9f11e74
commit 70dd45af9a
11 changed files with 39 additions and 108 deletions
+6 -10
View File
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { stripIndents } = require('common-tags');
const { WORDNIK_KEY } = process.env;
module.exports = class WordOfTheDayCommand extends Command {
@@ -10,8 +10,7 @@ module.exports = class WordOfTheDayCommand extends Command {
aliases: ['wordnik-word-of-the-day'],
group: 'random',
memberName: 'word-of-the-day',
description: 'Gets the word of the day.',
clientPermissions: ['EMBED_LINKS']
description: 'Gets the word of the day.'
});
}
@@ -20,13 +19,10 @@ module.exports = class WordOfTheDayCommand extends Command {
const { body } = await snekfetch
.get('http://api.wordnik.com/v4/words.json/wordOfTheDay')
.query({ api_key: WORDNIK_KEY });
const embed = new MessageEmbed()
.setAuthor('Wordnik', 'https://i.imgur.com/VcLZLXn.jpg')
.setColor(0xFE6F11)
.setTitle(body.word)
.setURL('http://wordnik.com/word-of-the-day')
.setDescription(`(${body.definitions[0].partOfSpeech || 'N/A'}) ${body.definitions[0].text}`);
return msg.embed(embed);
return msg.say(stripIndents`
**${body.word}**
(${body.definitions[0].partOfSpeech || 'N/A'}) ${body.definitions[0].text}
`);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}