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

Last updated