mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-23 19:22:40 +01:00
factoids: levenshtein search working again; rate-limit working again
This commit is contained in:
parent
e4019895d3
commit
845dff008e
@ -203,11 +203,18 @@ sub interpreter {
|
||||
return undef if not length $keyword;
|
||||
|
||||
$from = lc $from;
|
||||
$ref_from = "" if not defined $ref_from;
|
||||
|
||||
# search for factoid against global channel and current channel (from)
|
||||
# search for factoid against global channel and current channel (from unless ref_from is defined)
|
||||
my $original_keyword = $keyword;
|
||||
($channel, $keyword) = $self->find_factoid($from, $keyword, $arguments);
|
||||
($channel, $keyword) = $self->find_factoid($ref_from ? $ref_from : $from, $keyword, $arguments);
|
||||
|
||||
if(not defined $ref_from) {
|
||||
$ref_from = "";
|
||||
} else {
|
||||
$ref_from = "[$ref_from] ";
|
||||
}
|
||||
|
||||
$arguments = "" if not defined $arguments;
|
||||
|
||||
# if no match found, attempt to call factoid from another channel if it exists there
|
||||
if(not defined $keyword) {
|
||||
@ -238,13 +245,13 @@ sub interpreter {
|
||||
elsif($found == 1) {
|
||||
$pbot->logger->log("Found '$original_keyword' as '$fwd_trig' in [$fwd_chan]\n");
|
||||
|
||||
return $ref_from . $pbot->factoids->interpreter($fwd_chan, $nick, $user, $host, $count, $fwd_trig, $arguments, undef, "[$fwd_chan] ");
|
||||
return $ref_from . $pbot->factoids->interpreter($from, $nick, $user, $host, $count, $fwd_trig, $arguments, undef, $fwd_chan);
|
||||
}
|
||||
# otherwise keyword hasn't been found, display similiar matches for all channels
|
||||
else {
|
||||
# if a non-nick argument was supplied, e.g., a sentence using the bot's nick, don't say anything
|
||||
return "" if $arguments !~ /^[^.+-, ]{1,20}$/;
|
||||
|
||||
return "" if length $arguments and $arguments !~ /^[^.+-, ]{1,20}$/;
|
||||
|
||||
# find matches from all channels
|
||||
my $matches = $self->factoids->levenshtein_matches('.*', lc $original_keyword);
|
||||
|
||||
|
@ -13,7 +13,7 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 285,
|
||||
BUILD_REVISION => 286,
|
||||
BUILD_DATE => "2011-01-29",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user