mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
Add per-channel ratelimit_override registry object to ... override factoid ratelimits on a per-channel basis
This commit is contained in:
parent
e0b03ee3d4
commit
99be204a95
@ -830,8 +830,10 @@ sub interpreter {
|
|||||||
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_on}) {
|
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_on}) {
|
||||||
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_in}) {
|
if (exists $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_in}) {
|
||||||
if ($self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_in} eq $stuff->{from}) {
|
if ($self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_in} eq $stuff->{from}) {
|
||||||
if (gettimeofday - $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_on} < $self->{factoids}->hash->{$channel}->{$keyword}->{rate_limit}) {
|
my $ratelimit = $self->{pbot}->{registry}->get_value($channel, 'ratelimit_override');
|
||||||
return "/msg $stuff->{nick} $stuff->{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, "$stuff->{nick}!$stuff->{user}\@$stuff->{host}");
|
$ratelimit = $self->{factoids}->hash->{$channel}->{$keyword}->{rate_limit} if not defined $ratelimit;
|
||||||
|
if (gettimeofday - $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_on} < $ratelimit) {
|
||||||
|
return "/msg $stuff->{nick} $stuff->{ref_from}'$keyword' is rate-limited; try again in " . duration ($ratelimit - int(gettimeofday - $self->{factoids}->hash->{$channel}->{$keyword}->{last_referenced_on})) . "." unless $self->{pbot}->{admins}->loggedin($channel, "$stuff->{nick}!$stuff->{user}\@$stuff->{host}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user