This commit is contained in:
Maybe Waffle 2022-10-07 12:19:54 +04:00
parent 83d3a11be9
commit d9b18abd55
2 changed files with 6 additions and 8 deletions

View file

@ -3,13 +3,12 @@ use crate::{
update_listeners, update_listeners::UpdateListener, HandlerExt, UpdateFilterExt, update_listeners, update_listeners::UpdateListener, HandlerExt, UpdateFilterExt,
}, },
error_handlers::LoggingErrorHandler, error_handlers::LoggingErrorHandler,
requests::{Requester, ResponseResult},
types::Update, types::Update,
utils::command::BotCommands, utils::command::BotCommands,
RequestError,
}; };
use dptree::di::{DependencyMap, Injectable}; use dptree::di::{DependencyMap, Injectable};
use std::{fmt::Debug, marker::PhantomData}; use std::{fmt::Debug, marker::PhantomData};
use teloxide_core::requests::Requester;
/// A [REPL] for commands. /// A [REPL] for commands.
// //
@ -58,7 +57,7 @@ pub async fn commands_repl<'a, R, Cmd, H, Args>(bot: R, handler: H, cmd: Phantom
where where
R: Requester + Clone + Send + Sync + 'static, R: Requester + Clone + Send + Sync + 'static,
<R as Requester>::GetUpdates: Send, <R as Requester>::GetUpdates: Send,
H: Injectable<DependencyMap, Result<(), RequestError>, Args> + Send + Sync + 'static, H: Injectable<DependencyMap, ResponseResult<()>, Args> + Send + Sync + 'static,
Cmd: BotCommands + Send + Sync + 'static, Cmd: BotCommands + Send + Sync + 'static,
{ {
let cloned_bot = bot.clone(); let cloned_bot = bot.clone();
@ -123,7 +122,7 @@ pub async fn commands_repl_with_listener<'a, R, Cmd, H, L, Args>(
cmd: PhantomData<Cmd>, cmd: PhantomData<Cmd>,
) where ) where
Cmd: BotCommands + Send + Sync + 'static, Cmd: BotCommands + Send + Sync + 'static,
H: Injectable<DependencyMap, Result<(), RequestError>, Args> + Send + Sync + 'static, H: Injectable<DependencyMap, ResponseResult<()>, Args> + Send + Sync + 'static,
L: UpdateListener + Send + 'a, L: UpdateListener + Send + 'a,
L::Err: Debug + Send + 'a, L::Err: Debug + Send + 'a,
R: Requester + Clone + Send + Sync + 'static, R: Requester + Clone + Send + Sync + 'static,

View file

@ -1,12 +1,11 @@
use crate::{ use crate::{
dispatching::{update_listeners, update_listeners::UpdateListener, UpdateFilterExt}, dispatching::{update_listeners, update_listeners::UpdateListener, UpdateFilterExt},
error_handlers::LoggingErrorHandler, error_handlers::LoggingErrorHandler,
requests::{Requester, ResponseResult},
types::Update, types::Update,
RequestError,
}; };
use dptree::di::{DependencyMap, Injectable}; use dptree::di::{DependencyMap, Injectable};
use std::fmt::Debug; use std::fmt::Debug;
use teloxide_core::requests::Requester;
/// A [REPL] for messages. /// A [REPL] for messages.
// //
@ -47,7 +46,7 @@ pub async fn repl<R, H, Args>(bot: R, handler: H)
where where
R: Requester + Send + Sync + Clone + 'static, R: Requester + Send + Sync + Clone + 'static,
<R as Requester>::GetUpdates: Send, <R as Requester>::GetUpdates: Send,
H: Injectable<DependencyMap, Result<(), RequestError>, Args> + Send + Sync + 'static, H: Injectable<DependencyMap, ResponseResult<()>, Args> + Send + Sync + 'static,
{ {
let cloned_bot = bot.clone(); let cloned_bot = bot.clone();
repl_with_listener(bot, handler, update_listeners::polling_default(cloned_bot).await).await; repl_with_listener(bot, handler, update_listeners::polling_default(cloned_bot).await).await;
@ -94,7 +93,7 @@ where
pub async fn repl_with_listener<R, H, L, Args>(bot: R, handler: H, listener: L) pub async fn repl_with_listener<R, H, L, Args>(bot: R, handler: H, listener: L)
where where
R: Requester + Clone + Send + Sync + 'static, R: Requester + Clone + Send + Sync + 'static,
H: Injectable<DependencyMap, Result<(), RequestError>, Args> + Send + Sync + 'static, H: Injectable<DependencyMap, ResponseResult<()>, Args> + Send + Sync + 'static,
L: UpdateListener + Send, L: UpdateListener + Send,
L::Err: Debug, L::Err: Debug,
{ {