]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Factoids/Reply.pl
converted %{$blah{$blah}} to %{ $blah{$blah} }
[infobot.git] / src / Factoids / Reply.pl
index 2a2899e8b440b2cc935da8a3ecba0ed3f0b29579..1c470c4ca98c1a8584616e20adb273f436c401a8 100644 (file)
@@ -19,7 +19,6 @@ sub getReply {
     my($message) = @_;
     my($lhs,$mhs,$rhs);
     my($result,$reply);
-    my $literal = 0;
     $orig{message} = $message;
 
     if (!defined $message or $message =~ /^\s*$/) {
@@ -33,6 +32,8 @@ sub getReply {
        $lhs = $message;
        $mhs = "is";
        $rhs = $result;
+
+       return "$lhs $mhs $rhs" if ($literal);
     } else {
        return '';
     }
@@ -138,7 +139,7 @@ sub getReply {
            # result is random if separated by '||'.
            # rhs is full factoid with '||'.
            if ($mhs eq "is") {
-               $reply = &getRandom(keys %{$lang{'factoid'}});
+               $reply = &getRandom(keys %{ $lang{'factoid'} });
                $reply =~ s/##KEY/$lhs/;
                $reply =~ s/##VALUE/$result/;
            } else {
@@ -149,7 +150,7 @@ sub getReply {
                # fix the person.
            } else {
                if ($reply =~ /^you are / or $reply =~ / you are /) {
-                   return $noreply if ($addressed);
+                   return if ($addressed);
                }
            }
        }
@@ -199,7 +200,7 @@ sub getReply {
        $reply =~ s/\$randpercentage/$randp/g;  # ???
        # randnick.
        if ($reply =~ /\$randnick/) {
-           my @nicks = keys %{$channels{$chan}{''}};
+           my @nicks = keys %{ $channels{$chan}{''} };
            my $randnick = $nicks[ int($rand*$#nicks) ];
            s/\$randnick/$randnick/;
        }
@@ -310,5 +311,4 @@ sub smart_replace {
     return $string;
 }
 
-
 1;