]> git.localhorst.tv Git - alttp.git/commitdiff
prefer adlib in response to questions
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 14 Nov 2025 17:07:07 +0000 (18:07 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 14 Nov 2025 17:07:07 +0000 (18:07 +0100)
app/TwitchBot/TwitchChatBot.php

index 9ad2385ee69e1ce880da5736783a902a0f324f8e..5443394e1fa3795cef5e62fd24eeb17ccf974c9d 100644 (file)
@@ -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];