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.
Methods
Section titled “Methods”pub fn id(&self) -> InteractionIdIts id.
pub fn kind(&self) -> InteractionTypeCommand, component, autocomplete or modal submit.
pub fn data(&self) -> &DataEverything the host sent.
channel
Section titled “channel”pub fn channel(&self) -> ChannelThe channel it happened in.
member
Section titled “member”pub fn member(&self) -> MemberWho used it.
command_name
Section titled “command_name”pub fn command_name(&self) -> Option<&str>The command’s name, for a command or autocomplete.
options
Section titled “options”pub fn options(&self) -> &[OptionValue]The options given, for a command or autocomplete.
custom_id
Section titled “custom_id”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.
respond
Section titled “respond”pub fn respond(&self, response: Response) -> Result<Replied>Answers it (once, within 3 s).
Errors
Section titled “Errors”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.
Errors
Section titled “Errors”As respond.
reply_ephemeral
Section titled “reply_ephemeral”pub fn reply_ephemeral<impl Into<String>>(&self, content: impl Into<String>) -> Result<Replied>Answers with a message only the invoker sees.
Errors
Section titled “Errors”As respond.
followup
Section titled “followup”pub fn followup(&self, body: MessageBody) -> Result<Replied>Another message after the answer (up to 10, within 15 minutes).
Errors
Section titled “Errors”The host refused or did not answer.
edit_original
Section titled “edit_original”pub fn edit_original(&self, body: MessageBody) -> Result<()>Edits the answer (ends a deferred “thinking…”); absent fields stay.
Errors
Section titled “Errors”The host refused or did not answer.
delete_original
Section titled “delete_original”pub fn delete_original(&self) -> Result<()>Deletes the answer.
Errors
Section titled “Errors”The host refused or did not answer.
Trait implementations
Section titled “Trait implementations”Clone, Debug