mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 14:00:22 +02:00
Destructuring Args
This commit is contained in:
@@ -27,7 +27,7 @@ module.exports = class MathCommand extends Command {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const expression = args.expression;
|
||||
const { expression } = args;
|
||||
try {
|
||||
const solved = math.eval(expression);
|
||||
return message.say(solved).catch(() => message.say(':x: Error! Invalid statement!'));
|
||||
|
||||
@@ -15,8 +15,7 @@ module.exports = class MotivateCommand extends Command {
|
||||
args: [{
|
||||
key: 'thing',
|
||||
prompt: 'What do you want to motivate?',
|
||||
type: 'string',
|
||||
default: ''
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -25,7 +24,7 @@ module.exports = class MotivateCommand extends Command {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const motivated = args.thing || message.author;
|
||||
return message.say(`${motivated}, https://www.youtube.com/watch?v=ZXsQAXx_ao0`);
|
||||
const { thing } = args;
|
||||
return message.say(`${thing}, https://www.youtube.com/watch?v=ZXsQAXx_ao0`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -36,8 +36,7 @@ module.exports = class StrawpollCommand extends Command {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const title = args.title;
|
||||
const choices = args.choices;
|
||||
const { title, choices } = args;
|
||||
if (choices.length < 2) return message.say(':x: Error! You provided less than two choices!');
|
||||
if (choices.length > 31) return message.say(':x: Error! You provided more than thirty choices!');
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user