3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-01-11 12:32:37 +01:00

Interpreter: check for {} code command before regular commands

This commit is contained in:
Pragmatic Software 2014-02-25 03:47:12 +00:00
parent f6edfce6b4
commit 91a9c69fa5
2 changed files with 6 additions and 6 deletions

View File

@ -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) {

View File

@ -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;