forked from Galactic/galactic-bot
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
const { stripIndents } = require('common-tags');
|
|
|
|
const { Command, Argument } = require('../../../../interfaces/');
|
|
|
|
class PingCommand extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
name: 'arguments',
|
|
module: 'utility',
|
|
description: "Tests the argument parsing of the command handler.",
|
|
aliases: ['args', 'arg', 'argument'],
|
|
arguments: [
|
|
new Argument(client, {
|
|
name: 'apple',
|
|
type: 'BOOLEAN',
|
|
types: ['VERBAL', 'FLAG'],
|
|
default: true
|
|
}),
|
|
new Argument(client, {
|
|
name: 'banana',
|
|
aliases: ['bans', 'bananas'],
|
|
type: 'INTEGER',
|
|
types: ['FLAG', 'VERBAL'],
|
|
default: 0
|
|
}),
|
|
new Argument(client, {
|
|
name: 'carrot',
|
|
aliases: ['cars', 'carrots'],
|
|
type: 'STRING',
|
|
required: true,
|
|
types: ['FLAG', 'VERBAL']
|
|
})
|
|
]
|
|
});
|
|
|
|
this.client = client;
|
|
|
|
|
|
}
|
|
|
|
async execute(message, { args, params }) {
|
|
await message.respond(stripIndents`**arguments:** ${Object.values(args).map(a=>`${a.name}: ${a.value}`).join(' | ')}
|
|
**words:** ${params.join(', ')}`, { emoji: 'success' });
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = PingCommand; |