diff --git a/Cargo.toml b/Cargo.toml index 96531a6b8bc..5311f90d428 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ bitflags = "1.3" serde_json = "1.0.75" serde-value = "0.7" async-trait = "0.1.9" +rustversion = "1.0.7" [dependencies.nougat] version = "0.2.0" @@ -29,10 +30,6 @@ optional = true version = "2.2.0" optional = true -[dependencies.rustversion] -version = "1.0.7" -optional = true - [dependencies.simd-json] version = "0.4.14" optional = true @@ -177,7 +174,7 @@ default_no_backend = [ builder = ["utils"] cache = ["dashmap", "parking_lot"] -collector = ["gateway", "model", "rustversion", "derivative", "nougat"] +collector = ["gateway", "model", "derivative", "nougat"] client = ["http", "typemap_rev"] extras = [] framework = ["client", "model", "utils"] @@ -216,9 +213,6 @@ native_tls_backend = [ "bytes", ] -# TODO(next): Remove, these are deprecated aliases -simdjson = ["simd_json"] -voice-model = ["voice_model"] [package.metadata.docs.rs] features = ["default", "collector", "unstable_discord_api", "voice", "voice-model"] diff --git a/build.rs b/build.rs index 8de1a0db18f..905a137f05f 100644 --- a/build.rs +++ b/build.rs @@ -12,19 +12,4 @@ compile_error!( If you are unsure, go with `rustls_backend`." ); -#[cfg_attr( - feature = "simdjson", - deprecated = "The `simdjson` feature name is deprecated and will be removed in the next version of serenity, use `simd_json`." -)] -fn deprecated_simd_json_feature() {} - -#[cfg_attr( - feature = "voice-model", - deprecated = "The `voice-model` feature name is deprecated and will be removed in the next version of serenity, use `voice_model`." -)] -fn deprecated_voice_model_feature() {} - -fn main() { - deprecated_simd_json_feature(); - deprecated_voice_model_feature() -} +fn main() {} diff --git a/src/builder/create_application_command.rs b/src/builder/create_application_command.rs index f700fe9eeaf..018a47e2c59 100644 --- a/src/builder/create_application_command.rs +++ b/src/builder/create_application_command.rs @@ -48,6 +48,10 @@ pub struct CreateApplicationCommandOption { min_value: Option, #[serde(skip_serializing_if = "Option::is_none")] max_value: Option, + #[serde(skip_serializing_if = "Option::is_none")] + min_length: Option, + #[serde(skip_serializing_if = "Option::is_none")] + max_length: Option, channel_types: Vec, choices: Vec, @@ -290,7 +294,7 @@ impl CreateApplicationCommandOption { /// /// The value of `min_length` must be greater or equal to `0`. pub fn min_length(&mut self, value: u16) -> &mut Self { - self.0.insert("min_length", value.into()); + self.min_length = Some(value); self } @@ -299,7 +303,7 @@ impl CreateApplicationCommandOption { /// /// The value of `max_length` must be greater or equal to `1`. pub fn max_length(&mut self, value: u16) -> &mut Self { - self.0.insert("max_length", value.into()); + self.max_length = Some(value); self } diff --git a/src/http/client.rs b/src/http/client.rs index dca1890349e..6f7794399db 100644 --- a/src/http/client.rs +++ b/src/http/client.rs @@ -2450,7 +2450,7 @@ impl Http { let body = to_vec(&map)?; self.fire(Request { - body: Some(&body), + body: Some(body), multipart: None, headers: None, route: RouteInfo::CreateAutoModRule { @@ -2472,7 +2472,7 @@ impl Http { let body = to_vec(&map)?; self.fire(Request { - body: Some(&body), + body: Some(body), multipart: None, headers: None, route: RouteInfo::EditAutoModRule { diff --git a/src/model/channel/guild_channel.rs b/src/model/channel/guild_channel.rs index 94e085fd660..10aec8f04ab 100644 --- a/src/model/channel/guild_channel.rs +++ b/src/model/channel/guild_channel.rs @@ -1,4 +1,3 @@ -use std::convert::TryFrom; use std::fmt; #[cfg(feature = "model")] use std::sync::Arc; diff --git a/src/model/guild/automod.rs b/src/model/guild/automod.rs index f94310561a7..9e67d32a731 100644 --- a/src/model/guild/automod.rs +++ b/src/model/guild/automod.rs @@ -611,7 +611,7 @@ mod tests { Token::StructEnd, ]); - let value = Action::Alert(ChannelId(123)); + let value = Action::Alert(ChannelId::new(123)); serde_test::assert_tokens(&value, &[ Token::Struct { name: "Action", diff --git a/src/model/guild/guild_id.rs b/src/model/guild/guild_id.rs index cfaeb59917f..9321daa12cf 100644 --- a/src/model/guild/guild_id.rs +++ b/src/model/guild/guild_id.rs @@ -33,7 +33,7 @@ use crate::http::{CacheHttp, Http, UserPagination}; #[cfg(feature = "model")] use crate::internal::prelude::*; #[cfg(feature = "model")] -use crate::json::json; +use crate::json::{self, json}; #[cfg(feature = "model")] use crate::model::application::command::{Command, CommandPermission}; #[cfg(feature = "model")] @@ -53,7 +53,7 @@ impl GuildId { /// [Manage Guild]: Permissions::MANAGE_GUILD #[inline] pub async fn automod_rules(self, http: impl AsRef) -> Result> { - http.as_ref().get_automod_rules(self.0).await + http.as_ref().get_automod_rules(self.get()).await } /// Gets an auto moderation [`Rule`] of this guild by its ID via HTTP. @@ -71,7 +71,7 @@ impl GuildId { http: impl AsRef, rule_id: impl Into, ) -> Result { - http.as_ref().get_automod_rule(self.0, rule_id.into().0).await + http.as_ref().get_automod_rule(self.get(), rule_id.into().0.get()).await } /// Creates an auto moderation [`Rule`] in the guild. @@ -91,7 +91,7 @@ impl GuildId { /// # async fn run() { /// # use serenity::http::Http; /// # let http = Http::new("token"); - /// let _rule = GuildId(7) + /// let _rule = GuildId::new(7) /// .create_automod_rule(&http, |r| { /// r.name("foobar filter") /// .trigger(Trigger::Keyword(vec!["foo*".to_string(), "*bar".to_string()])) @@ -118,7 +118,7 @@ impl GuildId { let map = json::hashmap_to_json_map(builder.0); - http.as_ref().create_automod_rule(self.0, &map).await + http.as_ref().create_automod_rule(self.get(), &map).await } /// Edit an auto moderation [`Rule`] by its ID. @@ -143,7 +143,7 @@ impl GuildId { let map = json::hashmap_to_json_map(builder.0); - http.as_ref().edit_automod_rule(self.0, rule_id.into().0, &map).await + http.as_ref().edit_automod_rule(self.get(), rule_id.into().0.get(), &map).await } /// Deletes an auto moderation [`Rule`] from the guild. @@ -162,7 +162,7 @@ impl GuildId { http: impl AsRef, rule_id: impl Into, ) -> Result<()> { - http.as_ref().delete_automod_rule(self.0, rule_id.into().0).await + http.as_ref().delete_automod_rule(self.get(), rule_id.into().0.get()).await } /// Adds a [`User`] to this guild with a valid OAuth2 access token. diff --git a/src/model/id.rs b/src/model/id.rs index f5b5d7977a2..15c76e80502 100644 --- a/src/model/id.rs +++ b/src/model/id.rs @@ -144,10 +144,8 @@ pub struct MessageId(#[serde(with = "snowflake")] pub NonZeroU64); pub struct RoleId(#[serde(with = "snowflake")] pub NonZeroU64); /// An identifier for an auto moderation rule -#[derive( - Copy, Clone, Default, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Deserialize, Serialize, -)] -pub struct RuleId(#[serde(with = "snowflake")] pub u64); +#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Deserialize, Serialize)] +pub struct RuleId(#[serde(with = "snowflake")] pub NonZeroU64); /// An identifier for a Scheduled Event #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize)]