Skip to content

Commit

Permalink
Gateway: Introduce Call::current_channel (#60)
Browse files Browse the repository at this point in the history
* Introduce Call::current_channel

* Add note on channel id
  • Loading branch information
DoumanAsh authored Apr 10, 2021
1 parent df64ad9 commit 22214a0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ChannelId> {
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
Expand Down

0 comments on commit 22214a0

Please sign in to comment.