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:
@@ -37,9 +37,6 @@ pub enum GetGuildAndVoiceChannelIdError {
|
||||
/// there is no user who invoked this command
|
||||
NoUser,
|
||||
|
||||
/// there are no voice chats in this guild
|
||||
NoVCsInGuild,
|
||||
|
||||
/// the bot is not in a voice chat in this guild
|
||||
BotNotInVC,
|
||||
}
|
||||
@@ -58,10 +55,10 @@ pub fn get_user_and_guild_and_voice_channel_id(
|
||||
|
||||
let guild_id = interaction.guild_id.context(NotInGuildSnafu)?;
|
||||
|
||||
let guild_vcs = vcs.get(&guild_id).context(NoVCsInGuildSnafu)?;
|
||||
|
||||
let &voice_channel_id = guild_vcs
|
||||
.get_left_for(&bot_user_id)
|
||||
let voice_channel_id = vcs
|
||||
.with_guild(guild_id, |guild_vcs| {
|
||||
guild_vcs.get_left_for(&bot_user_id).copied()
|
||||
})
|
||||
.context(BotNotInVCSnafu)?;
|
||||
|
||||
Ok((user_id, guild_id, voice_channel_id))
|
||||
@@ -75,9 +72,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 leave VC because there aren't any in this server right now (therefore the bot must not be in any).").validate().unwrap().build()
|
||||
},
|
||||
GetGuildAndVoiceChannelIdError::BotNotInVC => {
|
||||
EmbedBuilder::new().title("Not in a VC").description("This bot can't leave VC if it isn't in one in this server.").validate().unwrap().build()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user