mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 14:18:36 +02:00
Fix some things
This commit is contained in:
@@ -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!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user