diff --git a/examples/admin_bot/src/main.rs b/examples/admin_bot/src/main.rs index e98eef97..3b427c72 100644 --- a/examples/admin_bot/src/main.rs +++ b/examples/admin_bot/src/main.rs @@ -2,7 +2,7 @@ use std::{convert::TryInto, str::FromStr}; use teloxide::{prelude::*, utils::command::BotCommand}; -use teloxide::core::types::ChatPermissions; +use teloxide::types::ChatPermissions; // Derive BotCommand to parse text with a command into this enumeration. // diff --git a/examples/heroku_ping_pong_bot/src/main.rs b/examples/heroku_ping_pong_bot/src/main.rs index 8c4837ab..8f02734a 100644 --- a/examples/heroku_ping_pong_bot/src/main.rs +++ b/examples/heroku_ping_pong_bot/src/main.rs @@ -1,7 +1,7 @@ // The version of Heroku ping-pong-bot, which uses a webhook to receive updates // from Telegram, instead of long polling. -use teloxide::{dispatching::update_listeners, prelude::*}; +use teloxide::{dispatching::update_listeners, prelude::*, types::Update}; use std::{convert::Infallible, env, net::SocketAddr}; use tokio::sync::mpsc; diff --git a/examples/ngrok_ping_pong_bot/src/main.rs b/examples/ngrok_ping_pong_bot/src/main.rs index 9d614807..a00c60ee 100644 --- a/examples/ngrok_ping_pong_bot/src/main.rs +++ b/examples/ngrok_ping_pong_bot/src/main.rs @@ -1,7 +1,7 @@ // The version of ngrok ping-pong-bot, which uses a webhook to receive updates // from Telegram, instead of long polling. -use teloxide::{dispatching::update_listeners, prelude::*}; +use teloxide::{dispatching::update_listeners, prelude::*, types::Update}; use std::{convert::Infallible, net::SocketAddr}; use tokio::sync::mpsc; diff --git a/examples/redis_remember_bot/src/main.rs b/examples/redis_remember_bot/src/main.rs index 7176b75b..8b8fed65 100644 --- a/examples/redis_remember_bot/src/main.rs +++ b/examples/redis_remember_bot/src/main.rs @@ -9,6 +9,7 @@ use states::*; use teloxide::{ dispatching::dialogue::{serializer::Bincode, RedisStorage, Storage}, prelude::*, + RequestError, }; use thiserror::Error; diff --git a/examples/sqlite_remember_bot/src/main.rs b/examples/sqlite_remember_bot/src/main.rs index 337bea8a..ba13ad1e 100644 --- a/examples/sqlite_remember_bot/src/main.rs +++ b/examples/sqlite_remember_bot/src/main.rs @@ -9,6 +9,7 @@ use states::*; use teloxide::{ dispatching::dialogue::{serializer::JSON, SqliteStorage, Storage}, prelude::*, + RequestError, }; use thiserror::Error; diff --git a/src/dispatching/update_listeners.rs b/src/dispatching/update_listeners.rs index 0632611d..131c3757 100644 --- a/src/dispatching/update_listeners.rs +++ b/src/dispatching/update_listeners.rs @@ -120,9 +120,9 @@ impl UpdateListener for S where S: Stream> {} /// Returns a long polling update listener with `timeout` of 10 seconds. /// /// See also: [`polling`](polling). -pub fn polling_default(requester: R) -> impl UpdateListener +pub fn polling_default(requester: R) -> impl UpdateListener where - R: Requester, + R: Requester, ::GetUpdatesFaultTolerant: Send, { polling(requester, Some(Duration::from_secs(10)), None, None) @@ -140,14 +140,14 @@ where /// See also: [`polling_default`](polling_default). /// /// [`GetUpdates`]: crate::requests::GetUpdates -pub fn polling( +pub fn polling( requester: R, timeout: Option, limit: Option, allowed_updates: Option>, -) -> impl UpdateListener +) -> impl UpdateListener where - R: Requester, + R: Requester, ::GetUpdatesFaultTolerant: Send, { let timeout = timeout.map(|t| t.as_secs().try_into().expect("timeout is too big")); diff --git a/src/lib.rs b/src/lib.rs index e5c27cd0..afa15b2a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,7 +64,8 @@ pub mod error_handlers; pub mod prelude; pub mod utils; -pub use teloxide_core as core; +#[doc(inline)] +pub use teloxide_core::*; use teloxide_core::requests::ResponseResult; #[cfg(feature = "macros")] diff --git a/src/prelude.rs b/src/prelude.rs index 1a5741e7..dac0b14f 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -12,15 +12,15 @@ pub use crate::{ respond, }; -pub use teloxide_core::prelude::*; - pub use teloxide_core::{ adaptors::AutoSend, requests::{Request, ResponseResult}, - types::{Message, Update}, - RequestError, + types::Message, }; +#[doc(inline)] +pub use teloxide_core::prelude::*; + #[cfg(feature = "frunk")] // FIXME(waffle): use `docsrs` here when issue with combine is resolved #[cfg_attr(all(teloxide_docsrs, feature = "nightly"), doc(cfg(feature = "frunk")))] diff --git a/tests/command.rs b/tests/command.rs index 657bc98d..deed8647 100644 --- a/tests/command.rs +++ b/tests/command.rs @@ -56,8 +56,8 @@ fn attribute_prefix() { #[test] #[cfg(feature = "macros")] fn many_attributes() { - #[command(rename = "lowercase")] #[derive(BotCommand, Debug, PartialEq)] + #[command(rename = "lowercase")] enum DefaultCommands { #[command(prefix = "!", description = "desc")] Start, @@ -71,8 +71,8 @@ fn many_attributes() { #[test] #[cfg(feature = "macros")] fn global_attributes() { - #[command(prefix = "!", rename = "lowercase", description = "Bot commands")] #[derive(BotCommand, Debug, PartialEq)] + #[command(prefix = "!", rename = "lowercase", description = "Bot commands")] enum DefaultCommands { #[command(prefix = "/")] Start, @@ -87,8 +87,8 @@ fn global_attributes() { #[test] #[cfg(feature = "macros")] fn parse_command_with_bot_name() { - #[command(rename = "lowercase")] #[derive(BotCommand, Debug, PartialEq)] + #[command(rename = "lowercase")] enum DefaultCommands { #[command(prefix = "/")] Start, @@ -104,9 +104,9 @@ fn parse_command_with_bot_name() { #[test] #[cfg(feature = "macros")] fn parse_with_split() { + #[derive(BotCommand, Debug, PartialEq)] #[command(rename = "lowercase")] #[command(parse_with = "split")] - #[derive(BotCommand, Debug, PartialEq)] enum DefaultCommands { Start(u8, String), Help,