pub struct Response { /* private fields */ }Expand description
Unified bot response builder
Represents a response that can be sent back to any platform. Each platform adapter converts this to platform-specific format.
Implementations§
Source§impl Response
impl Response
Sourcepub fn acknowledge() -> Self
pub fn acknowledge() -> Self
Create an acknowledgement response (deferred)
Sourcepub fn with_embed(self, embed: Embed) -> Self
pub fn with_embed(self, embed: Embed) -> Self
Add an embed to this response
Sourcepub fn with_components(self, components: Vec<Component>) -> Self
pub fn with_components(self, components: Vec<Component>) -> Self
Add components (buttons, select menus) to this response
Sourcepub fn with_filename(self, name: impl Into<String>) -> Self
pub fn with_filename(self, name: impl Into<String>) -> Self
Set the filename for a file response
Sourcepub fn with_caption(self, caption: impl Into<String>) -> Self
pub fn with_caption(self, caption: impl Into<String>) -> Self
Set the caption for a file response
Sourcepub fn is_acknowledge(&self) -> bool
pub fn is_acknowledge(&self) -> bool
Check if this is an acknowledge response
Sourcepub fn components(&self) -> &[Component]
pub fn components(&self) -> &[Component]
Get components if this is a text response
Sourcepub fn is_ephemeral(&self) -> bool
pub fn is_ephemeral(&self) -> bool
Check if this response is ephemeral
Sourcepub fn take_file(&mut self) -> Option<FileResponse>
pub fn take_file(&mut self) -> Option<FileResponse>
Take the file response data, leaving Empty in its place
This consumes the file data, so it can only be called once.
Trait Implementations§
Source§impl IntoResponse for Response
impl IntoResponse for Response
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Convert this type into a bot response
Auto Trait Implementations§
impl !Freeze for Response
impl !RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl !UnwindSafe for Response
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