pub struct EditWebhookMessage { /* private fields */ }
Expand description
A builder to specify the fields to edit in an existing Webhook
’s message.
Implementations§
Source§impl EditWebhookMessage
impl EditWebhookMessage
Sourcepub fn new() -> Self
pub fn new() -> Self
Equivalent to Self::default
.
Sourcepub fn content(self, content: impl Into<String>) -> Self
pub fn content(self, content: impl Into<String>) -> Self
Set the content of the message.
Note: Message contents must be under 2000 unicode code points.
Sourcepub fn in_thread(self, thread_id: impl Into<ChannelId>) -> Self
pub fn in_thread(self, thread_id: impl Into<ChannelId>) -> Self
Edits a message within a given thread. If the provided thread Id doesn’t belong to the current webhook, the API will return an error.
Sourcepub fn add_embed(self, embed: CreateEmbed) -> Self
pub fn add_embed(self, embed: CreateEmbed) -> Self
Adds an embed for the message.
Embeds from the original message are reset when adding new embeds and must be re-added.
Sourcepub fn add_embeds(self, embeds: Vec<CreateEmbed>) -> Self
pub fn add_embeds(self, embeds: Vec<CreateEmbed>) -> Self
Adds multiple embeds to the message.
Embeds from the original message are reset when adding new embeds and must be re-added.
Sourcepub fn embed(self, embed: CreateEmbed) -> Self
pub fn embed(self, embed: CreateEmbed) -> Self
Sets a single embed to include in the message
Calling this will overwrite the embed list. To append embeds, call Self::add_embed
instead.
Sourcepub fn embeds(self, embeds: Vec<CreateEmbed>) -> Self
pub fn embeds(self, embeds: Vec<CreateEmbed>) -> Self
Sets the embeds for the message.
Note: You can only have up to 10 embeds per message.
Calling this will overwrite the embed list. To append embeds, call Self::add_embeds
instead.
Sourcepub fn allowed_mentions(self, allowed_mentions: CreateAllowedMentions) -> Self
pub fn allowed_mentions(self, allowed_mentions: CreateAllowedMentions) -> Self
Set the allowed mentions for the message.
Sourcepub fn components(self, components: Vec<CreateActionRow>) -> Self
pub fn components(self, components: Vec<CreateActionRow>) -> Self
Sets the components for this message. Requires an application-owned webhook, meaning either
the webhook’s kind
field is set to WebhookType::Application
, or it was created by an
application (and has kind WebhookType::Incoming
).
Adds a clickable button to this message.
Convenience method that wraps Self::components
. Arranges buttons in action rows
automatically.
Adds an interactive select menu to this message.
Convenience method that wraps Self::components
.
Sourcepub fn attachments(self, attachments: EditAttachments) -> Self
pub fn attachments(self, attachments: EditAttachments) -> Self
Sets attachments, see EditAttachments
for more details.
Sourcepub fn new_attachment(self, attachment: CreateAttachment) -> Self
pub fn new_attachment(self, attachment: CreateAttachment) -> Self
Adds a new attachment to the message.
Resets existing attachments. See the documentation for EditAttachments
for details.
Sourcepub fn keep_existing_attachment(self, id: AttachmentId) -> Self
pub fn keep_existing_attachment(self, id: AttachmentId) -> Self
Shorthand for EditAttachments::keep
.
Sourcepub fn clear_attachments(self) -> Self
pub fn clear_attachments(self) -> Self
Shorthand for calling Self::attachments
with EditAttachments::new
.
Trait Implementations§
Source§impl Builder for EditWebhookMessage
impl Builder for EditWebhookMessage
Source§fn execute<'life0, 'async_trait>(
self,
cache_http: impl 'async_trait + CacheHttp,
ctx: Self::Context<'life0>,
) -> Pin<Box<dyn Future<Output = Result<Self::Built>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
self,
cache_http: impl 'async_trait + CacheHttp,
ctx: Self::Context<'life0>,
) -> Pin<Box<dyn Future<Output = Result<Self::Built>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Edits the webhook’s message.
Note: Message contents must be under 2000 unicode code points, and embeds must be under 6000 code points.
§Errors
Returns an Error::Model
if the message content is too long.
May also return an Error::Http
if the content is malformed, the webhook’s token is
invalid, or the given message Id does not belong to the webhook.
Or may return an Error::Json
if there is an error deserialising Discord’s response.
Source§type Context<'ctx> = (WebhookId, &'ctx str, MessageId)
type Context<'ctx> = (WebhookId, &'ctx str, MessageId)
type Built = Message
Source§impl Clone for EditWebhookMessage
impl Clone for EditWebhookMessage
Source§fn clone(&self) -> EditWebhookMessage
fn clone(&self) -> EditWebhookMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more