mirror of
https://github.com/pragma-/pbot.git
synced 2025-10-19 09:37:24 +02:00
Commands/Factoids: factchange
handles newlines; factadd $0-data
exempted from recursion limit
This commit is contained in:
parent
fe31b630e9
commit
49b926c372
@ -821,10 +821,6 @@ my @valid_pastesites = (
|
|||||||
sub cmd_factadd($self, $context) {
|
sub cmd_factadd($self, $context) {
|
||||||
my ($from_chan, $keyword, $text, $force);
|
my ($from_chan, $keyword, $text, $force);
|
||||||
|
|
||||||
if ($context->{interpret_depth} > 2) {
|
|
||||||
return "factadd: recursion depth exceeded.\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
my @arglist = @{$context->{arglist}};
|
my @arglist = @{$context->{arglist}};
|
||||||
|
|
||||||
if (@arglist) {
|
if (@arglist) {
|
||||||
@ -939,6 +935,12 @@ sub cmd_factadd($self, $context) {
|
|||||||
|
|
||||||
my $userinfo = $self->{pbot}->{users}->loggedin($from_chan, $context->{hostmask});
|
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}) {
|
if (!$self->{pbot}->{capabilities}->userhas($userinfo, 'admin') && $from_chan =~ /^#/ && $from_chan ne $context->{from}) {
|
||||||
return "/say Switch to $from_chan to add this factoid.";
|
return "/say Switch to $from_chan to add this factoid.";
|
||||||
}
|
}
|
||||||
@ -1494,11 +1496,11 @@ sub cmd_factchange($self, $context) {
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if ($count == 0) {
|
if ($count == 0) {
|
||||||
if ($insensitive) { $changed = $action =~ s|$tochange|$changeto$magic|i; }
|
if ($insensitive) { $changed = $action =~ s|$tochange|$changeto$magic|ims; }
|
||||||
else { $changed = $action =~ s|$tochange|$changeto$magic|; }
|
else { $changed = $action =~ s|$tochange|$changeto$magic|ms; }
|
||||||
} else {
|
} else {
|
||||||
if ($insensitive) { $changed = $action =~ s|$tochange|$1$changeto$magic|i; }
|
if ($insensitive) { $changed = $action =~ s|$tochange|$1$changeto$magic|ims; }
|
||||||
else { $changed = $action =~ s|$tochange|$1$changeto$magic|; }
|
else { $changed = $action =~ s|$tochange|$1$changeto$magic|ms; }
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($changed) {
|
if ($changed) {
|
||||||
@ -1515,9 +1517,9 @@ sub cmd_factchange($self, $context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elsif ($modifier eq 'i') {
|
} elsif ($modifier eq 'i') {
|
||||||
$changed = $action =~ s|$tochange|$changeto|i;
|
$changed = $action =~ s|$tochange|$changeto|ims;
|
||||||
} else {
|
} else {
|
||||||
$changed = $action =~ s|$tochange|$changeto|;
|
$changed = $action =~ s|$tochange|$changeto|ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not $changed) {
|
if (not $changed) {
|
||||||
|
@ -25,7 +25,7 @@ use PBot::Imports;
|
|||||||
# These are set by the /misc/update_version script
|
# These are set by the /misc/update_version script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 4891,
|
BUILD_REVISION => 4892,
|
||||||
BUILD_DATE => "2025-09-24",
|
BUILD_DATE => "2025-09-24",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user