Update twitch integration

This commit is contained in:
2024-08-06 01:14:20 +02:00
parent 754b44d19a
commit 06d86716cb
4 changed files with 77 additions and 24 deletions

View File

@@ -1,8 +1,7 @@
use futures::StreamExt;
use serenity::all::ActivityData;
use serenity::prelude::*;
use twitch_handler::{auth::{self}, helix};
use twitch_handler::TwitchBot;
use tokio::join;
use rustls;
@@ -35,25 +34,7 @@ async fn start_discord_bot() {
}
async fn start_twitch_bot() {
println!("Starting Twitch bot...");
let token_storage = auth::VoidStorage {};
let mut client = helix::Client::from_get_app_token(
config::CONFIG.twitch_client_id.clone(),
config::CONFIG.twitch_client_secret.clone(),
token_storage,
).await.unwrap();
let mut t = client.connect_eventsub(vec![
("stream.online".to_string(), "1".to_string()),
("stream.offline".to_string(), "1".to_string()),
("channel.update".to_string(), "2".to_string())
], config::CONFIG.twitch_channel_id.clone()).await.unwrap();
while let Some(event) = t.next().await {
println!("{:?}", event);
}
TwitchBot::start().await;
}