]> git.localhorst.tv Git - alttp.git/blobdiff - app/TwitchBot/TwitchChatBot.php
try to guess chat language
[alttp.git] / app / TwitchBot / TwitchChatBot.php
index 5864c5f6beeb392cb21926c5ef544224eb32e4e0..576bf04a9dfdcf8b938598b3d129f8b3f2869c8b 100644 (file)
@@ -80,6 +80,10 @@ class TwitchChatBot extends TwitchBot {
                $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;
@@ -90,7 +94,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) {