diff --git a/src/data.rs b/src/data.rs index 4ef9d44..cfbe602 100644 --- a/src/data.rs +++ b/src/data.rs @@ -122,7 +122,10 @@ pub async fn is_fitting( // TODO: check all authors subscribers Ok(true) } else if message_data.entity == "chat" { - // payload is Message or Chat + // payload is Chat + Ok(true) + } else if message_data.entity == "message" { + // payload is Message Ok(true) } else if message_data.entity == "follower" { // payload is Author diff --git a/src/main.rs b/src/main.rs index 681451e..5b5b20a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,8 +86,13 @@ async fn connect_handler( pubsub.subscribe("reaction").await.unwrap(); println!("'reaction' pubsub subscribed"); + // chats by member_id + pubsub.subscribe(format!("chat:{}", listener_id)).await.unwrap(); + println!("'chat:{}' pubsub subscribed", listener_id); + + // messages by chat_id for chat_id in &chats { - let channel_name = format!("chat:{}", chat_id); + let channel_name = format!("message:{}", chat_id); pubsub.subscribe(&channel_name).await.unwrap(); println!("'{}' subscribed", channel_name); }