Word of the Day, TONS of new aliases

This commit is contained in:
Daniel Odendahl Jr
2017-09-25 13:45:57 +00:00
parent 515fb8dc8c
commit d9d9219ddc
54 changed files with 86 additions and 18 deletions
+3 -3
View File
@@ -7,6 +7,7 @@ module.exports = class DefineCommand extends Command {
constructor(client) {
super(client, {
name: 'define',
aliases: ['dictionary', 'wordnik'],
group: 'search',
memberName: 'define',
description: 'Defines a word.',
@@ -25,11 +26,10 @@ module.exports = class DefineCommand extends Command {
async run(msg, { query }) {
try {
const { body } = await snekfetch
.get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions`)
.get(`http://api.wordnik.com/v4/word.json/${query}/definitions`)
.query({
limit: 1,
includeRelated: false,
useCanonical: false,
api_key: WORDNIK_KEY
});
if (!body.length) return msg.say('Could not find any results.');
@@ -37,7 +37,7 @@ module.exports = class DefineCommand extends Command {
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setTitle(data.word)
.setDescription(data.text);
.setDescription(`(${data.partOfSpeech}) ${data.text}`);
return msg.embed(embed);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);