slappey icon indicating copy to clipboard operation
slappey copied to clipboard

Subcommands and more

Open daanbreur opened this issue 4 years ago • 6 comments

It may be a good idea to add subcommands to the command/commandhandler. and stuff like AdminOnly / GuildOnly.

the BaseCommand.ts class could be something like this:

export default abstract class BaseCommand {
  constructor(private name: string, private description: string, private category: string, private args: boolean, private guildOnly: boolean, private adminOnly: boolean, private subCommands: [], private aliases: Array<string>) {}

  getName(): string { return this.name; }
  getDescription(): string { return this.description; }
  getCategory(): string { return this.category; }
  getArgs(): boolean { return this.args; }
  getGuildOnly(): boolean { return this.guildOnly; }
  getAdminOnly(): boolean { return this.adminOnly; }
  getSubCommands(): [] { return this.subCommands; }
  getAliases(): Array<string> { return this.aliases; }


  abstract run(client: DiscordClient, message: Message, args: Array<string> | null): Promise<void>;
}

this is just an example and i couldnt get it working. Someone more experianced then me should be able to figure it out quite easily i think.

daanbreur avatar Jan 30 '21 21:01 daanbreur

This may be a better idea to put in a pull request rather than an issue.

loveisglitchy avatar Mar 08 '21 21:03 loveisglitchy

Well i have no code so i cant make a pr.... and i have no idea on how to implement this.

daanbreur avatar Mar 13 '21 22:03 daanbreur

May I ask what you would like the subCommands to do?

loveisglitchy avatar Mar 15 '21 05:03 loveisglitchy

Just so you can have all subcommands in seperate files. Like /command subcommand args

daanbreur avatar Mar 18 '21 07:03 daanbreur

Isn't that just like aliases?

loveisglitchy avatar Mar 18 '21 13:03 loveisglitchy

No, I think they meant this for example:

/filters clear
/filters 8d off
/filters nightcore on

SirTenzin avatar May 09 '21 17:05 SirTenzin