Upgraded command parser package
Added aliases to commands
Added global help flag
This commit is contained in:
Erik 2024-03-28 17:05:59 +02:00
parent 88c7c3fbde
commit c3ca8bbee6
8 changed files with 21 additions and 7 deletions

View File

@ -20,7 +20,7 @@
"dependencies": {
"@discordjs/opus": "^0.9.0",
"@discordjs/voice": "^0.16.1",
"@navy.gif/commandparser": "^1.6.6",
"@navy.gif/commandparser": "^1.6.7",
"@navy.gif/logger": "^2.5.4",
"@navy.gif/timestring": "^6.0.6",
"@types/node": "^20.11.30",

View File

@ -319,7 +319,7 @@ class MusicPlayer implements Initialisable
get queue ()
{
return Object.freeze(this.#queue);
return this.#queue;
}
}

View File

@ -9,6 +9,7 @@ class QueueCommand extends Command
{
super(client, {
name: 'queue',
aliases: [ 'q' ],
options: [{
name: 'artist',
flag: true

View File

@ -11,6 +11,7 @@ class RequestCommand extends Command
{
super(client, {
name: 'request',
aliases: [ 'r', 'req' ],
guildOnly: true,
sameVc: true,
showUsage: true,

View File

@ -9,6 +9,7 @@ class SearchCommand extends Command
{
super(client, {
name: 'search',
aliases: [ 's' ],
showUsage: true,
options: [{
name: 'keyword',

View File

@ -9,6 +9,7 @@ class VolumeCommand extends Command
{
super(client, {
name: 'volume',
aliases: [ 'v', 'vol' ],
options: [
{
name: 'volume',

View File

@ -30,6 +30,13 @@ class CommandHandler extends Observer
commands: this.client.commands.values(),
prefix: client.prefix,
resolver: client.resolver,
globalFlags: [{
name: 'help',
flag: true,
valueOptional: true,
defaultValue: true,
type: OptionType.BOOLEAN
}],
debug: false
});
@ -120,6 +127,9 @@ class CommandHandler extends Observer
});
}
if (rest.globalFlags.help)
return this.#showUsage(message, command as Command);
if ((command as Command).showUsage && !Object.keys(rest.args).length && !rest.subcommand && !rest.subcommandGroup)
return this.#showUsage(message, command as Command);

View File

@ -1628,10 +1628,10 @@ __metadata:
languageName: node
linkType: hard
"@navy.gif/commandparser@npm:^1.6.6":
version: 1.6.6
resolution: "@navy.gif/commandparser@npm:1.6.6"
checksum: 10/1020ef32bd3b2b2e75dbbbf4814829765ec354ccac1c980978b49ebf2a6bc94cc7031691d2aa275ad98781027aa5cabe7bede8aecbd2d5a3bf8a48440b8befdf
"@navy.gif/commandparser@npm:^1.6.7":
version: 1.6.7
resolution: "@navy.gif/commandparser@npm:1.6.7"
checksum: 10/2f3ac85ca0d7168af96fd5d03ff85e00949e8f02ff7ac409e01f492c9712442723df536103897bed7d3c3091066525e78254e36591e49d1a9cade16f472383e9
languageName: node
linkType: hard
@ -3577,7 +3577,7 @@ __metadata:
"@babel/preset-typescript": "npm:^7.24.1"
"@discordjs/opus": "npm:^0.9.0"
"@discordjs/voice": "npm:^0.16.1"
"@navy.gif/commandparser": "npm:^1.6.6"
"@navy.gif/commandparser": "npm:^1.6.7"
"@navy.gif/logger": "npm:^2.5.4"
"@navy.gif/timestring": "npm:^6.0.6"
"@types/babel__core": "npm:^7"