Fix sending cache message

This commit is contained in:
2023-01-18 19:07:55 +01:00
parent 79f7ade26a
commit eb84fecdaa

View File

@@ -69,29 +69,22 @@ async fn send_cached_message(
bot: AutoSend<Bot>, bot: AutoSend<Bot>,
download_data: DownloadData, download_data: DownloadData,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
match get_cached_message(&download_data).await { if let Ok(v) = get_cached_message(&download_data).await {
Ok(v) => match _send_cached(&message, &bot, v).await { if let Ok(_) = _send_cached(&message, &bot, v).await {
Ok(_) => return Ok(()), return Ok(());
Err(err) => return Err(err), }
},
Err(err) => log::warn!("{:?}", err),
}; };
match get_cached_message(&download_data).await { match send_with_download_from_channel(message, bot, download_data).await {
Ok(v) => match _send_cached(&message, &bot, v).await { Ok(_) => Ok(()),
Ok(v_2) => return Ok(v_2), Err(err) => Err(err),
Err(err) => log::warn!("{:?}", err), }
},
Err(err) => log::warn!("{:?}", err),
};
send_with_download_from_channel(message, bot, download_data).await
} }
async fn _send_downloaded_file( async fn _send_downloaded_file(
message: &Message, message: &Message,
bot: &AutoSend<Bot>, bot: &AutoSend<Bot>,
downloaded_data: DownloadFile downloaded_data: DownloadFile,
) -> BotHandlerInternal { ) -> BotHandlerInternal {
let DownloadFile { let DownloadFile {
response, response,
@@ -136,7 +129,7 @@ async fn send_with_download_from_channel(
Ok(v_2) => Ok(v_2), Ok(v_2) => Ok(v_2),
Err(err) => Err(err), Err(err) => Err(err),
}, },
Err(err) => Err(err) Err(err) => Err(err),
} }
} }