Skip to content

Instantly share code, notes, and snippets.

@Enigo
Last active January 11, 2023 03:51
Show Gist options
  • Save Enigo/11a1b5a8465e1c08f92de0b30949ff37 to your computer and use it in GitHub Desktop.
Save Enigo/11a1b5a8465e1c08f92de0b30949ff37 to your computer and use it in GitHub Desktop.
async fn process_order(result: TheResult) {
let timestamp = DateTime::parse_from_rfc3339(&result.timestamp).unwrap();
let for_last_minutes = 1;
let last_minute = Utc::now() - Duration::minutes(for_last_minutes);
let is_after = timestamp > last_minute;
if is_after {
info!("Newly listed land detected");
let response = reqwest::get(ASSET_URL.to_owned() + &result.sell.data.id)
.await.unwrap().json::<Asset>()
.await;
match response {
Ok(asset) => {
// telegram_bot_sender will be called here
info!("{:?}", asset);
}
Err(e) => {
error!("Asset API response cannot be parsed! {}", e)
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment