#[non_exhaustive]pub struct JoinOptions { /* private fields */ }Expand description
How a VoiceManager joins a channel: the bot’s own mute and deafen flags (D-341,
D-343), and the bitrate of the audio it encodes (D-357). The default is deafened and not
muted, as discord.js’s joinVoiceChannel does (a bot that only plays gets nobody’s
audio), at 128 kb/s.
discord.js counterpart: the selfDeaf and selfMute options of joinVoiceChannel.
§Examples
use djs_voice::JoinOptions;
// Hear the channel (to receive audio, later), and start muted.
let options = JoinOptions::new().self_deaf(false).self_mute(true);
assert_ne!(options, JoinOptions::default());
// Encode at 96 kb/s, a common voice-channel bitrate.
let options = JoinOptions::new().bitrate(96_000);Implementations§
Source§impl JoinOptions
impl JoinOptions
Sourcepub const fn new() -> JoinOptions
pub const fn new() -> JoinOptions
The default options: deafened, not muted, 128 kb/s.
discord.js counterpart: JoinVoiceChannelOptions (@discordjs/voice).
Sourcepub const fn self_mute(self, self_mute: bool) -> JoinOptions
pub const fn self_mute(self, self_mute: bool) -> JoinOptions
Whether the bot mutes itself (others see it muted; it can still send audio, which Discord drops).
discord.js counterpart: the selfMute option of joinVoiceChannel (@discordjs/voice).
Sourcepub const fn self_deaf(self, self_deaf: bool) -> JoinOptions
pub const fn self_deaf(self, self_deaf: bool) -> JoinOptions
Whether the bot deafens itself: Discord sends it nobody’s audio.
discord.js counterpart: the selfDeaf option of joinVoiceChannel (@discordjs/voice).
Sourcepub const fn bitrate(self, bits_per_second: u32) -> JoinOptions
pub const fn bitrate(self, bits_per_second: u32) -> JoinOptions
The bitrate, in bits per second, of the audio the call encodes (D-357): PCM, FFmpeg, and Ogg/Opus at a volume other than 1.0 (Ogg/Opus at 1.0 is sent as it is). 128 kb/s by default, as songbird; clamped to what libopus accepts, 500 b/s to 512 kb/s. A channel’s own bitrate (8 to 96 kb/s, more with boosts) does not limit what the bot sends.
Joining again with other options changes the bitrate of the call’s next frames.
songbird counterpart: Call::set_bitrate.
discord.js counterpart: none (@discordjs/voice encodes at a fixed rate).
Trait Implementations§
Source§impl Clone for JoinOptions
impl Clone for JoinOptions
Source§fn clone(&self) -> JoinOptions
fn clone(&self) -> JoinOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for JoinOptions
Source§impl Debug for JoinOptions
impl Debug for JoinOptions
Source§impl Default for JoinOptions
impl Default for JoinOptions
Source§fn default() -> JoinOptions
fn default() -> JoinOptions
impl Eq for JoinOptions
Source§impl Hash for JoinOptions
impl Hash for JoinOptions
Source§impl PartialEq for JoinOptions
impl PartialEq for JoinOptions
impl StructuralPartialEq for JoinOptions
Auto Trait Implementations§
impl Freeze for JoinOptions
impl RefUnwindSafe for JoinOptions
impl Send for JoinOptions
impl Sync for JoinOptions
impl Unpin for JoinOptions
impl UnsafeUnpin for JoinOptions
impl UnwindSafe for JoinOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more