X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FTwitchBot%2FTwitchChatBot.php;h=831bf5ca4560acf7f09f909079d4dcbea787c324;hb=249e06be11d0f7778d99956c87d4f0a8ac7e69f7;hp=a3ffe2dbed0970ef60a29080b718b205dcfc0287;hpb=c85a9e1de80d4a68e9b1b730e60906475682455b;p=alttp.git diff --git a/app/TwitchBot/TwitchChatBot.php b/app/TwitchBot/TwitchChatBot.php index a3ffe2d..831bf5c 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 (!ChatLog::isKnownBot($msg->nick) && !ChatLog::spammyText($msg->getText())) { + $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']); + } } }