clemsbot/src/app/task/tokens.rs

20 lines
540 B
Rust
Raw Normal View History

2022-03-18 16:40:09 +00:00
use chrono::Duration;
use crate::app::State;
use std::sync::Arc;
pub async fn start_task(state: Arc<State>) {
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);
}
2022-04-11 19:50:20 +00:00
tokio::time::sleep(Duration::minutes(5).to_std().unwrap()).await;
2022-03-18 16:40:09 +00:00
}
});
}