Updating from v6 to v7

GCommandsOptions

cmdDir

You now need to give the full path. This can be easily done with path.

const { join } = require('path'); // You don't have to install this package.

const client = new GCommandsClient({
  ...options,
  cmdDir: join(__dirname, 'commands'),
});
1
2
3
4
5
6

eventDir

You now need to give the full path. This can be easily done with path.

const { join } = require('path'); // You don't have to install this package.

const client = new GCommandsClient({
  ...options,
  eventDir: join(__dirname, 'events'),
});
1
2
3
4
5
6

commands

The slash/context set in the client are now default options, and will be overwriten by options in the command. For example:

const client = new GCommandsClient({
  ...options,
  commands: {
    slash: 'false',
    context: 'false',
  }
});

// And in the command

class extends Command {
  constructor(client) {
    super(client, {
      ...options,
      slash: 'both', // This will now create a slash and message command.
    })
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

commands#slash

This was changed to turn of message/slash commands completly. (mainly for context menu's)

TYPEDESCRIPTION
bothMessage + Slash
slashOnly slash
messageOnly message
falseNone

Arguments

SUB_COMMAND and SUB_COMMAND_GROUP

GCommands now supports the SUB_COMMAND and SUB_COMMAND_GROUP type!

See here for more information.

Choices

Choices were fixed for message based commands. This means that the value of the choice, will be the returned argument.

const choices = {
  name: "True", // This will be the option for the user.
  value: true, // This will be the returned argument.
};

// In the command
run({ args }) {
  console.log(args) // [ true ]
}
1
2
3
4
5
6
7
8
9

Commands

CommandRunOptions

The args and objectArgs have been moved to the CommandRunOptions.

run({ args, objectArgs, etc }) {}
1

Permissions

Slash commands automaticly grey out if the userRequiredRoles or userOnly requirements are not met.

Inhibitors

The args and objectArgs in inhibitors have been moved. You can now acces them like this:

client.dispatcher.addInhibitor((interaction, { args, objectArgs, etc }) => {});
1