From 4601d404824d0843aa9eeb199634e10e656e1177 Mon Sep 17 00:00:00 2001
From: Alexandre Morignot <erdnaxeli@cervoi.se>
Date: Sun, 28 Nov 2021 16:17:30 +0100
Subject: [PATCH] Check for command by using the first word only

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

diff --git a/PlayBot/sessions/irc.pm b/PlayBot/sessions/irc.pm
index 2a9c21a..13be30f 100644
--- a/PlayBot/sessions/irc.pm
+++ b/PlayBot/sessions/irc.pm
@@ -264,13 +264,16 @@ sub on_speak
     # first we check for url
     my @processed_str = PlayBot::sites::parse(@args);
 
-    # we remove any part processed (url and tags)
-    foreach (@processed_str) {
-        $msg =~ s/\Q$_\E// if $_;
-    }
-
     # and we check for command
-    @args = ($kernel, $user, lc $chan->[0], $msg);
+    my $cmd = (split /\s/, $msg)[0];
+    if ($cmd eq "!fav")
+    {
+        @args = ($kernel, $user, lc $chan->[0], $cmd);
+    }
+    else
+    {
+        @args = ($kernel, $user, lc $chan->[0], $msg);
+    }
     PlayBot::commands::parser::exec(@args);
 }
 
-- 
GitLab