3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-09 04:48:43 +02:00

factoids: better handling of triggering factoids in other namesapces; actions_with_args fixed

This commit is contained in:
Pragmatic Software 2011-01-30 07:18:28 +00:00
parent 845dff008e
commit cd8791a854
2 changed files with 9 additions and 9 deletions

View File

@ -245,7 +245,7 @@ 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($from, $nick, $user, $host, $count, $fwd_trig, $arguments, undef, $fwd_chan); return $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 {
@ -267,7 +267,7 @@ sub interpreter {
# Check if it's an alias # Check if it's an alias
if($self->factoids->hash->{$channel}->{$keyword}->{action} =~ /^\/call\s+(.*)$/) { if($self->factoids->hash->{$channel}->{$keyword}->{action} =~ /^\/call\s+(.*)$/) {
my $command; my $command;
if(defined $arguments) { if(length $arguments) {
$command = "$1 $arguments"; $command = "$1 $arguments";
} else { } else {
$command = $1; $command = $1;
@ -279,7 +279,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); return $pbot->interpreter->interpret($from, $nick, $user, $host, $count, $command);
} }
my $last_ref_in = 0; my $last_ref_in = 0;
@ -345,7 +345,7 @@ sub interpreter {
$result = $self->factoids->hash->{$channel}->{$keyword}->{action}; $result = $self->factoids->hash->{$channel}->{$keyword}->{action};
} }
if(defined $arguments) { if(length $arguments) {
if(exists $self->factoids->hash->{$channel}->{$keyword}->{action_with_args}) { if(exists $self->factoids->hash->{$channel}->{$keyword}->{action_with_args}) {
$result = $self->factoids->hash->{$channel}->{$keyword}->{action_with_args}; $result = $self->factoids->hash->{$channel}->{$keyword}->{action_with_args};
} }
@ -395,9 +395,9 @@ sub interpreter {
$result =~ s/\\\$/\$/g; $result =~ s/\\\$/\$/g;
if($result =~ s/^\/say\s+//i || $result =~ /^\/me\s+/i if($result =~ s/^\/say\s+/$ref_from/i || $result =~ s/^\/me\s+(.*)/\/me $1 $ref_from/i
|| $result =~ /^\/msg\s+/i) { || $result =~ s/^\/msg\s+([^ ]+)/\/msg $1 $ref_from/i) {
return $ref_from . $result; return $result;
} else { } else {
return $ref_from . "$keyword is $result"; return $ref_from . "$keyword is $result";
} }
@ -427,7 +427,7 @@ sub interpreter {
} }
$result = $pbot->interpreter->interpret($from, $nick, $user, $host, $count, $cmd); $result = $pbot->interpreter->interpret($from, $nick, $user, $host, $count, $cmd);
return $ref_from . $result; return $result;
}; };
if($@) { if($@) {

View File

@ -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 => 286, BUILD_REVISION => 287,
BUILD_DATE => "2011-01-29", BUILD_DATE => "2011-01-29",
}; };