X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=app%2FModels%2FDiscordBotCommand.php;h=ca8a0308ce0d96d37cd3d902b827cef327bb0925;hb=de6fd9ef047bda248eebec0c135f7487e781a7ae;hp=8a74d4342e11046c7c56f5fd41ea38a43810e229;hpb=66e57699b8055ef8a65a1be55b05301c811090bb;p=alttp.git diff --git a/app/Models/DiscordBotCommand.php b/app/Models/DiscordBotCommand.php index 8a74d43..ca8a030 100644 --- a/app/Models/DiscordBotCommand.php +++ b/app/Models/DiscordBotCommand.php @@ -13,6 +13,18 @@ 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 function tournament() { return $this->belongsTo(Tournament::class); }