mirror of https://github.com/pragma-/pbot.git
Add ability to override command effective-level
This commit is contained in:
parent
24e9d2ae40
commit
8fb98d614f
|
@ -102,6 +102,11 @@ sub interpreter {
|
||||||
my $level = defined $admin ? $admin->{level} : 0;
|
my $level = defined $admin ? $admin->{level} : 0;
|
||||||
my $keyword = lc $stuff->{keyword};
|
my $keyword = lc $stuff->{keyword};
|
||||||
|
|
||||||
|
if (exists $stuff->{'effective-level'}) {
|
||||||
|
$self->{pbot}->{logger}->log("override level to $stuff->{'effective-level'}\n");
|
||||||
|
$level = $stuff->{'effective-level'};
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $ref (@{ $self->{handlers} }) {
|
foreach my $ref (@{ $self->{handlers} }) {
|
||||||
if ($ref->{name} eq $keyword) {
|
if ($ref->{name} eq $keyword) {
|
||||||
if ($level >= $ref->{level}) {
|
if ($level >= $ref->{level}) {
|
||||||
|
|
|
@ -650,6 +650,11 @@ sub process_command_queue {
|
||||||
preserve_whitespace => 0
|
preserve_whitespace => 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (exists $command->{level}) {
|
||||||
|
$self->{pbot}->{logger}->log("Override command effective-level to $command->{level}\n");
|
||||||
|
$stuff->{'effective-level'} = $command->{level};
|
||||||
|
}
|
||||||
|
|
||||||
my $result = $self->interpret($stuff);
|
my $result = $self->interpret($stuff);
|
||||||
$stuff->{result} = $result;
|
$stuff->{result} = $result;
|
||||||
$self->handle_result($stuff, $result);
|
$self->handle_result($stuff, $result);
|
||||||
|
|
Loading…
Reference in New Issue