From d39bf201752f22c43460b89861164471f90a3cf6 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Sun, 5 May 2024 19:18:37 +0200 Subject: [PATCH] Fix --- src/bots/approved_bot/modules/download/mod.rs | 9 ++++++++- src/bots/approved_bot/services/book_cache/mod.rs | 2 +- src/bots_manager/bot_manager_client.rs | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/bots/approved_bot/modules/download/mod.rs b/src/bots/approved_bot/modules/download/mod.rs index 7d8087d..f221e53 100644 --- a/src/bots/approved_bot/modules/download/mod.rs +++ b/src/bots/approved_bot/modules/download/mod.rs @@ -205,7 +205,14 @@ async fn download_handler( download_data: DownloadQueryData, need_delete_message: bool, ) -> BotHandlerInternal { - send_cached_message(message, bot, download_data, need_delete_message, cache).await + match cache { + BotCache::Original | BotCache::Cache => { + send_cached_message(message, bot, download_data, need_delete_message, cache).await + } + BotCache::NoCache => { + send_with_download_from_channel(message, bot, download_data, need_delete_message).await + } + } } async fn get_download_keyboard_handler( diff --git a/src/bots/approved_bot/services/book_cache/mod.rs b/src/bots/approved_bot/services/book_cache/mod.rs index e8d1393..225225f 100644 --- a/src/bots/approved_bot/services/book_cache/mod.rs +++ b/src/bots/approved_bot/services/book_cache/mod.rs @@ -30,7 +30,7 @@ pub async fn get_cached_message( file_type: format, } = download_data; - let is_need_copy = bot_cache != BotCache::Original; + let is_need_copy = bot_cache == BotCache::Cache; let client = reqwest::Client::new(); let response = client diff --git a/src/bots_manager/bot_manager_client.rs b/src/bots_manager/bot_manager_client.rs index 3dd7077..8a77f0f 100644 --- a/src/bots_manager/bot_manager_client.rs +++ b/src/bots_manager/bot_manager_client.rs @@ -6,6 +6,8 @@ use crate::config; pub enum BotCache { #[serde(rename = "original")] Original, + #[serde(rename = "cache")] + Cache, #[serde(rename = "no_cache")] NoCache, }