Deprecate AutoSend

This commit is contained in:
Maybe Waffle 2022-09-23 17:48:26 +04:00
parent fe88ba2949
commit d541faa621
5 changed files with 10 additions and 6 deletions

View file

@ -99,8 +99,8 @@ cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples=examples"]
[[example]]
name = "self_info"
required-features = ["tokio/macros", "tokio/rt-multi-thread", "auto_send"]
required-features = ["tokio/macros", "tokio/rt-multi-thread"]
[[example]]
name = "erased"
required-features = ["tokio/macros", "tokio/rt-multi-thread", "auto_send", "erased"]
required-features = ["tokio/macros", "tokio/rt-multi-thread", "erased", "trace_adaptor"]

View file

@ -32,9 +32,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
log::info!("Trace settings: {:?}", trace_settings);
let bot = if trace_settings.is_empty() {
Bot::from_env().erase().auto_send()
Bot::from_env().erase()
} else {
Bot::from_env().trace(trace_settings).erase().auto_send()
Bot::from_env().trace(trace_settings).erase()
};
bot.send_chat_action(chat_id, ChatAction::Typing).await?;

View file

@ -14,8 +14,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
);
let bot = Bot::from_env()
.parse_mode(ParseMode::MarkdownV2)
.auto_send();
.parse_mode(ParseMode::MarkdownV2);
let Me { user: me, .. } = bot.get_me().await?;

View file

@ -14,6 +14,7 @@
/// [`AutoSend`]: auto_send::AutoSend
/// [`send`]: crate::requests::Request::send
#[cfg(feature = "auto_send")]
#[deprecated(since = "0.8.0", note = "`AutoSend` is no longer required to `.await` requests and is now noop")]
pub mod auto_send;
/// [`CacheMe`] bot adaptor which caches [`GetMe`] requests.
@ -47,6 +48,7 @@ pub mod throttle;
mod parse_mode;
#[cfg(feature = "auto_send")]
#[allow(deprecated)]
pub use auto_send::AutoSend;
#[cfg(feature = "cache_me")]
pub use cache_me::CacheMe;

View file

@ -4,6 +4,7 @@ use crate::{adaptors::DefaultParseMode, requests::Requester, types::ParseMode};
use crate::adaptors::CacheMe;
#[cfg(feature = "auto_send")]
#[allow(deprecated)]
use crate::adaptors::AutoSend;
#[cfg(feature = "erased")]
@ -28,6 +29,8 @@ pub trait RequesterExt: Requester {
/// Send requests automatically, see [`AutoSend`] for more.
#[cfg(feature = "auto_send")]
#[deprecated(since = "0.8.0", note = "`AutoSend` is no longer required to `.await` requests and is now noop")]
#[allow(deprecated)]
fn auto_send(self) -> AutoSend<Self>
where
Self: Sized,