SlashCommandHandler
This is used to interact with the Discord SlashCommand api.
Constructor
new SlashCommandHandler(options);
Parameter
Type
Required
Default
Description
options
SlashCommandOptions
true
none
The options for the SlashCommandHandler
Properties
client
The client this handler uses. Type: Discord.Client | undefined
clientLike
This contains the client token & id, used for making API requests. Type: ClientLike | undefined
clientID
The id of the client | clientlike. Type: string
registerCommands
If enabled, commands will get patched / deleted / created. Type: bool
runCommands
If enabled, command will be run. disable when on the ShardingManager. Type: bool
deleteUnregisteredCommands
If enabled, commands that no longer exist will get deleted. Type: bool
sendPongIfNoResponse
If the ran command hasn't executed any interaction callback, execute a PONG with source. Type: bool
parseInteractionOptions
If enabled, If enabled this will automatically parse the options of an Interaction. Type: bool
debug
If enabled, the debug messages will be displayed. Type: bool
debugPrefix
The prefix of the debug messages. Type: string
sendNoLongerAvailable
If enabled, when a command gets executed that isn't recognized it will return a message. Type: bool
noLongerAvailableMessage
The message which should be displayed if sendNoLongerAvailable is true. Type: string
Methods
addCommand(command: ApplicationCommand)
Create and register a new Command. Returns: SlashCommand
async start(command: ApplicationCommand)
Start the command registration process, if you are using a Discord.Client instance you don't need to execute this command Returns: void
async respond(tokenID: string, response: InteractionResponse)
Respond to an Interaction. Returns: void
log(msg: any, ...optionalParams: any[])
Logs the provided message if this.debug is true, params are simulair to console.log Returns: void
Last updated
Was this helpful?