chore: refactor VCs to use a watch channel internally (but I'm going to rework this in the next commit anyway)
This commit is contained in:
@@ -50,9 +50,6 @@ enum GetGuildAndVoiceChannelIdError {
|
||||
/// there is no user who invoked this command
|
||||
NoUser,
|
||||
|
||||
/// there are no voice chats in this guild
|
||||
NoVCsInGuild,
|
||||
|
||||
/// the user is not in a voice chat in this guild
|
||||
UserNotInVC,
|
||||
}
|
||||
@@ -70,9 +67,11 @@ fn get_guild_and_voice_channel_id(
|
||||
.and_then(|member| member.user.as_ref().map(|user| user.id))
|
||||
.context(NoUserSnafu)?;
|
||||
|
||||
let guild_vcs = vcs.get(&guild_id).context(NoVCsInGuildSnafu)?;
|
||||
|
||||
let &voice_channel_id = guild_vcs.get_left_for(&user_id).context(UserNotInVCSnafu)?;
|
||||
let voice_channel_id = vcs
|
||||
.with_guild(guild_id, |guild_vcs| {
|
||||
guild_vcs.get_left_for(&user_id).copied()
|
||||
})
|
||||
.context(UserNotInVCSnafu)?;
|
||||
|
||||
Ok((guild_id, voice_channel_id))
|
||||
}
|
||||
@@ -85,9 +84,6 @@ fn get_guild_and_vc_error_to_embed(error: GetGuildAndVoiceChannelIdError) -> Emb
|
||||
GetGuildAndVoiceChannelIdError::NoUser => {
|
||||
EmbedBuilder::new().title("Not invoked by a user").description("This command works by joining the same VC as the user, but this bot didn't receive any user data. So did no user invoke it?! (This error should be impossible!)").validate().unwrap().build()
|
||||
},
|
||||
GetGuildAndVoiceChannelIdError::NoVCsInGuild => {
|
||||
EmbedBuilder::new().title("No VCs in this server").description("This bot can't find a VC to join because there aren't any in this server right now.").validate().unwrap().build()
|
||||
},
|
||||
GetGuildAndVoiceChannelIdError::UserNotInVC => {
|
||||
EmbedBuilder::new().title("You're not in a VC").description("This bot can't follow you into VC if you aren't in one in this server.").validate().unwrap().build()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user