@@ -17,8 +17,8 @@ import { getPublicChannels } from '../../util/channel.js';
1717import { logToChannel } from '../../util/channel-logging.js' ;
1818import { buildCommandString , createCommand } from '../../util/commands.js' ;
1919
20- const DEFAULT_LOOK_BACK = 10 * MINUTE ;
21- const DEFAULT_TIMEOUT_DURATION = 1 * HOUR ;
20+ const DEFAULT_LOOK_BACK_MS = 10 * MINUTE ;
21+ const DEFAULT_TIMEOUT_DURATION_MS = 1 * HOUR ;
2222
2323const isUserInServer = ( target : User | GuildMember ) : target is GuildMember => {
2424 return target instanceof GuildMember ;
@@ -108,17 +108,17 @@ const getTargetFromInteraction = async (
108108
109109const handleTimeout = async ( {
110110 target,
111- duration ,
111+ durationInMilliseconds ,
112112} : {
113113 target : GuildMember | User ;
114- duration : number ;
114+ durationInMilliseconds : number ;
115115} ) : Promise < number > => {
116- if ( duration === 0 || ! isUserInServer ( target ) || isUserTimedOut ( target ) ) {
116+ if ( durationInMilliseconds === 0 || ! isUserInServer ( target ) || isUserTimedOut ( target ) ) {
117117 return 0 ;
118118 }
119119 try {
120- await target . timeout ( duration * HOUR , 'Repel command executed' ) ;
121- return duration ;
120+ await target . timeout ( durationInMilliseconds , 'Repel command executed' ) ;
121+ return durationInMilliseconds ;
122122 } catch ( error ) {
123123 console . error ( 'Error applying timeout to user:' , error ) ;
124124 return 0 ;
@@ -307,7 +307,7 @@ export const repelCommand = createCommand({
307307 name : RepelOptions . LOOK_BACK ,
308308 required : false ,
309309 type : ApplicationCommandOptionType . Integer ,
310- description : `Number of recent messages to delete (default: ${ timeToString ( DEFAULT_LOOK_BACK ) } )` ,
310+ description : `Number of recent messages to delete (default: ${ timeToString ( DEFAULT_LOOK_BACK_MS ) } )` ,
311311 choices : [
312312 {
313313 name : '10 minutes (Default)' ,
@@ -331,8 +331,8 @@ export const repelCommand = createCommand({
331331 name : RepelOptions . TIMEOUT_DURATION ,
332332 required : false ,
333333 type : ApplicationCommandOptionType . Integer ,
334- description : `Duration of the timeout in hours (default: ${ timeToString ( DEFAULT_TIMEOUT_DURATION ) } )` ,
335- min_value : 1 ,
334+ description : `Duration of the timeout in hours (default: ${ timeToString ( DEFAULT_TIMEOUT_DURATION_MS ) } )` ,
335+ min_value : 0 ,
336336 max_value : 24 ,
337337 } ,
338338 {
@@ -396,19 +396,19 @@ export const repelCommand = createCommand({
396396 try {
397397 const reason = interaction . options . getString ( RepelOptions . REASON , true ) ;
398398 const lookBack = interaction . options . getInteger ( RepelOptions . LOOK_BACK ) ;
399- const timeoutDuration = interaction . options . getInteger ( RepelOptions . TIMEOUT_DURATION ) ;
399+ const timeoutHours = interaction . options . getInteger ( RepelOptions . TIMEOUT_DURATION ) ;
400400
401401 const timeout = await handleTimeout ( {
402402 target : target ,
403- duration : timeoutDuration ? timeoutDuration * HOUR : DEFAULT_TIMEOUT_DURATION ,
403+ durationInMilliseconds : timeoutHours ? timeoutHours * HOUR : DEFAULT_TIMEOUT_DURATION_MS ,
404404 } ) ;
405405
406406 const channels = getTextChannels ( interaction ) ;
407407
408408 const { deleted, failedChannels } = await handleDeleteMessages ( {
409409 channels,
410410 target : target ,
411- lookBack : lookBack ?? DEFAULT_LOOK_BACK ,
411+ lookBack : lookBack ?? DEFAULT_LOOK_BACK_MS ,
412412 } ) ;
413413
414414 logRepelAction ( {
0 commit comments