Merge pull request #72 from OpzekerIT/dev

bug fix custom game discord stats
This commit is contained in:
Lanta 2023-10-11 11:11:44 +02:00 committed by GitHub
commit 0f6c5f13c3

View file

@ -73,9 +73,15 @@ foreach ($winid in $new_win_matches) {
if ($null -eq $winid) { continue }
$winmatches = $player_matches.player_matches | Where-Object { $_.id -eq $winid }
$telemetry = (invoke-webrequest @($winmatches.telemetry_url)[0]).content | convertfrom-json | where-object { ($_._T -eq 'LOGPLAYERTAKEDAMAGE') -or ($_._T -eq 'LOGPLAYERKILLV2') }
$players = $winmatches.stats.name
$players = ($winmatches | where-object {$_.stats.winPlace -eq 1}).stats.name
$match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$winid" -Method GET -Headers $headers
if($winmatches[0].matchType -eq 'custom'){
$all_winners_of_match = $match_stats.included.attributes.stats
}else{
$all_winners_of_match = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 })
}
send-discord -content ":chicken: :chicken: **WINNER WINNER CHICKEN DINNER!!** :chicken: :chicken:"
send-discord -content ":partying_face::partying_face::partying_face: Gefeliciteerd $($players -join ', ') :partying_face::partying_face::partying_face:"
$match_settings = @"
@ -83,10 +89,12 @@ foreach ($winid in $new_win_matches) {
match mode $($winmatches[0].gameMode)
match type $($winmatches[0].matchType)
map $($map_map[$winmatches[0].mapName])
id $($winmatches[0].id)
``````
"@
send-discord -content $match_settings
foreach ($player in $all_winners_of_match.name) {
if($null -eq $player){continue}
write-output "creating table for player $player"
$win_stats += [PSCustomObject]@{
Name = $player