From 00204bb4c0a767c5e1fce6fc84bb555a588b6079 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Wed, 21 Jun 2023 11:39:05 +0200 Subject: [PATCH] Optimize --- src/bots/approved_bot/modules/download.rs | 8 ++++---- src/bots/approved_bot/services/donation_notificatioins.rs | 6 +++--- src/bots_manager/mod.rs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bots/approved_bot/modules/download.rs b/src/bots/approved_bot/modules/download.rs index 8c5ec61..337c3c8 100644 --- a/src/bots/approved_bot/modules/download.rs +++ b/src/bots/approved_bot/modules/download.rs @@ -208,7 +208,7 @@ async fn send_cached_message( message: Message, bot: CacheMe>, download_data: DownloadQueryData, - donation_notification_cache: Cache, + donation_notification_cache: Cache, need_delete_message: bool, ) -> BotHandlerInternal { if let Ok(v) = get_cached_message(&download_data).await { @@ -233,7 +233,7 @@ async fn _send_downloaded_file( message: &Message, bot: CacheMe>, downloaded_data: DownloadFile, - donation_notification_cache: Cache, + donation_notification_cache: Cache, ) -> BotHandlerInternal { let DownloadFile { response, @@ -263,7 +263,7 @@ async fn send_with_download_from_channel( message: Message, bot: CacheMe>, download_data: DownloadQueryData, - donation_notification_cache: Cache, + donation_notification_cache: Cache, need_delete_message: bool, ) -> BotHandlerInternal { match download_file(&download_data).await { @@ -285,7 +285,7 @@ async fn download_handler( bot: CacheMe>, cache: BotCache, download_data: DownloadQueryData, - donation_notification_cache: Cache, + donation_notification_cache: Cache, need_delete_message: bool, ) -> BotHandlerInternal { match cache { diff --git a/src/bots/approved_bot/services/donation_notificatioins.rs b/src/bots/approved_bot/services/donation_notificatioins.rs index 6aabc4c..f1b4a9a 100644 --- a/src/bots/approved_bot/services/donation_notificatioins.rs +++ b/src/bots/approved_bot/services/donation_notificatioins.rs @@ -9,16 +9,16 @@ use super::user_settings::{is_need_donate_notifications, mark_donate_notificatio pub async fn send_donation_notification( bot: CacheMe>, message: Message, - donation_notification_cache: Cache, + donation_notification_cache: Cache, ) -> BotHandlerInternal { if donation_notification_cache.get(&message.chat.id).is_some() { return Ok(()); } else if !is_need_donate_notifications(message.chat.id).await? { - donation_notification_cache.insert(message.chat.id, true).await; + donation_notification_cache.insert(message.chat.id, ()).await; return Ok(()); } - donation_notification_cache.insert(message.chat.id, true).await; + donation_notification_cache.insert(message.chat.id, ()).await; mark_donate_notification_sended(message.chat.id).await?; support_command_handler(message, bot).await?; diff --git a/src/bots_manager/mod.rs b/src/bots_manager/mod.rs index 7fda588..dc2f278 100644 --- a/src/bots_manager/mod.rs +++ b/src/bots_manager/mod.rs @@ -26,7 +26,7 @@ use crate::config; pub struct AppState { pub user_activity_cache: Cache, pub user_langs_cache: Cache>, - pub chat_donation_notifications_cache: Cache, + pub chat_donation_notifications_cache: Cache, } pub struct BotsManager {