mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
Use Time::Duration for rate_limit message
This commit is contained in:
parent
5ac5229bf3
commit
381b4bee4b
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user