Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Call::current_channel #60

Merged
merged 2 commits into from
Apr 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Returns `id` of the channel, if connected to any.
/// Returns `id` of the channel, if connected to any.
///
/// **Note**: The returned `id` will not correctly update if a connected bot
/// is moved between channels manually. This will be fixed in the next
// breaking release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expanded a bit your suggestion. Check it out

///
/// **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