]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/DiscordBotCommand.php
fix reevaluate command class name
[alttp.git] / app / Models / DiscordBotCommand.php
index 8a74d4342e11046c7c56f5fd41ea38a43810e229..7d7c3a88da96b6761a74e943474dd5ef1e6aaa78 100644 (file)
@@ -13,6 +13,28 @@ class DiscordBotCommand extends Model
 {
        use HasFactory;
 
+       public static function queueResult(Result $result) {
+               $cmd = new DiscordBotCommand();
+               $cmd->tournament_id = $result->round->tournament_id;
+               $cmd->command = 'result';
+               $cmd->parameters = [
+                       'round' => $result->round_id,
+                       'user' => $result->user_id,
+               ];
+               $cmd->status = 'pending';
+               $cmd->save();
+       }
+
+       public static function syncUser($user_id) {
+               $cmd = new DiscordBotCommand();
+               $cmd->command = 'sync-user';
+               $cmd->parameters = [
+                       'user' => $user_id,
+               ];
+               $cmd->status = 'pending';
+               $cmd->save();
+       }
+
        public function tournament() {
                return $this->belongsTo(Tournament::class);
        }