mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 20:22:37 +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')) {
|
$self->{pbot}->{logger}->log("$keyword $context->{interpret_depth}\n");
|
||||||
if ($self->{factoids}->exists($channel, $keyword, 'last_referenced_in')) {
|
if ($context->{interpret_depth} <= 1 and $self->{factoids}->get_data($channel, $keyword, 'last_referenced_in') eq $context->{from}) {
|
||||||
if ($self->{factoids}->get_data($channel, $keyword, 'last_referenced_in') eq $context->{from}) {
|
|
||||||
my $ratelimit = $self->{pbot}->{registry}->get_value($context->{from}, 'ratelimit_override');
|
my $ratelimit = $self->{pbot}->{registry}->get_value($context->{from}, 'ratelimit_override');
|
||||||
$ratelimit = $self->{factoids}->get_data($channel, $keyword, 'rate_limit') if not defined $ratelimit;
|
$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) {
|
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}");
|
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 $ref_count = $self->{factoids}->get_data($channel, $keyword, 'ref_count');
|
||||||
my $update_data = {
|
my $update_data = {
|
||||||
|
@ -154,7 +154,7 @@ sub process_line {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$context->{referenced} = $embedded;
|
$context->{referenced} = $embedded;
|
||||||
$context->{interpret_depth} = 1;
|
$context->{interpret_depth} = 0;
|
||||||
$context->{preserve_whitespace} = $preserve_whitespace;
|
$context->{preserve_whitespace} = $preserve_whitespace;
|
||||||
|
|
||||||
$context->{result} = $self->interpret($context);
|
$context->{result} = $self->interpret($context);
|
||||||
@ -170,6 +170,8 @@ sub interpret {
|
|||||||
my $text;
|
my $text;
|
||||||
my $pbot = $self->{pbot};
|
my $pbot = $self->{pbot};
|
||||||
|
|
||||||
|
$context->{interpret_depth}++;
|
||||||
|
|
||||||
$pbot->{logger}->log("=== [$context->{interpret_depth}] Got command: ("
|
$pbot->{logger}->log("=== [$context->{interpret_depth}] Got command: ("
|
||||||
. (defined $context->{from} ? $context->{from} : "undef")
|
. (defined $context->{from} ? $context->{from} : "undef")
|
||||||
. ") $context->{nick}!$context->{user}\@$context->{host}: $context->{command}\n");
|
. ") $context->{nick}!$context->{user}\@$context->{host}: $context->{command}\n");
|
||||||
@ -183,7 +185,7 @@ sub interpret {
|
|||||||
$self->{pbot}->{logger}->log(Dumper $context);
|
$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}) {
|
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");
|
$pbot->{logger}->log("Error 1, bad parameters to interpret_command\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user