Skip to content

zaun_bot::Reply · Struct

pub struct Reply(…)

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

pub fn new() -> Self

An empty body.

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

Sets the text (≤ 4 000 scalars).

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

Adds an embed (≤ 10).

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

Adds a row of buttons or one select.

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

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

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

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

pub fn v2(self) -> Self

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

pub fn ephemeral(self) -> Self

Only the invoker sees it (interaction answers only).

pub fn silent(self) -> Self

Delivers without notifying anyone.

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

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

pub fn build(self) -> MessageBody

The finished body.

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

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

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

Notifies these members.

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

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

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

Notifies the members with these roles.

pub fn mention_everyone(self) -> Self

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

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

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

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.

Clone, Debug, Default, From<&str>, From<EmbedBuilder>, From<String>

Full rustdoc page