From b6b27da925ac2acee9ba5452119ad2805ddbb10a Mon Sep 17 00:00:00 2001
From: Alexandre Morignot <amorignot@meilleursagents.com>
Date: Tue, 1 Aug 2023 15:13:12 +0200
Subject: [PATCH] fix: I hate Perl

---
 PlayBot/sessions/irc.pm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/PlayBot/sessions/irc.pm b/PlayBot/sessions/irc.pm
index 1df7d1f..bafdffa 100644
--- a/PlayBot/sessions/irc.pm
+++ b/PlayBot/sessions/irc.pm
@@ -257,9 +257,10 @@ sub on_invite {
 }
 
 sub external_parse {
-    my ( $user, $chan, $msg ) = shift;
+    my ( $user, $chan, $msg ) = @_;
+    $msg =~ tr/'"/_/;
 
-    my $content = `./PlayBot-cli "$user" "$chan" "$msg"`;
+    my $content = `./PlayBot-cli '$chan' '$user' '$msg'`;
     if ( $? >> 8 != 0 ) {
         die "Error";
     }
@@ -288,10 +289,10 @@ sub on_speak {
     my %content;
 
     eval {
-        %content = external_parse($user, lc $chan->[0], $msg);
+        %content = external_parse($nick, lc $chan->[0], $msg);
         $irc->yield(
-            privmsg => $chan => PlayBot::utils::print::print($content) );
-    }
+            privmsg => $chan => PlayBot::utils::print::print(\%content) );
+    };
     if ($@) {
         # first we check for url
         PlayBot::sites::parse(@args);
-- 
GitLab