3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 05:49:27 +01:00

Fix channel-specific bot admins being unable to privately /msg admin commands

This commit is contained in:
Pragmatic Software 2020-01-03 19:20:25 -08:00
parent 790abba7e5
commit d35a0f4081
2 changed files with 4 additions and 2 deletions

View File

@ -113,7 +113,7 @@ sub find_admin {
my $result = eval {
foreach my $channel_regex (keys %{ $self->{admins}->hash }) {
if ($from =~ m/^$channel_regex$/i) {
if ($from !~ m/^#/ or $from =~ m/^$channel_regex$/i) {
foreach my $hostmask_regex (keys %{ $self->{admins}->hash->{$channel_regex} }) {
return $self->{admins}->hash->{$channel_regex}->{$hostmask_regex} if $hostmask =~ m/^$hostmask_regex$/i or $hostmask eq lc $hostmask_regex;
}

View File

@ -100,7 +100,9 @@ sub interpreter {
}
my $from = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $stuff->{from};
my $admin = $self->{pbot}->{admins}->loggedin($from, "$stuff->{nick}!$stuff->{user}\@$stuff->{host}");
my ($admin_channel) = $stuff->{arguments} =~ m/(#[^ ]+)/; # assume first channel-like argument
$admin_channel = $from if not defined $admin_channel;
my $admin = $self->{pbot}->{admins}->loggedin($admin_channel, "$stuff->{nick}!$stuff->{user}\@$stuff->{host}");
my $level = defined $admin ? $admin->{level} : 0;
my $keyword = lc $stuff->{keyword};