diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 9fac7fa2..8bfe9bc9 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -17,6 +17,7 @@ no if $] >= 5.018, warnings => "experimental::smartmatch"; use HTML::Entities; use Time::HiRes qw(gettimeofday); +use Time::Duration qw(duration); use Carp (); use POSIX qw(strftime); use Text::ParseWords; @@ -589,7 +590,7 @@ sub interpreter { if(exists $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_in}) { if($self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_in} eq $from) { if(gettimeofday - $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_on} < $self->{factoids}->hash->{$channel}->{$keyword}->{rate_limit}) { - return "/msg $nick $ref_from'$keyword' is rate-limited; try again in " . ($self->{factoids}->hash->{$channel}->{$keyword}->{rate_limit} - int(gettimeofday - $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_on})) . " seconds." unless $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host"); + return "/msg $nick $ref_from'$keyword' is rate-limited; try again in " . duration ($self->{factoids}->hash->{$channel}->{$keyword}->{rate_limit} - int(gettimeofday - $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_on})) . "." unless $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host"); } } }