From 22214a0f891946f42f7c23d7de3a1f380791e51d Mon Sep 17 00:00:00 2001 From: Douman Date: Sat, 10 Apr 2021 15:19:59 +0300 Subject: [PATCH] Gateway: Introduce Call::current_channel (#60) * Introduce Call::current_channel * Add note on channel id --- src/handler.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/handler.rs b/src/handler.rs index 05f962c..932f549 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -240,6 +240,19 @@ impl Call { } } + /// Returns `id` of the channel, if connected to any. + /// + /// **Note:**: Returned `id` is of the channel, to which bot performed connection. + /// It is possible that it is different from actual channel due to ability of server's admin to + /// move bot from channel to channel. This is to be fixed with next breaking change release. + #[instrument(skip(self))] + pub fn current_channel(&self) -> Option { + match &self.connection { + Some((id, _, _)) => Some(*id), + _ => None, + } + } + /// Leaves the current voice channel, disconnecting from it. /// /// This does _not_ forget settings, like whether to be self-deafened or