pub struct SlackMessageBuilder { /* private fields */ }Expand description
Builder for constructing Slack messages with a fluent API.
Implementations§
Source§impl SlackMessageBuilder
impl SlackMessageBuilder
Sourcepub fn block(self, block: SlackBlock) -> Self
pub fn block(self, block: SlackBlock) -> Self
Add a Block Kit block to the message.
Sourcepub fn blocks(self, blocks: Vec<SlackBlock>) -> Self
pub fn blocks(self, blocks: Vec<SlackBlock>) -> Self
Set all blocks for the message (replaces existing).
Sourcepub fn username(self, username: impl Into<String>) -> Self
pub fn username(self, username: impl Into<String>) -> Self
Override the webhook’s default username.
Sourcepub fn icon_emoji(self, emoji: impl Into<String>) -> Self
pub fn icon_emoji(self, emoji: impl Into<String>) -> Self
Override the webhook’s icon using an emoji.
Sourcepub fn reply_broadcast(self, broadcast: bool) -> Self
pub fn reply_broadcast(self, broadcast: bool) -> Self
Broadcast the reply to the channel.
Sourcepub fn build(self) -> Result<SlackMessage, SlackError>
pub fn build(self) -> Result<SlackMessage, SlackError>
Build the final Slack message.
§Errors
Returns SlackError::EmptyMessage if both text and blocks are empty.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SlackMessageBuilder
impl RefUnwindSafe for SlackMessageBuilder
impl Send for SlackMessageBuilder
impl Sync for SlackMessageBuilder
impl Unpin for SlackMessageBuilder
impl UnsafeUnpin for SlackMessageBuilder
impl UnwindSafe for SlackMessageBuilder
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