mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 20:42:38 +01:00
factoids: be more clear about how to choose factoids from another channel if ambiguous keyword; find_factoid searches channel namespace better
This commit is contained in:
parent
221a698ecb
commit
ffdecba6ee
@ -167,7 +167,7 @@ sub find_factoid {
|
|||||||
if($exact_channel) {
|
if($exact_channel) {
|
||||||
next unless $from eq $channel;
|
next unless $from eq $channel;
|
||||||
} else {
|
} else {
|
||||||
next unless $from =~ m/$channel/i;
|
next unless $from =~ m/^$channel$/i;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $trigger (keys %{ $self->factoids->hash->{$channel} }) {
|
foreach my $trigger (keys %{ $self->factoids->hash->{$channel} }) {
|
||||||
@ -209,7 +209,6 @@ sub interpreter {
|
|||||||
($channel, $keyword) = $self->find_factoid($from, $keyword, $arguments);
|
($channel, $keyword) = $self->find_factoid($from, $keyword, $arguments);
|
||||||
|
|
||||||
if(not defined $keyword) {
|
if(not defined $keyword) {
|
||||||
# first check all channels for this keyword
|
|
||||||
my $chans = "";
|
my $chans = "";
|
||||||
my $comma = "";
|
my $comma = "";
|
||||||
my $found = 0;
|
my $found = 0;
|
||||||
@ -229,7 +228,7 @@ sub interpreter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($found > 1) {
|
if($found > 1) {
|
||||||
return $ref_from . "Ambiguous keyword '$original_keyword' exists in multiple locations (choose one): $chans";
|
return $ref_from . "Ambiguous keyword '$original_keyword' exists in multiple locations (use 'fact <keyword> <location>' to choose one): $chans";
|
||||||
}
|
}
|
||||||
elsif($found == 1) {
|
elsif($found == 1) {
|
||||||
$pbot->logger->log("Found '$original_keyword' as '$fwd_trig' in [$fwd_chan]\n");
|
$pbot->logger->log("Found '$original_keyword' as '$fwd_trig' in [$fwd_chan]\n");
|
||||||
@ -266,7 +265,7 @@ sub interpreter {
|
|||||||
$self->factoids->hash->{$channel}->{$keyword}->{ref_user} = $nick;
|
$self->factoids->hash->{$channel}->{$keyword}->{ref_user} = $nick;
|
||||||
$self->factoids->hash->{$channel}->{$keyword}->{last_referenced_on} = gettimeofday;
|
$self->factoids->hash->{$channel}->{$keyword}->{last_referenced_on} = gettimeofday;
|
||||||
|
|
||||||
return $ref_from . $pbot->interpreter->interpret($from, $nick, $user, $host, $count, $command, $ref_from);
|
return $ref_from . $pbot->interpreter->interpret($from, $nick, $user, $host, $count, $command);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $last_ref_in = 0;
|
my $last_ref_in = 0;
|
||||||
@ -413,7 +412,7 @@ sub interpreter {
|
|||||||
$cmd = $self->factoids->hash->{$channel}->{$keyword}->{action};
|
$cmd = $self->factoids->hash->{$channel}->{$keyword}->{action};
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $pbot->interpreter->interpret($from, $nick, $user, $host, $count, $cmd, $ref_from);
|
$result = $pbot->interpreter->interpret($from, $nick, $user, $host, $count, $cmd);
|
||||||
return $ref_from . $result;
|
return $ref_from . $result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ use warnings;
|
|||||||
# These are set automatically by the build/commit script
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 281,
|
BUILD_REVISION => 282,
|
||||||
BUILD_DATE => "2011-01-29",
|
BUILD_DATE => "2011-01-29",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user