From c74e396396b02ba1c1b5274bc4b0a730696ffc44 Mon Sep 17 00:00:00 2001 From: GnomedDev Date: Tue, 14 May 2024 13:56:37 +0100 Subject: [PATCH] Remove recently deprecated items --- examples/testing/src/model_type_sizes.rs | 1 - src/builder/create_command.rs | 10 --------- src/client/dispatch.rs | 4 ---- src/client/event_handler.rs | 3 --- src/model/application/command.rs | 5 ----- src/model/application/interaction.rs | 28 +----------------------- src/model/application/mod.rs | 5 ----- src/model/channel/message.rs | 21 ------------------ src/model/event.rs | 19 ---------------- src/model/guild/mod.rs | 11 +--------- 10 files changed, 2 insertions(+), 105 deletions(-) diff --git a/examples/testing/src/model_type_sizes.rs b/examples/testing/src/model_type_sizes.rs index b020d6219b8..9f0f076a88e 100644 --- a/examples/testing/src/model_type_sizes.rs +++ b/examples/testing/src/model_type_sizes.rs @@ -125,7 +125,6 @@ pub fn print_ranking() { ("MessageFlags", std::mem::size_of::()), ("MessageFlags", std::mem::size_of::()), ("MessageId", std::mem::size_of::()), - ("MessageInteraction", std::mem::size_of::()), ("MessageReaction", std::mem::size_of::()), ("MessageReference", std::mem::size_of::()), ("MessageUpdateEvent", std::mem::size_of::()), diff --git a/src/builder/create_command.rs b/src/builder/create_command.rs index 5fdfc2cb793..ecbc8e31694 100644 --- a/src/builder/create_command.rs +++ b/src/builder/create_command.rs @@ -338,8 +338,6 @@ pub struct CreateCommand<'a> { #[serde(skip_serializing_if = "Option::is_none")] default_member_permissions: Option, #[serde(skip_serializing_if = "Option::is_none")] - dm_permission: Option, - #[serde(skip_serializing_if = "Option::is_none")] #[serde(rename = "type")] kind: Option, #[cfg(feature = "unstable")] @@ -362,7 +360,6 @@ impl<'a> CreateCommand<'a> { description: None, description_localizations: HashMap::new(), default_member_permissions: None, - dm_permission: None, #[cfg(feature = "unstable")] integration_types: None, @@ -415,13 +412,6 @@ impl<'a> CreateCommand<'a> { self } - /// Specifies if the command is available in DMs. - #[cfg_attr(feature = "unstable", deprecated = "Use contexts instead")] - pub fn dm_permission(mut self, enabled: bool) -> Self { - self.dm_permission = Some(enabled); - self - } - /// Specifies the description of the application command. /// /// **Note**: Must be between 1 and 100 characters long. diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs index 88d655c7049..1f5f2b252a1 100644 --- a/src/client/dispatch.rs +++ b/src/client/dispatch.rs @@ -314,10 +314,6 @@ fn update_cache_with_event( event, } }, - #[allow(deprecated)] - Event::PresencesReplace(event) => FullEvent::PresenceReplace { - presences: event.presences.into_vec(), - }, Event::PresenceUpdate(mut event) => { let old_data = if_cache!(event.update(cache)); diff --git a/src/client/event_handler.rs b/src/client/event_handler.rs index 2956c089842..318893f881b 100644 --- a/src/client/event_handler.rs +++ b/src/client/event_handler.rs @@ -329,9 +329,6 @@ event_handler! { /// Provides the channel's id and the message's id. ReactionRemoveEmoji { removed_reactions: Reaction } => async fn reaction_remove_emoji(&self, ctx: Context); - #[deprecated = "This event does not exist"] - PresenceReplace { presences: Vec } => async fn presence_replace(&self, ctx: Context); - /// Dispatched when a user's presence is updated (e.g off -> on). /// /// Provides the presence's new data, as well as the old presence data if the diff --git a/src/model/application/command.rs b/src/model/application/command.rs index 275b5f6d0e4..b4a9d83fabc 100644 --- a/src/model/application/command.rs +++ b/src/model/application/command.rs @@ -73,11 +73,6 @@ pub struct Command { pub options: FixedArray, /// The default permissions required to execute the command. pub default_member_permissions: Option, - /// Indicates whether the command is available in DMs with the app, only for globally-scoped - /// commands. By default, commands are visible. - #[serde(default)] - #[deprecated = "Use Command::contexts"] - pub dm_permission: Option, /// Indicates whether the command is [age-restricted](https://discord.com/developers/docs/interactions/application-commands#agerestricted-commands), /// defaults to false. #[serde(default)] diff --git a/src/model/application/interaction.rs b/src/model/application/interaction.rs index 13f59fdbe63..95226d53c12 100644 --- a/src/model/application/interaction.rs +++ b/src/model/application/interaction.rs @@ -6,11 +6,11 @@ use serde_json::from_value; use super::InstallationContext; use super::{CommandInteraction, ComponentInteraction, ModalInteraction, PingInteraction}; use crate::internal::prelude::*; -use crate::model::guild::PartialMember; use crate::model::id::{ApplicationId, InteractionId}; #[cfg(feature = "unstable")] use crate::model::id::{GuildId, MessageId, UserId}; use crate::model::monetization::Entitlement; +#[cfg(feature = "unstable")] use crate::model::user::User; use crate::model::utils::deserialize_val; #[cfg(feature = "unstable")] @@ -395,32 +395,6 @@ impl serde::Serialize for AuthorizingIntegrationOwners { } } -/// Sent when a [`Message`] is a response to an [`Interaction`]. -/// -/// [`Message`]: crate::model::channel::Message -/// -/// [Discord docs](https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object). -#[cfg_attr(not(ignore_serenity_deprecated), deprecated = "Use Message::interaction_metadata")] -#[cfg_attr(feature = "typesize", derive(typesize::derive::TypeSize))] -#[derive(Clone, Debug, Deserialize, Serialize)] -#[non_exhaustive] -pub struct MessageInteraction { - /// The id of the interaction. - pub id: InteractionId, - /// The type of the interaction. - #[serde(rename = "type")] - pub kind: InteractionType, - /// The name of the [`Command`]. - /// - /// [`Command`]: crate::model::application::Command - pub name: FixedString, - /// The user who invoked the interaction. - pub user: User, - /// The member who invoked the interaction in the guild. - #[serde(skip_serializing_if = "Option::is_none")] - pub member: Option, -} - /// Metadata about the interaction, including the source of the interaction relevant server and /// user IDs. #[cfg_attr(feature = "typesize", derive(typesize::derive::TypeSize))] diff --git a/src/model/application/mod.rs b/src/model/application/mod.rs index 00d26cd563e..5fe90e51e47 100644 --- a/src/model/application/mod.rs +++ b/src/model/application/mod.rs @@ -152,11 +152,6 @@ pub struct Team { pub struct TeamMember { /// The member's membership state. pub membership_state: MembershipState, - /// The list of permissions of the member on the team. - /// - /// NOTE: Will always be "*" for now. - #[deprecated = "This field is not sent by the API anymore"] - pub permissions: FixedArray, /// The ID of the team they are a member of. pub team_id: GenericId, /// The user type of the team member. diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs index d8f77a8fe94..88242038d5f 100644 --- a/src/model/channel/message.rs +++ b/src/model/channel/message.rs @@ -107,9 +107,6 @@ pub struct Message { pub flags: Option, /// The message that was replied to using this message. pub referenced_message: Option>, // Boxed to avoid recursion - #[cfg_attr(not(ignore_serenity_deprecated), deprecated = "Use interaction_metadata")] - #[allow(deprecated)] - pub interaction: Option>, /// Sent if the message is a response to an [`Interaction`]. /// /// [`Interaction`]: crate::model::application::Interaction @@ -195,13 +192,6 @@ impl Message { self.channel_id.to_channel(cache_http).await } - /// A util function for determining whether this message was sent by someone else, or the bot. - #[cfg(feature = "cache")] - #[deprecated = "Check Message::author is equal to Cache::current_user"] - pub fn is_own(&self, cache: &Cache) -> bool { - self.author.id == cache.current_user().id - } - /// Deletes the message. /// /// **Note**: The logged in user must either be the author of the message or have the [Manage @@ -375,17 +365,6 @@ impl Message { cache.guild(self.guild_id?) } - /// True if message was sent using direct messages. - /// - /// **Only use this for messages from the gateway (event handler)!** Not for returned Message - /// objects from HTTP requests, like [`ChannelId::send_message`], because [`Self::guild_id`] is - /// never set for those, which this method relies on. - #[must_use] - #[deprecated = "Check if guild_id is None if the message is received from the gateway."] - pub fn is_private(&self) -> bool { - self.guild_id.is_none() - } - /// Retrieves a clone of the author's Member instance, if this message was sent in a guild. /// /// If the instance cannot be found in the cache, or the `cache` feature is disabled, a HTTP diff --git a/src/model/event.rs b/src/model/event.rs index e397c0666aa..ed9418b02c3 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -521,10 +521,6 @@ pub struct MessageUpdateEvent { pub flags: Option>, #[serde(default, deserialize_with = "deserialize_some")] pub referenced_message: Option>>, - #[cfg_attr(not(ignore_serenity_deprecated), deprecated = "Use interaction_metadata")] - #[serde(default, deserialize_with = "deserialize_some")] - #[allow(deprecated)] - pub interaction: Option>>, #[cfg(feature = "unstable")] pub interaction_metadata: Option>>, #[serde(default, deserialize_with = "deserialize_some")] @@ -568,7 +564,6 @@ impl MessageUpdateEvent { message_reference, flags, referenced_message, - interaction, #[cfg(feature = "unstable")] interaction_metadata, thread, @@ -607,7 +602,6 @@ impl MessageUpdateEvent { if let Some(x) = message_reference { message.message_reference.clone_from(x) } if let Some(x) = flags { message.flags.clone_from(x) } if let Some(x) = referenced_message { message.referenced_message.clone_from(x) } - if let Some(x) = interaction { message.interaction.clone_from(x) } #[cfg(feature = "unstable")] if let Some(x) = interaction_metadata { message.interaction_metadata.clone_from(x) } if let Some(x) = thread { message.thread.clone_from(x) } @@ -631,16 +625,6 @@ pub struct PresenceUpdateEvent { pub presence: Presence, } -/// Not officially documented. -#[cfg_attr(not(ignore_serenity_deprecated), deprecated = "This event doesn't exist")] -#[cfg_attr(feature = "typesize", derive(typesize::derive::TypeSize))] -#[derive(Clone, Debug, Deserialize, Serialize)] -#[serde(transparent)] -#[non_exhaustive] -pub struct PresencesReplaceEvent { - pub presences: FixedArray, -} - /// Requires [`GatewayIntents::GUILD_MESSAGE_REACTIONS`] or /// [`GatewayIntents::DIRECT_MESSAGE_REACTIONS`]. /// @@ -1244,9 +1228,6 @@ pub enum Event { MessageUpdate(MessageUpdateEvent), /// A member's presence state (or username or avatar) has changed PresenceUpdate(PresenceUpdateEvent), - /// The presence list of the user's friends should be replaced entirely - #[cfg_attr(not(ignore_serenity_deprecated), deprecated = "This event doesn't exist")] - PresencesReplace(PresencesReplaceEvent), /// A reaction was added to a message. /// /// Fires the [`EventHandler::reaction_add`] event handler. diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs index 9aebbce8a37..47d0f00dbc8 100644 --- a/src/model/guild/mod.rs +++ b/src/model/guild/mod.rs @@ -51,7 +51,7 @@ use crate::builder::{ }; #[cfg(feature = "collector")] use crate::collector::{MessageCollector, ReactionCollector}; -#[cfg(feature = "model")] +#[cfg(doc)] use crate::constants::LARGE_THRESHOLD; #[cfg(feature = "collector")] use crate::gateway::ShardMessenger; @@ -1388,15 +1388,6 @@ impl Guild { self.id.invites(http).await } - /// Checks if the guild is 'large'. - /// - /// A guild is considered large if it has more than 250 members. - #[must_use] - #[deprecated = "Use Guild::large"] - pub fn is_large(&self) -> bool { - self.member_count > u64::from(LARGE_THRESHOLD) - } - /// Kicks a [`Member`] from the guild. /// /// Requires the [Kick Members] permission.