move generic bot download function to its own function to avoid code duplication
This commit is contained in:
parent
83136d7158
commit
64d1f67e16
1 changed files with 5 additions and 1 deletions
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue