From: Daniel Karbach Date: Fri, 14 Nov 2025 17:07:07 +0000 (+0100) Subject: prefer adlib in response to questions X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=dad6b0fb3aa0b069aa0481299a98da0ea3ca8d73;p=alttp.git prefer adlib in response to questions --- diff --git a/app/TwitchBot/TwitchChatBot.php b/app/TwitchBot/TwitchChatBot.php index 9ad2385..5443394 100644 --- a/app/TwitchBot/TwitchChatBot.php +++ b/app/TwitchBot/TwitchChatBot.php @@ -95,6 +95,10 @@ class TwitchChatBot extends TwitchBot { // don't immediately respond if we crossed the msg threshold last return; } + if ($this->getLatestMessage($channel)->classify() == 'question' && $this->shouldAdlib($channel)) { + $this->performAdlib($channel); + return; + } $text = $this->contextualMsg($channel); if (!$text && $this->shouldAdlib($channel)) { $this->performAdlib($channel); @@ -364,7 +368,7 @@ class TwitchChatBot extends TwitchBot { $this->notes[$channel->id]['last_special'][$classification] = time(); } - private function getLatestMessage(Channel $channel) { + private function getLatestMessage(Channel $channel): TokenizedMessage { $notes = $this->getNotes($channel); if (!empty($notes['latest_msgs'])) { return $notes['latest_msgs'][count($notes['latest_msgs']) - 1];