From: Daniel Karbach Date: Fri, 5 Apr 2024 18:21:06 +0000 (+0200) Subject: speak when spoken to X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=d2bba770693e1f85479725eb176818c416be414d;p=alttp.git speak when spoken to --- 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 = [];