From ab4f5528d5b6fab46f8b966e26d72558f00936e5 Mon Sep 17 00:00:00 2001 From: kangalioo Date: Mon, 30 Oct 2023 19:25:38 +0100 Subject: [PATCH] Undeprecate methods --- src/builder/edit_interaction_response.rs | 13 ++++++++----- src/builder/edit_message.rs | 11 +++++++---- src/builder/edit_webhook_message.rs | 11 +++++++---- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/builder/edit_interaction_response.rs b/src/builder/edit_interaction_response.rs index b679a65b52b..1523175d5b2 100644 --- a/src/builder/edit_interaction_response.rs +++ b/src/builder/edit_interaction_response.rs @@ -81,22 +81,25 @@ impl EditInteractionResponse { Self(self.0.attachments(attachments)) } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] + /// Adds a new attachment to the message. + /// + /// Resets existing attachments. See [`Self::keep_existing_attachment`] or read + /// [`EditAttachments`] for explanation. pub fn new_attachment(self, attachment: CreateAttachment) -> Self { #[allow(deprecated)] Self(self.0.new_attachment(attachment)) } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] + /// Shorthand for [`EditAttachments::keep`] pub fn keep_existing_attachment(self, id: AttachmentId) -> Self { #[allow(deprecated)] Self(self.0.keep_existing_attachment(id)) } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] - pub fn clear_existing_attachments(self) -> Self { + /// Shorthand for [`Self::attachments`] with [`EditAttachments::new`] + pub fn clear_attachments(self) -> Self { #[allow(deprecated)] - Self(self.0.clear_existing_attachments()) + Self(self.0.clear_attachments()) } } diff --git a/src/builder/edit_message.rs b/src/builder/edit_message.rs index 4421b4370ec..76c2688c294 100644 --- a/src/builder/edit_message.rs +++ b/src/builder/edit_message.rs @@ -193,21 +193,24 @@ impl EditMessage { self } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] + /// Adds a new attachment to the message. + /// + /// Resets existing attachments. See [`Self::keep_existing_attachment`] or read + /// [`EditAttachments`] for explanation. pub fn attachment(mut self, attachment: CreateAttachment) -> Self { let attachments = self.attachments.get_or_insert_with(Default::default); self.attachments = Some(std::mem::take(attachments).add(attachment)); self } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] + /// Shorthand for [`EditAttachments::keep`] pub fn add_existing_attachment(mut self, id: AttachmentId) -> Self { let attachments = self.attachments.get_or_insert_with(Default::default); self.attachments = Some(std::mem::take(attachments).keep(id)); self } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] + /// Shorthand for [`EditAttachments::remove`] pub fn remove_existing_attachment(mut self, id: AttachmentId) -> Self { if let Some(attachments) = self.attachments { self.attachments = Some(attachments.remove(id)); @@ -215,7 +218,7 @@ impl EditMessage { self } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] + /// Shorthand for [`Self::attachments`] with [`EditAttachments::new`] pub fn remove_all_attachments(mut self) -> Self { self.attachments = Some(EditAttachments::new()); self diff --git a/src/builder/edit_webhook_message.rs b/src/builder/edit_webhook_message.rs index d13901f9a8b..88c5e5ebb3d 100644 --- a/src/builder/edit_webhook_message.rs +++ b/src/builder/edit_webhook_message.rs @@ -137,22 +137,25 @@ impl EditWebhookMessage { self } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] + /// Adds a new attachment to the message. + /// + /// Resets existing attachments. See [`Self::keep_existing_attachment`] or read + /// [`EditAttachments`] for explanation. pub fn new_attachment(mut self, attachment: CreateAttachment) -> Self { let attachments = self.attachments.get_or_insert_with(Default::default); self.attachments = Some(std::mem::take(attachments).add(attachment)); self } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] + /// Shorthand for [`EditAttachments::keep`] pub fn keep_existing_attachment(mut self, id: AttachmentId) -> Self { let attachments = self.attachments.get_or_insert_with(Default::default); self.attachments = Some(std::mem::take(attachments).keep(id)); self } - #[deprecated(since = "0.12.0", note = "use `.attachments(...)` for new code")] - pub fn clear_existing_attachments(mut self) -> Self { + /// Shorthand for [`Self::attachments`] with [`EditAttachments::new`] + pub fn clear_attachments(mut self) -> Self { self.attachments = Some(EditAttachments::new()); self }