# SlashCommandHandler

### Constructor

```javascript
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](https://discord.js.org/#/docs/main/stable/class/Client) | undefined

clientLike

> This contains the client token & id, used for making API requests.\
> **Type**: [ClientLike ](https://jeroenoboy.gitbook.io/slashdiscord-js/documentation/class-slashcommandhandler/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*](https://jeroenoboy.gitbook.io/slashdiscord-js/documentation/slashcommand/applicationcommand))

> Create and register a new Command.\
> **Returns**: [SlashCommand](https://jeroenoboy.gitbook.io/slashdiscord-js/documentation/slashcommand)

async start(*command:* [*ApplicationCommand*](https://jeroenoboy.gitbook.io/slashdiscord-js/documentation/slashcommand/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
