move generic bot download function to its own function to avoid code duplication
This commit is contained in:
parent
9420ad681b
commit
2c45e4fa44
1 changed files with 5 additions and 1 deletions
|
|
@ -83,7 +83,7 @@ async fn cmd_test(bot: Bot, msg: Message) -> HandlerResult {
|
||||||
Ok(())
|
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 {
|
let output_path = match download(url.as_str()).await {
|
||||||
Ok(path) => path,
|
Ok(path) => path,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -103,6 +103,10 @@ async fn cmd_download(bot: Bot, msg: Message, url: String) -> HandlerResult {
|
||||||
Ok(())
|
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 {
|
async fn handle_message(_bot: Bot, _dialogue: MyDialogue, msg: Message) -> HandlerResult {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue