mirror of
https://codeberg.org/icewind/steam-resolve-vanity.git
synced 2026-06-03 17:14:06 +02:00
add method to get vanity url by steamid
This commit is contained in:
parent
84e8419179
commit
1ca978544a
2 changed files with 69 additions and 1 deletions
20
examples/get.rs
Normal file
20
examples/get.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
use std::env::args;
|
||||
use steam_resolve_vanity::get_vanity_url;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let mut args = args();
|
||||
let binary = args.next().unwrap(); // first argument is binary
|
||||
|
||||
if let Some(steam_id) = args.next() {
|
||||
if let Some(vanity) = get_vanity_url(steam_id.parse()?).await? {
|
||||
println!("{}", vanity);
|
||||
} else {
|
||||
println!("No vanity found for steamid");
|
||||
}
|
||||
} else {
|
||||
eprintln!("usage {} <vanity>", binary);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue