3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-29 23:39:24 +01:00

Plugin/TypoSub: final closing slash is now optional

This commit is contained in:
Pragmatic Software 2020-01-31 02:15:20 -08:00
parent 7dda42a181
commit 982cefcebd

View File

@ -57,7 +57,7 @@ sub on_public {
if ($msg =~ m/^\s*s([[:punct:]])/) {
my $separator = $1;
my $sep = quotemeta $separator;
if ($msg =~ m/^\s*s${sep}(.*?)(?<!\\)${sep}(.*?)(?<!\\)${sep}([g]*)\s*$/) {
if ($msg =~ m/^\s*s${sep}(.*?)(?<!\\)${sep}(.*?)(?<!\\)${sep}([g]*)\s*$/ or $msg =~ m/^\s*s${sep}(.*?)(?<!\\)${sep}(.*?)$/) {
my ($regex, $replacement, $modifiers) = ($1, $2, $3);
eval {
my $rx = qr/$regex/;
@ -74,7 +74,7 @@ sub on_public {
foreach my $message (@$messages) {
next if $ignore_commands and $message->{msg} =~ m/^(?:$bot_trigger|$botnick.?)/;
next if $message->{msg} =~ m/^\s*s[[:punct:]](.*?)[[:punct:]](.*?)[[:punct:]]g?\s*$/;
next if $message->{msg} =~ m/^\s*s[[:punct:]](.*?)[[:punct:]](.*?)[[:punct:]]?g?\s*$/;
if ($message->{msg} =~ /$rx/) {
my $hostmask = $self->{pbot}->{messagehistory}->{database}->find_message_account_by_id($message->{id});