diff --git a/PBot/BotAdmins.pm b/PBot/BotAdmins.pm index eab2a4d5..82b6164d 100644 --- a/PBot/BotAdmins.pm +++ b/PBot/BotAdmins.pm @@ -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; } diff --git a/PBot/Commands.pm b/PBot/Commands.pm index da0a128a..965b2457 100644 --- a/PBot/Commands.pm +++ b/PBot/Commands.pm @@ -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};