From 3cc66e66b959ec3a38d232a5fbc467f949bca61a Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 27 Sep 2023 22:06:56 +0200 Subject: [PATCH] cleanup --- update/update_clan_members.ps1 | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/update/update_clan_members.ps1 b/update/update_clan_members.ps1 index 542c0f1..075cf09 100644 --- a/update/update_clan_members.ps1 +++ b/update/update_clan_members.ps1 @@ -72,13 +72,12 @@ $playermodes = @( ) # Initialize the master hashtable $lifetimestats = @{} -$webrequestlimiter = 0 + foreach ($playmode in $playermodes) { # Fetch stats for the current playmode - if ($webrequestlimiter -le 8) { + write-output "Getting data for players $playeridstring gameode $playmode" - - + try{ $stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/seasons/lifetime/gameMode/$playmode/players?filter[playerIds]=$playeridstring" -Method GET -Headers $headers } catch { @@ -86,15 +85,7 @@ foreach ($playmode in $playermodes) { start-sleep -Seconds 61 $stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/seasons/lifetime/gameMode/$playmode/players?filter[playerIds]=$playeridstring" -Method GET -Headers $headers } - - - - $webrequestlimiter++ - } - else { - write-ouput "sleeping for 60 seconds" - $webrequestlimiter = 0 - } + # Check if the playmode doesn't exist in the hashtable, then add it if (-not $lifetimestats.ContainsKey($playmode)) {