From 789a4bfe2d0c3749783e83dcc20124bd8698e759 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 14 Apr 2015 20:14:22 -0700 Subject: [PATCH] Correct handling of `tell`ing factoid aliases --- PBot/Factoids.pm | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 13e45a52..ec5ba9b0 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -466,6 +466,19 @@ sub interpreter { } } + # Check if it's an alias + if($action =~ /^\/call\s+(.*)$/) { + my $command; + if(length $arguments) { + $command = "$1 $arguments"; + } else { + $command = $1; + } + + $pbot->{logger}->log("[" . (defined $from ? $from : "stdin") . "] ($nick!$user\@$host) [$keyword] aliased to: [$command]\n"); + return $pbot->{interpreter}->interpret($from, $nick, $user, $host, $depth, $command, $tonick); + } + if(defined $tonick) { # !tell foo about bar $self->{pbot}->{logger}->log("($from): $nick!$user\@$host) sent to $tonick\n"); my $botnick = $self->{pbot}->{registry}->get_value('irc', 'botnick'); @@ -511,19 +524,6 @@ sub interpreter { $action =~ s/\\\$/\$/g; - # Check if it's an alias - if($action =~ /^\/call\s+(.*)$/) { - my $command; - if(length $arguments) { - $command = "$1 $arguments"; - } else { - $command = $1; - } - - $pbot->{logger}->log("[" . (defined $from ? $from : "stdin") . "] ($nick!$user\@$host) [$keyword] aliased to: [$command]\n"); - return $pbot->{interpreter}->interpret($from, $nick, $user, $host, $depth, $command, $tonick); - } - if($self->{factoids}->hash->{$channel}->{$keyword}->{enabled} == 0) { $self->{pbot}->{logger}->log("$keyword disabled.\n"); return "/msg $nick $ref_from$keyword is currently disabled.";