#[non_exhaustive]pub struct EditWebhookMessage {
pub content: Patch<CompactString>,
pub embeds: Patch<Vec<Embed>>,
pub flags: Patch<MessageFlags>,
pub allowed_mentions: Patch<AllowedMentions>,
pub components: Patch<Vec<Component>>,
pub attachments: Patch<Vec<AttachmentRequest>>,
pub poll: Patch<CreatePoll>,
pub files: Vec<FileUpload>,
pub thread_id: Option<ChannelId>,
pub with_components: Option<bool>,
}Expand description
The body of Edit Webhook Message, also used to edit the original response to an interaction and its follow-up messages.
Every field is a Patch: fields left at Patch::Keep are not changed. Attachments
work like in EditMessage: new files are added to
the attachments listed in attachments, every other attachment is
removed, and Patch::Clear removes all of them.
discord.js counterpart: WebhookMessageEditOptions / InteractionEditReplyOptions.
§Examples
use djs_model::rest::EditWebhookMessage;
let body = EditWebhookMessage::from("Done!");
assert_eq!(serde_json::to_string(&body).unwrap(), r#"{"content":"Done!"}"#);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.content: Patch<CompactString>The text (up to 2000 characters).
embeds: Patch<Vec<Embed>>Up to 10 rich embeds.
flags: Patch<MessageFlags>Only SUPPRESS_EMBEDS can be set and unset;
IS_COMPONENTS_V2 can only be set.
allowed_mentions: Patch<AllowedMentions>Which mentions in the content notify.
components: Patch<Vec<Component>>The components.
attachments: Patch<Vec<AttachmentRequest>>The attachments to keep (and the metadata of new files, which is otherwise generated).
poll: Patch<CreatePoll>A poll; it can only be added when editing a deferred interaction response.
files: Vec<FileUpload>Files to add (D-087).
thread_id: Option<ChannelId>The thread the message is in; sent in the query string (D-119).
with_components: Option<bool>Whether Discord uses components (Discord’s default: only for
application-owned webhooks); sent in the query string.
Implementations§
Source§impl EditWebhookMessage
impl EditWebhookMessage
Sourcepub fn content(self, content: impl Into<CompactString>) -> Self
pub fn content(self, content: impl Into<CompactString>) -> Self
Sets the text (up to 2000 characters).
discord.js counterpart: the content option.
Sourcepub fn embed(self, embed: Embed) -> Self
pub fn embed(self, embed: Embed) -> Self
Adds an embed after the ones set before (up to 10, 6000 characters in all; check
them with djs_builders::validate_embeds).
discord.js counterpart: an item of the embeds option.
Sourcepub fn embeds(self, embeds: impl IntoIterator<Item = Embed>) -> Self
pub fn embeds(self, embeds: impl IntoIterator<Item = Embed>) -> Self
Replaces the embeds. When editing a message (or updating it from a component), an empty list removes its embeds, while not calling this keeps them.
discord.js counterpart: the embeds option.
Sourcepub fn component(self, component: impl Into<Component>) -> Self
pub fn component(self, component: impl Into<Component>) -> Self
Adds a top-level component (an action row, or a Components V2 item with the
IS_COMPONENTS_V2 flag) after
the ones set before.
discord.js counterpart: an item of the components option.
Sourcepub fn components(self, components: impl IntoIterator<Item = Component>) -> Self
pub fn components(self, components: impl IntoIterator<Item = Component>) -> Self
Replaces the top-level components. When editing a message (or updating it from a component), an empty list removes its components, while not calling this keeps them.
discord.js counterpart: the components option.
Sourcepub fn allowed_mentions(self, mentions: AllowedMentions) -> Self
pub fn allowed_mentions(self, mentions: AllowedMentions) -> Self
Sets which mentions of the text notify their targets.
discord.js counterpart: the allowedMentions option.
Sourcepub fn no_mentions(self) -> Self
pub fn no_mentions(self) -> Self
Lets no mention notify anyone: no @everyone, role or user ping, whatever the text
contains. The safe choice for text that comes from users.
discord.js counterpart: allowedMentions: { parse: [] }.
Sourcepub fn flags(self, flags: MessageFlags) -> Self
pub fn flags(self, flags: MessageFlags) -> Self
Replaces the message flags (only some can be sent; see
MessageFlags).
discord.js counterpart: the flags option.
Sourcepub fn suppress_embeds(self) -> Self
pub fn suppress_embeds(self) -> Self
Hides the embeds Discord would generate for the links in the text (adds
SUPPRESS_EMBEDS to the flags).
discord.js counterpart: flags: MessageFlags.SuppressEmbeds.
Sourcepub fn file(self, file: FileUpload) -> Self
pub fn file(self, file: FileUpload) -> Self
Attaches a file, after the ones set before.
discord.js counterpart: an item of the files option.
Sourcepub fn files(self, files: impl IntoIterator<Item = FileUpload>) -> Self
pub fn files(self, files: impl IntoIterator<Item = FileUpload>) -> Self
Replaces the attached files.
discord.js counterpart: the files option.
Sourcepub fn attachments(
self,
attachments: impl IntoIterator<Item = AttachmentRequest>,
) -> Self
pub fn attachments( self, attachments: impl IntoIterator<Item = AttachmentRequest>, ) -> Self
Sets the attachment metadata: descriptions of the uploaded files, or, when editing, the existing attachments to keep (an empty list removes them all).
discord.js counterpart: the attachments option.
Sourcepub fn poll(self, poll: CreatePoll) -> Self
pub fn poll(self, poll: CreatePoll) -> Self
Attaches a poll.
discord.js counterpart: the poll option.
Source§impl EditWebhookMessage
The setters of the fields only EditWebhookMessage has (D-290).
impl EditWebhookMessage
The setters of the fields only EditWebhookMessage has (D-290).
Sourcepub const fn thread_id(self, thread_id: ChannelId) -> Self
pub const fn thread_id(self, thread_id: ChannelId) -> Self
Edits a message in this thread of the webhook’s channel.
discord.js counterpart: the threadId option.
Sourcepub const fn with_components(self, with_components: bool) -> Self
pub const fn with_components(self, with_components: bool) -> Self
Sets whether Discord uses the components (by default only for
application-owned webhooks).
discord.js counterpart: the withComponents option.