stuyy / slappey

Discord Bot Project Generator
219 stars 50 forks source link

suggestion (if this is the right place) - aliases #68

Closed tad-dufort closed 2 years ago

tad-dufort commented 3 years ago

basically what I'm thinking of is that when you generate a command you can choose the name and category as normal but after category, you can add aliases separated by spaces for example, it could look like this:

C:\[insert bot path here]>slappey
√ What would you like to do? » Generate
√ What would you like to generate? » Command
√ Enter the name of the command ...  command
√ Enter the category of the command ...  command category
? Enter one or more aliases separated by spaces...  command_alias_1 command_alias_2

C:\[insert bot path here]>
loveisglitchy commented 3 years ago

I don't think this would be beneficial to those that don't use aliases.

tad-dufort commented 3 years ago

I don't think this would be beneficial to those that don't use aliases.

though it would for those who do use them and don't want to make 2 commands and copy the code

GAndersenCode commented 3 years ago

Why not just use the aliases as they are in slappey today?

tad-dufort commented 3 years ago

Why not just use the aliases as they are in slappey today?

there are aliases already? how do you use them

GAndersenCode commented 3 years ago

Why not just use the aliases as they are in slappey today?

there are aliases already? how do you use them

Yes, slappey supports aliases by default. Here is a basic test command:

const BaseCommand = require('../../utils/structures/BaseCommand');

module.exports = class TestCommand extends BaseCommand {
  constructor() {
    super('test', 'testing', ['alias1', 'alias2', 'etc']);
  }

  async run(client, message, args) {
    for (const cmd of client.commands.array()){
      console.log(cmd);
    }
  }
}

This has command with name: test Also answers to the three aliases: alias1, alias2 and etc

Each element in the array (third parameter in the super) is an alias

tad-dufort commented 3 years ago

Why not just use the aliases as they are in slappey today?

there are aliases already? how do you use them

Yes, slappey supports aliases by default. Here is a basic test command:

const BaseCommand = require('../../utils/structures/BaseCommand');

module.exports = class TestCommand extends BaseCommand {
  constructor() {
    super('test', 'testing', ['alias1', 'alias2', 'etc']);
  }

  async run(client, message, args) {
    for (const cmd of client.commands.array()){
      console.log(cmd);
    }
  }
}

This has command with name: test Also answers to the three aliases: alias1, alias2 and etc

Each element in the array (third parameter in the super) is an alias

okay thanks ill try that