mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 12:32:37 +01:00
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 $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} }) {
|
||||
if ($ref->{name} eq $keyword) {
|
||||
if ($level >= $ref->{level}) {
|
||||
|
@ -650,6 +650,11 @@ sub process_command_queue {
|
||||
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);
|
||||
$stuff->{result} = $result;
|
||||
$self->handle_result($stuff, $result);
|
||||
|
Loading…
Reference in New Issue
Block a user