--- /dev/null
+<?php
+
+namespace App\Console\Commands;
+
+use App\Models\Channel;
+use Illuminate\Console\Command;
+use Illuminate\Http\Client\RequestException;
+use Illuminate\Support\Facades\Http;
+
+class GuessingClean extends Command {
+
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'guessing:clean';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = 'Cancel orphaned guessing games';
+
+ /**
+ * Execute the console command.
+ *
+ * @return int
+ */
+ public function handle()
+ {
+ $channels = Channel
+ ::whereNotNull('guessing_start')
+ ->where('guessing_start', '<', now()
+ ->sub(4, 'hour'))
+ ->get();
+ foreach ($channels as $channel) {
+ $this->line($channel->title);
+ $channel->guessing_start = null;
+ $channel->guessing_end = null;
+ $channel->save();
+ }
+ return Command::SUCCESS;
+ }
+
+}
$schedule->command('sync:avatars')->everyFiveMinutes();
$schedule->command('sync:racetime')->everyFiveMinutes();
$schedule->command('chat:evaluate 100')->everyMinute();
+ $schedule->command('guessing:clean')->everyFifteenMinutes();
}
/**