mirror of
https://github.com/kurbezz/discord-bot.git
synced 2026-03-04 00:20:48 +01:00
Update twitch integration
This commit is contained in:
23
src/main.rs
23
src/main.rs
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user