Revert "added handle_message function"

This reverts commit e7ef38c1
This commit is contained in:
P0lunin 2019-10-19 21:06:36 +03:00
parent e7ef38c1b2
commit 69096dc01d

View file

@ -227,16 +227,16 @@ where
match kind {
UpdateKind::Message(mes) => {
self.handle_message(mes, &self.message_handlers).await;
call!(self.message_handlers, mes)
}
UpdateKind::EditedMessage(mes) => {
self.handle_message(mes, &self.edited_message_handlers).await;
call!(self.edited_message_handlers, mes)
}
UpdateKind::ChannelPost(post) => {
self.handle_message(post, &self.channel_post_handlers).await;
call!(self.channel_post_handlers, post)
}
UpdateKind::EditedChannelPost(post) => {
self.handle_message(post, &self.edited_channel_post_handlers).await;
call!(self.edited_channel_post_handlers, post)
}
UpdateKind::InlineQuery(query) => {
call!(self.inline_query_handlers, query)
@ -252,27 +252,6 @@ where
})
.await;
}
async fn handle_message(&self, message: Message, handlers: &Handlers<'a, Message, E>) {
let handler = handlers.iter().find_map(|e|{
let (filter, handler) = e;
if filter.test(&message) {
Some(handler)
} else {
None
}
});
match handler {
Some(handler) => {
if let Err(err) = handler.handle(message).await {
self.error_policy.handle_error(err).await
}
}
None => {
log::warn!("unhandled update {:?}", message);
}
}
}
}
#[async_trait(? Send)]