This commit is contained in:
2023-05-06 23:14:19 +02:00
parent 3802ac0c1f
commit 08d55be68f
7 changed files with 31 additions and 31 deletions

View File

@@ -4,7 +4,7 @@ use regex::Regex;
use strum_macros::EnumIter;
use teloxide::{
prelude::*,
types::{InlineKeyboardButton, InlineKeyboardMarkup}, dispatching::dialogue::GetChatId,
types::{InlineKeyboardButton, InlineKeyboardMarkup}, dispatching::dialogue::GetChatId, adaptors::Throttle,
};
use crate::bots::{
@@ -107,7 +107,7 @@ fn get_query(cq: CallbackQuery) -> Option<String> {
async fn generic_search_pagination_handler<T, Fut>(
cq: CallbackQuery,
bot: Bot,
bot: Throttle<Bot>,
search_data: SearchCallbackData,
items_getter: fn(query: String, page: u32, allowed_langs: Vec<String>) -> Fut,
) -> BotHandlerInternal
@@ -217,7 +217,7 @@ where
}
}
pub async fn message_handler(message: Message, bot: Bot) -> BotHandlerInternal {
pub async fn message_handler(message: Message, bot: Throttle<Bot>) -> BotHandlerInternal {
let message_text = "Что ищем?";
let keyboard = InlineKeyboardMarkup {
@@ -268,7 +268,7 @@ pub fn get_search_handler() -> crate::bots::BotHandler {
).branch(
Update::filter_callback_query()
.chain(filter_callback_query::<SearchCallbackData>())
.endpoint(|cq: CallbackQuery, callback_data: SearchCallbackData, bot: Bot| async move {
.endpoint(|cq: CallbackQuery, callback_data: SearchCallbackData, bot: Throttle<Bot>| async move {
match callback_data {
SearchCallbackData::SearchBook { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_book).await,
SearchCallbackData::SearchAuthors { .. } => generic_search_pagination_handler(cq, bot, callback_data, search_author).await,