]> git.localhorst.tv Git - alttp.git/commitdiff
speak when spoken to
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 5 Apr 2024 18:21:06 +0000 (20:21 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 5 Apr 2024 18:21:06 +0000 (20:21 +0200)
app/TwitchBot/TwitchChatBot.php

index cb390f9655a863d21217c424d2b7672ae1c8d1c5..da4cc041aff1314e7f2f3ca75226ea686cca50e6 100644 (file)
@@ -338,6 +338,10 @@ class TwitchChatBot extends TwitchBot {
                                array_shift($this->notes[$channel->id]['latest_msgs']);
                        }
                }
+               if ($this->isDirectedAtMe($msg->getText())) {
+                       $this->notes[$channel->id]['wait_msgs'] = 0;
+                       $this->notes[$channel->id]['wait_time'] = 0;
+               }
        }
 
        private function tagChannelWrite(Channel $channel) {
@@ -348,6 +352,14 @@ class TwitchChatBot extends TwitchBot {
                $this->notes[$channel->id]['wait_time'] = $this->randomWaitTime($channel);
        }
 
+       private function isDirectedAtMe($raw_text) {
+               $text = strtolower($raw_text);
+               if (strpos($text, 'horstie') !== false) {
+                       return true;
+               }
+               return false;
+       }
+
        private $channels;
        private $notes = [];