Command Properties

Using Prodige, a command can have many properties that allows you to quickly set your command as you wish and not have to worry about it anymore.

circle-info

Note that only the name and run properties are required

./cmds/ping.js
const { MessageEmbed } = require('discord.js');

module.exports = {
  //The command name: (string)
  name: 'ping',
  //An array of command aliases that can also be used to run the same command
  //Array<string>
  aliases: ['p', 'latency', 'ms'],
  // The command description for the built-in help command
  description: 'A simple ping pong commad',
  // A description for the built-in help command to use (string)
  category: '🔧 Miscellaneous',
  // A usage pattern for when user run the help command like this: !help ping
  //string
  usage: 'ping (messageId)',
  //An array of ProdigrArgument objects
  //Array<ProdigeArgument>
  args: [{ name: 'messageId', type: 'message', required: false, byDefault: null }],
  //Cooldown object (ProdigeCooldown)
  cooldown: {
    delay: 50000,
    roleBypass: ['860299357327589396', '858871915556765718'],
  },
  //If the command must be run only by the people in the ownerIds config property
  //boolean
  ownerOnly: false,
  //All the channels where the command can be ran (Array<string>)
  channels: ['858879116185960448'],
  //All the roles that are allowed to run the command (Array<string>)
  roles: ['860299357327589396', '858871915556765718', '863847118749302815'],
  //Permissions that the user must have (at least one of them)
  //Array<PermissionResolvable>
  permissions: ['MANAGE_CHANNELS', 'KICK_MEMBERS'],
  //If the message should be deleted after it has been sent (boolean)
  deleteMessage: false,
  //The function that will be run if all the properties are respected
  //ProdigeRunFunction
  run: async ({ client, message, args }) => {
    const { messageId } = args;
    const embed = new MessageEmbed()
      .setTitle('Pong!')
      .setDescription(
        "I'm currently using [Prodige](https://www.github.com/Expensiveee/prodige)",
      )
      .setColor(client.colors.GREEN); //Can can access mutiple colors via client.colors
    if (messageId) {
      messageId.reply({ embeds: [embed] });
    } else {
      message.channel.send({ embeds: [embed] });
    }
  },
};

Last updated