mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 19:52:34 +01:00
Factoid rate-limit no longer affects factoids piped/substituted/splitted within the same command
This commit is contained in:
parent
aee7f706c7
commit
33f8c5aeab
@ -870,9 +870,8 @@ sub interpreter {
|
||||
}
|
||||
}
|
||||
|
||||
if ($self->{factoids}->exists($channel, $keyword, 'last_referenced_on')) {
|
||||
if ($self->{factoids}->exists($channel, $keyword, 'last_referenced_in')) {
|
||||
if ($self->{factoids}->get_data($channel, $keyword, 'last_referenced_in') eq $context->{from}) {
|
||||
$self->{pbot}->{logger}->log("$keyword $context->{interpret_depth}\n");
|
||||
if ($context->{interpret_depth} <= 1 and $self->{factoids}->get_data($channel, $keyword, 'last_referenced_in') eq $context->{from}) {
|
||||
my $ratelimit = $self->{pbot}->{registry}->get_value($context->{from}, 'ratelimit_override');
|
||||
$ratelimit = $self->{factoids}->get_data($channel, $keyword, 'rate_limit') if not defined $ratelimit;
|
||||
if (gettimeofday - $self->{factoids}->get_data($channel, $keyword, 'last_referenced_on') < $ratelimit) {
|
||||
@ -883,8 +882,6 @@ sub interpreter {
|
||||
unless $self->{pbot}->{users}->loggedin_admin($channel, "$context->{nick}!$context->{user}\@$context->{host}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $ref_count = $self->{factoids}->get_data($channel, $keyword, 'ref_count');
|
||||
my $update_data = {
|
||||
|
@ -154,7 +154,7 @@ sub process_line {
|
||||
}
|
||||
|
||||
$context->{referenced} = $embedded;
|
||||
$context->{interpret_depth} = 1;
|
||||
$context->{interpret_depth} = 0;
|
||||
$context->{preserve_whitespace} = $preserve_whitespace;
|
||||
|
||||
$context->{result} = $self->interpret($context);
|
||||
@ -170,6 +170,8 @@ sub interpret {
|
||||
my $text;
|
||||
my $pbot = $self->{pbot};
|
||||
|
||||
$context->{interpret_depth}++;
|
||||
|
||||
$pbot->{logger}->log("=== [$context->{interpret_depth}] Got command: ("
|
||||
. (defined $context->{from} ? $context->{from} : "undef")
|
||||
. ") $context->{nick}!$context->{user}\@$context->{host}: $context->{command}\n");
|
||||
@ -183,7 +185,7 @@ sub interpret {
|
||||
$self->{pbot}->{logger}->log(Dumper $context);
|
||||
}
|
||||
|
||||
return "Too many levels of recursion, aborted." if (++$context->{interpret_depth} > $self->{pbot}->{registry}->get_value('interpreter', 'max_recursion'));
|
||||
return "Too many levels of recursion, aborted." if ($context->{interpret_depth} > $self->{pbot}->{registry}->get_value('interpreter', 'max_recursion'));
|
||||
|
||||
if (not defined $context->{nick} || not defined $context->{user} || not defined $context->{host} || not defined $context->{command}) {
|
||||
$pbot->{logger}->log("Error 1, bad parameters to interpret_command\n");
|
||||
|
Loading…
Reference in New Issue
Block a user