From d2bba770693e1f85479725eb176818c416be414d Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Fri, 5 Apr 2024 20:21:06 +0200 Subject: [PATCH] speak when spoken to --- app/TwitchBot/TwitchChatBot.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/TwitchBot/TwitchChatBot.php b/app/TwitchBot/TwitchChatBot.php index cb390f9..da4cc04 100644 --- a/app/TwitchBot/TwitchChatBot.php +++ b/app/TwitchBot/TwitchChatBot.php @@ -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 = []; -- 2.39.2