Prodige custom events

Prodige have multiple custom so that you can have your own custom error messages.

Example

Here is so examples on how you can have your own error messages.

events/errors.js
module.exports = {
  name: 'prodigeError', // The event name needs to be exact
  run: async (client, error) => {
    const { type, message, command, argument } = error;
    switch (type) {
      case 'ARGUMENT_REQUIRED':
        message.channel.send(`Argument: ${argument.name} is required`);
      case 'ROLE':
        message.channel.send("You don't have the required role(s)");
      case 'NOT_IN_DM':
        message.channel.send('This command is only executable in DMs');
      case 'NOT_IN_GUILD':
        message.channel.send('This command is only executable in a guild');
      case 'EXECUTION':
        console.log(error.error);
        message.channel.send('An unknown error has occured');
      case 'PERMISSION':
        message.channel.send(
          `You need to have one of these permissions: ${command.prodigeCommand?.permissions.join(
            ', ',
          )}`,
        );
    }
  },
};

ProdigeError Types

Name

Description

EXECUTION

When there is an error while trying to execute the command. You can access error.error to get the actual error message.

CHANNEL

When the command is ran in the wrong channel

COOLDOWN

When the user is still in cooldown

PERMISSION

When the user doens't have one of the required permissions

OWNER_ONLY

When the command is on ownerOnly mode and the user isn't an owner

ROLE

When the user doesn't have the required roles

ARGUMENT_REQUIRED

When an argument is required but not specified by the user

ARGUMENT_WRONG_TYPE

When the argument has a certain type but the user sends back the wrong type

NOT_IN_DM

When the command is on dmOnly mode but is ran in a guild

NOT_IN_GUILD

When the command is not on dmOnly mode but is ran in dms

Last updated