Merge pull request #99 from OpzekerIT/dev

fixes for discord scripts
This commit is contained in:
Lanta 2023-11-13 10:31:49 +01:00 committed by GitHub
commit b3e82c5c65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View file

@ -1,6 +1,4 @@
. .\..\includes\ps1\lockfile.ps1 Start-Transcript -Path '/var/log/dtch/report_new_matches.log' -Append
new-lock
if ($PSScriptRoot.length -eq 0) { if ($PSScriptRoot.length -eq 0) {
$scriptroot = Get-Location $scriptroot = Get-Location
@ -8,6 +6,8 @@ if ($PSScriptRoot.length -eq 0) {
else { else {
$scriptroot = $PSScriptRoot $scriptroot = $PSScriptRoot
} }
. $scriptroot\..\includes\ps1\lockfile.ps1
new-lock
$fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw $fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw
@ -170,3 +170,4 @@ $newJson = $player_matches | ConvertTo-Json -Depth 100
$newJson | out-file "$scriptroot/../data/player_matches.json" $newJson | out-file "$scriptroot/../data/player_matches.json"
remove-lock remove-lock
Stop-Transcript

View file

@ -1,7 +1,4 @@
Start-Transcript -Path '/var/log/report_new_matches.log' -Append
. .\..\includes\ps1\lockfile.ps1
new-lock
if ($PSScriptRoot.length -eq 0) { if ($PSScriptRoot.length -eq 0) {
$scriptroot = Get-Location $scriptroot = Get-Location
@ -9,6 +6,8 @@ if ($PSScriptRoot.length -eq 0) {
else { else {
$scriptroot = $PSScriptRoot $scriptroot = $PSScriptRoot
} }
. $scriptroot\..\includes\ps1\lockfile.ps1
new-lock
function IsValidEntry($entry) { function IsValidEntry($entry) {
return ($entry.KD_H -ne 'NaN' -and $entry.KD_ALL -ne 'NaN') -and return ($entry.KD_H -ne 'NaN' -and $entry.KD_ALL -ne 'NaN') -and
($entry.KD_H -ne 'Infinity' -and $entry.KD_ALL -ne 'Infinity') ($entry.KD_H -ne 'Infinity' -and $entry.KD_ALL -ne 'Infinity')
@ -100,3 +99,4 @@ $payload = [PSCustomObject]@{
Invoke-RestMethod -Uri $webhookurl -Method Post -Body ($payload | ConvertTo-Json) -ContentType 'Application/Json' Invoke-RestMethod -Uri $webhookurl -Method Post -Body ($payload | ConvertTo-Json) -ContentType 'Application/Json'
remove-lock remove-lock
Stop-Transcript