This commit is contained in:
2023-05-22 11:47:17 +02:00
parent e26342ac89
commit 4dccd0f7bc

View File

@@ -8,7 +8,7 @@ use teloxide::{
types::{InlineKeyboardButton, InlineKeyboardMarkup}, dispatching::dialogue::GetChatId, adaptors::{Throttle, CacheMe}, types::{InlineKeyboardButton, InlineKeyboardMarkup}, dispatching::dialogue::GetChatId, adaptors::{Throttle, CacheMe},
}; };
use crate::bots::{ use crate::{bots::{
approved_bot::{ approved_bot::{
services::{ services::{
book_library::{ book_library::{
@@ -20,7 +20,7 @@ use crate::bots::{
tools::filter_callback_query, tools::filter_callback_query,
}, },
BotHandlerInternal, BotHandlerInternal,
}; }, bots_manager::AppState};
use super::utils::{generic_get_pagination_keyboard, GetPaginationCallbackData}; use super::utils::{generic_get_pagination_keyboard, GetPaginationCallbackData};
@@ -255,12 +255,12 @@ pub fn get_search_handler() -> crate::bots::BotHandler {
).branch( ).branch(
Update::filter_callback_query() Update::filter_callback_query()
.chain(filter_callback_query::<SearchCallbackData>()) .chain(filter_callback_query::<SearchCallbackData>())
.endpoint(|cq: CallbackQuery, callback_data: SearchCallbackData, bot: CacheMe<Throttle<Bot>>, user_langs_cache: Cache<UserId, Vec<String>>| async move { .endpoint(|cq: CallbackQuery, callback_data: SearchCallbackData, bot: CacheMe<Throttle<Bot>>, app_state: AppState| async move {
match callback_data { match callback_data {
SearchCallbackData::Book { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_book, user_langs_cache).await, SearchCallbackData::Book { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_book, app_state.user_langs_cache).await,
SearchCallbackData::Authors { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_author, user_langs_cache).await, SearchCallbackData::Authors { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_author, app_state.user_langs_cache).await,
SearchCallbackData::Sequences { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_sequence, user_langs_cache).await, SearchCallbackData::Sequences { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_sequence, app_state.user_langs_cache).await,
SearchCallbackData::Translators { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_translator, user_langs_cache).await, SearchCallbackData::Translators { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_translator, app_state.user_langs_cache).await,
} }
}) })
) )