Skip to main content

Reply

Struct Reply 

Source
pub struct Reply(/* private fields */);
Expand description

Builds a MessageBody. Reply::from("text") is the common case.

Implementations§

Source§

impl Reply

Source

pub fn new() -> Self

An empty body.

Source

pub fn content(self, text: impl Into<String>) -> Self

Sets the text (≤ 4 000 scalars).

Source

pub fn embed(self, embed: impl Into<Embed>) -> Self

Adds an embed (≤ 10).

Source

pub fn row(self, row: ActionRow) -> Self

Adds a row of buttons or one select.

Source

pub fn component(self, component: Component) -> Self

Adds any top-level component. Anything but an action row needs v2.

Source

pub fn container(self, container: Container) -> Self

Adds a Components V2 container and switches the message to V2 layout.

Source

pub fn v2(self) -> Self

Uses Components V2 layout: no content or embeds, components carry everything.

Source

pub fn ephemeral(self) -> Self

Only the invoker sees it (interaction answers only).

Source

pub fn silent(self) -> Self

Delivers without notifying anyone.

Source

pub fn attachment(self, id: impl Into<Id>) -> Self

Attaches a file uploaded with crate::messages::upload.

Source

pub fn build(self) -> MessageBody

The finished body.

Source§

impl Reply

Source

pub fn mention_member(self, id: impl Into<Id>) -> Self

Notifies member id (write mention::member in the text to show where).

Source

pub fn mention_members(self, ids: impl IntoIterator<Item = Id>) -> Self

Notifies these members.

Source

pub fn mention_role(self, id: impl Into<Id>) -> Self

Notifies the members with role id (write mention::role in the text).

Source

pub fn mention_roles(self, ids: impl IntoIterator<Item = Id>) -> Self

Notifies the members with these roles.

Source

pub fn mention_everyone(self) -> Self

Notifies everyone who can see the channel (needs MENTION_EVERYONE).

Source

pub fn mentions(self, mentions: Mentions) -> Self

Sets the mentions to exactly mentions (mention::none(): nobody; on an edit, clears them).

Source

pub fn mentions_from_content(self) -> Self

Adds the mentions the content shows (<@id>, <@&id>, @everyone; see mention::parse). Call it after content, and only for text the bot wrote itself, never for text a member gave it.

Trait Implementations§

Source§

impl Clone for Reply

Source§

fn clone(&self) -> Reply

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Reply

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Reply

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&str> for Reply

Source§

fn from(text: &str) -> Self

Converts to this type from the input type.
Source§

impl From<EmbedBuilder> for Reply

Source§

fn from(embed: EmbedBuilder) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Reply

Source§

fn from(text: String) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Reply

§

impl RefUnwindSafe for Reply

§

impl Send for Reply

§

impl Sync for Reply

§

impl Unpin for Reply

§

impl UnsafeUnpin for Reply

§

impl UnwindSafe for Reply

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.