@@ -14,6 +14,7 @@ import { TextBasedCommand } from "../../../../command-abstractions/text-based-co
1414import { SelfClearingSet } from "../../../../utils/containers.js" ;
1515import { build_description } from "../../../../utils/strings.js" ;
1616import { unwrap } from "../../../../utils/misc.js" ;
17+ import SkillRoles , { SkillLevel } from "../../../tccpp/components/skill-roles.js" ;
1718
1819type voice_first_join_notice_entry = {
1920 guild : string ;
@@ -119,6 +120,17 @@ export default class VoiceModeration extends BotComponent {
119120 ) ;
120121 }
121122
123+ private has_skill_role_above_beginner ( member : Discord . GuildMember ) {
124+ const skill_roles_component = this . wheatley . components . get ( "SkillRoles" ) ;
125+ if ( skill_roles_component && skill_roles_component instanceof SkillRoles ) {
126+ return skill_roles_component . find_highest_skill_level ( member ) > SkillLevel . beginner ;
127+ }
128+
129+ // If the SkillRoles component isn't loaded, check by role name.
130+ const higher_skill_role_names = new Set ( [ "intermediate" , "proficient" , "advanced" , "expert" ] ) ;
131+ return member . roles . cache . some ( role => higher_skill_role_names . has ( role . name . toLowerCase ( ) ) ) ;
132+ }
133+
122134 private wrap_command_handler < Args extends unknown [ ] = [ ] > (
123135 handler : ( command : TextBasedCommand , target : Discord . GuildMember , ...args : Args ) => Promise < void > ,
124136 ) {
@@ -306,6 +318,8 @@ export default class VoiceModeration extends BotComponent {
306318 res . upsertedCount > 0 &&
307319 ! member . roles . cache . has ( this . wheatley . roles . voice . id ) &&
308320 ! member . roles . cache . has ( this . wheatley . roles . no_voice . id ) &&
321+ ! member . roles . cache . has ( this . wheatley . roles . server_booster . id ) &&
322+ ! this . has_skill_role_above_beginner ( member ) &&
309323 new_state . channel ?. isVoiceBased ( )
310324 ) {
311325 await new_state . channel . send ( {
@@ -314,7 +328,7 @@ export default class VoiceModeration extends BotComponent {
314328 "new users are suppressed by default to protect our voice channels. " +
315329 "You will be able to speak when joining a channel with a voice moderator present. " +
316330 "Stick around and you will eventually be granted permanent voice access. " +
317- "Please do not ping voice moderators to be unsupressed." ,
331+ "Please do not ping voice moderators to be unsupressed or for the voice role ." ,
318332 allowedMentions : { users : [ member . id ] } ,
319333 } ) ;
320334 }
0 commit comments