X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FTwitchBot%2FTwitchChatBot.php;h=7a6eb1c1357cb9c59d12c2bfc9af81467383ae53;hb=06fbdc15c8db57590c9b6a38ee1f00d5f349cff9;hp=0469fbc324ccf55abeb230bad13b009fd4aeb4bf;hpb=85879ea0c27ce6506919e2c083a139c470c0952c;p=alttp.git diff --git a/app/TwitchBot/TwitchChatBot.php b/app/TwitchBot/TwitchChatBot.php index 0469fbc..7a6eb1c 100644 --- a/app/TwitchBot/TwitchChatBot.php +++ b/app/TwitchBot/TwitchChatBot.php @@ -20,6 +20,7 @@ class TwitchChatBot extends TwitchBot { ]; } $this->startTimer(); + $this->listenCommands(); } public function joinChannels() { @@ -77,7 +78,15 @@ class TwitchChatBot extends TwitchBot { } private function randomMsg(Channel $channel) { - $line = ChatLog::where('type', '=', 'chat')->where('banned', '=', false)->inRandomOrder()->first(); + $line = ChatLog::where('type', '=', 'chat') + ->where('banned', '=', false) + ->where('created_at', '<', now()->sub(1, 'day')) + ->where(function ($query) use ($channel) { + $query->whereNull('detected_language'); + $query->orWhereIn('detected_language', $channel->languages); + }) + ->inRandomOrder() + ->first(); return $line->text_content; } @@ -86,7 +95,7 @@ class TwitchChatBot extends TwitchBot { } private function randomWaitTime(Channel $channel) { - return random_int(1, 1800); + return random_int(1, 900); } private function tagChannelRead(Channel $channel) {