File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,14 +8,16 @@ export class MuteService {
88 * @param ctx - The bot context.
99 * @returns A message indicating the duration of the mute.
1010 */
11- static async muteUser ( ctx : Context ) : Promise < string > {
11+ static async muteUser ( ctx : Context , durationStr ?: string | null ) : Promise < string > {
1212 const replyMessage = ctx . message ?. reply_to_message ;
1313 if ( ! replyMessage ) {
1414 return 'Please reply to a user to mute them.' ;
1515 }
1616
1717 const userId = replyMessage . from ?. id ! ;
18- const durationStr = MuteService . extractDurationFromCommand ( ctx . message ?. text ) ;
18+ if ( ! durationStr ) {
19+ durationStr = MuteService . extractDurationFromCommand ( ctx . message ?. text ) ;
20+ }
1921 const durationMs = durationStr ? parseDuration ( durationStr ) : null ;
2022
2123 const expiration = durationMs ? new Date ( tehranZone ( ) . getTime ( ) + durationMs ) : null ;
Original file line number Diff line number Diff line change 11import { Context } from 'grammy' ;
22import { AdminValidationService } from './validation' ;
33import { ServiceProvider } from '../../../service/database/ServiceProvider' ;
4+ import { MuteService } from './Mute' ;
45
56export class WarnService {
67 static async warnUser ( ctx : Context ) : Promise < {
@@ -64,6 +65,7 @@ export class WarnService {
6465 } ;
6566 await warnService . delete ( warn . id ) ;
6667 await Promise . all ( [ groupService . update ( updatedGroup ) , userService . update ( updatedUser ) ] ) ;
68+ await MuteService . muteUser ( ctx , '1d' ) ;
6769 return {
6870 warningApplied : true ,
6971 isWarningLimitReached : true ,
You can’t perform that action at this time.
0 commit comments