mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 10:59:29 +01:00
Fix channel-specific bot admins being unable to privately /msg admin commands
This commit is contained in:
parent
790abba7e5
commit
d35a0f4081
@ -113,7 +113,7 @@ sub find_admin {
|
|||||||
|
|
||||||
my $result = eval {
|
my $result = eval {
|
||||||
foreach my $channel_regex (keys %{ $self->{admins}->hash }) {
|
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} }) {
|
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;
|
return $self->{admins}->hash->{$channel_regex}->{$hostmask_regex} if $hostmask =~ m/^$hostmask_regex$/i or $hostmask eq lc $hostmask_regex;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,9 @@ sub interpreter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $from = exists $stuff->{admin_channel_override} ? $stuff->{admin_channel_override} : $stuff->{from};
|
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 $level = defined $admin ? $admin->{level} : 0;
|
||||||
my $keyword = lc $stuff->{keyword};
|
my $keyword = lc $stuff->{keyword};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user