mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 05:54:33 +02:00
DIE EMBEDS
This commit is contained in:
@@ -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!`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user