diff --git a/applets/pbot-vm/host/lib/Languages/_default.pm b/applets/pbot-vm/host/lib/Languages/_default.pm index 2b78b0fe..a5fccb9f 100755 --- a/applets/pbot-vm/host/lib/Languages/_default.pm +++ b/applets/pbot-vm/host/lib/Languages/_default.pm @@ -360,9 +360,30 @@ sub postprocess_output($self) { } $self->{output} = $boutput; + # bell my @beeps = qw/*BEEP* *BING* *DING* *DONG* *CLUNK* *BONG* *PING* *BOOP* *BLIP* *BOP* *WHIRR*/; - $self->{output} =~ s/\007/$beeps[rand @beeps]/g; + + # known control characters + my %escapes = ( + "\e" => '', + "\f" => '', + + # \r and \n are disabled so the bot itself processes them, e.g. when + # web-pasting, etc. feel free to uncomment them if you like (add them + # to the group in the substitution regex as well). + + # "\r" => '', + # "\n" => '', + + # \t is left alone + ); + + $self->{output} =~ s/([\e\f])/$escapes{$1}/gs; + + # other unprintables + my %disregard = ( "\n" => 1, "\r" => 1, "\t" => 1 ); + $self->{output} =~ s/([\x00-\x1f])/$disregard{$1} ? $1 : sprintf('\x%X', ord $1)/gse; } sub show_output($self) { diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index f54d9b1d..9798f5d0 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 => 4528, - BUILD_DATE => "2022-04-06", + BUILD_REVISION => 4530, + BUILD_DATE => "2022-04-07", }; sub initialize {}