diff --git a/src/main.rs b/src/main.rs index 7661715..cce9b8e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,7 +31,7 @@ async fn main() -> Result<(), Option<()>> { .build() .unwrap(); - while let Some(events) = client.wait_for_events().await { + 'outer: while let Some(events) = client.wait_for_events().await { for event in events { match event { Event::Online => { @@ -43,10 +43,11 @@ async fn main() -> Result<(), Option<()>> { } Event::HTTPUploadedFile(url) => { println!("URL: {}", url); + client.disconnect().await.unwrap(); }, Event::Disconnected => { println!("Disconnected"); - return Err(None); + break 'outer; } _ => (), }