mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-12 04:42:16 +00:00
refactor
This commit is contained in:
1 parent
d29286a164
commit
7aa33d19b0
4 files changed
+25
-1
No files matched your search
@@ -15,6 +15,7 @@ use std::time::Duration;
|
||||
use tokio::runtime::Handle;
|
||||
use twitch_api2::pubsub::Topic;
|
||||
use twitch_api2::pubsub;
|
||||
use crate::twitch::pubsub::build_pubsub_topics_for_user::build_pubsub_topics_for_user;
|
||||
|
||||
/// Endpoint
|
||||
pub async fn obs_gateway_websocket_handler(
|
||||
@@ -63,7 +64,9 @@ pub async fn obs_gateway_websocket_handler(
|
||||
channel_id: user_id,
|
||||
}.into_topic();
|
||||
|
||||
let topics = [bit_topic, points_topic, cheer_topic, sub_topic];
|
||||
//let topics = [bit_topic, points_topic, cheer_topic, sub_topic];
|
||||
|
||||
let topics = build_pubsub_topics_for_user(user_id);
|
||||
|
||||
let auth_token = server_state.twitch_oauth_temp.temp_oauth_access_token.clone();
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
pub mod oauth_token_builder;
|
||||
pub mod polling_websocket_client;
|
||||
pub mod pubsub;
|
||||
pub mod twitch_client_wrapper;
|
||||
pub mod twitch_secrets;
|
||||
pub mod websocket_client;
|
||||
@@ -0,0 +1,19 @@
|
||||
use twitch_api2::pubsub::{Topics, Topic};
|
||||
use twitch_api2::pubsub;
|
||||
|
||||
pub fn build_pubsub_topics_for_user(user_id: u32) -> Vec<Topics> {
|
||||
vec![
|
||||
pubsub::channel_bits::ChannelBitsEventsV2 {
|
||||
channel_id: user_id,
|
||||
}.into_topic(),
|
||||
pubsub::channel_points::ChannelPointsChannelV1 {
|
||||
channel_id: user_id,
|
||||
}.into_topic(),
|
||||
pubsub::channel_cheer::ChannelCheerEventsPublicV1 {
|
||||
channel_id: user_id,
|
||||
}.into_topic(),
|
||||
pubsub::channel_subscriptions::ChannelSubscribeEventsV1 {
|
||||
channel_id: user_id,
|
||||
}.into_topic(),
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
pub mod build_pubsub_topics_for_user;
|
||||
Reference in new issue
Block a user