diff --git a/lib/PBot/Core/Commands/Factoids.pm b/lib/PBot/Core/Commands/Factoids.pm index 36b13c0c..d1bc03df 100644 --- a/lib/PBot/Core/Commands/Factoids.pm +++ b/lib/PBot/Core/Commands/Factoids.pm @@ -821,10 +821,6 @@ my @valid_pastesites = ( sub cmd_factadd($self, $context) { my ($from_chan, $keyword, $text, $force); - if ($context->{interpret_depth} > 2) { - return "factadd: recursion depth exceeded.\n"; - } - my @arglist = @{$context->{arglist}}; if (@arglist) { @@ -939,6 +935,12 @@ sub cmd_factadd($self, $context) { my $userinfo = $self->{pbot}->{users}->loggedin($from_chan, $context->{hostmask}); + if ($context->{interpret_depth} > 2) { + if (($from_chan ne '.*' && $from_chan ne $context->{from}) || ($keyword ne "$context->{trigger}-data" && $keyword ne "$context->{root_keyword}-data")) { + return "factadd: recursion depth exceeded.\n"; + } + } + if (!$self->{pbot}->{capabilities}->userhas($userinfo, 'admin') && $from_chan =~ /^#/ && $from_chan ne $context->{from}) { return "/say Switch to $from_chan to add this factoid."; } @@ -1494,11 +1496,11 @@ sub cmd_factchange($self, $context) { while (1) { if ($count == 0) { - if ($insensitive) { $changed = $action =~ s|$tochange|$changeto$magic|i; } - else { $changed = $action =~ s|$tochange|$changeto$magic|; } + if ($insensitive) { $changed = $action =~ s|$tochange|$changeto$magic|ims; } + else { $changed = $action =~ s|$tochange|$changeto$magic|ms; } } else { - if ($insensitive) { $changed = $action =~ s|$tochange|$1$changeto$magic|i; } - else { $changed = $action =~ s|$tochange|$1$changeto$magic|; } + if ($insensitive) { $changed = $action =~ s|$tochange|$1$changeto$magic|ims; } + else { $changed = $action =~ s|$tochange|$1$changeto$magic|ms; } } if ($changed) { @@ -1515,9 +1517,9 @@ sub cmd_factchange($self, $context) { } } } elsif ($modifier eq 'i') { - $changed = $action =~ s|$tochange|$changeto|i; + $changed = $action =~ s|$tochange|$changeto|ims; } else { - $changed = $action =~ s|$tochange|$changeto|; + $changed = $action =~ s|$tochange|$changeto|ms; } if (not $changed) { diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index a55314ee..8b493c3f 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,7 +25,7 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4891, + BUILD_REVISION => 4892, BUILD_DATE => "2025-09-24", };