File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ import { ChatError } from '@/utils/chatError';
44
55import type { PSCommand } from '@/types/chat' ;
66
7+ function isPublicStaff ( [ room , { isPrivate } ] : [ string , { isPrivate ?: boolean } ] ) : boolean {
8+ if ( isPrivate ) return false ;
9+ return / ^ [ % @ * # ] / . test ( room ) ;
10+ }
11+
712export const command : PSCommand = {
813 name : 'alts' ,
914 help : "Lists a user's alts. Requires trusted perms to view beyond your own." ,
@@ -14,8 +19,10 @@ export const command: PSCommand = {
1419 async run ( { message, arg, $T, checkPermissions } ) {
1520 let lookup = message . author . userid ;
1621 if ( arg ) {
17- // TODO: Change this to use _any_ room
18- if ( ! checkPermissions ( [ 'room' , 'driver' ] ) && ! checkPermissions ( [ 'global' , 'voice' ] ) ) throw new ChatError ( $T ( 'ACCESS_DENIED' ) ) ;
22+ if ( ! checkPermissions ( [ 'room' , 'driver' ] ) && ! checkPermissions ( [ 'global' , 'voice' ] ) ) {
23+ const isPublicRoomStaff = message . author . rooms && Object . entries ( message . author . rooms ) . some ( isPublicStaff ) ;
24+ if ( ! isPublicRoomStaff ) throw new ChatError ( $T ( 'ACCESS_DENIED' ) ) ;
25+ }
1926 lookup = toId ( arg ) ;
2027 }
2128 const altsList = await getAlts ( lookup ) ;
You can’t perform that action at this time.
0 commit comments