diff --git a/xp-bot/src/commands/misc/voicetime.rs b/xp-bot/src/commands/misc/voicetime.rs index a2180a5..4881cb7 100644 --- a/xp-bot/src/commands/misc/voicetime.rs +++ b/xp-bot/src/commands/misc/voicetime.rs @@ -70,7 +70,7 @@ impl XpCommand for VoicetimeCommand { response .kind(InteractionResponseType::ChannelMessageWithSource) .interaction_response_data(|message| { - message.content("This user has never joined a voice channel."); + message.content("This user has not joined a voice channel yet."); message.ephemeral(true) }) }) @@ -82,7 +82,7 @@ impl XpCommand for VoicetimeCommand { }; // check if the user is currently in a voice channel - match ctx + let state = match ctx .cache .guild(command.guild_id.unwrap()) .unwrap() @@ -106,10 +106,26 @@ impl XpCommand for VoicetimeCommand { } }; - let current_timestamp = chrono::Utc::now().timestamp() * 1000; - let guild = Guild::from_id(command.guild_id.unwrap().0).await?; + // check if the user is in a voicechannel that's ignored + if guild.clone().ignored.channels.unwrap().contains(&state.unwrap().channel_id.unwrap().0.to_string()) { + command + .create_interaction_response(&ctx.http, |response| { + response + .kind(InteractionResponseType::ChannelMessageWithSource) + .interaction_response_data(|message| { + message.content("This voice channel is ignored."); + message.ephemeral(true) + }) + }) + .await + .unwrap(); + return Ok(()); + } + + let current_timestamp = chrono::Utc::now().timestamp() * 1000; + let boost_percentage = utils::calculate_total_boost_percentage( guild.clone(), &command.member.as_ref().unwrap().roles,