From 37579408f92a4c282e26bb1e2f09b7209aa11568 Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Tue, 23 Jan 2024 21:49:44 +0000 Subject: [PATCH] Make CreateReply fields private to match serenity --- src/reply/builder.rs | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/reply/builder.rs b/src/reply/builder.rs index 980db844bf7a..8610c3f2cd2d 100644 --- a/src/reply/builder.rs +++ b/src/reply/builder.rs @@ -4,26 +4,23 @@ use crate::serenity_prelude as serenity; /// Message builder that abstracts over prefix and application command responses #[derive(Default, Clone)] +#[allow(clippy::missing_docs_in_private_items)] // docs on setters pub struct CreateReply { - /// Message content. - pub content: Option, - /// Embeds, if present. - pub embeds: Vec, - /// Message attachments. - pub attachments: Vec, - /// Whether the message is ephemeral (only has an effect in application commands) - pub ephemeral: Option, - /// Message components, that is, buttons and select menus. - pub components: Option>, - /// The allowed mentions for the message. - pub allowed_mentions: Option, - /// Whether this message is an inline reply. - pub reply: bool, - #[doc(hidden)] - pub __non_exhaustive: (), + content: Option, + embeds: Vec, + attachments: Vec, + pub(crate) ephemeral: Option, + components: Option>, + pub(crate) allowed_mentions: Option, + reply: bool, } impl CreateReply { + /// Creates a blank CreateReply. Equivalent to [`Self::default`]. + pub fn new() -> Self { + Self::default() + } + /// Set the content of the message. pub fn content(mut self, content: impl Into) -> Self { self.content = Some(content.into()); @@ -97,7 +94,6 @@ impl CreateReply { ephemeral, allowed_mentions, reply: _, // can't reply to a message in interactions - __non_exhaustive: (), } = self; if let Some(content) = content { @@ -129,7 +125,6 @@ impl CreateReply { ephemeral, allowed_mentions, reply: _, - __non_exhaustive: (), } = self; if let Some(content) = content { @@ -162,7 +157,6 @@ impl CreateReply { ephemeral: _, // can't edit ephemerality in retrospect allowed_mentions, reply: _, - __non_exhaustive: (), } = self; if let Some(content) = content { @@ -188,7 +182,6 @@ impl CreateReply { ephemeral: _, // not supported in prefix allowed_mentions, reply: _, // can't edit reference message afterwards - __non_exhaustive: (), } = self; let mut attachments_builder = serenity::EditAttachments::new(); @@ -222,7 +215,6 @@ impl CreateReply { ephemeral: _, // not supported in prefix allowed_mentions, reply, - __non_exhaustive: (), } = self; let mut builder = serenity::CreateMessage::new();