3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

Give embedded commands lowest priority so they are not extracted from actual commands

This commit is contained in:
Pragmatic Software 2017-08-24 15:13:20 -07:00
parent 26dfc9c0fa
commit f6827aa886

View File

@ -100,17 +100,7 @@ sub process_line {
$command = undef; $command = undef;
$has_code = undef; $has_code = undef;
if ($cmd_text =~ s/\B$bot_trigger`([^`]+)// || $cmd_text =~ s/\B$bot_trigger\{([^}]+)//) { if($cmd_text =~ s/^(?:$bot_trigger|$botnick.?)?\s*{\s*(.*)\s*}\s*$//) {
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*$//) {
$has_code = $1 if length $1; $has_code = $1 if length $1;
$preserve_whitespace = 1; $preserve_whitespace = 1;
$processed += 100; $processed += 100;
@ -142,6 +132,16 @@ sub process_line {
} elsif($cmd_text =~ s/^(.*?),?\s*$botnick[?!.]*$//i) { } elsif($cmd_text =~ s/^(.*?),?\s*$botnick[?!.]*$//i) {
$command = $1; $command = $1;
$processed += 100; $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; last if not defined $command and not defined $has_code;