> For the complete documentation index, see [llms.txt](https://jeroenoboy.gitbook.io/slashdiscord-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jeroenoboy.gitbook.io/slashdiscord-js/documentation/interaction.md).

# Interaction

The interaction class.

### Constructor

```javascript
new Interaction(client, handler, channel, d);
```

| Parameter | Type                                                                               | Required | Default | Description                                     |
| --------- | ---------------------------------------------------------------------------------- | -------- | ------- | ----------------------------------------------- |
| client    | [Discord.Client](https://discord.js.org/#/docs/main/stable/class/Client)           | true     | none    | The client this interaction uses.               |
| handler   | [SlashCommandHandler](/slashdiscord-js/documentation/class-slashcommandhandler.md) | true     | none    | The handler this command uses                   |
| channel   | [Discord.TextChannel](https://discord.js.org/#/docs/main/stable/class/TextChannel) | true     | none    | The TextChannel this interaction was called in. |
| d         | any                                                                                | true     | none    | The raw Gateway event data.                     |

### Properties

id

> ID of this interaction.\
> **Type**: string

type

> The type of this interaction.\
> **Type**: [InteractionType](/slashdiscord-js/documentation/interaction/interactiontype.md)

data

> The data used by this interaction.\
> **Type**: [InteractionData](/slashdiscord-js/documentation/interaction/interactiondata.md)

guild

> The guild this command has been executed in.\
> **Type**: [Discord.Guild](https://discord.js.org/#/docs/main/stable/class/Guild)

channel

> The channel this command has been executed in.\
> **Type**: [Discord.TextChannel](https://discord.js.org/#/docs/main/stable/class/TextChannel)

member

> The member that executed this command.\
> **Type**: [Discord.GuildMember](https://discord.js.org/#/docs/main/stable/class/GuildMember)

client

> The client this interaction uses.\
> **Type**: [Discord.Client](https://discord.js.org/#/docs/main/stable/class/Client)

handler

> The command handler this interaction uses.\
> **Type**: [SlashCommandHandler](/slashdiscord-js/documentation/class-slashcommandhandler.md)

reply\_send

> Used to check if a reply has already been send.\
> There is a maximum of 1 reply each interaction.\
> **Type**: bool

### Methods

option\<T = any>(*option: string | string\[]*)

> Easily get an specified option.\
> **Returns**: T | undefined | null
>
> ```javascript
> const user = interaction.option<User>('mute user');
> ```

@DEPRECATED getOption\<T = any>(*option: string*)

> Get an specified option from all options.\
> **Returns**: [InteractionOption\<T>](/slashdiscord-js/documentation/interaction/interactionoption-less-than-t-any-greater-than.md)
>
> ```javascript
> interaction.getOption<User>('mute user');
> ```

async send(...messages: [InteractionMessageType\[\]](/slashdiscord-js/documentation/interaction/interactionmessage.md))

> Send a message back to the user, this won't display source and closes the callback.\
> **Returns**: [InteractionMessage](/slashdiscord-js/documentation/interactionmessage.md)

async reply(...messages: [InteractionMessageType](/slashdiscord-js/documentation/interaction/interactionmessage.md)[\[\]](/slashdiscord-js/documentation/interaction/interactionmessage.md))

> Send a message back to the user, this will display source and close the callback.\
> **Returns**: [InteractionMessage](/slashdiscord-js/documentation/interactionmessage.md)

async pong(*showSource: bool = true*)

> Close the interaction callback.\
> **Returns**: void

async parseOptions(*command:* [*SlashCommand*](/slashdiscord-js/documentation/slashcommand.md))

> Parse the interaction options using the command.\
> **Returns**: void
