split voice ops into its own library

This commit is contained in:
Zomatree
2024-05-13 14:09:08 +01:00
parent 675c7d6c0d
commit ffbc899792
17 changed files with 446 additions and 217 deletions

View File

@@ -1,4 +1,4 @@
use std::collections::HashMap;
use std::{borrow::Cow, collections::HashMap};
use revolt_config::config;
use revolt_models::v0::{self, MessageAuthor, VoiceInformation};
@@ -438,6 +438,15 @@ impl Channel {
}
}
/// Gets this channel's voice information
pub fn voice(&self) -> Option<Cow<VoiceInformation>> {
match self {
Self::DirectMessage { .. } | Channel::VoiceChannel { .. } => Some(Cow::Owned(v0::VoiceInformation::default())),
Self::TextChannel { voice: Some(voice), .. } => Some(Cow::Borrowed(voice)),
_ => None
}
}
/// Set role permission on a channel
pub async fn set_role_permission(
&mut self,