3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-17 01:19:31 +01:00

Core/Interpreter: preserve newlines in commands

This commit is contained in:
Pragmatic Software 2024-10-30 16:37:20 -07:00
parent e5e0f26b90
commit d8a284e9c1
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 10 additions and 2 deletions

View File

@ -343,6 +343,9 @@ sub interpret($self, $context) {
}
}
# strip any trailing newlines from keyword
$keyword =~ s/\n+$//;
# ensure we have a $keyword
if (not defined $keyword or not length $keyword) {
$self->{pbot}->{logger}->log("Error: Missing keyword; disregarding command\n");
@ -709,7 +712,7 @@ sub handle_result($self, $context, $result = $context->{result}) {
my $link = $self->{pbot}->{webpaste}->paste("$context->{from} <$context->{nick}> $context->{text}\n\n$original_result");
my $message = "And that's all I have to say about that. See $link for full text.";
my $message = "<truncated; $link>";
if ($context->{use_output_queue}) {
my $message = {
@ -1276,9 +1279,14 @@ sub split_line($self, $line, %opts) {
$token .= $ch;
next;
} else {
if ($opts{keep_spaces} && $ch eq "\n") {
$token .= $ch;
}
unless ($opts{strip_commas} and $token eq ',') {
push @args, $token if length $token;
}
$token = '';
next;
}

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4817,
BUILD_REVISION => 4818,
BUILD_DATE => "2024-10-30",
};