Use cache-me

This commit is contained in:
2023-05-06 23:39:11 +02:00
parent 6dac2be859
commit e58f45b776
11 changed files with 46 additions and 46 deletions

View File

@@ -2,7 +2,7 @@ use std::{convert::TryInto, str::FromStr};
use futures::TryStreamExt; use futures::TryStreamExt;
use regex::Regex; use regex::Regex;
use teloxide::{dispatching::UpdateFilterExt, dptree, prelude::*, types::*, adaptors::Throttle}; use teloxide::{dispatching::UpdateFilterExt, dptree, prelude::*, types::*, adaptors::{Throttle, CacheMe}};
use tokio_util::compat::FuturesAsyncReadCompatExt; use tokio_util::compat::FuturesAsyncReadCompatExt;
use crate::bots::{ use crate::bots::{
@@ -162,7 +162,7 @@ async fn download_image(
pub async fn send_annotation_handler<T, Fut>( pub async fn send_annotation_handler<T, Fut>(
message: Message, message: Message,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
command: AnnotationCommand, command: AnnotationCommand,
annotation_getter: fn(id: u32) -> Fut, annotation_getter: fn(id: u32) -> Fut,
) -> BotHandlerInternal ) -> BotHandlerInternal
@@ -248,7 +248,7 @@ where
pub async fn annotation_pagination_handler<T, Fut>( pub async fn annotation_pagination_handler<T, Fut>(
cq: CallbackQuery, cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
callback_data: AnnotationCallbackData, callback_data: AnnotationCallbackData,
annotation_getter: fn(id: u32) -> Fut, annotation_getter: fn(id: u32) -> Fut,
) -> BotHandlerInternal ) -> BotHandlerInternal
@@ -308,7 +308,7 @@ pub fn get_annotations_handler() -> crate::bots::BotHandler {
Update::filter_message() Update::filter_message()
.chain(filter_command::<AnnotationCommand>()) .chain(filter_command::<AnnotationCommand>())
.endpoint( .endpoint(
|message: Message, bot: Throttle<Bot>, command: AnnotationCommand| async move { |message: Message, bot: CacheMe<Throttle<Bot>>, command: AnnotationCommand| async move {
match command { match command {
AnnotationCommand::Book { .. } => { AnnotationCommand::Book { .. } => {
send_annotation_handler(message, bot, command, get_book_annotation) send_annotation_handler(message, bot, command, get_book_annotation)
@@ -332,7 +332,7 @@ pub fn get_annotations_handler() -> crate::bots::BotHandler {
.chain(filter_callback_query::<AnnotationCallbackData>()) .chain(filter_callback_query::<AnnotationCallbackData>())
.endpoint( .endpoint(
|cq: CallbackQuery, |cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
callback_data: AnnotationCallbackData| async move { callback_data: AnnotationCallbackData| async move {
match callback_data { match callback_data {
AnnotationCallbackData::Book { .. } => { AnnotationCallbackData::Book { .. } => {

View File

@@ -1,7 +1,7 @@
use std::str::FromStr; use std::str::FromStr;
use regex::Regex; use regex::Regex;
use teloxide::{dispatching::UpdateFilterExt, dptree, prelude::*, adaptors::Throttle}; use teloxide::{dispatching::UpdateFilterExt, dptree, prelude::*, adaptors::{Throttle, CacheMe}};
use crate::bots::approved_bot::{ use crate::bots::approved_bot::{
services::{ services::{
@@ -114,7 +114,7 @@ impl GetPaginationCallbackData for BookCallbackData {
async fn send_book_handler<T, Fut>( async fn send_book_handler<T, Fut>(
message: Message, message: Message,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
command: BookCommand, command: BookCommand,
books_getter: fn(id: u32, page: u32, allowed_langs: Vec<String>) -> Fut, books_getter: fn(id: u32, page: u32, allowed_langs: Vec<String>) -> Fut,
) -> crate::bots::BotHandlerInternal ) -> crate::bots::BotHandlerInternal
@@ -196,7 +196,7 @@ where
async fn send_pagination_book_handler<T, Fut>( async fn send_pagination_book_handler<T, Fut>(
cq: CallbackQuery, cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
callback_data: BookCallbackData, callback_data: BookCallbackData,
books_getter: fn(id: u32, page: u32, allowed_langs: Vec<String>) -> Fut, books_getter: fn(id: u32, page: u32, allowed_langs: Vec<String>) -> Fut,
) -> crate::bots::BotHandlerInternal ) -> crate::bots::BotHandlerInternal
@@ -295,7 +295,7 @@ pub fn get_book_handler() -> crate::bots::BotHandler {
Update::filter_message() Update::filter_message()
.chain(filter_command::<BookCommand>()) .chain(filter_command::<BookCommand>())
.endpoint( .endpoint(
|message: Message, bot: Throttle<Bot>, command: BookCommand| async move { |message: Message, bot: CacheMe<Throttle<Bot>>, command: BookCommand| async move {
match command { match command {
BookCommand::Author { .. } => { BookCommand::Author { .. } => {
send_book_handler( send_book_handler(
@@ -331,7 +331,7 @@ pub fn get_book_handler() -> crate::bots::BotHandler {
.branch( .branch(
Update::filter_callback_query() Update::filter_callback_query()
.chain(filter_callback_query::<BookCallbackData>()) .chain(filter_callback_query::<BookCallbackData>())
.endpoint(|cq: CallbackQuery, bot: Throttle<Bot>, callback_data: BookCallbackData| async move { .endpoint(|cq: CallbackQuery, bot: CacheMe<Throttle<Bot>>, callback_data: BookCallbackData| async move {
match callback_data { match callback_data {
BookCallbackData::Author { .. } => send_pagination_book_handler(cq, bot, callback_data, get_author_books).await, BookCallbackData::Author { .. } => send_pagination_book_handler(cq, bot, callback_data, get_author_books).await,
BookCallbackData::Translator { .. } => send_pagination_book_handler(cq, bot, callback_data, get_translator_books).await, BookCallbackData::Translator { .. } => send_pagination_book_handler(cq, bot, callback_data, get_translator_books).await,

View File

@@ -1,6 +1,6 @@
use futures::TryStreamExt; use futures::TryStreamExt;
use regex::Regex; use regex::Regex;
use teloxide::{dispatching::UpdateFilterExt, dptree, prelude::*, types::*, adaptors::Throttle}; use teloxide::{dispatching::UpdateFilterExt, dptree, prelude::*, types::*, adaptors::{Throttle, CacheMe}};
use tokio_util::compat::FuturesAsyncReadCompatExt; use tokio_util::compat::FuturesAsyncReadCompatExt;
use crate::{ use crate::{
@@ -47,7 +47,7 @@ impl CommandParse<Self> for DownloadData {
async fn _send_cached( async fn _send_cached(
message: &Message, message: &Message,
bot: &Throttle<Bot>, bot: &CacheMe<Throttle<Bot>>,
cached_message: CachedMessage, cached_message: CachedMessage,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
match bot match bot
@@ -66,7 +66,7 @@ async fn _send_cached(
async fn send_cached_message( async fn send_cached_message(
message: Message, message: Message,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
download_data: DownloadData, download_data: DownloadData,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
if let Ok(v) = get_cached_message(&download_data).await { if let Ok(v) = get_cached_message(&download_data).await {
@@ -83,7 +83,7 @@ async fn send_cached_message(
async fn _send_downloaded_file( async fn _send_downloaded_file(
message: &Message, message: &Message,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
downloaded_data: DownloadFile, downloaded_data: DownloadFile,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
let DownloadFile { let DownloadFile {
@@ -113,7 +113,7 @@ async fn _send_downloaded_file(
async fn send_with_download_from_channel( async fn send_with_download_from_channel(
message: Message, message: Message,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
download_data: DownloadData, download_data: DownloadData,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
match download_file(&download_data).await { match download_file(&download_data).await {
@@ -127,7 +127,7 @@ async fn send_with_download_from_channel(
async fn download_handler( async fn download_handler(
message: Message, message: Message,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
cache: BotCache, cache: BotCache,
download_data: DownloadData, download_data: DownloadData,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
@@ -143,7 +143,7 @@ pub fn get_download_hander() -> crate::bots::BotHandler {
.chain(filter_command::<DownloadData>()) .chain(filter_command::<DownloadData>())
.endpoint( .endpoint(
|message: Message, |message: Message,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
cache: BotCache, cache: BotCache,
download_data: DownloadData| async move { download_data: DownloadData| async move {
download_handler(message, bot, cache, download_data).await download_handler(message, bot, cache, download_data).await

View File

@@ -1,6 +1,6 @@
use crate::bots::BotHandlerInternal; use crate::bots::BotHandlerInternal;
use teloxide::{prelude::*, utils::command::BotCommands, types::ParseMode, adaptors::Throttle}; use teloxide::{prelude::*, utils::command::BotCommands, types::ParseMode, adaptors::{Throttle, CacheMe}};
#[derive(BotCommands, Clone)] #[derive(BotCommands, Clone)]
#[command(rename_rule = "lowercase")] #[command(rename_rule = "lowercase")]
@@ -10,7 +10,7 @@ enum HelpCommand {
} }
pub async fn help_handler(message: Message, bot: Throttle<Bot>) -> BotHandlerInternal { pub async fn help_handler(message: Message, bot: CacheMe<Throttle<Bot>>) -> BotHandlerInternal {
let name = message let name = message
.from() .from()
.map(|user| user.first_name.clone()) .map(|user| user.first_name.clone())

View File

@@ -2,7 +2,7 @@ use strum_macros::{Display, EnumIter};
use teloxide::{ use teloxide::{
prelude::*, prelude::*,
types::{InlineKeyboardButton, InlineKeyboardMarkup}, types::{InlineKeyboardButton, InlineKeyboardMarkup},
utils::command::BotCommands, adaptors::Throttle, utils::command::BotCommands, adaptors::{Throttle, CacheMe},
}; };
use crate::bots::{ use crate::bots::{
@@ -75,7 +75,7 @@ impl std::str::FromStr for RandomCallbackData {
} }
} }
async fn random_handler(message: Message, bot: Throttle<Bot>) -> crate::bots::BotHandlerInternal { async fn random_handler(message: Message, bot: CacheMe<Throttle<Bot>>) -> crate::bots::BotHandlerInternal {
const MESSAGE_TEXT: &str = "Что хотим получить?"; const MESSAGE_TEXT: &str = "Что хотим получить?";
let keyboard = InlineKeyboardMarkup { let keyboard = InlineKeyboardMarkup {
@@ -122,7 +122,7 @@ async fn random_handler(message: Message, bot: Throttle<Bot>) -> crate::bots::Bo
async fn get_random_item_handler_internal<T>( async fn get_random_item_handler_internal<T>(
cq: CallbackQuery, cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
item: Result<T, Box<dyn std::error::Error + Send + Sync>>, item: Result<T, Box<dyn std::error::Error + Send + Sync>>,
) -> BotHandlerInternal ) -> BotHandlerInternal
where where
@@ -176,7 +176,7 @@ where
async fn get_random_item_handler<T, Fut>( async fn get_random_item_handler<T, Fut>(
cq: CallbackQuery, cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
item_getter: fn(allowed_langs: Vec<String>) -> Fut, item_getter: fn(allowed_langs: Vec<String>) -> Fut,
) -> BotHandlerInternal ) -> BotHandlerInternal
where where
@@ -190,7 +190,7 @@ where
get_random_item_handler_internal(cq, bot, item).await get_random_item_handler_internal(cq, bot, item).await
} }
async fn get_genre_metas_handler(cq: CallbackQuery, bot: Throttle<Bot>) -> BotHandlerInternal { async fn get_genre_metas_handler(cq: CallbackQuery, bot: CacheMe<Throttle<Bot>>) -> BotHandlerInternal {
let genre_metas = match book_library::get_genre_metas().await { let genre_metas = match book_library::get_genre_metas().await {
Ok(v) => v, Ok(v) => v,
Err(err) => return Err(err), Err(err) => return Err(err),
@@ -243,7 +243,7 @@ async fn get_genre_metas_handler(cq: CallbackQuery, bot: Throttle<Bot>) -> BotHa
async fn get_genres_by_meta_handler( async fn get_genres_by_meta_handler(
cq: CallbackQuery, cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
genre_index: u32, genre_index: u32,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
let genre_metas = match book_library::get_genre_metas().await { let genre_metas = match book_library::get_genre_metas().await {
@@ -323,7 +323,7 @@ async fn get_genres_by_meta_handler(
async fn get_random_book_by_genre( async fn get_random_book_by_genre(
cq: CallbackQuery, cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
genre_id: u32, genre_id: u32,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
let allowed_langs = get_user_or_default_lang_codes(cq.from.id).await; let allowed_langs = get_user_or_default_lang_codes(cq.from.id).await;
@@ -350,7 +350,7 @@ pub fn get_random_hander() -> crate::bots::BotHandler {
.branch( .branch(
Update::filter_callback_query() Update::filter_callback_query()
.chain(filter_callback_query::<RandomCallbackData>()) .chain(filter_callback_query::<RandomCallbackData>())
.endpoint(|cq: CallbackQuery, callback_data: RandomCallbackData, bot: Throttle<Bot>| async move { .endpoint(|cq: CallbackQuery, callback_data: RandomCallbackData, bot: CacheMe<Throttle<Bot>>| async move {
match callback_data { match callback_data {
RandomCallbackData::RandomBook => get_random_item_handler(cq, bot, book_library::get_random_book).await, RandomCallbackData::RandomBook => get_random_item_handler(cq, bot, book_library::get_random_book).await,
RandomCallbackData::RandomAuthor => get_random_item_handler(cq, bot, book_library::get_random_author).await, RandomCallbackData::RandomAuthor => get_random_item_handler(cq, bot, book_library::get_random_author).await,

View File

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

View File

@@ -14,7 +14,7 @@ use regex::Regex;
use teloxide::{ use teloxide::{
prelude::*, prelude::*,
types::{InlineKeyboardButton, InlineKeyboardMarkup, Me}, types::{InlineKeyboardButton, InlineKeyboardMarkup, Me},
utils::command::BotCommands, adaptors::Throttle, utils::command::BotCommands, adaptors::{Throttle, CacheMe},
}; };
#[derive(BotCommands, Clone)] #[derive(BotCommands, Clone)]
@@ -67,7 +67,7 @@ impl ToString for SettingsCallbackData {
} }
} }
async fn settings_handler(message: Message, bot: Throttle<Bot>) -> BotHandlerInternal { async fn settings_handler(message: Message, bot: CacheMe<Throttle<Bot>>) -> BotHandlerInternal {
let keyboard = InlineKeyboardMarkup { let keyboard = InlineKeyboardMarkup {
inline_keyboard: vec![vec![InlineKeyboardButton { inline_keyboard: vec![vec![InlineKeyboardButton {
text: "Языки".to_string(), text: "Языки".to_string(),
@@ -117,7 +117,7 @@ fn get_lang_keyboard(all_langs: Vec<Lang>, allowed_langs: HashSet<String>) -> In
async fn settings_callback_handler( async fn settings_callback_handler(
cq: CallbackQuery, cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
callback_data: SettingsCallbackData, callback_data: SettingsCallbackData,
me: Me, me: Me,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
@@ -219,7 +219,7 @@ pub fn get_settings_handler() -> crate::bots::BotHandler {
.chain(filter_callback_query::<SettingsCallbackData>()) .chain(filter_callback_query::<SettingsCallbackData>())
.endpoint( .endpoint(
|cq: CallbackQuery, |cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
callback_data: SettingsCallbackData, callback_data: SettingsCallbackData,
me: Me| async move { me: Me| async move {
settings_callback_handler(cq, bot, callback_data, me).await settings_callback_handler(cq, bot, callback_data, me).await

View File

@@ -3,7 +3,7 @@ use crate::bots::BotHandlerInternal;
use teloxide::{ use teloxide::{
prelude::*, prelude::*,
types::{InlineKeyboardButton, InlineKeyboardMarkup}, types::{InlineKeyboardButton, InlineKeyboardMarkup},
utils::command::BotCommands, adaptors::Throttle, utils::command::BotCommands, adaptors::{Throttle, CacheMe},
}; };
#[derive(BotCommands, Clone)] #[derive(BotCommands, Clone)]
@@ -12,7 +12,7 @@ enum SupportCommand {
Support, Support,
} }
pub async fn support_command_handler(message: Message, bot: Throttle<Bot>) -> BotHandlerInternal { pub async fn support_command_handler(message: Message, bot: CacheMe<Throttle<Bot>>) -> BotHandlerInternal {
const MESSAGE_TEXT: &str = " const MESSAGE_TEXT: &str = "
[Лицензии](https://github.com/flibusta-apps/book_bot/blob/main/LICENSE.md) [Лицензии](https://github.com/flibusta-apps/book_bot/blob/main/LICENSE.md)

View File

@@ -12,7 +12,7 @@ use regex::Regex;
use teloxide::{ use teloxide::{
prelude::*, prelude::*,
types::{InlineKeyboardButton, InlineKeyboardMarkup}, types::{InlineKeyboardButton, InlineKeyboardMarkup},
utils::command::BotCommands, adaptors::Throttle, utils::command::BotCommands, adaptors::{Throttle, CacheMe},
}; };
use super::utils::{generic_get_pagination_keyboard, GetPaginationCallbackData}; use super::utils::{generic_get_pagination_keyboard, GetPaginationCallbackData};
@@ -77,7 +77,7 @@ impl GetPaginationCallbackData for UpdateLogCallbackData {
} }
} }
async fn update_log_command(message: Message, bot: Throttle<Bot>) -> BotHandlerInternal { async fn update_log_command(message: Message, bot: CacheMe<Throttle<Bot>>) -> BotHandlerInternal {
let now = Utc::now().date_naive(); let now = Utc::now().date_naive();
let d3 = now - Duration::days(3); let d3 = now - Duration::days(3);
let d7 = now - Duration::days(7); let d7 = now - Duration::days(7);
@@ -134,7 +134,7 @@ async fn update_log_command(message: Message, bot: Throttle<Bot>) -> BotHandlerI
async fn update_log_pagination_handler( async fn update_log_pagination_handler(
cq: CallbackQuery, cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
update_callback_data: UpdateLogCallbackData, update_callback_data: UpdateLogCallbackData,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
let message = match cq.message { let message = match cq.message {
@@ -223,7 +223,7 @@ pub fn get_update_log_handler() -> crate::bots::BotHandler {
.chain(filter_callback_query::<UpdateLogCallbackData>()) .chain(filter_callback_query::<UpdateLogCallbackData>())
.endpoint( .endpoint(
|cq: CallbackQuery, |cq: CallbackQuery,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
update_log_data: UpdateLogCallbackData| async move { update_log_data: UpdateLogCallbackData| async move {
update_log_pagination_handler(cq, bot, update_log_data).await update_log_pagination_handler(cq, bot, update_log_data).await
}, },

View File

@@ -1,4 +1,4 @@
use teloxide::{prelude::*, adaptors::Throttle}; use teloxide::{prelude::*, adaptors::{Throttle, CacheMe}};
use std::error::Error; use std::error::Error;
@@ -10,7 +10,7 @@ pub mod utils;
pub async fn message_handler( pub async fn message_handler(
message: Message, message: Message,
bot: Throttle<Bot>, bot: CacheMe<Throttle<Bot>>,
) -> Result<(), Box<dyn Error + Send + Sync>> { ) -> Result<(), Box<dyn Error + Send + Sync>> {
let from_user = message.from().unwrap(); let from_user = message.from().unwrap();
let text = message.text().unwrap_or(""); let text = message.text().unwrap_or("");

View File

@@ -3,7 +3,7 @@ pub mod bots_manager;
use std::error::Error; use std::error::Error;
use teloxide::{prelude::*, adaptors::Throttle}; use teloxide::{prelude::*, adaptors::{Throttle, CacheMe}};
pub type BotHandlerInternal = Result<(), Box<dyn Error + Send + Sync>>; pub type BotHandlerInternal = Result<(), Box<dyn Error + Send + Sync>>;
@@ -27,7 +27,7 @@ fn ignore_chat_member_update() -> crate::bots::BotHandler {
} }
fn get_pending_handler() -> BotHandler { fn get_pending_handler() -> BotHandler {
let handler = |msg: Message, bot: Throttle<Bot>| async move { let handler = |msg: Message, bot: CacheMe<Throttle<Bot>>| async move {
let message_text = " let message_text = "
Бот зарегистрирован, но не подтвержден администратором! \ Бот зарегистрирован, но не подтвержден администратором! \
Подтверждение занимает примерно 12 часов. Подтверждение занимает примерно 12 часов.
@@ -44,7 +44,7 @@ fn get_pending_handler() -> BotHandler {
} }
fn get_blocked_handler() -> BotHandler { fn get_blocked_handler() -> BotHandler {
let handler = |msg: Message, bot: Throttle<Bot>| async move { let handler = |msg: Message, bot: CacheMe<Throttle<Bot>>| async move {
let message_text = "Бот заблокирован!"; let message_text = "Бот заблокирован!";
bot.send_message(msg.chat.id, message_text).await?; bot.send_message(msg.chat.id, message_text).await?;