From 91a9c69fa5694607fa8e4b7ce569bf521375876a Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 25 Feb 2014 03:47:12 +0000 Subject: [PATCH] Interpreter: check for {} code command before regular commands --- PBot/Interpreter.pm | 8 ++++---- PBot/VERSION.pm | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index 69a6ef7c..1b77cc8e 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -106,7 +106,10 @@ sub process_line { my $cmd_text = $text; $cmd_text =~ s/^\/me\s+//; - if($cmd_text =~ /^\Q$pbot->{trigger}\E(.*)$/) { + if($cmd_text =~ /^$pbot->{trigger}?\s*{\s*(.*)\s*}\s*$/) { + $has_code = $1 if length $1; + $preserve_whitespace = 1; + } elsif($cmd_text =~ /^\Q$pbot->{trigger}\E(.*)$/) { $command = $1; } elsif($cmd_text =~ /^.?$mynick.?\s+(.*?)$/i) { $command = $1; @@ -118,9 +121,6 @@ sub process_line { $nick_override = $1; $has_code = $2 if length $2 and $nick_override ne 'enum' and $nick_override ne 'struct'; $preserve_whitespace = 1; - } elsif($cmd_text =~ /^\s*{\s*(.*)\s*}\s*$/) { - $has_code = $1 if length $1; - $preserve_whitespace = 1; } if(defined $command || defined $has_url || defined $has_code) { diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index acb3a0a8..85e3f6be 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 485, - BUILD_DATE => "2014-02-23", + BUILD_REVISION => 486, + BUILD_DATE => "2014-02-24", }; 1;