From 540fe66dc721e62c8f8755ed7a130be51b6fee5c Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 27 Sep 2023 14:01:13 +0200 Subject: [PATCH] header missing --- discord/report_new_matches.ps1 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 123faee..fcb07c0 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -8,6 +8,22 @@ else { Start-Transcript "$scriptroot/debug.txt" -Append +$fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw + +# Use regex to match the apiKey value +if ($fileContent -match "\`$apiKey\s*=\s*\'([^\']+)\'") { + $apiKey = $matches[1] +} +else { + Write-Output "API Key not found" +} + +$headers = @{ + 'accept' = 'application/vnd.api+json' + 'Authorization' = "$apiKey" +} + + $fileContent = Get-Content -Path "$scriptroot/../discord/config.php" -Raw # Use regex to match the apiKey value @@ -15,7 +31,7 @@ if ($fileContent -match "\`$webhookurl\s*=\s*\'([^\']+)\'") { $webhookurl = $matches[1] } else { - Write-Output "API Key not found" + Write-Output "No web url found" } function send-discord { -- 2.49.1