(&mut self, guild_id: Id<GuildMarker>)
| 213 | } |
| 214 | |
| 215 | async fn subscribe_logs(&mut self, guild_id: Id<GuildMarker>) -> WsResult { |
| 216 | if self |
| 217 | .active_log_streams |
| 218 | .iter() |
| 219 | .any(|s| s.guild_id == guild_id) |
| 220 | { |
| 221 | // already subscribed |
| 222 | return Ok(()); |
| 223 | } |
| 224 | |
| 225 | self.check_guild_acces(guild_id).await?; |
| 226 | |
| 227 | let stream = self |
| 228 | .app_state |
| 229 | .bot_rpc_client |
| 230 | .stream_guild_logs(GuildSpecifier { guild_id }) |
| 231 | .await |
| 232 | .map_err(|_| WsCloseReason::BotRpcError)?; |
| 233 | |
| 234 | self.active_log_streams.push(GuildLogStream { |
| 235 | guild_id, |
| 236 | inner: stream, |
| 237 | }); |
| 238 | |
| 239 | self.emit_subscriptions().await |
| 240 | } |
| 241 | |
| 242 | async fn unsubscribe_logs(&mut self, guild_id: Id<GuildMarker>) -> WsResult { |
| 243 | let current_streams = std::mem::replace(&mut self.active_log_streams, SelectAll::new()); |
no test coverage detected