mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 03:33:06 +01:00
Allow bot admins to factset factoids from /msg
Fix some channel/from discrepancies in factset, etc.
This commit is contained in:
parent
b6f7dd87e5
commit
97bbb298e4
@ -145,17 +145,8 @@ sub find_admin {
|
||||
my $result = eval {
|
||||
foreach my $channel_regex (keys %{ $self->{admins}->hash }) {
|
||||
if($from !~ m/^#/) {
|
||||
# if not from a channel, make sure that nick portion of hostmask matches $from
|
||||
foreach my $hostmask_regex (keys %{ $self->{admins}->hash->{$channel_regex} }) {
|
||||
my $nick;
|
||||
|
||||
if($hostmask_regex =~ m/^([^!]+)!.*/) {
|
||||
$nick = $1;
|
||||
} else {
|
||||
$nick = $hostmask_regex;
|
||||
}
|
||||
|
||||
return $self->{admins}->hash->{$channel_regex}->{$hostmask_regex} if($from =~ m/$nick/i and $hostmask =~ m/$hostmask_regex/i);
|
||||
return $self->{admins}->hash->{$channel_regex}->{$hostmask_regex} if $hostmask =~ m/$hostmask_regex/i;
|
||||
}
|
||||
} elsif($from =~ m/^$channel_regex$/i) {
|
||||
foreach my $hostmask_regex (keys %{ $self->{admins}->hash->{$channel_regex} }) {
|
||||
|
@ -117,7 +117,7 @@ sub factset {
|
||||
if (defined $owner_channel) {
|
||||
$admininfo = $self->{pbot}->{admins}->loggedin($owner_channel, "$nick!$user\@$host");
|
||||
} else {
|
||||
$admininfo = $self->{pbot}->{admins}->loggedin($from, "$nick!$user\@$host");
|
||||
$admininfo = $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host");
|
||||
}
|
||||
|
||||
my $level = 0;
|
||||
@ -172,7 +172,7 @@ sub factunset {
|
||||
if (defined $owner_channel) {
|
||||
$admininfo = $self->{pbot}->{admins}->loggedin($owner_channel, "$nick!$user\@$host");
|
||||
} else {
|
||||
$admininfo = $self->{pbot}->{admins}->loggedin($from, "$nick!$user\@$host");
|
||||
$admininfo = $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host");
|
||||
}
|
||||
|
||||
my $level = 0;
|
||||
@ -955,13 +955,14 @@ sub factchange {
|
||||
return "Usage: factchange <channel> <keyword> s/<pattern>/<replacement>/";
|
||||
}
|
||||
|
||||
my $chan = $channel;
|
||||
($channel, $trigger) = $self->{pbot}->{factoids}->find_factoid($channel, $keyword, undef, 1, 1);
|
||||
|
||||
if(not defined $trigger) {
|
||||
return "$keyword not found in channel $from.";
|
||||
return "$keyword not found in channel $chan.";
|
||||
}
|
||||
|
||||
if(not $self->{pbot}->{admins}->loggedin($from, "$nick!$user\@$host") and $factoids->{$channel}->{$trigger}->{'locked'}) {
|
||||
if(not $self->{pbot}->{admins}->loggedin($channel, "$nick!$user\@$host") and $factoids->{$channel}->{$trigger}->{'locked'}) {
|
||||
return "$trigger is locked and cannot be changed.";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user