This commit is contained in:
2024-05-05 19:18:37 +02:00
parent a509647ed0
commit d39bf20175
3 changed files with 11 additions and 2 deletions

View File

@@ -205,7 +205,14 @@ async fn download_handler(
download_data: DownloadQueryData, download_data: DownloadQueryData,
need_delete_message: bool, need_delete_message: bool,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
match cache {
BotCache::Original | BotCache::Cache => {
send_cached_message(message, bot, download_data, need_delete_message, cache).await 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( async fn get_download_keyboard_handler(

View File

@@ -30,7 +30,7 @@ pub async fn get_cached_message(
file_type: format, file_type: format,
} = download_data; } = download_data;
let is_need_copy = bot_cache != BotCache::Original; let is_need_copy = bot_cache == BotCache::Cache;
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let response = client let response = client

View File

@@ -6,6 +6,8 @@ use crate::config;
pub enum BotCache { pub enum BotCache {
#[serde(rename = "original")] #[serde(rename = "original")]
Original, Original,
#[serde(rename = "cache")]
Cache,
#[serde(rename = "no_cache")] #[serde(rename = "no_cache")]
NoCache, NoCache,
} }