Fix some things

This commit is contained in:
Daniel Odendahl Jr
2019-05-16 14:29:39 +00:00
parent 7a86c80c23
commit e6e38fb4e4
7 changed files with 16 additions and 71 deletions
-36
View File
@@ -1,36 +0,0 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { stripIndents } = require('common-tags');
const { WORDNIK_KEY } = process.env;
module.exports = class WordOfTheDayCommand extends Command {
constructor(client) {
super(client, {
name: 'word-of-the-day',
aliases: ['wordnik-word-of-the-day'],
group: 'events',
memberName: 'word-of-the-day',
description: 'Responds with today\'s word of the day.',
credit: [
{
name: 'Wordnik API',
url: 'https://developer.wordnik.com/'
}
]
});
}
async run(msg) {
try {
const { body } = await request
.get('http://api.wordnik.com/v4/words.json/wordOfTheDay')
.query({ api_key: WORDNIK_KEY });
return msg.say(stripIndents`
**${body.word}**
(${body.definitions[0].partOfSpeech || '???'}) ${body.definitions[0].text}
`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};