pub struct Interaction { /* private fields */ }Expand description
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.
Implementations§
Source§impl Interaction
impl Interaction
Sourcepub fn command_name(&self) -> Option<&str>
pub fn command_name(&self) -> Option<&str>
The command’s name, for a command or autocomplete.
Sourcepub fn custom_id(&self) -> Option<&str>
pub fn custom_id(&self) -> Option<&str>
The clicked component’s or submitted modal’s custom_id.
Sourcepub fn field(&self, custom_id: &str) -> Option<&str>
pub fn field(&self, custom_id: &str) -> Option<&str>
A submitted modal input’s text (value) by custom_id.
Sourcepub fn respond(&self, response: Response) -> Result<Replied>
pub fn respond(&self, response: Response) -> Result<Replied>
Answers it (once, within 3 s).
§Errors
The host refused (too late, answered already, a body it does not accept).
Sourcepub fn reply_ephemeral(&self, content: impl Into<String>) -> Result<Replied>
pub fn reply_ephemeral(&self, content: impl Into<String>) -> Result<Replied>
Sourcepub fn followup(&self, body: MessageBody) -> Result<Replied>
pub fn followup(&self, body: MessageBody) -> Result<Replied>
Another message after the answer (up to 10, within 15 minutes).
§Errors
The host refused or did not answer.
Sourcepub fn edit_original(&self, body: MessageBody) -> Result<()>
pub fn edit_original(&self, body: MessageBody) -> Result<()>
Edits the answer (ends a deferred “thinking…”); absent fields stay.
§Errors
The host refused or did not answer.
Sourcepub fn delete_original(&self) -> Result<()>
pub fn delete_original(&self) -> Result<()>
Trait Implementations§
Source§impl Clone for Interaction
impl Clone for Interaction
Source§fn clone(&self) -> Interaction
fn clone(&self) -> Interaction
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Interaction
impl RefUnwindSafe for Interaction
impl Send for Interaction
impl Sync for Interaction
impl Unpin for Interaction
impl UnsafeUnpin for Interaction
impl UnwindSafe for Interaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more