import { Parser, Command, OptionType } from '../build/esm/index.js'; const commands = [ 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 }] }] }), new Command({ name: 'botban', options: [ { name: 'users', type: OptionType.STRING, required: true }, { name: 'service', choices: ['support', 'reports'], valueAsAlias: true, required: true } ] }), new Command({ name: 'volume', options: [ { name: 'volume', type: OptionType.INTEGER, maximum: 100, minimum: 0 }, ] }), new Command({ name: 'search', options: [ { name: 'artist', flag: true }, { name: 'id', flag: true, type: OptionType.INTEGER }, { name: 'song' } ] }) ] const parser = new Parser({ commands, prefix: '', debug: true }); parser.on('debug', console.log) console.log((await parser.parseMessage('create code -a 1')).args); console.log((await parser.parseMessage('create code --help')).args); // console.log(await parser.parseMessage('create --help')); console.log((await parser.parseMessage('create code')).args); console.log((await parser.parseMessage('botban support dingus')).args); console.log((await parser.parseMessage('volume 100')).args); console.log((await parser.parseMessage('search --id 5000')).args);