MCPcopy Create free account
hub / github.com/Botloader/botloader / subscribe_logs

Method subscribe_logs

components/webapi/src/routes/ws.rs:215–240  ·  view source on GitHub ↗
(&mut self, guild_id: Id<GuildMarker>)

Source from the content-addressed store, hash-verified

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());

Callers 1

Calls 3

check_guild_accesMethod · 0.80
stream_guild_logsMethod · 0.80
emit_subscriptionsMethod · 0.80

Tested by

no test coverage detected