chore: improve checks
This commit is contained in:
parent
fc32017a10
commit
29392dc72d
7 changed files with 20 additions and 29 deletions
|
@ -12,6 +12,7 @@ pub fn request_guild(ctx: &Context, guild_id: &GuildId) -> Guild {
|
|||
}
|
||||
|
||||
/// Request a guild by id, get it from Discord, not from cache, this is a partial guild
|
||||
#[allow(dead_code)]
|
||||
pub async fn request_partial_guild(ctx: &Context, guild_id: &GuildId) -> PartialGuild {
|
||||
match ctx.http.get_guild(*guild_id).await {
|
||||
Ok(guild) => guild,
|
||||
|
@ -32,16 +33,12 @@ pub async fn get_vc_id(ctx: &Context, guild_id: &GuildId, user_id: &UserId) -> O
|
|||
|
||||
/// Check if the bot is connected to a voice channel
|
||||
pub async fn is_self_connected_to_vc(ctx: &Context, guild_id: &GuildId) -> bool {
|
||||
let channel_id = get_self_vc_id(ctx, guild_id);
|
||||
|
||||
channel_id.await.is_some()
|
||||
get_self_vc_id(ctx, guild_id).await.is_some()
|
||||
}
|
||||
|
||||
/// Check if a user is connected to a voice channel
|
||||
pub async fn is_user_connected_to_vc(ctx: &Context, guild_id: &GuildId, user_id: &UserId) -> bool {
|
||||
let channel_id = get_vc_id(ctx, guild_id, user_id).await;
|
||||
|
||||
channel_id.is_some()
|
||||
get_vc_id(ctx, guild_id, user_id).await.is_some()
|
||||
}
|
||||
|
||||
/// Get the voice channel id of the bot
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue