File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,18 +91,18 @@ export async function commandHandler(message: PSMessage, indirect: IndirectCtx |
9191 if ( message . type === 'chat' ) {
9292 const roomConfig = PSRoomConfigs [ message . target . id ] ;
9393 const lookup = context . command . join ( '.' ) ;
94- if ( roomConfig ?. blacklist ?. includes ( lookup ) && ! roomConfig ?. whitelist ?. includes ( lookup ) ) {
94+ const isWhitelisted =
95+ roomConfig . whitelist &&
96+ ( roomConfig . whitelist ?. includes ( lookup ) ||
97+ sourceCommand . categories . some ( category => roomConfig . whitelist ! . includes ( `cat:${ category } ` ) ) ) ;
98+ if ( roomConfig ?. blacklist ?. includes ( lookup ) && ! isWhitelisted ) {
9599 throw new ChatError ( $T ( 'BLACKLISTED_COMMAND' , { room : message . target . title } ) ) ;
96100 }
97101 const blacklistedCategories = roomConfig ?. blacklist
98102 ? sourceCommand . categories . filter ( category => roomConfig . blacklist ! . includes ( `cat:${ category } ` ) )
99103 : [ ] ;
100- if ( blacklistedCategories . length > 0 ) {
101- if ( ! ( roomConfig ?. whitelist && sourceCommand . categories . some ( category => roomConfig . whitelist ! . includes ( `cat:${ category } ` ) ) ) ) {
102- throw new ChatError (
103- $T ( 'BLACKLISTED_CATEGORIES' , { room : message . target . title , categories : blacklistedCategories . list ( $T ) } )
104- ) ;
105- }
104+ if ( blacklistedCategories . length > 0 && ! isWhitelisted ) {
105+ throw new ChatError ( $T ( 'BLACKLISTED_CATEGORIES' , { room : message . target . title , categories : blacklistedCategories . list ( $T ) } ) ) ;
106106 }
107107 }
108108 if ( ! cascade . flags . routePMs && indirect ?. type === 'spoof' ) {
You can’t perform that action at this time.
0 commit comments