Skip to content

Commit

Permalink
Add support for GuildChannel::{rtc_region, video_quality_mode} fiel…
Browse files Browse the repository at this point in the history
…ds (#1276)
  • Loading branch information
drklee3 committed Apr 2, 2021
1 parent a04291f commit 95c2f78
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cache/mod.rs
Expand Up @@ -1081,6 +1081,8 @@ mod test {
user_limit: None,
nsfw: false,
slow_mode_rate: Some(0),
rtc_region: None,
video_quality_mode: None,
};

// Add a channel delete event to the cache, the cached messages for that
Expand Down
7 changes: 7 additions & 0 deletions src/model/channel/guild_channel.rs
Expand Up @@ -102,6 +102,13 @@ pub struct GuildChannel {
/// channels.
#[serde(default, rename = "rate_limit_per_user")]
pub slow_mode_rate: Option<u64>,
/// The region override.
///
/// **Note**: This is only available for voice and stage channels. `None`
/// for voice and stage channels means automatic region selection.
pub rtc_region: Option<String>,
/// The video quality mode for a voice channel.
pub video_quality_mode: Option<VideoQualityMode>,
}

#[cfg(feature = "model")]
Expand Down
18 changes: 18 additions & 0 deletions src/model/channel/mod.rs
Expand Up @@ -413,6 +413,22 @@ pub enum PermissionOverwriteType {
Role(RoleId),
}

/// The video quality mode for a voice channel.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
#[non_exhaustive]
pub enum VideoQualityMode {
/// An indicator that the video quality is chosen by Discord for optimal
/// performance.
Auto = 1,
/// An indicator that the video quality is 720p.
Full = 2,
}

enum_number!(VideoQualityMode {
Auto,
Full,
});

#[cfg(test)]
mod test {
#[cfg(all(feature = "model", feature = "utils"))]
Expand All @@ -435,6 +451,8 @@ mod test {
user_limit: None,
nsfw: false,
slow_mode_rate: Some(0),
rtc_region: None,
video_quality_mode: None,
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/model/misc.rs
Expand Up @@ -401,6 +401,8 @@ mod test {
user_limit: None,
nsfw: false,
slow_mode_rate: Some(0),
rtc_region: None,
video_quality_mode: None,
});
let emoji = Emoji {
animated: false,
Expand Down
2 changes: 2 additions & 0 deletions src/utils/mod.rs
Expand Up @@ -900,6 +900,8 @@ mod test {
user_limit: None,
nsfw: false,
slow_mode_rate: Some(0),
rtc_region: None,
video_quality_mode: None,
};

let cache = Arc::new(Cache::default());
Expand Down

0 comments on commit 95c2f78

Please sign in to comment.