mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 20:42:38 +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;
|
return undef if not length $keyword;
|
||||||
|
|
||||||
$from = lc $from;
|
$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;
|
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 no match found, attempt to call factoid from another channel if it exists there
|
||||||
if(not defined $keyword) {
|
if(not defined $keyword) {
|
||||||
@ -238,12 +245,12 @@ sub interpreter {
|
|||||||
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");
|
||||||
|
|
||||||
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
|
# otherwise keyword hasn't been found, display similiar matches for all channels
|
||||||
else {
|
else {
|
||||||
# if a non-nick argument was supplied, e.g., a sentence using the bot's nick, don't say anything
|
# 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
|
# find matches from all channels
|
||||||
my $matches = $self->factoids->levenshtein_matches('.*', lc $original_keyword);
|
my $matches = $self->factoids->levenshtein_matches('.*', lc $original_keyword);
|
||||||
|
@ -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 => 285,
|
BUILD_REVISION => 286,
|
||||||
BUILD_DATE => "2011-01-29",
|
BUILD_DATE => "2011-01-29",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user