Skip to content

Struct Interaction

zaun_client::Interaction · Struct

pub struct Interaction { … }

Someone used one of this bot’s commands, components or modals. Answer within 3 s (respond, or Response::defer first); follow-ups and edits work for 15 minutes.

pub fn id(&self) -> InteractionId

Its id.

pub fn kind(&self) -> InteractionType

Command, component, autocomplete or modal submit.

pub fn data(&self) -> &Data

Everything the host sent.

pub fn channel(&self) -> Channel

The channel it happened in.

pub fn member(&self) -> Member

Who used it.

pub fn command_name(&self) -> Option<&str>

The command’s name, for a command or autocomplete.

pub fn options(&self) -> &[OptionValue]

The options given, for a command or autocomplete.

pub fn custom_id(&self) -> Option<&str>

The clicked component’s or submitted modal’s custom_id.

pub fn field(&self, custom_id: &str) -> Option<&str>

A submitted modal input’s text (value) by custom_id.

pub fn respond(&self, response: Response) -> Result<Replied>

Answers it (once, within 3 s).

The host refused (too late, answered already, a body it does not accept).

pub fn reply<impl Into<String>>(&self, content: impl Into<String>) -> Result<Replied>

Answers with a text message in the channel.

As respond.

pub fn reply_ephemeral<impl Into<String>>(&self, content: impl Into<String>) -> Result<Replied>

Answers with a message only the invoker sees.

As respond.

pub fn followup(&self, body: MessageBody) -> Result<Replied>

Another message after the answer (up to 10, within 15 minutes).

The host refused or did not answer.

pub fn edit_original(&self, body: MessageBody) -> Result<()>

Edits the answer (ends a deferred “thinking…”); absent fields stay.

The host refused or did not answer.

pub fn delete_original(&self) -> Result<()>

Deletes the answer.

The host refused or did not answer.

Clone, Debug

Full rustdoc page