Disconnect after getting URL

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-12-27 01:12:16 +01:00
parent bcd3861fe0
commit 74e2303652
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -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;
}
_ => (),
}