deal with newlines from owncast

This commit is contained in:
jake 2024-12-12 19:14:08 -05:00
parent 3356d6d181
commit 3176ab86a6

View file

@ -19,11 +19,11 @@ use Mojo::JSON qw(decode_json);
use Mojo::UserAgent; use Mojo::UserAgent;
use Mojo::IRC; use Mojo::IRC;
use Carp qw(croak); use Carp qw(croak);
#use Smart::Comments; use Smart::Comments;
use MIME::Base64 qw(encode_base64); use MIME::Base64 qw(encode_base64);
## no critic (prototype) ## no critic (prototype)
our $VERSION = '0.2'; # not 100% stress tested our $VERSION = '0.3'; # not 100% stress tested
my $streaming_RN = 0; my $streaming_RN = 0;
my $stream_stop_time = 0; my $stream_stop_time = 0;
@ -308,6 +308,7 @@ sub chat ($c, $hook) {
my $name = $hook->{eventData}->{user}->{displayName}; my $name = $hook->{eventData}->{user}->{displayName};
my $color = $hook->{eventData}->{user}->{displayColor}; my $color = $hook->{eventData}->{user}->{displayColor};
my $body = $hook->{eventData}->{rawBody}; # no html my $body = $hook->{eventData}->{rawBody}; # no html
$body =~ s|\s\n|/ |g;
my $visible = $hook->{eventData}->{visible}; my $visible = $hook->{eventData}->{visible};
if ($visible) { if ($visible) {
send_chat_to_irc( '<' . $colors{$color} . "$name" . NORMAL . '>' . " $body"); send_chat_to_irc( '<' . $colors{$color} . "$name" . NORMAL . '>' . " $body");