use steam_tradeoffer_manager::{TradeOfferManager, SteamID}; use steam_tradeoffer_manager::enums::GetUserDetailsMethod; use owo_colors::OwoColorize; #[tokio::main] async fn main() -> Result<(), Box> { dotenv::dotenv().ok(); let steamid: SteamID = std::env::var("STEAMID_OTHER").unwrap().parse::().unwrap().into(); let cookies = std::env::var("COOKIES").expect("COOKIES missing") .split("; ") .map(|s| s.to_string()) .collect::>(); // An API key isn't needed for this example. let manager = TradeOfferManager::builder() // Cookies are required for getting user details. These can be included in the builder or // using the `set_cookies` method on the manager. .cookies(cookies) .build(); // Passing in GetUserDetailsMethod::None assumes we are friends with the user. let user_details = manager.get_user_details(steamid, GetUserDetailsMethod::None).await?; println!("Trade will result in escrow? {}", user_details.has_escrow().bold()); Ok(()) } // Not really necessary, this just makes true/false values display in a more human way. trait Nope { fn nope(&self) -> &'static str; } impl Nope for bool { fn nope(&self) -> &'static str { if *self { "yep" } else { "nope" } } }