use chrono::Duration; use crate::app::State; use std::sync::Arc; pub async fn start_task(state: Arc) { tokio::task::spawn(async move { loop { if let Err(e) = state.twitch.bot_token().await { eprintln!("could not get bot token: {:?}", e); } if let Err(e) = state.twitch.user_token().await { eprintln!("could not get user token: {:?}", e); } tokio::time::sleep(Duration::minutes(5).to_std().unwrap()).await; } }); }