@@ -707,6 +707,7 @@ export const commands: Chat.ChatCommands = {
707
707
this . privateModAction ( displayMessage ) ;
708
708
}
709
709
710
+ Chat . runHandlers ( 'onPunishUser' , 'MUTE' , user , room ) ;
710
711
room . mute ( targetUser , muteDuration ) ;
711
712
} ,
712
713
mutehelp : [ `/mute OR /m [username], [reason] - Mutes a user with reason for 7 minutes. Requires: % @ # &` ] ,
@@ -803,6 +804,7 @@ export const commands: Chat.ChatCommands = {
803
804
const time = week ? Date . now ( ) + 7 * 24 * 60 * 60 * 1000 : null ;
804
805
const affected = Punishments . roomBan ( room , targetUser , time , null , privateReason ) ;
805
806
807
+ for ( const u of affected ) Chat . runHandlers ( 'onPunishUser' , 'ROOMBAN' , u , room ) ;
806
808
if ( ! room . settings . isPrivate && room . persist ) {
807
809
const acAccount = ( targetUser . autoconfirmed !== userid && targetUser . autoconfirmed ) ;
808
810
let displayMessage = '' ;
@@ -923,6 +925,7 @@ export const commands: Chat.ChatCommands = {
923
925
affected = await Punishments . lock ( userid , duration , null , false , publicReason ) ;
924
926
}
925
927
928
+ for ( const u of affected ) Chat . runHandlers ( 'onPunishUser' , 'LOCK' , u , room ) ;
926
929
this . globalModlog (
927
930
( force ? `FORCE` : `` ) + ( week ? "WEEKLOCK" : ( month ? "MONTHLOCK" : "LOCK" ) ) , targetUser || userid , privateReason
928
931
) ;
@@ -1127,6 +1130,7 @@ export const commands: Chat.ChatCommands = {
1127
1130
this . addGlobalModAction ( `${ name } was globally banned by ${ user . name } .${ ( publicReason ? ` (${ publicReason } )` : `` ) } ` ) ;
1128
1131
1129
1132
const affected = await Punishments . ban ( userid , null , null , false , publicReason ) ;
1133
+ for ( const u of affected ) Chat . runHandlers ( 'onPunishUser' , 'BAN' , u , room ) ;
1130
1134
const acAccount = ( targetUser && targetUser . autoconfirmed !== userid && targetUser . autoconfirmed ) ;
1131
1135
let displayMessage = '' ;
1132
1136
if ( affected . length > 1 ) {
@@ -1969,6 +1973,7 @@ export const commands: Chat.ChatCommands = {
1969
1973
}
1970
1974
const duration = week ? 7 * 24 * 60 * 60 * 1000 : 48 * 60 * 60 * 1000 ;
1971
1975
await Punishments . namelock ( userid , Date . now ( ) + duration , null , false , publicReason ) ;
1976
+ if ( targetUser ) Chat . runHandlers ( 'onPunishUser' , 'NAMELOCK' , targetUser , room ) ;
1972
1977
// Automatically upload replays as evidence/reference to the punishment
1973
1978
if ( room ?. battle ) this . parse ( '/savereplay forpunishment' ) ;
1974
1979
Monitor . forceRenames . set ( userid , false ) ;
@@ -2158,6 +2163,7 @@ export const commands: Chat.ChatCommands = {
2158
2163
2159
2164
const affected = Punishments . roomBlacklist ( room , targetUser , expireTime , null , reason ) ;
2160
2165
2166
+ for ( const u of affected ) Chat . runHandlers ( 'onPunishUser' , 'BLACKLIST' , u , room ) ;
2161
2167
if ( ! room . settings . isPrivate && room . persist ) {
2162
2168
const acAccount = ( targetUser . autoconfirmed !== userid && targetUser . autoconfirmed ) ;
2163
2169
let displayMessage = '' ;
0 commit comments