--- /dev/null
+<?php
+
+namespace App\Console\Commands;
+
+use App\Models\ChatLib;
+use App\Models\ChatLog;
+use Illuminate\Console\Command;
+
+class ChatlibDatabase extends Command {
+
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'chatlib:database';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = 'Updates the ChatLib database';
+
+ /**
+ * Execute the console command.
+ *
+ * @return int
+ */
+ public function handle() {
+ $db = new ChatLib();
+
+ ChatLog::where('banned', '=', false)
+ ->whereNotNull('evaluated_at')
+ ->chunk(500, function ($msgs) use ($db) {
+ foreach ($msgs as $msg) {
+ $db->addMessage($msg);
+ }
+ });
+
+ $db->compile();
+
+ for ($i = 0; $i < 50; ++$i) {
+ $this->line($db->generate());
+ }
+
+ return 0;
+ }
+
+}
+
+?>