- $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();