X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=app%2FTwitchBot%2FTwitchChatBot.php;fp=app%2FTwitchBot%2FTwitchChatBot.php;h=a3ffe2dbed0970ef60a29080b718b205dcfc0287;hb=c85a9e1de80d4a68e9b1b730e60906475682455b;hp=8aac9d70bd66652eee0edad17161007732ad0586;hpb=ff4c89c3dd1a92697d0f7dbd048d2e91a1a45595;p=alttp.git diff --git a/app/TwitchBot/TwitchChatBot.php b/app/TwitchBot/TwitchChatBot.php index 8aac9d7..a3ffe2d 100644 --- a/app/TwitchBot/TwitchChatBot.php +++ b/app/TwitchBot/TwitchChatBot.php @@ -190,6 +190,17 @@ class TwitchChatBot extends TwitchBot { return $pogs > 2; } + private function checkForSalute(Channel $channel) { + $notes = $this->getNotes($channel); + $o7s = 0; + foreach ($notes['latest_msgs'] as $text) { + if (ChatLog::classify($text) == 'o7') { + ++$o7s; + } + } + return $o7s > 2; + } + private function contextualMsg(Channel $channel) { $last = $this->getNote($channel, 'last_special'); if ($last != 'gg' && $this->checkForGG($channel)) { @@ -220,6 +231,10 @@ class TwitchChatBot extends TwitchBot { $this->setNote($channel, 'last_special', 'pog'); return $this->randomOfClass($channel, 'pog'); } + if ($last != 'o7' && $this->checkForSalute($channel)) { + $this->setNote($channel, 'last_special', 'o7'); + return $this->randomOfClass($channel, 'o7'); + } return false; }