diff --git a/CHANGELOG.md b/CHANGELOG.md index 75e56d7a..81417feb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Some dependencies was bumped: `sqlx` to `0.8.1`, `tower` to `0.5.0`, `reqwest` to `0.12.7` - `tokio` version was explicitly specified as `1.39` - Added new `Send` and `Sync` trait bounds to the `UListener` and `Eh` generic parameters of `try_dispatch_with_listener` and `dispatch_with_listener` ([PR 1185](https://github.com/teloxide/teloxide/pull/1185)) [**BC**] +- Renamed `Limits::messages_per_min_channel` to `messages_per_min_channel_or_supergroup` to reflect its actual behavior ([PR 1214](https://github.com/teloxide/teloxide/pull/1214)) ### Fixed diff --git a/crates/teloxide-core/src/adaptors/throttle.rs b/crates/teloxide-core/src/adaptors/throttle.rs index 7c4aaba3..6d5eed88 100644 --- a/crates/teloxide-core/src/adaptors/throttle.rs +++ b/crates/teloxide-core/src/adaptors/throttle.rs @@ -185,7 +185,7 @@ enum ChatIdHash { } impl ChatIdHash { - fn is_channel(&self) -> bool { + fn is_channel_or_supergroup(&self) -> bool { match self { &Self::Id(id) => id.is_channel_or_supergroup(), Self::ChannelUsernameHash(_) => true, diff --git a/crates/teloxide-core/src/adaptors/throttle/settings.rs b/crates/teloxide-core/src/adaptors/throttle/settings.rs index 57b38e9a..9f66d5c2 100644 --- a/crates/teloxide-core/src/adaptors/throttle/settings.rs +++ b/crates/teloxide-core/src/adaptors/throttle/settings.rs @@ -47,8 +47,8 @@ pub struct Limits { /// Allowed messages in one chat per minute. pub messages_per_min_chat: u32, - /// Allowed messages in one channel per minute. - pub messages_per_min_channel: u32, + /// Allowed messages in one channel or supergroup per minute. + pub messages_per_min_channel_or_supergroup: u32, /// Allowed messages per second. pub messages_per_sec_overall: u32, @@ -104,7 +104,7 @@ impl Default for Limits { messages_per_sec_chat: 1, messages_per_sec_overall: 30, messages_per_min_chat: 20, - messages_per_min_channel: 10, + messages_per_min_channel_or_supergroup: 10, } } } diff --git a/crates/teloxide-core/src/adaptors/throttle/worker.rs b/crates/teloxide-core/src/adaptors/throttle/worker.rs index 26d08493..acb4d5ac 100644 --- a/crates/teloxide-core/src/adaptors/throttle/worker.rs +++ b/crates/teloxide-core/src/adaptors/throttle/worker.rs @@ -242,8 +242,8 @@ pub(super) async fn worker( let requests_sent_per_sec_count = requests_sent.per_sec.get(chat).copied().unwrap_or(0); let requests_sent_per_min_count = requests_sent.per_min.get(chat).copied().unwrap_or(0); - let messages_per_min_limit = if chat.is_channel() { - limits.messages_per_min_channel + let messages_per_min_limit = if chat.is_channel_or_supergroup() { + limits.messages_per_min_channel_or_supergroup } else { limits.messages_per_min_chat };