diff --git a/lib/PBot/Core/Interpreter.pm b/lib/PBot/Core/Interpreter.pm index cf9f8928..f078f504 100644 --- a/lib/PBot/Core/Interpreter.pm +++ b/lib/PBot/Core/Interpreter.pm @@ -730,6 +730,11 @@ sub handle_result { last; } + # insert null-width spaces into nicknames to prevent IRC clients + # from unncessarily highlighting people + $line = $self->dehighlight_nicks($line, $context->{from}); + + # truncate if necessary, pasting original result to a web paste site $line = $self->truncate_result($context, $line, $original_result); if ($use_output_queue) { @@ -806,7 +811,9 @@ sub truncate_result { # make room to append the truncation text to the message text # (third argument to truncate_egc is '' to prevent appending its own ellipsis) - my $trunc_len = length $text < $max_msg_len ? length $text : $max_msg_len; + my $text_len = length $text; + my $trunc_len = $text_len < $max_msg_len ? $text_len : $max_msg_len; + $text = truncate_egc $text, $trunc_len - length $trunc, ''; # append the truncation text @@ -862,12 +869,6 @@ sub output_result { # nothing more to do here if the command came from STDIN return if $context->{from} eq 'stdin@pbot'; - # insert null-width spaces into nicknames to prevent IRC clients - # from unncessarily highlighting people - if ($context->{from} =~ /^#/ and $output !~ /^\/msg\s+/i) { - $output = $self->dehighlight_nicks($output, $context->{from}); - } - my $botnick = $self->{pbot}->{registry}->get_value('irc', 'botnick'); my $to = $context->{from}; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 0f8ee793..91438889 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4365, - BUILD_DATE => "2021-08-23", + BUILD_REVISION => 4366, + BUILD_DATE => "2021-08-24", }; sub initialize {}