Skip to content

SlashCommand

const { SlashCommand } = require('commandkit-helper')

module.exports = new SlashCommand()
  .setData({
    name: 'ping',
    description: 'Pong!'
  })
  .setRun(async ({ interaction, client, handler }) => {

  })

Properties

data

options

run

Methods

setRun(run)

Sets the function to be executed when the command is used.

setData(data)

Sets the data for the slash command.

setDevOnly(devOnly)

Sets whether the command is for development purposes only.

  • Parameters:
    • devOnly: boolean
  • Returns: The modified SlashCommand.

setGuildOnly(guildOnly)

Sets whether the command can only be used in guilds (servers).

  • Parameters:
    • guildOnly: boolean
  • Returns: The modified SlashCommand.

setUserPermissions(userPermissions)

Sets the required user permissions to use the command.

setBotPermissions(botPermissions)

Sets the required bot permissions to execute the command.

setDeleted(deleted)

Sets whether the command is deleted.

  • Parameters:
    • deleted: boolean
  • Returns: The modified SlashCommand.

addCustomOption(optionName, optionValue)

Adds a custom option to the options section to be used in a custom validation commandObj.options?.optionname

  • Parameters:
    • optionName: string
    • optionValue: any
  • Returns: The modified SlashCommand.