]> git.localhorst.tv Git - alttp.git/commitdiff
slightly better chat bot msg selection
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 23 Mar 2024 19:47:09 +0000 (20:47 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 23 Mar 2024 19:47:09 +0000 (20:47 +0100)
app/TwitchBot/TwitchChatBot.php

index a3ffe2dbed0970ef60a29080b718b205dcfc0287..f43dba7a35e18ad39b74ed73a3662dcc0528e8cd 100644 (file)
@@ -249,6 +249,13 @@ class TwitchChatBot extends TwitchBot {
                        ->inRandomOrder();
        }
 
+       private function randomChat(Channel $channel) {
+               $line = $this->queryChatlog($channel)
+                       ->whereIn('classification', ['hi', 'hype', 'lol', 'pog', 'unclassified'])
+                       ->first();
+               return $line->text_content;
+       }
+
        private function randomContextualNumber(Channel $channel) {
                $notes = $this->getNotes($channel);
                $min = 100000;
@@ -325,9 +332,11 @@ class TwitchChatBot extends TwitchBot {
                $this->getNotes($channel);
                $this->notes[$channel->id]['last_read'] = time();
                ++$this->notes[$channel->id]['read_since_last_write'];
-               $this->notes[$channel->id]['latest_msgs'][] = $msg->getText();
-               if (count($this->notes[$channel->id]['latest_msgs']) > 10) {
-                       array_shift($this->notes[$channel->id]['latest_msgs']);
+               if (!$msg->isKnownBot() && !$msg->scanForSpam()) {
+                       $this->notes[$channel->id]['latest_msgs'][] = $msg->getText();
+                       if (count($this->notes[$channel->id]['latest_msgs']) > 10) {
+                               array_shift($this->notes[$channel->id]['latest_msgs']);
+                       }
                }
        }