mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 14:19:11 +02:00
Destructuring Args
This commit is contained in:
@@ -19,7 +19,10 @@ module.exports = class DefineCommand extends Command {
|
||||
args: [{
|
||||
key: 'word',
|
||||
prompt: 'What would you like to define?',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
parse: text => {
|
||||
return encodeURIComponent(text);
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -29,7 +32,7 @@ module.exports = class DefineCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const word = encodeURIComponent(args.word);
|
||||
const { word } = args;
|
||||
try {
|
||||
const response = 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}`);
|
||||
|
||||
Reference in New Issue
Block a user