move generic bot download function to its own function to avoid code duplication

This commit is contained in:
mykola2312 2024-02-24 15:23:57 +02:00
parent 83136d7158
commit 64d1f67e16

View file

@ -83,7 +83,7 @@ async fn cmd_test(bot: Bot, msg: Message) -> HandlerResult {
Ok(())
}
async fn cmd_download(bot: Bot, msg: Message, url: String) -> HandlerResult {
async fn bot_download(bot: Bot, msg: Message, url: String) -> HandlerResult {
let output_path = match download(url.as_str()).await {
Ok(path) => path,
Err(e) => {
@ -103,6 +103,10 @@ async fn cmd_download(bot: Bot, msg: Message, url: String) -> HandlerResult {
Ok(())
}
async fn cmd_download(bot: Bot, msg: Message, url: String) -> HandlerResult {
bot_download(bot, msg, url).await
}
async fn handle_message(_bot: Bot, _dialogue: MyDialogue, msg: Message) -> HandlerResult {
Ok(())
}