Skip to content

Commit

Permalink
Change absolute_ratelimits deprecation error to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kangalio committed Feb 5, 2023
1 parent f0c511a commit 7a3f1c1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
23 changes: 22 additions & 1 deletion src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ impl ClientBuilder {
/// If you have enabled the `framework`-feature (on by default), you must specify
/// a framework via the [`Self::framework`] method,
/// otherwise awaiting the builder will cause a panic.
#[cfg(feature = "gateway")]
#[cfg_attr(
feature = "absolute_ratelimits",
deprecated = "\n\
You've enabled the absolute_ratelimits feature but it has been removed.\n\
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
)]
pub fn new(token: impl AsRef<str>, intents: GatewayIntents) -> Self {
Self::_new(Http::new(token.as_ref()), intents)
}
Expand All @@ -120,6 +128,13 @@ impl ClientBuilder {
/// If you have enabled the `framework`-feature (on by default), you must specify
/// a framework via the [`Self::framework`] method,
/// otherwise awaiting the builder will cause a panic.
#[cfg_attr(
feature = "absolute_ratelimits",
deprecated = "\n\
You've enabled the absolute_ratelimits feature but it has been removed.\n\
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
)]
pub fn new_with_http(http: Http, intents: GatewayIntents) -> Self {
Self::_new(http, intents)
}
Expand Down Expand Up @@ -345,7 +360,6 @@ impl ClientBuilder {
}
}

#[cfg(feature = "gateway")]
impl IntoFuture for ClientBuilder {
type Output = Result<Client>;

Expand Down Expand Up @@ -679,6 +693,13 @@ pub struct Client {
}

impl Client {
#[cfg_attr(
feature = "absolute_ratelimits",
deprecated = "\n\
You've enabled the absolute_ratelimits feature but it has been removed.\n\
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
)]
pub fn builder(token: impl AsRef<str>, intents: GatewayIntents) -> ClientBuilder {
ClientBuilder::new(token, intents)
}
Expand Down
14 changes: 14 additions & 0 deletions src/http/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ pub struct HttpBuilder {
impl HttpBuilder {
/// Construct a new builder to call methods on for the HTTP construction.
/// The `token` will automatically be prefixed "Bot " if not already.
#[cfg_attr(
feature = "absolute_ratelimits",
deprecated = "\n\
You've enabled the absolute_ratelimits feature but it has been removed.\n\
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
)]
pub fn new(token: impl AsRef<str>) -> Self {
Self {
client: None,
Expand Down Expand Up @@ -208,6 +215,13 @@ pub struct Http {

impl Http {
#[must_use]
#[cfg_attr(
feature = "absolute_ratelimits",
deprecated = "\n\
You've enabled the absolute_ratelimits feature but it has been removed.\n\
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
)]
pub fn new(token: &str) -> Self {
HttpBuilder::new(token).build()
}
Expand Down
7 changes: 0 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,6 @@ pub use static_assertions;
pub use crate::client::Client;
pub use crate::error::{Error, Result};

#[cfg(feature = "absolute_ratelimits")]
compile_error!(
"The absolute_ratelimits feature has been removed.\n\
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits.\n\
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
);

/// Special module that re-exports most public items from this crate.
///
/// Useful, because you don't have to remember the full paths of serenity items.
Expand Down

0 comments on commit 7a3f1c1

Please sign in to comment.