Skip to content

Commit 7a3f1c1

Browse files
committed
Change absolute_ratelimits deprecation error to warning
1 parent f0c511a commit 7a3f1c1

File tree

3 files changed

+36
-8
lines changed

3 files changed

+36
-8
lines changed

src/client/mod.rs

+22-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ impl ClientBuilder {
109109
/// If you have enabled the `framework`-feature (on by default), you must specify
110110
/// a framework via the [`Self::framework`] method,
111111
/// otherwise awaiting the builder will cause a panic.
112+
#[cfg(feature = "gateway")]
113+
#[cfg_attr(
114+
feature = "absolute_ratelimits",
115+
deprecated = "\n\
116+
You've enabled the absolute_ratelimits feature but it has been removed.\n\
117+
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
118+
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
119+
)]
112120
pub fn new(token: impl AsRef<str>, intents: GatewayIntents) -> Self {
113121
Self::_new(Http::new(token.as_ref()), intents)
114122
}
@@ -120,6 +128,13 @@ impl ClientBuilder {
120128
/// If you have enabled the `framework`-feature (on by default), you must specify
121129
/// a framework via the [`Self::framework`] method,
122130
/// otherwise awaiting the builder will cause a panic.
131+
#[cfg_attr(
132+
feature = "absolute_ratelimits",
133+
deprecated = "\n\
134+
You've enabled the absolute_ratelimits feature but it has been removed.\n\
135+
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
136+
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
137+
)]
123138
pub fn new_with_http(http: Http, intents: GatewayIntents) -> Self {
124139
Self::_new(http, intents)
125140
}
@@ -345,7 +360,6 @@ impl ClientBuilder {
345360
}
346361
}
347362

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

@@ -679,6 +693,13 @@ pub struct Client {
679693
}
680694

681695
impl Client {
696+
#[cfg_attr(
697+
feature = "absolute_ratelimits",
698+
deprecated = "\n\
699+
You've enabled the absolute_ratelimits feature but it has been removed.\n\
700+
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
701+
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
702+
)]
682703
pub fn builder(token: impl AsRef<str>, intents: GatewayIntents) -> ClientBuilder {
683704
ClientBuilder::new(token, intents)
684705
}

src/http/client.rs

+14
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ pub struct HttpBuilder {
6262
impl HttpBuilder {
6363
/// Construct a new builder to call methods on for the HTTP construction.
6464
/// The `token` will automatically be prefixed "Bot " if not already.
65+
#[cfg_attr(
66+
feature = "absolute_ratelimits",
67+
deprecated = "\n\
68+
You've enabled the absolute_ratelimits feature but it has been removed.\n\
69+
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
70+
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
71+
)]
6572
pub fn new(token: impl AsRef<str>) -> Self {
6673
Self {
6774
client: None,
@@ -208,6 +215,13 @@ pub struct Http {
208215

209216
impl Http {
210217
#[must_use]
218+
#[cfg_attr(
219+
feature = "absolute_ratelimits",
220+
deprecated = "\n\
221+
You've enabled the absolute_ratelimits feature but it has been removed.\n\
222+
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits instead.\n\
223+
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
224+
)]
211225
pub fn new(token: &str) -> Self {
212226
HttpBuilder::new(token).build()
213227
}

src/lib.rs

-7
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,6 @@ pub use static_assertions;
127127
pub use crate::client::Client;
128128
pub use crate::error::{Error, Result};
129129

130-
#[cfg(feature = "absolute_ratelimits")]
131-
compile_error!(
132-
"The absolute_ratelimits feature has been removed.\n\
133-
Configure absolute ratelimits via Ratelimiter::set_absolute_ratelimits.\n\
134-
You can set the Ratelimiter of Http via HttpBuilder::ratelimiter."
135-
);
136-
137130
/// Special module that re-exports most public items from this crate.
138131
///
139132
/// Useful, because you don't have to remember the full paths of serenity items.

0 commit comments

Comments
 (0)