From c479dd4b2c15d020a719a857940761944892c926 Mon Sep 17 00:00:00 2001 From: nickelc Date: Sat, 14 May 2022 14:48:43 +0200 Subject: [PATCH] Remove deprecated interaction type aliases, field and method (#1902) --- src/builder/create_application_command.rs | 11 -- src/model/application.rs | 8 + src/model/application/command.rs | 9 -- src/model/interactions.rs | 189 ---------------------- src/model/mod.rs | 8 - src/model/prelude.rs | 43 +++-- 6 files changed, 29 insertions(+), 239 deletions(-) delete mode 100644 src/model/interactions.rs diff --git a/src/builder/create_application_command.rs b/src/builder/create_application_command.rs index 6b7552805fd..2e2c29a445a 100644 --- a/src/builder/create_application_command.rs +++ b/src/builder/create_application_command.rs @@ -350,17 +350,6 @@ impl CreateApplicationCommand { self } - /// Specifies if the command should not be usable by default - /// - /// **Note**: Setting it to false will disable it for anyone, - /// including administrators and guild owners. - #[deprecated(note = "replaced by `default_member_permissions`")] - pub fn default_permission(&mut self, default_permission: bool) -> &mut Self { - self.0.insert("default_permission", Value::from(default_permission)); - - self - } - /// Specifies the description of the application command. /// /// **Note**: Must be between 1 and 100 characters long. diff --git a/src/model/application.rs b/src/model/application.rs index c7d68ed5c36..a0364169f9a 100644 --- a/src/model/application.rs +++ b/src/model/application.rs @@ -5,6 +5,14 @@ pub mod component; pub mod interaction; pub mod oauth; +pub use interaction::{ + Interaction, + InteractionResponseType, + InteractionType, + MessageFlags, + MessageInteraction, +}; + use self::oauth::Scope; use super::id::{snowflake, ApplicationId, GuildId, SkuId, UserId}; use super::user::User; diff --git a/src/model/application/command.rs b/src/model/application/command.rs index cee5cbab2e9..bd8fa4708f9 100644 --- a/src/model/application/command.rs +++ b/src/model/application/command.rs @@ -77,19 +77,10 @@ pub struct Command { /// By default, commands are visible. #[serde(default)] pub dm_permission: Option, - /// Whether the command is enabled by default when - /// the application is added to a guild. - #[serde(default = "default_permission_value")] - #[deprecated(note = "replaced by `default_member_permissions`")] - pub default_permission: bool, /// An autoincremented version identifier updated during substantial record changes. pub version: CommandVersionId, } -fn default_permission_value() -> bool { - true -} - #[cfg(feature = "http")] impl Command { /// Creates a global [`Command`], diff --git a/src/model/interactions.rs b/src/model/interactions.rs deleted file mode 100644 index 94a411af552..00000000000 --- a/src/model/interactions.rs +++ /dev/null @@ -1,189 +0,0 @@ -#[deprecated(note = "use `model::application::interaction::application_command")] -pub mod application_command { - use crate::model::application::interaction::application_command; - - /// An interaction when a user invokes a slash command. - #[deprecated( - note = "use `model::application::interaction::application_command::ApplicationCommandInteraction`" - )] - pub type ApplicationCommandInteraction = application_command::ApplicationCommandInteraction; - - /// The command data payload. - #[deprecated(note = "use `model::application::interaction::application_command::CommandData`")] - pub type ApplicationCommandInteractionData = application_command::CommandData; - - /// The resolved value of a [`ApplicationCommandInteractionData::target_id`]. - #[deprecated( - note = "use `model::application::interaction::application_command::ResolvedTarget`" - )] - pub type ResolvedTarget<'a> = application_command::ResolvedTarget<'a>; - - /// The resolved data of a command data interaction payload. - /// It contains the objects of [`ApplicationCommandInteractionDataOption`]s. - #[deprecated( - note = "use `model::application::interaction::application_command::CommandDataResolved`" - )] - pub type ApplicationCommandInteractionDataResolved = application_command::CommandDataResolved; - - /// A set of a parameter and a value from the user. - /// - /// All options have names and an option can either be a parameter and input `value` or it can denote a sub-command or group, in which case it will contain a - /// top-level key and another vector of `options`. - /// - /// Their resolved objects can be found on [`ApplicationCommandInteractionData::resolved`]. - #[deprecated( - note = "use `model::application::interaction::application_command::CommandDataOption`" - )] - pub type ApplicationCommandInteractionDataOption = application_command::CommandDataOption; - - /// The resolved value of an [`ApplicationCommandInteractionDataOption`]. - #[deprecated( - note = "use `model::application::interaction::application_command::CommandDataOptionValue`" - )] - pub type ApplicationCommandInteractionDataOptionValue = - application_command::CommandDataOptionValue; - - use crate::model::application::command; - - /// The base command model that belongs to an application. - #[deprecated(note = "use `model::application::command::Command`")] - pub type ApplicationCommand = command::Command; - - /// The type of an application command. - #[deprecated(note = "use `model::application::command::CommandType`")] - pub type ApplicationCommandType = command::CommandType; - - /// The parameters for an [`ApplicationCommand`]. - #[deprecated(note = "use `model::application::command::CommandOption`")] - pub type ApplicationCommandOption = command::CommandOption; - - /// The type of an [`ApplicationCommandOption`]. - #[deprecated(note = "use `model::application::command::CommandOptionType`")] - pub type ApplicationCommandOptionType = command::CommandOptionType; - - /// The only valid values a user can pick in an [`ApplicationCommandOption`]. - #[deprecated(note = "use `model::application::command::CommandOptionChoice`")] - pub type ApplicationCommandOptionChoice = command::CommandOptionChoice; - - /// An [`ApplicationCommand`] permission. - #[deprecated(note = "use `model::application::command::CommandPermission`")] - pub type ApplicationCommandPermission = command::CommandPermission; - - /// The [`ApplicationCommandPermission`] data. - #[deprecated(note = "use `model::application::command::CommandPermissionData`")] - pub type ApplicationCommandPermissionData = command::CommandPermissionData; - - /// The type of an [`ApplicationCommandPermissionData`]. - #[deprecated(note = "use `model::application::command::CommandPermissionType`")] - pub type ApplicationCommandPermissionType = command::CommandPermissionType; -} - -#[deprecated(note = "use `model::application::interaction::autocomplete")] -pub mod autocomplete { - use crate::model::application::interaction::autocomplete; - - /// An interaction received when the user fills in an autocomplete option - #[deprecated( - note = "use `model::application::interaction::autocomplete::AutocompleteInteraction`" - )] - pub type AutocompleteInteraction = autocomplete::AutocompleteInteraction; -} - -#[deprecated(note = "use `model::application::interaction::message_component")] -pub mod message_component { - use crate::model::application::component; - use crate::model::application::interaction::message_component; - - /// An interaction triggered by a message component. - #[deprecated( - note = "use `model::application::interaction::message_component::MessageComponentInteraction`" - )] - pub type MessageComponentInteraction = message_component::MessageComponentInteraction; - - /// A message component interaction data, provided by [`MessageComponentInteraction::data`] - #[deprecated( - note = "use `model::application::interaction::message_component::MessageComponentInteractionData`" - )] - pub type MessageComponentInteractionData = message_component::MessageComponentInteractionData; - - /// The type of a component - #[deprecated(note = "use `model::application::component::ComponentType`")] - pub type ComponentType = component::ComponentType; - - /// An action row. - #[deprecated(note = "use `model::application::component::ActionRow`")] - pub type ActionRow = component::ActionRow; - - // A component which can be inside of an [`ActionRow`]. - #[deprecated(note = "use `model::application::component::ActionRowComponent`")] - pub type ActionRowComponent = component::ActionRowComponent; - - /// A button component. - #[deprecated(note = "use `model::application::component::Button`")] - pub type Button = component::Button; - - /// The style of a button. - #[deprecated(note = "use `model::application::component::ButtonStyle`")] - pub type ButtonStyle = component::ButtonStyle; - - /// A select menu component. - #[deprecated(note = "use `model::application::component::SelectMenu`")] - pub type SelectMenu = component::SelectMenu; - - /// A select menu component options. - #[deprecated(note = "use `model::application::component::SelectMenuOption`")] - pub type SelectMenuOption = component::SelectMenuOption; - - /// An input text component for modal interactions - #[deprecated(note = "use `model::application::component::InputText`")] - pub type InputText = component::InputText; - - /// The style of the input text - #[deprecated(note = "use `model::application::component::InputTextStyle`")] - pub type InputTextStyle = component::InputTextStyle; -} - -#[deprecated(note = "use `model::application::interaction::modal")] -pub mod modal { - use crate::model::application::interaction::modal; - - /// An interaction triggered by a modal submit. - #[deprecated(note = "use `model::application::interaction::modal::ModalSubmitInteraction`")] - pub type ModalSubmitInteraction = modal::ModalSubmitInteraction; - - /// A modal submit interaction data, provided by [`ModalSubmitInteraction::data`] - #[deprecated(note = "use `model::application::interaction::modal::ModalSubmitInteractionData`")] - pub type ModalSubmitInteractionData = modal::ModalSubmitInteractionData; -} - -#[deprecated(note = "use `model::application::interaction::ping")] -pub mod ping { - use crate::model::application::interaction::ping; - - /// A ping interaction, which can only be received through an endpoint url. - #[deprecated(note = "use `model::application::interaction::ping::PingInteraction`")] - pub type PingInteraction = ping::PingInteraction; -} - -use crate::model::application::interaction; - -#[deprecated(note = "use `model::application::interaction::Interaction`")] -pub type Interaction = interaction::Interaction; - -/// The type of an Interaction. -#[deprecated(note = "use `model::application::interaction::InteractionType`")] -pub type InteractionType = interaction::InteractionType; - -/// The flags for an interaction response. -#[deprecated(note = "use `model::application::interaction::MessageFlags`")] -pub type InteractionApplicationCommandCallbackDataFlags = interaction::MessageFlags; - -/// Sent when a [`Message`] is a response to an [`Interaction`]. -/// -/// [`Message`]: crate::model::channel::Message -#[deprecated(note = "use `model::application::interaction::MessageInteraction`")] -pub type MessageInteraction = interaction::MessageInteraction; - -/// The available responses types for an interaction response. -#[deprecated(note = "use `model::application::interaction::InteractionResponseType`")] -pub type InteractionResponseType = interaction::InteractionResponseType; diff --git a/src/model/mod.rs b/src/model/mod.rs index 224b608f28b..daed16151ca 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -30,8 +30,6 @@ pub mod event; pub mod gateway; pub mod guild; pub mod id; -#[deprecated(note = "use `model::application::interaction`")] -pub mod interactions; pub mod invite; pub mod mention; pub mod misc; @@ -43,12 +41,6 @@ pub mod user; pub mod voice; pub mod webhook; -#[deprecated(note = "use `model::application::oauth`")] -pub mod oauth2 { - #[deprecated(note = "use `model::application::oauth::Scope`")] - pub type OAuth2Scope = super::application::oauth::Scope; -} - use std::collections::HashMap; use std::result::Result as StdResult; diff --git a/src/model/prelude.rs b/src/model/prelude.rs index d8cf38cb8a9..9e679a33e3f 100644 --- a/src/model/prelude.rs +++ b/src/model/prelude.rs @@ -9,27 +9,26 @@ //! ```rust,no_run //! use serenity::model::prelude::*; //! ``` -#[doc(inline)] -pub use super::{ - application::interaction::MessageFlags as InteractionApplicationCommandCallbackDataFlags, - application::interaction::*, - application::oauth::*, - application::*, - channel::MessageFlags, - channel::*, - connection::*, - event::*, - gateway::*, - guild::audit_log::*, - guild::*, - id::*, - invite::*, - mention::*, - misc::*, - permissions::*, - sticker::*, - user::*, - voice::*, - webhook::*, + +pub use super::application::interaction::{ + MessageFlags as InteractionApplicationCommandCallbackDataFlags, *, }; +pub use super::application::oauth::*; +pub use super::application::*; +pub use super::channel::{MessageFlags, *}; +pub use super::connection::*; +pub use super::event::*; +pub use super::gateway::*; +pub use super::guild::audit_log::*; +pub use super::guild::*; +pub use super::id::*; +pub use super::invite::*; +pub use super::mention::*; +pub use super::misc::*; +pub use super::permissions::*; +pub use super::sticker::*; +pub use super::user::*; +pub use super::voice::*; +pub use super::webhook::*; +pub use super::*;