From: Daniel Karbach Date: Sat, 23 Mar 2024 19:47:09 +0000 (+0100) Subject: slightly better chat bot msg selection X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=aff6a3e616b822dc6bff00b8b4acfee8b33f19a0;p=alttp.git slightly better chat bot msg selection --- diff --git a/app/TwitchBot/TwitchChatBot.php b/app/TwitchBot/TwitchChatBot.php index a3ffe2d..f43dba7 100644 --- a/app/TwitchBot/TwitchChatBot.php +++ b/app/TwitchBot/TwitchChatBot.php @@ -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']); + } } }