mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 22:32:52 +02:00
Change Variable Names, Remove Useless Commands
This commit is contained in:
@@ -10,10 +10,10 @@ module.exports = class DefineCommand extends Command {
|
||||
memberName: 'define',
|
||||
description: 'Defines a word.',
|
||||
args: [{
|
||||
key: 'word',
|
||||
key: 'query',
|
||||
prompt: 'What would you like to define?',
|
||||
type: 'string',
|
||||
parse: text => encodeURIComponent(text)
|
||||
parse: query => encodeURIComponent(query)
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -22,15 +22,14 @@ module.exports = class DefineCommand extends Command {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return message.say('This Command requires the `Embed Links` Permission.');
|
||||
const { word } = args;
|
||||
const { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`http://api.wordnik.com:80/v4/word.json/${word}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`);
|
||||
const data = body[0];
|
||||
.get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`);
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x9797FF)
|
||||
.setTitle(data.word)
|
||||
.setDescription(data.text);
|
||||
.setTitle(body[0].word)
|
||||
.setDescription(body[0].text);
|
||||
return message.embed(embed);
|
||||
} catch (err) {
|
||||
return message.say('An Error Occurred. The word may not have been found.');
|
||||
|
||||
Reference in New Issue
Block a user