SlashCommand
const { SlashCommand } = require('commandkit-helper')
module.exports = new SlashCommand()
.setData({
name: 'ping',
description: 'Pong!'
})
.setRun(async ({ interaction, client, handler }) => {
})
import { SlashCommand } from 'commandkit-helper'
export default new SlashCommand()
.setData({
name: 'ping',
description: 'Pong!'
})
.setRun(async ({ interaction, client, handler }) => {
})
Properties
data
- Type:
AnySlashCommandData
options
- Type:
CommandOptions
run
- Type:
SlashCommandRunFunction
Methods
setRun(run)
Sets the function to be executed when the command is used.
- Parameters:
- Returns: The modified
SlashCommand
.
setData(data)
Sets the data for the slash command.
- Parameters:
data
:AnySlashCommandData
- Returns: The modified
SlashCommand
.
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.
- Parameters:
userPermissions
:PermissionResolvable
- Returns: The modified
SlashCommand
.
setBotPermissions(botPermissions)
Sets the required bot permissions to execute the command.
- Parameters:
botPermissions
:PermissionResolvable
- Returns: The modified
SlashCommand
.
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
.