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

# Interaction

Contains information about components interact event.

{% tabs %}
{% tab title="Attributes" %}

| client                                                                                                                                                                              |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>The <code>DiscordComponents</code> instance.</p><p></p><p><strong>Type:</strong> <a href="/pages/-MawdcssKHrkRIwSc8-D"><code>discord-components.DiscordComponents</code></a></p> |

| user                                                                                                                                                                                                        |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>The user who interacted with the component.</p><p></p><p><strong>Type:</strong>  Optional\[<code>discord.User</code>, <code>discord.Member</code>]</p><p><strong>Alias:</strong> <code>member</code></p> |

| component                                                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p>The component with which the user interacted.<br>This is <code>dict</code> if the component was in a<strong>n</strong> ephemeral message.</p><p></p><p><strong>Type:</strong> <a href="/pages/-MbNkph4GvW_5uhr5S6z"><code>discord-components.Component</code></a></p> |

| custom\_id                                                                                         |
| -------------------------------------------------------------------------------------------------- |
| <p>The custom id of interacted component.</p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| values                                                                                                        |
| ------------------------------------------------------------------------------------------------------------- |
| <p>The values of interacted select</p><p></p><p><strong>Type:</strong> Optional\[List\[<code>str</code>]]</p> |

| `component_type`                                                                                       |
| ------------------------------------------------------------------------------------------------------ |
| <p>The component type of interacted component</p><p></p><p><strong>Type:</strong> <code>int</code></p> |

| raw\_data                                                                           |
| ----------------------------------------------------------------------------------- |
| <p>The request's raw data</p><p></p><p><strong>Type:</strong> <code>dict</code></p> |

| message                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>The mesage with the component interacted.</p><p></p><p><strong>Type:</strong> <a href="/pages/-MawnKUN1hvIyfalW7NX"><code>discord-components.ComponentMessage</code></a></p> |

| guild                                                                                                |
| ---------------------------------------------------------------------------------------------------- |
| <p>The component message’s guild.</p><p></p><p><strong>Type:</strong> <code>discord.Guild</code></p> |

| channel                                                                                                          |
| ---------------------------------------------------------------------------------------------------------------- |
| <p>The component message’s channel.</p><p></p><p><strong>Type:</strong> <code>discord.abc.Messageable</code></p> |

| interaction\_id                                                                   |
| --------------------------------------------------------------------------------- |
| <p>The interaction’s ID.</p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| interaction\_token                                                                   |
| ------------------------------------------------------------------------------------ |
| <p>The interaction’s token.</p><p></p><p><strong>Type:</strong> <code>str</code></p> |

| responded                                                                  |
| -------------------------------------------------------------------------- |
| <p>If responded?</p><p></p><p><strong>Type:</strong> <code>bool</code></p> |

| deferred                                                                  |
| ------------------------------------------------------------------------- |
| <p>If deferred?</p><p></p><p><strong>Type:</strong> <code>bool</code></p> |
| {% endtab %}                                                              |

{% tab title="Methods" %}

| respond                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Sends a response to Discord.<br></p><p><strong>Parameters:</strong></p><ul><li><strong>type</strong> (<code>int</code>) -  The interaction’s type. (4 \~ 6) Defaults to <code>4</code>.</li><li><strong>ephemeral</strong> (<code>bool</code> defaults to <code>True</code>) - If the response is ephemeral.</li><li><strong>content</strong>  (<code>str</code>) - The response message's content.</li><li><strong>embed</strong> (<code>discord.Embed</code>) - The response message’s embed.</li><li><strong>embeds</strong> (List\[<code>discord.Embed</code>]) - The response message’s embeds.</li><li><strong>suppress</strong> (<code>bool</code>) </li><li><strong>file</strong> (<code>discord.File</code>) - The response message’s file.</li><li><strong>files</strong> (List\[<code>discord.File</code>]) - The response message's files.</li><li><strong>allowed\_mentions</strong> ( <code>discord.AllowedMentions</code>) - The response message’s allowed mentions.</li><li><strong>tts</strong> (<code>bool</code> defaults to <code>False</code>) - The response message’s tts.</li><li><strong>components</strong> (List\[<a href="/pages/-MawnKUN1hvIyfalW7NX"><code>discord-components.Component</code></a> | List\[<a href="/pages/-MawnKUN1hvIyfalW7NX"><code>discord-components.Component</code></a>]]) - The components to send.</li></ul><p><strong>Returns:</strong> <a href="/pages/-MawnKUN1hvIyfalW7NX"><code>discord-components.ComponentMessage</code></a></p> |

{% hint style="info" %}
If you don't use the `respond` method after getting a interaction, an interaction error will be thrown.
{% endhint %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://devkiki7000.gitbook.io/discord-components/api-reference/interaction.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
