X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FTwitchBot%2FTwitchChatBot.php;h=479a9ab5eef2ebd5e793c2421e5959e9f4f972bc;hb=13ffde5b2abcf831af9c794044350737066c5933;hp=420e93704490fe804e037697fb070883547b3846;hpb=d7cbc88ac5eefd3d0e2b0819868676e55d43e7ab;p=alttp.git diff --git a/app/TwitchBot/TwitchChatBot.php b/app/TwitchBot/TwitchChatBot.php index 420e937..479a9ab 100644 --- a/app/TwitchBot/TwitchChatBot.php +++ b/app/TwitchBot/TwitchChatBot.php @@ -132,7 +132,7 @@ class TwitchChatBot extends TwitchBot { } private function contextualMsg(Channel $channel) { - $last = $this->getNote($channel, 'last_special'); + $last = $this->getLastSpecialSent($channel); $classifications = $this->collectClassifications($channel); $count_quotas = [ 'gg' => 2, @@ -140,9 +140,11 @@ class TwitchChatBot extends TwitchBot { 'hi' => 2, 'hype' => 2, 'lol' => 2, + 'love' => 2, 'number' => 2, 'pog' => 2, 'o7' => 2, + 'wtf' => 2, ]; $time_quotas = [ 'gg' => 600, @@ -150,11 +152,14 @@ class TwitchChatBot extends TwitchBot { 'hi' => 60, 'hype' => 60, 'lol' => 60, + 'love' => 60, 'number' => 300, 'pog' => 60, 'o7' => 300, + 'wtf' => 60, ]; foreach ($classifications as $classification => $count) { + if ($classification == $last) continue; if (!isset($count_quotas[$classification]) || $count < $count_quotas[$classification]) continue; if (!isset($time_quotas[$classification]) || $this->getTimeSinceSpecial($channel, $classification) < $time_quotas[$classification]) continue; $this->tagChannelSpecialSent($channel, $classification); @@ -190,6 +195,9 @@ class TwitchChatBot extends TwitchBot { } private function randomLaughter(Channel $channel) { + if (!random_int(0, 2)) { + return $channel->randomOfClass('lol'); + } return Arr::random([ ':tf:', '4Head', @@ -200,7 +208,6 @@ class TwitchChatBot extends TwitchBot { 'GunRun', 'heh', 'Hhhehehe', - 'HypeLUL', 'Jebaited', 'Jebasted', 'KEKW', @@ -219,7 +226,6 @@ class TwitchChatBot extends TwitchBot { 'SUBprise', 'xD', 'YouDontSay', - $channel->randomOfClass('lol'), ]); } @@ -270,6 +276,19 @@ class TwitchChatBot extends TwitchBot { $this->notes[$channel->id]['last_special'][$classification] = time(); } + private function getLastSpecialSent(Channel $channel) { + $notes = $this->getNotes($channel); + $max_time = 0; + $max_classification = ''; + foreach ($notes['last_special'] as $classification => $time) { + if ($time > $max_time) { + $max_time = $time; + $max_classification = $classification; + } + } + return $max_classification; + } + private function getTimeSinceSpecial(Channel $channel, $classification) { $notes = $this->getNotes($channel); if (isset($notes['last_special'][$classification])) {