Navy.gif
f024f059f2
new callback for when a command has been found with the ability to terminate the parsing
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
import { Parser, Command, OptionType } from '../build/esm/index.js';
|
|
|
|
// const command = new Command({
|
|
// name: 'create',
|
|
// options: [{
|
|
// name: 'registration-code',
|
|
// aliases: ['code'],
|
|
// type: OptionType.SUB_COMMAND,
|
|
// options: [{
|
|
// name: 'amount',
|
|
// flag: true,
|
|
// type: OptionType.INTEGER,
|
|
// defaultValue: 1,
|
|
// valueOptional: true,
|
|
// required: true
|
|
// }]
|
|
// }]
|
|
// });
|
|
const command = new Command({
|
|
name: 'botban',
|
|
options: [
|
|
{ name: 'users', type: OptionType.STRING, required: true },
|
|
{ name: 'service', choices: ['support', 'reports'], valueAsAlias: true, required: true }
|
|
]
|
|
});
|
|
const parser = new Parser({ commands: [command], prefix: '', debug: true });
|
|
parser.on('debug', console.log)
|
|
// console.log(await parser.parseMessage('create code -a 1'));
|
|
// console.log(await parser.parseMessage('create code --help'));
|
|
// // console.log(await parser.parseMessage('create --help'));
|
|
|
|
// console.log(await parser.parseMessage('create code'));
|
|
|
|
console.log(await parser.parseMessage('botban support dingus')); |