Skip to content

Commit

Permalink
Fix transcribe-only role
Browse files Browse the repository at this point in the history
  • Loading branch information
tazz4843 committed Dec 2, 2023
1 parent 4fc893c commit 6a433f0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripty_audio_handler/src/audio_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl EventHandler for AudioHandler {
Arc::clone(&self.ssrc_state),
self.seen_users.clone(),
self.guild_id,
self.transcribe_only_role.read().clone(),
*self.transcribe_only_role.read(),
)),
EventContext::VoiceTick(voice_data) => tokio::spawn(voice_tick(
voice_data.clone(),
Expand Down
2 changes: 1 addition & 1 deletion scripty_audio_handler/src/events/voice_tick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ async fn handle_speakers(
if ssrc_state
.ssrc_user_data_map
.get(&ssrc)
.map_or(false, |x| x.value().2)
.map_or(false, |x| !x.value().2)
{
continue;
}
Expand Down
1 change: 0 additions & 1 deletion scripty_audio_handler/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use dashmap::{DashMap, DashSet};
use parking_lot::RwLock;
use scripty_data_storage::VoiceIngest;
use scripty_stt::Stream;
use serenity::all::RoleId;

/// Type alias for a `DashMap` containing SSRCs mapped to `UserId`s.
pub type SsrcUserIdMap = DashMap<u32, u64, RandomState>;
Expand Down
4 changes: 2 additions & 2 deletions scripty_commands/src/cmds/config/transcribe_only_role.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use poise::CreateReply;
use scripty_bot_utils::{checks::is_guild, Context, Error};
use serenity::{all::RoleId, builder::CreateAllowedMentions};
use serenity::{all::RoleId, builder::CreateAllowedMentions, prelude::Mentionable};

/// Limit Scripty's transcriptions to only users with this role in a voice chat.
#[poise::command(
Expand Down Expand Up @@ -40,7 +40,7 @@ pub async fn config_transcribe_only_role(
} else {
"config-transcribe-only-role-disabled"
},
roleId: transcribe_only_role.map_or(0, |x| x.get() as i64)
roleId: transcribe_only_role.unwrap_or_else(|| RoleId::new(1)).mention().to_string()
)),
)
.await?;
Expand Down

0 comments on commit 6a433f0

Please sign in to comment.