X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FDiscordBotCommand.php;h=7d7c3a88da96b6761a74e943474dd5ef1e6aaa78;hb=ac6921da72ff4b0beab9e5f1308788a55aae3ad9;hp=8a74d4342e11046c7c56f5fd41ea38a43810e229;hpb=66e57699b8055ef8a65a1be55b05301c811090bb;p=alttp.git diff --git a/app/Models/DiscordBotCommand.php b/app/Models/DiscordBotCommand.php index 8a74d43..7d7c3a8 100644 --- a/app/Models/DiscordBotCommand.php +++ b/app/Models/DiscordBotCommand.php @@ -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); }