Merge pull request #27 from OpzekerIT/dev
New reporting system to discord
This commit is contained in:
commit
8f48cd77c3
8 changed files with 3757 additions and 1760 deletions
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
|
|
@ -33,7 +33,7 @@ jobs:
|
|||
- name: LINK TO WEBSITE
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
|
||||
echo "Visit the production site at: https://lanta.eu/DTCH/"
|
||||
echo "Visit the production site at: https://dtch.online"
|
||||
else
|
||||
echo "Visit the dev site at: https://lanta.eu/DTCH_DEV/"
|
||||
echo "Visit the dev site at: https://dev.dtch.online"
|
||||
fi
|
||||
|
|
|
|||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
|||
config/config.php
|
||||
data/telemetry_cache/*
|
||||
temp/*
|
||||
temp/*
|
||||
discord/config.php
|
||||
|
|
@ -3,13 +3,13 @@
|
|||
"type": "player",
|
||||
"id": "account.3e75bc1560664817900f3747e2270659",
|
||||
"attributes": {
|
||||
"patchVersion": "",
|
||||
"banType": "Innocent",
|
||||
"clanId": "clan.d67f3a9805414aa7b78a1f122a7de776",
|
||||
"name": "Lanta01",
|
||||
"stats": null,
|
||||
"titleId": "pubg",
|
||||
"shardId": "steam"
|
||||
"shardId": "steam",
|
||||
"patchVersion": ""
|
||||
},
|
||||
"relationships": {
|
||||
"assets": {
|
||||
|
|
@ -17,6 +17,38 @@
|
|||
},
|
||||
"matches": {
|
||||
"data": [
|
||||
{
|
||||
"type": "match",
|
||||
"id": "31725296-d259-43d8-ad99-9b57a71fbe4b"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "e010dbd6-ac3c-475e-84d3-7674613b4454"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "8c1f5639-c42e-4941-80b4-5592b447a3de"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "6e9b5a63-a33c-4c0c-a2ff-6762ca798e33"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "23672423-cbf6-4ff6-83bf-563b8016c0aa"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "d994e2c5-de88-4225-9f67-b5464b218953"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "158112a8-49cc-4c4b-bc7b-989a986fb654"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "edd0fdc7-4130-474f-ab66-bac52ec4a836"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "bbf981b7-c33e-446a-a1ef-9500bb833621"
|
||||
|
|
@ -296,33 +328,13 @@
|
|||
{
|
||||
"type": "match",
|
||||
"id": "ba1d8044-4c68-4d26-913c-2c941d4e664a"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "c28effbc-c886-4763-9ec7-556f29319f78"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "c95a0c9a-359a-4b22-a65d-e809b24ea6ad"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "b1364290-c180-4b00-8846-342bd96eafda"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "63e93f32-72dd-494a-97dc-dce43832b18e"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "05f81d57-7bec-4b79-bb77-bddfd4532911"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": "https://api.pubg.com/shards/steam/players/account.3e75bc1560664817900f3747e2270659",
|
||||
"schema": ""
|
||||
"schema": "",
|
||||
"self": "https://api.pubg.com/shards/steam/players/account.3e75bc1560664817900f3747e2270659"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -338,8 +350,51 @@
|
|||
"clanId": "clan.d67f3a9805414aa7b78a1f122a7de776"
|
||||
},
|
||||
"relationships": {
|
||||
"assets": {
|
||||
"data": []
|
||||
},
|
||||
"matches": {
|
||||
"data": [
|
||||
{
|
||||
"type": "match",
|
||||
"id": "8c1f5639-c42e-4941-80b4-5592b447a3de"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "6e9b5a63-a33c-4c0c-a2ff-6762ca798e33"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "23672423-cbf6-4ff6-83bf-563b8016c0aa"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "d994e2c5-de88-4225-9f67-b5464b218953"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "158112a8-49cc-4c4b-bc7b-989a986fb654"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "edd0fdc7-4130-474f-ab66-bac52ec4a836"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "92aa8c54-b2ef-4995-a335-6df528073a4d"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "3cf6e407-1e9b-4fe9-aecc-182136aa83a3"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "0a4a2b7e-bd57-426a-8f74-76e662815711"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "a5cea16d-5329-4de7-92d4-4fa969e3521a"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "206202ac-789a-4cf3-8c71-993de77abba8"
|
||||
|
|
@ -549,9 +604,6 @@
|
|||
"id": "ba1d8044-4c68-4d26-913c-2c941d4e664a"
|
||||
}
|
||||
]
|
||||
},
|
||||
"assets": {
|
||||
"data": []
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
|
|
@ -563,13 +615,13 @@
|
|||
"type": "player",
|
||||
"id": "account.4622686b9d9f44209d64503b18d96a1d",
|
||||
"attributes": {
|
||||
"name": "TaGMoM",
|
||||
"stats": null,
|
||||
"titleId": "pubg",
|
||||
"shardId": "steam",
|
||||
"patchVersion": "",
|
||||
"banType": "Innocent",
|
||||
"clanId": "clan.d67f3a9805414aa7b78a1f122a7de776",
|
||||
"name": "TaGMoM",
|
||||
"stats": null
|
||||
"clanId": "clan.d67f3a9805414aa7b78a1f122a7de776"
|
||||
},
|
||||
"relationships": {
|
||||
"assets": {
|
||||
|
|
@ -577,6 +629,18 @@
|
|||
},
|
||||
"matches": {
|
||||
"data": [
|
||||
{
|
||||
"type": "match",
|
||||
"id": "7653f62b-f897-4c83-82d9-8f1711cfd7e8"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "0729906e-a5d8-4b5c-a27e-0a07b85a3aae"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "a5cea16d-5329-4de7-92d4-4fa969e3521a"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "f625262b-b789-40e2-9c88-5220a354452b"
|
||||
|
|
@ -645,13 +709,13 @@
|
|||
"type": "player",
|
||||
"id": "account.b39f1fc9e49b471f8cd9ccce15ad9676",
|
||||
"attributes": {
|
||||
"stats": null,
|
||||
"titleId": "pubg",
|
||||
"shardId": "steam",
|
||||
"patchVersion": "",
|
||||
"banType": "Innocent",
|
||||
"clanId": "clan.d67f3a9805414aa7b78a1f122a7de776",
|
||||
"name": "r00tger",
|
||||
"stats": null,
|
||||
"titleId": "pubg"
|
||||
"name": "r00tger"
|
||||
},
|
||||
"relationships": {
|
||||
"assets": {
|
||||
|
|
@ -675,13 +739,13 @@
|
|||
"type": "player",
|
||||
"id": "account.2322e3d471a5418696b6f14271afd83a",
|
||||
"attributes": {
|
||||
"stats": null,
|
||||
"titleId": "pubg",
|
||||
"shardId": "steam",
|
||||
"patchVersion": "",
|
||||
"banType": "Innocent",
|
||||
"clanId": "clan.d67f3a9805414aa7b78a1f122a7de776",
|
||||
"name": "Masistuta"
|
||||
"name": "Masistuta",
|
||||
"stats": null,
|
||||
"titleId": "pubg",
|
||||
"shardId": "steam"
|
||||
},
|
||||
"relationships": {
|
||||
"assets": {
|
||||
|
|
@ -689,6 +753,26 @@
|
|||
},
|
||||
"matches": {
|
||||
"data": [
|
||||
{
|
||||
"type": "match",
|
||||
"id": "31725296-d259-43d8-ad99-9b57a71fbe4b"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "e010dbd6-ac3c-475e-84d3-7674613b4454"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "8c1f5639-c42e-4941-80b4-5592b447a3de"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "6e9b5a63-a33c-4c0c-a2ff-6762ca798e33"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "23672423-cbf6-4ff6-83bf-563b8016c0aa"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "4929ee06-5e9c-4ebb-a021-3c94ebae0ae9"
|
||||
|
|
@ -860,17 +944,13 @@
|
|||
{
|
||||
"type": "match",
|
||||
"id": "1b841795-28a8-4a56-a86e-fe23b28c7333"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "3287ea91-9545-4bde-ac07-c1871330545b"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"links": {
|
||||
"self": "https://api.pubg.com/shards/steam/players/account.2322e3d471a5418696b6f14271afd83a",
|
||||
"schema": ""
|
||||
"schema": "",
|
||||
"self": "https://api.pubg.com/shards/steam/players/account.2322e3d471a5418696b6f14271afd83a"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -891,6 +971,34 @@
|
|||
},
|
||||
"matches": {
|
||||
"data": [
|
||||
{
|
||||
"type": "match",
|
||||
"id": "6e9b5a63-a33c-4c0c-a2ff-6762ca798e33"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "23672423-cbf6-4ff6-83bf-563b8016c0aa"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "d994e2c5-de88-4225-9f67-b5464b218953"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "158112a8-49cc-4c4b-bc7b-989a986fb654"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "dcdf06f2-4a80-43dd-b193-ae2abf0c9645"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "0a4a2b7e-bd57-426a-8f74-76e662815711"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "7653f62b-f897-4c83-82d9-8f1711cfd7e8"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "16fdb69f-a891-4a90-8b2e-709c89368c31"
|
||||
|
|
@ -1066,50 +1174,6 @@
|
|||
{
|
||||
"type": "match",
|
||||
"id": "f2475dd2-18e3-4cce-84f7-a2f9496c4c5a"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "e579a31c-f9b7-46a9-8195-1d4b6f92a90d"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "d964b25e-c5c3-46d3-adf5-aac3a9d6bdd2"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "317735c4-851e-4b08-beb5-a2ebd2619d6a"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "a268d2e3-6382-41a3-ae51-e60e0dc350ee"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "c9eb62f8-574e-42b6-ad15-72241d8b1066"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "67e76bec-9cb3-4d69-82fc-680ef5b4379a"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "c28effbc-c886-4763-9ec7-556f29319f78"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "c95a0c9a-359a-4b22-a65d-e809b24ea6ad"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "b1364290-c180-4b00-8846-342bd96eafda"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "63e93f32-72dd-494a-97dc-dce43832b18e"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "05f81d57-7bec-4b79-bb77-bddfd4532911"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1123,13 +1187,13 @@
|
|||
"type": "player",
|
||||
"id": "account.0026f9f08725424fa477ba986991e064",
|
||||
"attributes": {
|
||||
"banType": "Innocent",
|
||||
"clanId": "clan.d67f3a9805414aa7b78a1f122a7de776",
|
||||
"name": "Jimbo_The_One",
|
||||
"stats": null,
|
||||
"titleId": "pubg",
|
||||
"shardId": "steam",
|
||||
"patchVersion": ""
|
||||
"patchVersion": "",
|
||||
"banType": "Innocent",
|
||||
"clanId": "clan.d67f3a9805414aa7b78a1f122a7de776",
|
||||
"name": "Jimbo_The_One"
|
||||
},
|
||||
"relationships": {
|
||||
"assets": {
|
||||
|
|
@ -1137,6 +1201,30 @@
|
|||
},
|
||||
"matches": {
|
||||
"data": [
|
||||
{
|
||||
"type": "match",
|
||||
"id": "e010dbd6-ac3c-475e-84d3-7674613b4454"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "8c1f5639-c42e-4941-80b4-5592b447a3de"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "6e9b5a63-a33c-4c0c-a2ff-6762ca798e33"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "23672423-cbf6-4ff6-83bf-563b8016c0aa"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "d994e2c5-de88-4225-9f67-b5464b218953"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "158112a8-49cc-4c4b-bc7b-989a986fb654"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "2b9c4668-e2de-41d0-ab5a-db39ded3ad4c"
|
||||
|
|
@ -1308,6 +1396,10 @@
|
|||
{
|
||||
"type": "match",
|
||||
"id": "696d9324-fa2c-461c-b35f-1c68d2bb6492"
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"id": "696d9324-fa2c-461c-b35f-1c68d2bb6497"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1321,13 +1413,13 @@
|
|||
"type": "player",
|
||||
"id": "account.56ea56d593e440a48c3eaa5613b7eaa0",
|
||||
"attributes": {
|
||||
"patchVersion": "",
|
||||
"banType": "Innocent",
|
||||
"clanId": "clan.d67f3a9805414aa7b78a1f122a7de776",
|
||||
"name": "Shepherders",
|
||||
"stats": null,
|
||||
"titleId": "pubg",
|
||||
"shardId": "steam",
|
||||
"patchVersion": ""
|
||||
"shardId": "steam"
|
||||
},
|
||||
"relationships": {
|
||||
"assets": {
|
||||
|
|
@ -1351,8 +1443,8 @@
|
|||
}
|
||||
},
|
||||
"links": {
|
||||
"schema": "",
|
||||
"self": "https://api.pubg.com/shards/steam/players/account.56ea56d593e440a48c3eaa5613b7eaa0"
|
||||
"self": "https://api.pubg.com/shards/steam/players/account.56ea56d593e440a48c3eaa5613b7eaa0",
|
||||
"schema": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
94
discord/report_new_matches.ps1
Normal file
94
discord/report_new_matches.ps1
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
if ($PSScriptRoot.length -eq 0) {
|
||||
$scriptroot = Get-Location
|
||||
}
|
||||
else {
|
||||
$scriptroot = $PSScriptRoot
|
||||
}
|
||||
|
||||
|
||||
$fileContent = Get-Content -Path "$scriptroot/../discord/config.php" -Raw
|
||||
|
||||
# Use regex to match the apiKey value
|
||||
if ($fileContent -match "\`$webhookurl\s*=\s*\'([^\']+)\'") {
|
||||
$webhookurl = $matches[1]
|
||||
}
|
||||
else {
|
||||
Write-Output "API Key not found"
|
||||
}
|
||||
|
||||
function send-discord {
|
||||
param (
|
||||
$content
|
||||
)
|
||||
$payload = [PSCustomObject]@{
|
||||
|
||||
content = $content
|
||||
|
||||
}
|
||||
|
||||
Invoke-RestMethod -Uri $webhookurl -Method Post -Body ($payload | ConvertTo-Json) -ContentType 'Application/Json'
|
||||
}
|
||||
|
||||
$player_matches = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100
|
||||
$new_win_matches = $player_matches.new_win_matches
|
||||
$win_stats = @()
|
||||
|
||||
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
|
||||
$players = $winmatches.stats.name
|
||||
|
||||
send-discord -content ":chicken: :chicken: CHICKEN CHICKEN WINNER DINNER!! :chicken: :chicken:"
|
||||
send-discord -content "Gefeliciteerd $($players -join ' ')"
|
||||
send-discord -content "match Type $($winmatches[0].matchType)"
|
||||
send-discord -content "map $($winmatches[0].mapName)"
|
||||
|
||||
foreach ($player in $players) {
|
||||
|
||||
$win_stats += [PSCustomObject]@{
|
||||
playername = $player
|
||||
dmg_h = (($telemetry | where-object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' } | where-object { $_.attacker.name -eq $player } | where-object { $_.victim.accountId -notlike "ai.*" } ).damage | Measure-Object -Sum).Sum
|
||||
dmg = ($winmatches.stats | Where-Object { $_.name -eq $player }).damageDealt
|
||||
k_h = (($telemetry | where-object { $_._T -eq 'LOGPLAYERKILLV2' } | where-object { $_.killer.name -eq $player } | where-object { $_.victim.accountId -notlike "ai.*" } )).count
|
||||
k_a = ($winmatches.stats | Where-Object { $_.name -eq $player }).kills
|
||||
k_t = ($winmatches.stats | Where-Object { $_.name -eq $player }).teamKills
|
||||
t_serv = ($winmatches.stats | Where-Object { $_.name -eq $player }).timeSurvived
|
||||
}
|
||||
}
|
||||
|
||||
$content_winstats = '```' + ($win_stats | Format-Table | out-string) + '```'
|
||||
send-discord -content $content_winstats
|
||||
|
||||
$legenda = "
|
||||
|
||||
Legenda:
|
||||
|
||||
dmg_h = Damege tegen echte spelers
|
||||
dmg = Alle dmg zowel echte spelers als ai
|
||||
k_h = Echte spelers die ge gekilled hebt
|
||||
K_a = alle spelers kills
|
||||
t_serv = time survived in secondes
|
||||
"
|
||||
|
||||
send-discord -content $legenda
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($item in $player_matches) {
|
||||
if ($item.PSObject.Properties.Name -contains "new_win_matches") {
|
||||
$item.new_win_matches = $null
|
||||
}
|
||||
}
|
||||
|
||||
# Convert back to JSON (optional)
|
||||
$newJson = $player_matches | ConvertTo-Json -Depth 100
|
||||
|
||||
# Display the updated JSON
|
||||
$newJson | out-file "$scriptroot/../data/player_matches.json"
|
||||
101
discord/report_to_discord.ps1
Normal file
101
discord/report_to_discord.ps1
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
|
||||
|
||||
if ($PSScriptRoot.length -eq 0) {
|
||||
$scriptroot = Get-Location
|
||||
}
|
||||
else {
|
||||
$scriptroot = $PSScriptRoot
|
||||
}
|
||||
|
||||
|
||||
$fileContent = Get-Content -Path "$scriptroot/../discord/config.php" -Raw
|
||||
|
||||
# Use regex to match the apiKey value
|
||||
if ($fileContent -match "\`$webhookurl\s*=\s*\'([^\']+)\'") {
|
||||
$webhookurl = $matches[1]
|
||||
}
|
||||
else {
|
||||
Write-Output "API Key not found"
|
||||
}
|
||||
|
||||
$stats = get-content "$scriptroot/../data/player_last_stats.json" | convertfrom-json
|
||||
|
||||
foreach ($player in $stats) {
|
||||
if ($player.KD_H -eq "Infinity") {
|
||||
$player.KD_H = 0
|
||||
}
|
||||
|
||||
if ($player.KD_ALL -eq "Infinity") {
|
||||
$player.KD_ALL = 0
|
||||
}
|
||||
}
|
||||
|
||||
$most_kills = @{
|
||||
'name' = (($stats | Sort-Object kills -Descending)[0].playername)
|
||||
'stat' = (($stats | Sort-Object kills -Descending)[0].kills)
|
||||
}
|
||||
$most_deaths = @{
|
||||
'name' = (($stats | Sort-Object deaths -Descending)[0].playername)
|
||||
'stat' = (($stats | Sort-Object deaths -Descending)[0].deaths)
|
||||
}
|
||||
$most_humankills = @{
|
||||
'name' = (($stats | Sort-Object humankills -Descending)[0].playername)
|
||||
'stat' = (($stats | Sort-Object humankills -Descending)[0].humankills)
|
||||
}
|
||||
$most_KD_H = @{
|
||||
'name' = (($stats | Sort-Object KD_H -Descending)[0].playername)
|
||||
'stat' = (($stats | Sort-Object KD_H -Descending)[0].KD_H)
|
||||
}
|
||||
$most_KD_ALL = @{
|
||||
'name' = (($stats | Sort-Object KD_ALL -Descending)[0].playername)
|
||||
'stat' = (($stats | Sort-Object KD_ALL -Descending)[0].KD_ALL)
|
||||
}
|
||||
$most_matches = @{
|
||||
'name' = (($stats | Sort-Object matches -Descending)[0].playername)
|
||||
'stat' = (($stats | Sort-Object matches -Descending)[0].matches)
|
||||
}
|
||||
|
||||
$content = "
|
||||
:rocket: Het 2 wekelijkse raportje :rocket:
|
||||
|
||||
Hey toppers!
|
||||
|
||||
Laten we eens duiken in de cijfers van onze supergamers van de afgelopen twee weken:
|
||||
|
||||
:dart: Meeste Kills:
|
||||
Hats off voor **$($most_kills['name'])**! Met **$($most_kills['stat'])** kills is hij/zij onze scherpschutter van de week!
|
||||
|
||||
:skull_crossbones: Meeste Deaths:
|
||||
Oei, oei, oei... **$($most_deaths['name'])** is helaas het vaakst naar het hiernamaals gestuurd met **$($most_deaths['stat'])** deaths. Kop op, volgende keer beter!
|
||||
|
||||
:robot: Meeste Humankills:
|
||||
Watch out! We hebben een Terminator onder ons. Hoedje af voor **$($most_humankills['name'])** met **$($most_humankills['stat'])** humankills!
|
||||
|
||||
:bar_chart: Beste KD Ratio (Alle vijanden):
|
||||
De onevenaarbare **$($most_KD_ALL['name'])** heeft een KD van **$($most_KD_ALL['stat'])** ! Niet slecht, toch? 😉
|
||||
|
||||
:adult: Beste KD Ratio (Alleen menselijke spelers):
|
||||
Opgelet, gamers! **$($most_KD_H['name'])** heeft een KD van **$($most_KD_H['stat'])** tegen andere spelers! Wie daagt hem/haar uit?
|
||||
|
||||
:video_game: Meeste Matches:
|
||||
Onze meest toegewijde gamer, **$($most_matches['name'])**, heeft maar liefst **$($most_matches['stat'])** matches gespeeld. Ga zo door!
|
||||
|
||||
Da's het voor nu, gamers! Blijf schieten, blijf lachen en tot het volgende rapportje!
|
||||
|
||||
High fives en knuffels (virtueel, natuurlijk),
|
||||
Het Gaming Team
|
||||
|
||||
Meer stats zijn hier te vinden : https://lanta.eu/DTCH
|
||||
"
|
||||
|
||||
$content
|
||||
|
||||
|
||||
|
||||
$payload = [PSCustomObject]@{
|
||||
|
||||
content = $content
|
||||
|
||||
}
|
||||
|
||||
Invoke-RestMethod -Uri $webhookurl -Method Post -Body ($payload | ConvertTo-Json) -ContentType 'Application/Json'
|
||||
|
|
@ -34,10 +34,10 @@ $headers = @{
|
|||
'accept' = 'application/vnd.api+json'
|
||||
'Authorization' = "$apiKey"
|
||||
}
|
||||
|
||||
$player_matches = @()
|
||||
$player_data = get-content "$scriptroot/../data/player_data.json" | convertfrom-json -Depth 100
|
||||
|
||||
$player_matches = @()
|
||||
|
||||
foreach ($player in $player_data) {
|
||||
$lastMatches = $player.relationships.matches.data.id #| Select-Object -First 10
|
||||
$playermatches = @()
|
||||
|
|
@ -45,13 +45,13 @@ foreach ($player in $player_data) {
|
|||
Write-Host "Getting match for $($player.attributes.name) match: $match "
|
||||
$stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$match" -Method GET -Headers $headers
|
||||
$playermatches += [PSCustomObject]@{
|
||||
stats = $stats.included.ATTRIBUTES.stats | where-object {$_.name -eq $player.attributes.name}
|
||||
matchType = $stats.data.attributes.matchtype
|
||||
gameMode = $stats.data.attributes.gameMode
|
||||
createdAt = $stats.data.attributes.createdAt
|
||||
mapName = $stats.data.attributes.mapName
|
||||
winPlace = $stats.data.attributes.winPlace
|
||||
telemetry_url = ($stats.included.attributes | Where-Object {$_.name -eq 'telemetry'}).URL
|
||||
stats = $stats.included.ATTRIBUTES.stats | where-object { $_.name -eq $player.attributes.name }
|
||||
matchType = $stats.data.attributes.matchtype
|
||||
gameMode = $stats.data.attributes.gameMode
|
||||
createdAt = $stats.data.attributes.createdAt
|
||||
mapName = $stats.data.attributes.mapName
|
||||
telemetry_url = ($stats.included.attributes | Where-Object { $_.name -eq 'telemetry' }).URL
|
||||
id = $stats.data.id
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -66,6 +66,20 @@ foreach ($player in $player_data) {
|
|||
|
||||
}
|
||||
|
||||
if (test-path "$scriptroot/../data/player_matches.json") {
|
||||
$old_player_data = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100
|
||||
$new_ids = ($player_matches.player_matches | where-object {$_.stats.winplace -eq 1}).id
|
||||
$old_ids = ($old_player_data.player_matches | where-object {$_.stats.winplace -eq 1}).id
|
||||
$new_win_matches = ((Compare-Object -ReferenceObject $old_ids -DifferenceObject $new_ids) | Where-Object { $_.SideIndicator -eq '=>' }).InputObject | Select-Object -Unique
|
||||
$new_win_matches = $old_player_data.new_win_matches + $new_win_matches | Select-Object -Unique
|
||||
$player_matches += [PSCustomObject]@{
|
||||
new_win_matches = $new_win_matches
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$currentDateTime = Get-Date
|
||||
|
||||
# Get current timezone
|
||||
|
|
@ -74,9 +88,8 @@ $currentTimezone = (Get-TimeZone).Id
|
|||
# Format and parse the information into a string
|
||||
$formattedString = "$currentDateTime - Time Zone: $currentTimezone"
|
||||
# Output the formatted string
|
||||
|
||||
|
||||
|
||||
$player_matches| Add-Member -Name "updated" -MemberType NoteProperty -Value $formattedString
|
||||
$playermatches += [PSCustomObject]@{
|
||||
updated = $formattedString
|
||||
}
|
||||
|
||||
$player_matches | convertto-json -Depth 100 | out-file "$scriptroot/../data/player_matches.json"
|
||||
Loading…
Add table
Add a link
Reference in a new issue