pub trait ResponseExt {
// Required method
fn json(&self) -> Value;
// Provided methods
fn response_type(&self) -> u8 { ... }
fn text(&self) -> Option<String> { ... }
fn is_ephemeral(&self) -> bool { ... }
fn components(&self) -> Vec<Value> { ... }
fn button(&self, label: &str) -> Option<Value> { ... }
fn custom_id(&self, label: &str) -> Option<String> { ... }
fn embeds(&self) -> Vec<Value> { ... }
fn choices(&self) -> Vec<Value> { ... }
}Available on crate feature
testing only.Expand description
Reading an InteractionResponse in assertions, through its JSON (what Discord receives).
Components are found anywhere in the message: in action rows, sections and containers.
Required Methods§
Provided Methods§
Sourcefn response_type(&self) -> u8
fn response_type(&self) -> u8
The response type: 4 message, 5 deferred message, 6 deferred update, 7 update, 8 autocomplete, 9 modal
Sourcefn text(&self) -> Option<String>
fn text(&self) -> Option<String>
The message’s content, else its text displays’ content joined with newlines (Components
V2); None without either
Sourcefn is_ephemeral(&self) -> bool
fn is_ephemeral(&self) -> bool
Whether the message (or deferral) is only shown to the invoking user
Sourcefn components(&self) -> Vec<Value>
fn components(&self) -> Vec<Value>
Every component, depth first
The first component labeled label (a button, mostly)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ResponseExt for Value
A response as JSON, like one read back from an Adapter over HTTP
impl ResponseExt for Value
A response as JSON, like one read back from an Adapter over HTTP