2023-05-05 16:32:29 +02:00
|
|
|
import { Parser, Command, OptionType } from '../build/esm/index.js';
|
|
|
|
|
2024-03-27 09:10:17 +01:00
|
|
|
const commands = [
|
|
|
|
new Command({
|
|
|
|
name: 'create',
|
2024-03-24 20:38:48 +01:00
|
|
|
options: [{
|
2024-03-27 09:10:17 +01:00
|
|
|
name: 'registration-code',
|
|
|
|
aliases: ['code'],
|
|
|
|
type: OptionType.SUB_COMMAND,
|
|
|
|
options: [{
|
|
|
|
name: 'amount',
|
|
|
|
flag: true,
|
|
|
|
type: OptionType.INTEGER,
|
|
|
|
defaultValue: 1,
|
|
|
|
valueOptional: true,
|
|
|
|
required: true
|
|
|
|
}]
|
2024-03-24 20:38:48 +01:00
|
|
|
}]
|
2024-03-27 09:10:17 +01:00
|
|
|
}),
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
2024-03-28 15:44:13 +01:00
|
|
|
];
|
2023-12-14 16:33:54 +01:00
|
|
|
|
2024-03-28 15:44:13 +01:00
|
|
|
const parser = new Parser({
|
|
|
|
commands, prefix: '', debug: true,
|
|
|
|
globalFlags: [{
|
|
|
|
name: 'help',
|
|
|
|
flag: true,
|
|
|
|
valueOptional: true,
|
|
|
|
defaultValue: true,
|
|
|
|
type: OptionType.BOOLEAN
|
|
|
|
}],
|
|
|
|
allowIncompleteReturn: 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'));
|
2023-12-14 16:33:54 +01:00
|
|
|
|
2024-03-28 15:44:13 +01:00
|
|
|
console.log((await parser.parseMessage('create code')));
|
|
|
|
|
|
|
|
console.log((await parser.parseMessage('botban support dingus')));
|
|
|
|
console.log((await parser.parseMessage('search --help')));
|
|
|
|
console.log((await parser.parseMessage('search --id 5000')));
|
|
|
|
console.log((await parser.parseMessage('volume 100')));
|
|
|
|
console.log((await parser.parseMessage('volume 200')));
|