@ -21,8 +21,12 @@ function check(user, commandName, commands) {
}
}
if ( commands . ratelimit === ratelimit [ userID ] [ commandName ] . limit ) {
if ( commands . ratelimit === ratelimit [ userID ] [ commandName ] . limit ) {
console . log ( ` \x 1b[33m ${ userTag } ( ${ userID } ) \x 1b[0m is rate limited on \x 1b[33m ${ commandName } \x 1b[0m for ${ Math . floor ( ( ratelimit [ userID ] [ commandName ] . cooldown - date ) / 1000 ) } seconds ` ) ;
const seconds = Math . floor ( ( ratelimit [ userID ] [ commandName ] . cooldown - date ) / 1000 ) ;
return ` You are being rate limited. You can try again in ${ Math . floor ( ( ratelimit [ userID ] [ commandName ] . cooldown - date ) / 1000 ) } seconds. ` ;
const minutes = Math . floor ( seconds / 60 ) ;
const hours = Math . floor ( minutes / 60 ) ;
const dateString = ` ${ hours > 0 ? ` ${ Math . floor ( hours ) } hours ` : '' } ${ minutes > 0 ? ` ${ Math . floor ( minutes % 60 ) } minutes ` : '' } ${ seconds > 0 ? ` ${ Math . floor ( seconds % 60 ) } seconds ` : '' } ` ;
console . log ( ` \x 1b[33m ${ userTag } ( ${ userID } ) \x 1b[0m is rate limited on \x 1b[33m ${ commandName } \x 1b[0m for ${ dateString } . ` ) ;
return ` You are being rate limited. You can try again in ${ dateString } . ` ;
}
}
}
}