From f6827aa88684646254b2c3f7fa984cac5914d908 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Thu, 24 Aug 2017 15:13:20 -0700 Subject: [PATCH] Give embedded commands lowest priority so they are not extracted from actual commands --- PBot/Interpreter.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index 482688c7..62374fae 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -100,17 +100,7 @@ sub process_line { $command = undef; $has_code = undef; - if ($cmd_text =~ s/\B$bot_trigger`([^`]+)// || $cmd_text =~ s/\B$bot_trigger\{([^}]+)//) { - my $cmd = $1; - my ($nick) = $cmd_text =~ m/^([^ ,:;]+)/; - $nick = $self->{pbot}->{nicklist}->is_present($from, $nick); - if ($nick) { - $command = "tell $nick about $cmd"; - } else { - $command = $cmd; - } - $referenced = 1; - } elsif($cmd_text =~ s/^(?:$bot_trigger|$botnick.?)?\s*{\s*(.*)\s*}\s*$//) { + if($cmd_text =~ s/^(?:$bot_trigger|$botnick.?)?\s*{\s*(.*)\s*}\s*$//) { $has_code = $1 if length $1; $preserve_whitespace = 1; $processed += 100; @@ -142,6 +132,16 @@ sub process_line { } elsif($cmd_text =~ s/^(.*?),?\s*$botnick[?!.]*$//i) { $command = $1; $processed += 100; + } elsif ($cmd_text =~ s/\B$bot_trigger`([^`]+)// || $cmd_text =~ s/\B$bot_trigger\{([^}]+)//) { + my $cmd = $1; + my ($nick) = $cmd_text =~ m/^([^ ,:;]+)/; + $nick = $self->{pbot}->{nicklist}->is_present($from, $nick); + if ($nick) { + $command = "tell $nick about $cmd"; + } else { + $command = $cmd; + } + $referenced = 1; } last if not defined $command and not defined $has_code;