From 7117608f18fc13aab2567cd2cb47068208b0432b Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 15 Apr 2025 11:55:43 +0200 Subject: [PATCH 01/78] lost matches --- discord/report_new_matches.ps1 | 40 +++++++++++++++++++++++++++++++--- update/get_matches.ps1 | 9 ++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 91a2253..5fee7cd 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -28,13 +28,19 @@ $headers = @{ $fileContent = Get-Content -Path "$scriptroot/../discord/config.php" -Raw # Use regex to match the apiKey value -if ($fileContent -match "\`$webhookurl\s*=\s*\'([^\']+)\'") { +if ($fileContent -match "\`$webhookurl\s*=\s*'([^']+)'") { $webhookurl = $matches[1] -} -else { +} else { Write-Output "No web url found" } +# Use regex to match the losers webhook url +if ($fileContent -match "\`$webhookurl_losers\s*=\s*'([^']+)'") { + $webhookurl_losers = $matches[1] +} else { + Write-Output "No losers web url found" +} + function send-discord { param ( $content @@ -48,6 +54,16 @@ function send-discord { Invoke-RestMethod -Uri $webhookurl -Method Post -Body ($payload | ConvertTo-Json) -ContentType 'Application/Json' } +function send-discord-losers { + param ( + $content + ) + $payload = [PSCustomObject]@{ + content = $content + } + Invoke-RestMethod -Uri $webhookurl_losers -Method Post -Body ($payload | ConvertTo-Json) -ContentType 'Application/Json' +} + $map_map = @{ "Baltic_Main" = "Erangel" "Chimera_Main" = "Paramo" @@ -71,7 +87,25 @@ catch { } $new_win_matches = $player_matches[-1].new_win_matches +# Gebruik nu de lijst van nieuwe verloren matches uit het JSON-bestand +$new_loss_matches = $player_matches[-1].new_loss_matches +# Post verloren matches naar #losers kanaal +foreach ($lossid in $new_loss_matches) { + $lossmatch = $player_matches.player_matches | Where-Object { $_.id -eq $lossid } + if ($null -eq $lossmatch) { continue } + if ($lossmatch[0].gameMode -eq 'tdm') { continue } + $losers = $lossmatch[0].stats.name + $map = $map_map[$lossmatch[0].mapName] + $place = $lossmatch[0].stats.winPlace + $replay_url = $lossmatch[0].telemetry_url -replace 'https://telemetry-cdn.pubg.com/bluehole-pubg', 'https://chickendinner.gg' + $replay_url = $replay_url -replace '-telemetry.json', '' + $replay_url = $replay_url + "?follow=$losers" + $msg = ":skull: **Verloren pot** :skull:`nTeam: $losers`nMap: $map`nPlaats: $place`n[2D replay]($replay_url)`nMeer details: https://dtch.online/matchinfo.php?matchid=$($lossmatch[0].id)" + send-discord-losers -content $msg +} + + foreach ($winid in $new_win_matches) { $win_stats = @() diff --git a/update/get_matches.ps1 b/update/get_matches.ps1 index 5c6063d..35e5d5f 100644 --- a/update/get_matches.ps1 +++ b/update/get_matches.ps1 @@ -87,6 +87,15 @@ if (test-path "$scriptroot/../data/player_matches.json") { new_win_matches = $new_win_matches } + # Nieuwe verloren matches bepalen + $new_loss_ids = ($player_matches.player_matches | Where-Object { $_.stats.winplace -ne 1 }).id + $old_loss_ids = ($old_player_data.player_matches | Where-Object { $_.stats.winplace -ne 1 }).id + $new_loss_matches = ((Compare-Object -ReferenceObject $old_loss_ids -DifferenceObject $new_loss_ids) | Where-Object { $_.SideIndicator -eq '=>' }).InputObject | Select-Object -Unique + $new_loss_matches = $old_player_data.new_loss_matches + $new_loss_matches | Select-Object -Unique + $player_matches += [PSCustomObject]@{ + new_loss_matches = $new_loss_matches + } + } $currentDateTime = Get-Date From 1b2756d076c0d6ccbc086a98b2817eb618745450 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 15 Apr 2025 16:07:23 +0200 Subject: [PATCH 02/78] fix custom met bots --- discord/report_new_matches.ps1 | 112 +++++++++++++++++++++++++++++++-- 1 file changed, 107 insertions(+), 5 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 3585188..45b15f5 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -105,17 +105,119 @@ foreach ($lossid in $new_loss_matches) { $lossmatch = $player_matches.player_matches | Where-Object { $_.id -eq $lossid } if ($null -eq $lossmatch) { continue } if ($lossmatch[0].gameMode -eq 'tdm') { continue } - $losers = $lossmatch[0].stats.name + + # Fetch detailed match stats and telemetry for the loss + $loss_match_stats = $null + $loss_telemetry = $null + try { + $loss_match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$lossid" -Method GET -Headers $headers + $loss_telemetry = (invoke-webrequest @($lossmatch.telemetry_url)[0]).content | convertfrom-json | where-object { ($_._T -eq 'LOGPLAYERTAKEDAMAGE') -or ($_._T -eq 'LOGPLAYERKILLV2') } + } catch { + $errorMessage = $_.Exception.Message + Write-Warning ("Failed to fetch API/telemetry data for loss match {0}: {1}" -f $lossid, $errorMessage) + } + + $loss_stats_table = @() + $loss_victims = @() # For team damage + + # Iterate through players found in the locally stored match data for this loss + foreach ($player_stat in $lossmatch[0].stats) { + $player_name = $player_stat.name + # Find the corresponding detailed stats from the API response + $detailed_player_stats = $null + if ($null -ne $loss_match_stats) { + $detailed_player_stats = $loss_match_stats.included | Where-Object {$_.type -eq 'participant'} | ForEach-Object {$_.attributes.stats} | Where-Object { $_.name -eq $player_name } + } + + if ($null -eq $detailed_player_stats) { + Write-Warning "Could not find detailed stats for player $player_name in loss match $lossid. Using basic stats." + # Fallback to basic stats if detailed stats are missing + $loss_stats_table += [PSCustomObject]@{ + Name = $player_name + 'Human dmg' = "N/A" + 'Human Kills' = "N/A" + 'Dmg' = "$([math]::Round($player_stat.damageDealt))" # Use basic stat + 'Kills' = "$($player_stat.kills)" # Use basic stat + 'alive' = "$([math]::Round(($player_stat.timeSurvived / 60)))" # Use basic stat + } + continue # Skip telemetry processing if detailed stats failed + } + + # Calculate stats (similar to win stats calculation) + $human_dmg = "N/A" + $human_kills = "N/A" + if ($null -ne $loss_telemetry) { + try { + $human_dmg = [math]::Round(($loss_telemetry | Where-Object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and $_.attacker.name -eq $player_name -and $_.victim.accountId -notlike "ai.*" -and $_.victim.teamId -ne $_.attacker.teamId } | Measure-Object -Property damage -Sum).Sum) + $human_kills = ($loss_telemetry | Where-Object { $_._T -eq 'LOGPLAYERKILLV2' -and $_.killer.name -eq $player_name -and $_.victim.accountId -notlike "ai.*" }).count + } catch { + $errorMessage = $_.Exception.Message + Write-Warning ("Error processing telemetry stats for {0} in loss {1}: {2}" -f $player_name, $lossid, $errorMessage) + } + } + + $loss_stats_table += [PSCustomObject]@{ + Name = $player_name + 'Human dmg' = "$human_dmg" + 'Human Kills' = "$human_kills" + 'Dmg' = "$([math]::Round($detailed_player_stats.damageDealt))" + 'Kills' = "$($detailed_player_stats.kills)" + 'alive' = "$([math]::Round(($detailed_player_stats.timeSurvived / 60)))" + } + + # Calculate team damage + if ($null -ne $loss_telemetry) { + try { + $teamdmg = $loss_telemetry | Where-Object { + $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and + $_.victim.teamId -eq $_.attacker.teamId -and + $_.victim.accountId -notlike "ai.*" -and + $_.victim.name -ne $_.attacker.name -and + $_.attacker.name -eq $player_name + } + if ($teamdmg.count -ge 1) { + foreach ($victim_name in ($teamdmg.victim.name | Select-Object -Unique)) { + $loss_victims += [PSCustomObject]@{ + attacker = $player_name + victim = $victim_name + Damage = "$([math]::Round((($teamdmg | Where-Object { $_.victim.name -eq $victim_name }).damage | Measure-Object -Sum).Sum))" + } + } + } + } catch { + $errorMessage = $_.Exception.Message + Write-Warning ("Error processing team damage for {0} in loss {1}: {2}" -f $player_name, $lossid, $errorMessage) + } + } + } + + # Format the stats table + $content_lossstats = "" + if ($loss_stats_table.Count -gt 0) { + $content_lossstats = '```' + ($loss_stats_table | Format-Table -AutoSize | Out-String) + '```' + } + + # Format team damage table + $content_loss_victims = "" + if ($loss_victims.Count -gt 0) { + $content_loss_victims = ":skull::skull: Team Damage :skull::skull:`n" + '```' + ($loss_victims | Format-Table -AutoSize | Out-String) + '```' + } + + # Original message construction variables + $losers = $lossmatch[0].stats.name -join ', ' # Join names for display $map = $map_map[$lossmatch[0].mapName] - $place = $lossmatch[0].stats.winPlace + $place = ($lossmatch[0].stats | Select-Object -First 1).winPlace # Get placement from the first player stat + $first_player_name = ($lossmatch[0].stats | Select-Object -First 1).name $replay_url = $lossmatch[0].telemetry_url -replace 'https://telemetry-cdn.pubg.com/bluehole-pubg', 'https://chickendinner.gg' $replay_url = $replay_url -replace '-telemetry.json', '' - $replay_url = $replay_url + "?follow=$losers" - $msg = ":skull: **Verloren pot** :skull:`nTeam: $losers`nMap: $map`nPlaats: $place`n[2D replay]($replay_url)`nMeer details: https://dtch.online/matchinfo.php?matchid=$($lossmatch[0].id)" + $replay_url = $replay_url + "?follow=$first_player_name" # Follow the first player + + # Modified message construction + $msg = ":skull: **Verloren pot** :skull:`nTeam: $losers`nMap: $map`nPlaats: $place`n$content_lossstats`n$content_loss_victims`n[2D replay]($replay_url)`nMeer details: https://dtch.online/matchinfo.php?matchid=$($lossmatch[0].id)" send-discord-losers -content $msg } - + foreach ($winid in $new_win_matches) { $win_stats = @() From ab768778540f5cd57914401bdcd877dbfce711bb Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 15 Apr 2025 16:18:18 +0200 Subject: [PATCH 03/78] betere links --- discord/report_new_matches.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 45b15f5..ddeab7e 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -213,7 +213,7 @@ foreach ($lossid in $new_loss_matches) { $replay_url = $replay_url + "?follow=$first_player_name" # Follow the first player # Modified message construction - $msg = ":skull: **Verloren pot** :skull:`nTeam: $losers`nMap: $map`nPlaats: $place`n$content_lossstats`n$content_loss_victims`n[2D replay]($replay_url)`nMeer details: https://dtch.online/matchinfo.php?matchid=$($lossmatch[0].id)" + $msg = ":skull: **Verloren pot** :skull:`nTeam: $losers`nMap: $map`nPlaats: $place`n$content_lossstats`n$content_loss_victims`n[2D replay](<$replay_url>)`nMeer details: [DTCH_STATS]()" send-discord-losers -content $msg } From ee0b298ddb8374a9ebcaba377bc35a1ec33aaa00 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 15 Apr 2025 16:28:56 +0200 Subject: [PATCH 04/78] beters --- discord/report_new_matches.ps1 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index ddeab7e..060558b 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -211,10 +211,21 @@ foreach ($lossid in $new_loss_matches) { $replay_url = $lossmatch[0].telemetry_url -replace 'https://telemetry-cdn.pubg.com/bluehole-pubg', 'https://chickendinner.gg' $replay_url = $replay_url -replace '-telemetry.json', '' $replay_url = $replay_url + "?follow=$first_player_name" # Follow the first player - - # Modified message construction - $msg = ":skull: **Verloren pot** :skull:`nTeam: $losers`nMap: $map`nPlaats: $place`n$content_lossstats`n$content_loss_victims`n[2D replay](<$replay_url>)`nMeer details: [DTCH_STATS]()" - send-discord-losers -content $msg + $match_settings = @" + `````` + match mode $($lossmatch[0].gameMode) + match type $($lossmatch[0].matchType) + map $($map_map[$lossmatch[0].mapName]) + id $($lossmatch[0].id) + `````` +"@ + send-discord-losers -content "We hebben een LOSERT! Geen Kip voor jou! :skull::skull:" + send-discord-losers -content ":partying_face::partying_face::partying_face: Helaas, $($losers) :partying_face::partying_face::partying_face:" + send-discord-losers -content $match_settings + send-discord-losers -content $content_lossstats + send-discord-losers -content $content_loss_victims + send-discord-losers -content "[2D replay](<$replay_url>)" + send-discord-losers -content "Meer match details [DTCH_STATS]()" } From 1be9732279f4f43ef2ea41114ddaa4e449b43e74 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 15 Apr 2025 16:31:36 +0200 Subject: [PATCH 05/78] remove lost matches from json --- discord/report_new_matches.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 060558b..d7a242e 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -212,12 +212,12 @@ foreach ($lossid in $new_loss_matches) { $replay_url = $replay_url -replace '-telemetry.json', '' $replay_url = $replay_url + "?follow=$first_player_name" # Follow the first player $match_settings = @" - `````` - match mode $($lossmatch[0].gameMode) - match type $($lossmatch[0].matchType) - map $($map_map[$lossmatch[0].mapName]) - id $($lossmatch[0].id) - `````` +`````` +match mode $($lossmatch[0].gameMode) +match type $($lossmatch[0].matchType) +map $($map_map[$lossmatch[0].mapName]) +id $($lossmatch[0].id) +`````` "@ send-discord-losers -content "We hebben een LOSERT! Geen Kip voor jou! :skull::skull:" send-discord-losers -content ":partying_face::partying_face::partying_face: Helaas, $($losers) :partying_face::partying_face::partying_face:" @@ -336,6 +336,7 @@ k_t = Team eliminaties foreach ($item in $player_matches) { if ($item.PSObject.Properties.Name -contains "new_win_matches") { $item.new_win_matches = $null + $item.new_loss_matches = $null } } From 48ede491fa637044487c77b98fbe867bfa4167c7 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 15 Apr 2025 19:02:45 +0200 Subject: [PATCH 06/78] Force empty commit voor PR From 65fa001a183cf3ed286c1a5790e8e3e20f3f5765 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 15 Apr 2025 19:08:22 +0200 Subject: [PATCH 07/78] test --- config/clanmembers.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/clanmembers.json b/config/clanmembers.json index d1083df..7828718 100644 --- a/config/clanmembers.json +++ b/config/clanmembers.json @@ -16,7 +16,7 @@ "SquadKiller101", "HeteKip", "Pettie1972", - "Reijn7000" + "Reijn7001" ], "alts": [ From 9529f95c01f14509e32fdfc73d0d03093a88ac12 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 15 Apr 2025 19:14:41 +0200 Subject: [PATCH 08/78] fix --- discord/report_new_matches.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index d7a242e..f2220ad 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -336,6 +336,8 @@ k_t = Team eliminaties foreach ($item in $player_matches) { if ($item.PSObject.Properties.Name -contains "new_win_matches") { $item.new_win_matches = $null + } + if ($item.PSObject.Properties.Name -contains "new_loss_matches") { $item.new_loss_matches = $null } } @@ -347,4 +349,5 @@ $newJson = $player_matches | ConvertTo-Json -Depth 100 $newJson | out-file "$scriptroot/../data/player_matches.json" remove-lock -Stop-Transcript \ No newline at end of file +Stop-Transcript + From 6de61e5ee0e9167813cb6321915888ffab3c0c5c Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 18 Apr 2025 12:06:26 +0200 Subject: [PATCH 09/78] debugging --- discord/report_new_matches.ps1 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index f2220ad..a80b9e9 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -11,11 +11,11 @@ $logDir = (Resolve-Path -Path $RelativeLogdir).Path Start-Transcript -Path "$logDir/report_new_matches_$logprefix.log" -Append . $scriptroot\..\includes\ps1\lockfile.ps1 new-lock -by "report_new_matches" -write-output "Scriptroot: $scriptroot" -write-output "Scriptname: $($MyInvocation.MyCommand)" -write-output "Script: $($MyInvocation.MyCommand.Path)" -write-output "PSScriptroot: $PSScriptRoot" -write-output "Logdir: $logDir" +Write-Host "Scriptroot: $scriptroot" +Write-Host "Scriptname: $($MyInvocation.MyCommand)" +Write-Host "Script: $($MyInvocation.MyCommand.Path)" +Write-Host "PSScriptroot: $PSScriptRoot" +Write-Host "Logdir: $logDir" $fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw @@ -24,7 +24,7 @@ if ($fileContent -match "\`$apiKey\s*=\s*\'([^\']+)\'") { $apiKey = $matches[1] } else { - Write-Output "API Key not found" + Write-Host "API Key not found" } $headers = @{ @@ -39,14 +39,14 @@ $fileContent = Get-Content -Path "$scriptroot/../discord/config.php" -Raw if ($fileContent -match "\`$webhookurl\s*=\s*'([^']+)'") { $webhookurl = $matches[1] } else { - Write-Output "No web url found" + Write-Host "No web url found" } # Use regex to match the losers webhook url if ($fileContent -match "\`$webhookurl_losers\s*=\s*'([^']+)'") { $webhookurl_losers = $matches[1] } else { - Write-Output "No losers web url found" + Write-Host "No losers web url found" } function send-discord { @@ -91,10 +91,10 @@ try { $player_matches = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100 } catch { - Write-Output 'Unable to read file exitin' + Write-Host 'Unable to read file exitin' } -Write-Output $player_matches -Write-Output $new_win_matches +Write-Host $player_matches +Write-Host $new_win_matches $new_win_matches = $player_matches[-1].new_win_matches # Gebruik nu de lijst van nieuwe verloren matches uit het JSON-bestand @@ -267,11 +267,11 @@ id $($winmatches[0].id) send-discord -content $match_settings } else { - write-output "Something went wrong (more then 10 matches to report)" + Write-Host "Something went wrong (more then 10 matches to report)" } foreach ($player in $players_to_report.name) { if ($null -eq $player) { continue } - write-output "creating table for player $player" + Write-Host "creating table for player $player" $win_stats += [PSCustomObject]@{ Name = $player 'Human dmg' = "$([math]::Round(($telemetry | Where-Object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and $_.attacker.name -eq $player -and $_.victim.accountId -notlike "ai.*" -and $_.victim.teamId -ne $_.attacker.teamId } | Measure-Object -Property damage -Sum).Sum))" @@ -300,7 +300,7 @@ id $($winmatches[0].id) } } - write-output "New win matches:" + Write-Host "New win matches:" $new_win_matches if ($new_win_matches.count -le 10) { $content_winstats = '```' + ($win_stats | Format-Table | out-string) + '```' @@ -316,7 +316,7 @@ id $($winmatches[0].id) send-discord -content "More match details [DTCH_STATS]()" } else { - write-output "Something went wrong (more then 10 matches to report)" + Write-Host "Something went wrong (more then 10 matches to report)" } $legenda = ' ``` From 32c2b516666b03227522c0053d39a73f48248bd7 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 18 Apr 2025 13:05:11 +0200 Subject: [PATCH 10/78] payloud empty --- discord/report_new_matches.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index a80b9e9..8447f1a 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -69,7 +69,13 @@ function send-discord-losers { $payload = [PSCustomObject]@{ content = $content } + if($payload.content -eq "") { + $payload = [PSCustomObject]@{ + content = "Nothing to report" + } + } Invoke-RestMethod -Uri $webhookurl_losers -Method Post -Body ($payload | ConvertTo-Json) -ContentType 'Application/Json' + } $map_map = @{ From db3cc79398373960b5d2b85b5962ed4d3cf5a524 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 18 Apr 2025 13:08:25 +0200 Subject: [PATCH 11/78] disable losers --- discord/report_new_matches.ps1 | 232 ++++++++++++++++----------------- 1 file changed, 116 insertions(+), 116 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 8447f1a..33a7916 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -107,132 +107,132 @@ $new_win_matches = $player_matches[-1].new_win_matches $new_loss_matches = $player_matches[-1].new_loss_matches # Post verloren matches naar #losers kanaal -foreach ($lossid in $new_loss_matches) { - $lossmatch = $player_matches.player_matches | Where-Object { $_.id -eq $lossid } - if ($null -eq $lossmatch) { continue } - if ($lossmatch[0].gameMode -eq 'tdm') { continue } +# foreach ($lossid in $new_loss_matches) { +# $lossmatch = $player_matches.player_matches | Where-Object { $_.id -eq $lossid } +# if ($null -eq $lossmatch) { continue } +# if ($lossmatch[0].gameMode -eq 'tdm') { continue } - # Fetch detailed match stats and telemetry for the loss - $loss_match_stats = $null - $loss_telemetry = $null - try { - $loss_match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$lossid" -Method GET -Headers $headers - $loss_telemetry = (invoke-webrequest @($lossmatch.telemetry_url)[0]).content | convertfrom-json | where-object { ($_._T -eq 'LOGPLAYERTAKEDAMAGE') -or ($_._T -eq 'LOGPLAYERKILLV2') } - } catch { - $errorMessage = $_.Exception.Message - Write-Warning ("Failed to fetch API/telemetry data for loss match {0}: {1}" -f $lossid, $errorMessage) - } +# # Fetch detailed match stats and telemetry for the loss +# $loss_match_stats = $null +# $loss_telemetry = $null +# try { +# $loss_match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$lossid" -Method GET -Headers $headers +# $loss_telemetry = (invoke-webrequest @($lossmatch.telemetry_url)[0]).content | convertfrom-json | where-object { ($_._T -eq 'LOGPLAYERTAKEDAMAGE') -or ($_._T -eq 'LOGPLAYERKILLV2') } +# } catch { +# $errorMessage = $_.Exception.Message +# Write-Warning ("Failed to fetch API/telemetry data for loss match {0}: {1}" -f $lossid, $errorMessage) +# } - $loss_stats_table = @() - $loss_victims = @() # For team damage +# $loss_stats_table = @() +# $loss_victims = @() # For team damage - # Iterate through players found in the locally stored match data for this loss - foreach ($player_stat in $lossmatch[0].stats) { - $player_name = $player_stat.name - # Find the corresponding detailed stats from the API response - $detailed_player_stats = $null - if ($null -ne $loss_match_stats) { - $detailed_player_stats = $loss_match_stats.included | Where-Object {$_.type -eq 'participant'} | ForEach-Object {$_.attributes.stats} | Where-Object { $_.name -eq $player_name } - } +# # Iterate through players found in the locally stored match data for this loss +# foreach ($player_stat in $lossmatch[0].stats) { +# $player_name = $player_stat.name +# # Find the corresponding detailed stats from the API response +# $detailed_player_stats = $null +# if ($null -ne $loss_match_stats) { +# $detailed_player_stats = $loss_match_stats.included | Where-Object {$_.type -eq 'participant'} | ForEach-Object {$_.attributes.stats} | Where-Object { $_.name -eq $player_name } +# } - if ($null -eq $detailed_player_stats) { - Write-Warning "Could not find detailed stats for player $player_name in loss match $lossid. Using basic stats." - # Fallback to basic stats if detailed stats are missing - $loss_stats_table += [PSCustomObject]@{ - Name = $player_name - 'Human dmg' = "N/A" - 'Human Kills' = "N/A" - 'Dmg' = "$([math]::Round($player_stat.damageDealt))" # Use basic stat - 'Kills' = "$($player_stat.kills)" # Use basic stat - 'alive' = "$([math]::Round(($player_stat.timeSurvived / 60)))" # Use basic stat - } - continue # Skip telemetry processing if detailed stats failed - } +# if ($null -eq $detailed_player_stats) { +# Write-Warning "Could not find detailed stats for player $player_name in loss match $lossid. Using basic stats." +# # Fallback to basic stats if detailed stats are missing +# $loss_stats_table += [PSCustomObject]@{ +# Name = $player_name +# 'Human dmg' = "N/A" +# 'Human Kills' = "N/A" +# 'Dmg' = "$([math]::Round($player_stat.damageDealt))" # Use basic stat +# 'Kills' = "$($player_stat.kills)" # Use basic stat +# 'alive' = "$([math]::Round(($player_stat.timeSurvived / 60)))" # Use basic stat +# } +# continue # Skip telemetry processing if detailed stats failed +# } - # Calculate stats (similar to win stats calculation) - $human_dmg = "N/A" - $human_kills = "N/A" - if ($null -ne $loss_telemetry) { - try { - $human_dmg = [math]::Round(($loss_telemetry | Where-Object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and $_.attacker.name -eq $player_name -and $_.victim.accountId -notlike "ai.*" -and $_.victim.teamId -ne $_.attacker.teamId } | Measure-Object -Property damage -Sum).Sum) - $human_kills = ($loss_telemetry | Where-Object { $_._T -eq 'LOGPLAYERKILLV2' -and $_.killer.name -eq $player_name -and $_.victim.accountId -notlike "ai.*" }).count - } catch { - $errorMessage = $_.Exception.Message - Write-Warning ("Error processing telemetry stats for {0} in loss {1}: {2}" -f $player_name, $lossid, $errorMessage) - } - } +# # Calculate stats (similar to win stats calculation) +# $human_dmg = "N/A" +# $human_kills = "N/A" +# if ($null -ne $loss_telemetry) { +# try { +# $human_dmg = [math]::Round(($loss_telemetry | Where-Object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and $_.attacker.name -eq $player_name -and $_.victim.accountId -notlike "ai.*" -and $_.victim.teamId -ne $_.attacker.teamId } | Measure-Object -Property damage -Sum).Sum) +# $human_kills = ($loss_telemetry | Where-Object { $_._T -eq 'LOGPLAYERKILLV2' -and $_.killer.name -eq $player_name -and $_.victim.accountId -notlike "ai.*" }).count +# } catch { +# $errorMessage = $_.Exception.Message +# Write-Warning ("Error processing telemetry stats for {0} in loss {1}: {2}" -f $player_name, $lossid, $errorMessage) +# } +# } - $loss_stats_table += [PSCustomObject]@{ - Name = $player_name - 'Human dmg' = "$human_dmg" - 'Human Kills' = "$human_kills" - 'Dmg' = "$([math]::Round($detailed_player_stats.damageDealt))" - 'Kills' = "$($detailed_player_stats.kills)" - 'alive' = "$([math]::Round(($detailed_player_stats.timeSurvived / 60)))" - } +# $loss_stats_table += [PSCustomObject]@{ +# Name = $player_name +# 'Human dmg' = "$human_dmg" +# 'Human Kills' = "$human_kills" +# 'Dmg' = "$([math]::Round($detailed_player_stats.damageDealt))" +# 'Kills' = "$($detailed_player_stats.kills)" +# 'alive' = "$([math]::Round(($detailed_player_stats.timeSurvived / 60)))" +# } - # Calculate team damage - if ($null -ne $loss_telemetry) { - try { - $teamdmg = $loss_telemetry | Where-Object { - $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and - $_.victim.teamId -eq $_.attacker.teamId -and - $_.victim.accountId -notlike "ai.*" -and - $_.victim.name -ne $_.attacker.name -and - $_.attacker.name -eq $player_name - } - if ($teamdmg.count -ge 1) { - foreach ($victim_name in ($teamdmg.victim.name | Select-Object -Unique)) { - $loss_victims += [PSCustomObject]@{ - attacker = $player_name - victim = $victim_name - Damage = "$([math]::Round((($teamdmg | Where-Object { $_.victim.name -eq $victim_name }).damage | Measure-Object -Sum).Sum))" - } - } - } - } catch { - $errorMessage = $_.Exception.Message - Write-Warning ("Error processing team damage for {0} in loss {1}: {2}" -f $player_name, $lossid, $errorMessage) - } - } - } +# # Calculate team damage +# if ($null -ne $loss_telemetry) { +# try { +# $teamdmg = $loss_telemetry | Where-Object { +# $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and +# $_.victim.teamId -eq $_.attacker.teamId -and +# $_.victim.accountId -notlike "ai.*" -and +# $_.victim.name -ne $_.attacker.name -and +# $_.attacker.name -eq $player_name +# } +# if ($teamdmg.count -ge 1) { +# foreach ($victim_name in ($teamdmg.victim.name | Select-Object -Unique)) { +# $loss_victims += [PSCustomObject]@{ +# attacker = $player_name +# victim = $victim_name +# Damage = "$([math]::Round((($teamdmg | Where-Object { $_.victim.name -eq $victim_name }).damage | Measure-Object -Sum).Sum))" +# } +# } +# } +# } catch { +# $errorMessage = $_.Exception.Message +# Write-Warning ("Error processing team damage for {0} in loss {1}: {2}" -f $player_name, $lossid, $errorMessage) +# } +# } +# } - # Format the stats table - $content_lossstats = "" - if ($loss_stats_table.Count -gt 0) { - $content_lossstats = '```' + ($loss_stats_table | Format-Table -AutoSize | Out-String) + '```' - } +# # Format the stats table +# $content_lossstats = "" +# if ($loss_stats_table.Count -gt 0) { +# $content_lossstats = '```' + ($loss_stats_table | Format-Table -AutoSize | Out-String) + '```' +# } - # Format team damage table - $content_loss_victims = "" - if ($loss_victims.Count -gt 0) { - $content_loss_victims = ":skull::skull: Team Damage :skull::skull:`n" + '```' + ($loss_victims | Format-Table -AutoSize | Out-String) + '```' - } +# # Format team damage table +# $content_loss_victims = "" +# if ($loss_victims.Count -gt 0) { +# $content_loss_victims = ":skull::skull: Team Damage :skull::skull:`n" + '```' + ($loss_victims | Format-Table -AutoSize | Out-String) + '```' +# } - # Original message construction variables - $losers = $lossmatch[0].stats.name -join ', ' # Join names for display - $map = $map_map[$lossmatch[0].mapName] - $place = ($lossmatch[0].stats | Select-Object -First 1).winPlace # Get placement from the first player stat - $first_player_name = ($lossmatch[0].stats | Select-Object -First 1).name - $replay_url = $lossmatch[0].telemetry_url -replace 'https://telemetry-cdn.pubg.com/bluehole-pubg', 'https://chickendinner.gg' - $replay_url = $replay_url -replace '-telemetry.json', '' - $replay_url = $replay_url + "?follow=$first_player_name" # Follow the first player - $match_settings = @" -`````` -match mode $($lossmatch[0].gameMode) -match type $($lossmatch[0].matchType) -map $($map_map[$lossmatch[0].mapName]) -id $($lossmatch[0].id) -`````` -"@ - send-discord-losers -content "We hebben een LOSERT! Geen Kip voor jou! :skull::skull:" - send-discord-losers -content ":partying_face::partying_face::partying_face: Helaas, $($losers) :partying_face::partying_face::partying_face:" - send-discord-losers -content $match_settings - send-discord-losers -content $content_lossstats - send-discord-losers -content $content_loss_victims - send-discord-losers -content "[2D replay](<$replay_url>)" - send-discord-losers -content "Meer match details [DTCH_STATS]()" -} +# # Original message construction variables +# $losers = $lossmatch[0].stats.name -join ', ' # Join names for display +# $map = $map_map[$lossmatch[0].mapName] +# $place = ($lossmatch[0].stats | Select-Object -First 1).winPlace # Get placement from the first player stat +# $first_player_name = ($lossmatch[0].stats | Select-Object -First 1).name +# $replay_url = $lossmatch[0].telemetry_url -replace 'https://telemetry-cdn.pubg.com/bluehole-pubg', 'https://chickendinner.gg' +# $replay_url = $replay_url -replace '-telemetry.json', '' +# $replay_url = $replay_url + "?follow=$first_player_name" # Follow the first player +# $match_settings = @" +# `````` +# match mode $($lossmatch[0].gameMode) +# match type $($lossmatch[0].matchType) +# map $($map_map[$lossmatch[0].mapName]) +# id $($lossmatch[0].id) +# `````` +# "@ +# send-discord-losers -content "We hebben een LOSERT! Geen Kip voor jou! :skull::skull:" +# send-discord-losers -content ":partying_face::partying_face::partying_face: Helaas, $($losers) :partying_face::partying_face::partying_face:" +# send-discord-losers -content $match_settings +# send-discord-losers -content $content_lossstats +# send-discord-losers -content $content_loss_victims +# send-discord-losers -content "[2D replay](<$replay_url>)" +# send-discord-losers -content "Meer match details [DTCH_STATS]()" +# } foreach ($winid in $new_win_matches) { From cdd97500893b1f9c152ef2a8457e50006bb473d2 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 18 Apr 2025 13:11:34 +0200 Subject: [PATCH 12/78] losers be gone --- discord/report_new_matches.ps1 | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 33a7916..3cc8728 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -11,11 +11,11 @@ $logDir = (Resolve-Path -Path $RelativeLogdir).Path Start-Transcript -Path "$logDir/report_new_matches_$logprefix.log" -Append . $scriptroot\..\includes\ps1\lockfile.ps1 new-lock -by "report_new_matches" -Write-Host "Scriptroot: $scriptroot" -Write-Host "Scriptname: $($MyInvocation.MyCommand)" -Write-Host "Script: $($MyInvocation.MyCommand.Path)" -Write-Host "PSScriptroot: $PSScriptRoot" -Write-Host "Logdir: $logDir" +write-output "Scriptroot: $scriptroot" +write-output "Scriptname: $($MyInvocation.MyCommand)" +write-output "Script: $($MyInvocation.MyCommand.Path)" +write-output "PSScriptroot: $PSScriptRoot" +write-output "Logdir: $logDir" $fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw @@ -24,7 +24,7 @@ if ($fileContent -match "\`$apiKey\s*=\s*\'([^\']+)\'") { $apiKey = $matches[1] } else { - Write-Host "API Key not found" + write-output "API Key not found" } $headers = @{ @@ -39,14 +39,14 @@ $fileContent = Get-Content -Path "$scriptroot/../discord/config.php" -Raw if ($fileContent -match "\`$webhookurl\s*=\s*'([^']+)'") { $webhookurl = $matches[1] } else { - Write-Host "No web url found" + write-output "No web url found" } # Use regex to match the losers webhook url if ($fileContent -match "\`$webhookurl_losers\s*=\s*'([^']+)'") { $webhookurl_losers = $matches[1] } else { - Write-Host "No losers web url found" + write-output "No losers web url found" } function send-discord { @@ -97,10 +97,10 @@ try { $player_matches = get-content "$scriptroot/../data/player_matches.json" | convertfrom-json -Depth 100 } catch { - Write-Host 'Unable to read file exitin' + write-output 'Unable to read file exitin' } -Write-Host $player_matches -Write-Host $new_win_matches +write-output $player_matches +write-output $new_win_matches $new_win_matches = $player_matches[-1].new_win_matches # Gebruik nu de lijst van nieuwe verloren matches uit het JSON-bestand @@ -273,11 +273,11 @@ id $($winmatches[0].id) send-discord -content $match_settings } else { - Write-Host "Something went wrong (more then 10 matches to report)" + write-output "Something went wrong (more then 10 matches to report)" } foreach ($player in $players_to_report.name) { if ($null -eq $player) { continue } - Write-Host "creating table for player $player" + write-output "creating table for player $player" $win_stats += [PSCustomObject]@{ Name = $player 'Human dmg' = "$([math]::Round(($telemetry | Where-Object { $_._T -eq 'LOGPLAYERTAKEDAMAGE' -and $_.attacker.name -eq $player -and $_.victim.accountId -notlike "ai.*" -and $_.victim.teamId -ne $_.attacker.teamId } | Measure-Object -Property damage -Sum).Sum))" @@ -306,7 +306,7 @@ id $($winmatches[0].id) } } - Write-Host "New win matches:" + write-output "New win matches:" $new_win_matches if ($new_win_matches.count -le 10) { $content_winstats = '```' + ($win_stats | Format-Table | out-string) + '```' @@ -322,7 +322,7 @@ id $($winmatches[0].id) send-discord -content "More match details [DTCH_STATS]()" } else { - Write-Host "Something went wrong (more then 10 matches to report)" + write-output "Something went wrong (more then 10 matches to report)" } $legenda = ' ``` From 0d7981091b7a75fc813f60250c19b25043d9de78 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 18 Apr 2025 20:35:21 +0200 Subject: [PATCH 13/78] fix --- discord/report_new_matches.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 3cc8728..3661a22 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -101,10 +101,10 @@ catch { } write-output $player_matches write-output $new_win_matches -$new_win_matches = $player_matches[-1].new_win_matches +$new_win_matches = $player_matches.new_win_matches # Gebruik nu de lijst van nieuwe verloren matches uit het JSON-bestand -$new_loss_matches = $player_matches[-1].new_loss_matches +$new_loss_matches = $player_matches.new_loss_matches # Post verloren matches naar #losers kanaal # foreach ($lossid in $new_loss_matches) { From 4001cde34ff24348587ee3f17356e113b4a41640 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 18 Apr 2025 20:42:35 +0200 Subject: [PATCH 14/78] wtf is hier gebeurd ?! --- discord/report_new_matches.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 3661a22..c5a69ff 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -308,7 +308,7 @@ id $($winmatches[0].id) } write-output "New win matches:" $new_win_matches - if ($new_win_matches.count -le 10) { + if ($new_win_matches.count -ge 10) { $content_winstats = '```' + ($win_stats | Format-Table | out-string) + '```' send-discord -content $content_winstats From a496c39b3e290dcb65529e7e6621665be4f209ab Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 18 Apr 2025 20:50:51 +0200 Subject: [PATCH 15/78] fix --- discord/report_new_matches.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index c5a69ff..0074fb9 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -101,10 +101,10 @@ catch { } write-output $player_matches write-output $new_win_matches -$new_win_matches = $player_matches.new_win_matches +$new_win_matches = $player_matches[-2].new_win_matches # Gebruik nu de lijst van nieuwe verloren matches uit het JSON-bestand -$new_loss_matches = $player_matches.new_loss_matches +$new_loss_matches = $player_matches[-1].new_loss_matches # Post verloren matches naar #losers kanaal # foreach ($lossid in $new_loss_matches) { @@ -308,7 +308,7 @@ id $($winmatches[0].id) } write-output "New win matches:" $new_win_matches - if ($new_win_matches.count -ge 10) { + if ($new_win_matches.count -le 10) { $content_winstats = '```' + ($win_stats | Format-Table | out-string) + '```' send-discord -content $content_winstats From 136c5f47d2d4e20e075b616487144db9629655bb Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 17 Jun 2025 16:28:35 +0200 Subject: [PATCH 16/78] videos --- includes/navigation.php | 3 ++- videos.php | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 videos.php diff --git a/includes/navigation.php b/includes/navigation.php index 0ceb42b..15fddc2 100644 --- a/includes/navigation.php +++ b/includes/navigation.php @@ -12,7 +12,8 @@ if ($host == 'dev.dtch.online') { Last quarter % Last Matches Top20 - User Stats + User Stats + Videos diff --git a/videos.php b/videos.php new file mode 100644 index 0000000..3201f13 --- /dev/null +++ b/videos.php @@ -0,0 +1,44 @@ + + + + + + + + + +
+
+

Videos

+ + +
+ +
+ +

+
+ +
+ +

No videos found.

+ + +
+
+ + + + \ No newline at end of file From 05796a788186e1ec303d09970a1f8d002e954879 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 17 Jun 2025 16:37:38 +0200 Subject: [PATCH 17/78] videos --- includes/styles.css | 22 ++++++++++++++++++++++ includes/styles_mobile.css | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/includes/styles.css b/includes/styles.css index 6ba4400..cf3919d 100644 --- a/includes/styles.css +++ b/includes/styles.css @@ -240,3 +240,25 @@ td, th { background-color: #0f0f0f; color: #e69109; } + +/* Videos page styles */ +.videos-container { + display: flex; + flex-wrap: wrap; + gap: 16px; + justify-content: center; + padding: 1rem; +} +.video-item { + flex: 1 1 300px; + max-width: 100%; +} +.video-item video { + max-width: 100%; + max-height: 80vh; + width: auto; + height: auto; + object-fit: contain; + display: block; + margin: 0 auto; +} diff --git a/includes/styles_mobile.css b/includes/styles_mobile.css index 70bdf9e..e6aaff5 100644 --- a/includes/styles_mobile.css +++ b/includes/styles_mobile.css @@ -81,4 +81,23 @@ table { section h2 { margin-top: 10px; +} +/* Videos page responsive adjustments */ +.videos-container { + display: flex; + flex-wrap: wrap; + gap: 16px; + justify-content: center; + padding: 1rem; +} +.video-item { + flex: 1 1 100%; + max-width: 100%; +} +.video-item video { + width: 100%; + max-width: 100%; + height: auto; + display: block; + margin: 0 auto; } \ No newline at end of file From 0eb08f3d2fca241bacef7e26981b37d138211da1 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 17 Jun 2025 16:46:51 +0200 Subject: [PATCH 18/78] k --- videos.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/videos.php b/videos.php index 3201f13..80805ef 100644 --- a/videos.php +++ b/videos.php @@ -7,6 +7,19 @@ $allFiles = scandir($videosDir); $videoFiles = array_filter($allFiles, function($file) use ($videosDir) { return is_file($videosDir . '/' . $file) && strtolower(pathinfo($file, PATHINFO_EXTENSION)) === 'mp4'; }); + +// Build array with creation time and sort by creation date descending +$videoData = []; +foreach ($videoFiles as $file) { + $path = $videosDir . '/' . $file; + $videoData[] = [ + 'filename' => $file, + 'ctime' => filectime($path) + ]; +} +usort($videoData, function($a, $b) { + return $b['ctime'] - $a['ctime']; +}); ?> @@ -20,15 +33,16 @@ $videoFiles = array_filter($allFiles, function($file) use ($videosDir) {

Videos

- +
- +
-

+

+

From dbf36ec5db49f9e288e87efb6bb94d7123793811 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 17 Jun 2025 17:45:38 +0200 Subject: [PATCH 19/78] 2d url fix --- discord/report_new_matches.ps1 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 0074fb9..cd8e5dd 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -38,14 +38,16 @@ $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 { +} +else { write-output "No web url found" } # Use regex to match the losers webhook url if ($fileContent -match "\`$webhookurl_losers\s*=\s*'([^']+)'") { $webhookurl_losers = $matches[1] -} else { +} +else { write-output "No losers web url found" } @@ -69,7 +71,7 @@ function send-discord-losers { $payload = [PSCustomObject]@{ content = $content } - if($payload.content -eq "") { + if ($payload.content -eq "") { $payload = [PSCustomObject]@{ content = "Nothing to report" } @@ -243,10 +245,10 @@ foreach ($winid in $new_win_matches) { $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') } $winners = @(($winmatches | where-object { $_.stats.winPlace -eq 1 }).stats.name) - $2D_replay_url = @($winmatches.telemetry_url)[0] -replace 'https://telemetry-cdn.pubg.com/bluehole-pubg', 'https://chickendinner.gg' - $2D_replay_url = $2D_replay_url -replace '-telemetry.json', '' - $2D_replay_url = $2D_replay_url + "?follow=$($winners[0])" - + # $2D_replay_url = @($winmatches.telemetry_url)[0] -replace 'https://telemetry-cdn.pubg.com/bluehole-pubg', 'https://chickendinner.gg' + # $2D_replay_url = $2D_replay_url -replace '-telemetry.json', '' + # $2D_replay_url = $2D_replay_url + "?follow=$($winners[0])" + $2D_replay_url = 'https://chickendinner.gg/' + $winid $match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$winid" -Method GET -Headers $headers if ($winmatches[0].gameMode -eq 'tdm' ) { continue @@ -257,7 +259,7 @@ foreach ($winid in $new_win_matches) { else { $players_to_report = $match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 } } - + $2D_replay_url = 'https://chickendinner.gg/' + $winid + "/" + $players_to_report[0].name if ($new_win_matches.count -le 10) { #fail safe send-discord -content ":chicken: :chicken: **WINNER WINNER CHICKEN DINNER!!** :chicken: :chicken:" From fd190d2636e9c02c8d08590ab0850822a4429810 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 17 Jun 2025 18:35:42 +0200 Subject: [PATCH 20/78] video dingen --- includes/styles.css | 9 +++++++ includes/styles_mobile.css | 8 ++++++ videos.php | 50 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/includes/styles.css b/includes/styles.css index cf3919d..d5cb071 100644 --- a/includes/styles.css +++ b/includes/styles.css @@ -262,3 +262,12 @@ td, th { display: block; margin: 0 auto; } + +/* Share and theatre button styles */ +.video-controls { + display: flex; + justify-content: center; + align-items: center; + margin-top: 0.5rem; + gap: 0.5rem; +} diff --git a/includes/styles_mobile.css b/includes/styles_mobile.css index e6aaff5..e0d22bc 100644 --- a/includes/styles_mobile.css +++ b/includes/styles_mobile.css @@ -100,4 +100,12 @@ section h2 { height: auto; display: block; margin: 0 auto; +} +/* Share and theatre button mobile styles */ +.video-controls { + display: flex; + justify-content: center; + align-items: center; + margin-top: 0.5rem; + gap: 0.5rem; } \ No newline at end of file diff --git a/videos.php b/videos.php index 80805ef..f995be9 100644 --- a/videos.php +++ b/videos.php @@ -43,6 +43,10 @@ usort($videoData, function($a, $b) {

+
+ + +
@@ -54,5 +58,51 @@ usort($videoData, function($a, $b) { + + \ No newline at end of file From 7ef1ade9e02713833e8b3aea4753941811e48598 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 17 Jun 2025 18:48:52 +0200 Subject: [PATCH 21/78] theater modus --- includes/styles.css | 11 +++++++++++ includes/styles_mobile.css | 10 ++++++++++ videos.php | 20 ++------------------ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/includes/styles.css b/includes/styles.css index d5cb071..ac7ca5e 100644 --- a/includes/styles.css +++ b/includes/styles.css @@ -271,3 +271,14 @@ td, th { margin-top: 0.5rem; gap: 0.5rem; } + +/* Theatre mode styles */ +.video-item.theatre-mode { + flex: 1 1 100%; + max-width: 100%; +} +.video-item.theatre-mode video { + width: 100%; + height: auto; + max-height: none; +} diff --git a/includes/styles_mobile.css b/includes/styles_mobile.css index e0d22bc..da632b7 100644 --- a/includes/styles_mobile.css +++ b/includes/styles_mobile.css @@ -5,6 +5,16 @@ table { td, th { padding: 8px; } +/* Theatre mode mobile styles */ +.video-item.theatre-mode { + flex: 1 1 100%; + max-width: 100%; +} +.video-item.theatre-mode video { + width: 100%; + height: auto; + max-height: none; +} .topnav { overflow: hidden; diff --git a/videos.php b/videos.php index f995be9..1d5e1c1 100644 --- a/videos.php +++ b/videos.php @@ -42,7 +42,6 @@ usort($videoData, function($a, $b) { Your browser does not support the video tag.

-

@@ -83,23 +82,8 @@ usort($videoData, function($a, $b) { document.querySelectorAll('.theatre-btn').forEach(function(btn) { btn.addEventListener('click', function() { var videoItem = btn.closest('.video-item'); - if (!document.fullscreenElement) { - if (videoItem.requestFullscreen) { - videoItem.requestFullscreen(); - } else if (videoItem.webkitRequestFullscreen) { - videoItem.webkitRequestFullscreen(); - } else if (videoItem.msRequestFullscreen) { - videoItem.msRequestFullscreen(); - } - } else { - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.webkitExitFullscreen) { - document.webkitExitFullscreen(); - } else if (document.msExitFullscreen) { - document.msExitFullscreen(); - } - } + var isActive = videoItem.classList.toggle('theatre-mode'); + btn.innerText = isActive ? 'Sluit theatermodus' : 'Theatermodus'; }); }); }); From af8c9ff61aaf5d05ad07c877a3dee4b7bf754a67 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 17 Jun 2025 19:11:09 +0200 Subject: [PATCH 22/78] video format --- includes/styles.css | 8 ++++++++ includes/styles_mobile.css | 7 +++++++ videos.php | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/includes/styles.css b/includes/styles.css index ac7ca5e..7bd91d7 100644 --- a/includes/styles.css +++ b/includes/styles.css @@ -282,3 +282,11 @@ td, th { height: auto; max-height: none; } + +.video-title { + text-align: center; + font-size: 1.2em; + font-weight: bold; + margin-top: 10px; + margin-bottom: 10px; +} diff --git a/includes/styles_mobile.css b/includes/styles_mobile.css index da632b7..f4cda5f 100644 --- a/includes/styles_mobile.css +++ b/includes/styles_mobile.css @@ -118,4 +118,11 @@ section h2 { align-items: center; margin-top: 0.5rem; gap: 0.5rem; +} +.video-title { + text-align: center; + font-size: 1.1em; + font-weight: bold; + margin-top: 8px; + margin-bottom: 8px; } \ No newline at end of file diff --git a/videos.php b/videos.php index 1d5e1c1..6ef7b33 100644 --- a/videos.php +++ b/videos.php @@ -41,7 +41,7 @@ usort($videoData, function($a, $b) { Your browser does not support the video tag. -

+

From ff327d1886492c81cb9b89feed7585fc5b54a0fb Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 17 Jun 2025 19:25:00 +0200 Subject: [PATCH 23/78] theathermode --- includes/styles.css | 34 ++++++++++++++++++++++++++++++++++ includes/styles_mobile.css | 12 ++++++++++++ 2 files changed, 46 insertions(+) diff --git a/includes/styles.css b/includes/styles.css index 7bd91d7..e022ed1 100644 --- a/includes/styles.css +++ b/includes/styles.css @@ -290,3 +290,37 @@ td, th { margin-top: 10px; margin-bottom: 10px; } + +.video-item.theatre-mode { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.9); + z-index: 1000; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 20px; + box-sizing: border-box; +} + +.video-item.theatre-mode video { + max-width: 90%; + max-height: 80vh; + width: auto; + height: auto; +} + +.video-item.theatre-mode .video-title { + color: #fff; + order: -1; /* Display title above the video */ +} + +.video-item.theatre-mode .video-controls { + position: relative; + bottom: auto; + margin-top: 15px; +} diff --git a/includes/styles_mobile.css b/includes/styles_mobile.css index f4cda5f..dbea823 100644 --- a/includes/styles_mobile.css +++ b/includes/styles_mobile.css @@ -125,4 +125,16 @@ section h2 { font-weight: bold; margin-top: 8px; margin-bottom: 8px; +} +.video-item.theatre-mode { + padding: 10px; +} + +.video-item.theatre-mode video { + max-width: 100%; + max-height: 70vh; +} + +.video-item.theatre-mode .video-controls { + margin-top: 10px; } \ No newline at end of file From f72fb0bb7d1fe59e8205627ae70b714c28b9d4b5 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 17 Jun 2025 19:46:03 +0200 Subject: [PATCH 24/78] theather modus --- videos.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/videos.php b/videos.php index 6ef7b33..113215e 100644 --- a/videos.php +++ b/videos.php @@ -81,8 +81,18 @@ usort($videoData, function($a, $b) { document.querySelectorAll('.theatre-btn').forEach(function(btn) { btn.addEventListener('click', function() { - var videoItem = btn.closest('.video-item'); - var isActive = videoItem.classList.toggle('theatre-mode'); + var clickedVideoItem = btn.closest('.video-item'); + + // Remove theatre mode from all other videos + document.querySelectorAll('.video-item.theatre-mode').forEach(function(item) { + if (item !== clickedVideoItem) { + item.classList.remove('theatre-mode'); + item.querySelector('.theatre-btn').innerText = 'Theatermodus'; + } + }); + + // Toggle theatre mode for the clicked video + var isActive = clickedVideoItem.classList.toggle('theatre-mode'); btn.innerText = isActive ? 'Sluit theatermodus' : 'Theatermodus'; }); }); From b3918e611de4dffae50ba10b1f7f12c85300dd0c Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 18 Jun 2025 14:13:42 +0200 Subject: [PATCH 25/78] Ghost_0223 --- config/clanmembers.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/clanmembers.json b/config/clanmembers.json index 7828718..e40bcb5 100644 --- a/config/clanmembers.json +++ b/config/clanmembers.json @@ -16,7 +16,8 @@ "SquadKiller101", "HeteKip", "Pettie1972", - "Reijn7001" + "Reijn7001", + "Ghost_0223" ], "alts": [ From d6d9ada74814c2f181017f0973c6644992f4cc95 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 18 Jun 2025 14:19:58 +0200 Subject: [PATCH 26/78] to pubg meta --- matchinfo.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/matchinfo.php b/matchinfo.php index 0c7c879..2b3a001 100644 --- a/matchinfo.php +++ b/matchinfo.php @@ -157,15 +157,15 @@ $lastMatches = array_slice($allMatches, 0, 8); if (substr($playerStats['playerId'], 0, 2) !== 'ai') { // Create links for each stat echo ""; - echo "" . htmlspecialchars($playerStats['name']) . ""; - echo " Human "; - echo "" . htmlspecialchars($playerStats['kills']) . ""; - echo "" . htmlspecialchars($playerStats['HumanDmg']) . ""; - echo "" . htmlspecialchars($playerStats['timeSurvived']) . ""; - echo "" . htmlspecialchars($playerStats['winPlace']) . ""; - echo "" . htmlspecialchars($playerStats['revives']) . ""; - echo "" . htmlspecialchars($playerStats['DBNOs']) . ""; - echo "" . htmlspecialchars($playerStats['assists']) . ""; + echo "" . htmlspecialchars($playerStats['name']) . ""; + echo " Human "; + echo "" . htmlspecialchars($playerStats['kills']) . ""; + echo "" . htmlspecialchars($playerStats['HumanDmg']) . ""; + echo "" . htmlspecialchars($playerStats['timeSurvived']) . ""; + echo "" . htmlspecialchars($playerStats['winPlace']) . ""; + echo "" . htmlspecialchars($playerStats['revives']) . ""; + echo "" . htmlspecialchars($playerStats['DBNOs']) . ""; + echo "" . htmlspecialchars($playerStats['assists']) . ""; echo ""; } else { // Display without link From 21dd9b990b82a01511bb82b009602a5ea45b1e90 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 19 Jun 2025 11:23:58 +0200 Subject: [PATCH 27/78] winwithurl --- discord/report_new_matches.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index cd8e5dd..8b7e97e 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -262,8 +262,12 @@ foreach ($winid in $new_win_matches) { $2D_replay_url = 'https://chickendinner.gg/' + $winid + "/" + $players_to_report[0].name if ($new_win_matches.count -le 10) { #fail safe + $winnerswithurl = @() + foreach($winner in $winners){ + $winnerswithurl += "[$winner]()" + } send-discord -content ":chicken: :chicken: **WINNER WINNER CHICKEN DINNER!!** :chicken: :chicken:" - send-discord -content ":partying_face::partying_face::partying_face: Gefeliciteerd $($winners -join ', ') :partying_face::partying_face::partying_face:" + send-discord -content ":partying_face::partying_face::partying_face: Gefeliciteerd $($winnerswithurl -join ', ') :partying_face::partying_face::partying_face:" $match_settings = @" `````` match mode $($winmatches[0].gameMode) From 7359204a9a1361f5778ddc27ae5cb858ff67ac83 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 23 Sep 2025 12:32:46 +0200 Subject: [PATCH 28/78] clanmember change --- config/clanmembers.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/clanmembers.json b/config/clanmembers.json index e40bcb5..c81001f 100644 --- a/config/clanmembers.json +++ b/config/clanmembers.json @@ -12,12 +12,12 @@ "THAIlux", "Reijn7000", "McPikkie", - "Brabo-Gamer", "SquadKiller101", "HeteKip", "Pettie1972", "Reijn7001", - "Ghost_0223" + "Ghost_0223", + "Bossoemang" ], "alts": [ From 56f40244c007c4046d62623a6a110723caba660f Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 10:54:15 +0200 Subject: [PATCH 29/78] tourists --- discord/teammakerv2.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index ff7858e..d572d12 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -251,5 +251,16 @@ async def moveall(ctx): await ctx.send(f"{moved_members} speler(s) zijn verplaatst naar het teamify kanaal.") else: await ctx.send("Er waren geen spelers om te verplaatsen.") - +@bot.command() +async def iamgamer(ctx): + role = discord.utils.get(ctx.guild.roles, name="Tourists") + if role is None: + await ctx.send("De rol **Tourists** bestaat niet!") + return + + try: + await ctx.author.add_roles(role) + await ctx.send(f"โœ… {ctx.author.mention}, je bent nu een **Tourist**! Veel plezier! ๐ŸŽฎ") + except Exception as e: + await ctx.send(f"Er is iets misgegaan bij het toekennen van de rol: {e}") bot.run(token) From 872b87ee093b735eca7ec309c749b216707012ba Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 12:00:09 +0200 Subject: [PATCH 30/78] help command --- discord/teammakerv2.py | 56 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index d572d12..645e8aa 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -215,7 +215,14 @@ async def on_voice_state_update(member, before, after): async def on_member_join(member): logging_channel = discord.utils.get(member.guild.text_channels, name="raadhuisplein") if logging_channel: - await logging_channel.send(f"๐ŸŽ‰ Welkom {member.mention} op de server! We hopen dat je een leuke tijd hebt!") + welcome_message = ( + f"๐ŸŽ‰ Welcome {member.mention} to **{member.guild.name}**!\n\n" + "๐Ÿ‘‹ We're glad to have you here.\n" + "๐Ÿ‘‰ Want to jump right in? Type `!iamgamer` in the chat and you'll get the **Tourists** role.\n" + "With that role you can join the fun and games with everyone else. ๐ŸŽฎ\n\n" + "Enjoy your stay and have a great time! ๐Ÿš€" + ) + await logging_channel.send(welcome_message) @bot.event async def on_member_remove(member): @@ -263,4 +270,51 @@ async def iamgamer(ctx): await ctx.send(f"โœ… {ctx.author.mention}, je bent nu een **Tourist**! Veel plezier! ๐ŸŽฎ") except Exception as e: await ctx.send(f"Er is iets misgegaan bij het toekennen van de rol: {e}") +@bot.command(name="help", aliases=["commands"]) +async def help_command(ctx): + embed = discord.Embed( + title="๐Ÿ“– Bot Command Help", + description="Hereโ€™s a list of all available commands and how to use them:", + color=discord.Color.blue() + ) + + embed.add_field( + name="๐Ÿ‘‰ !teamify", + value=( + "`!teamify` - Split players into random teams of max 4.\n" + "`!teamify ` - Split players into a given number of teams.\n" + "`!teamify move` - Split & move players into temporary voice channels.\n" + "`!teamify move` - Auto split & move players.\n" + "๐Ÿ”น Works only in the **#teamify** channel." + ), + inline=False + ) + + embed.add_field( + name="๐Ÿ‘‰ !moveall", + value="`!moveall` - Moves all players from other voice channels into the **teamify** channel.", + inline=False + ) + + embed.add_field( + name="๐Ÿ‘‰ !whoisbest", + value=( + "`!whoisbest [category] [matchesback]`\n" + "Shows the top 3 players based on win ratio and average damage.\n" + "`category` = e.g. Casual, Ranked\n" + "`matchesback` = minimum matches required (default: 18)\n" + "Example: `!whoisbest Casual 18`" + ), + inline=False + ) + + embed.add_field( + name="๐Ÿ‘‰ !iamgamer", + value="`!iamgamer` - Gives you the **Tourists** role ๐ŸŽฎ so you can join games and unlock more fun.", + inline=False + ) + + embed.set_footer(text="โœจ For advanced options, use: !teamify help or !whoisbest help") + + await ctx.send(embed=embed) bot.run(token) From 4d02286ce2bd730b6dd2a972af95a6a6a3cb0c74 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 13:21:24 +0200 Subject: [PATCH 31/78] dtch help --- discord/teammakerv2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 645e8aa..acc3856 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -270,10 +270,10 @@ async def iamgamer(ctx): await ctx.send(f"โœ… {ctx.author.mention}, je bent nu een **Tourist**! Veel plezier! ๐ŸŽฎ") except Exception as e: await ctx.send(f"Er is iets misgegaan bij het toekennen van de rol: {e}") -@bot.command(name="help", aliases=["commands"]) -async def help_command(ctx): +@bot.command(name="dtch_help", aliases=["commands"]) +async def dtch_help_command(ctx): embed = discord.Embed( - title="๐Ÿ“– Bot Command Help", + title="๐Ÿ“– DTCH Bot Command Help", description="Hereโ€™s a list of all available commands and how to use them:", color=discord.Color.blue() ) From fe62e841e564393231d9a3aa4b7dce3339426088 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 13:28:28 +0200 Subject: [PATCH 32/78] new member --- discord/teammakerv2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index acc3856..31cf0fd 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -220,6 +220,7 @@ async def on_member_join(member): "๐Ÿ‘‹ We're glad to have you here.\n" "๐Ÿ‘‰ Want to jump right in? Type `!iamgamer` in the chat and you'll get the **Tourists** role.\n" "With that role you can join the fun and games with everyone else. ๐ŸŽฎ\n\n" + "Use !dtch_help for more info" "Enjoy your stay and have a great time! ๐Ÿš€" ) await logging_channel.send(welcome_message) From c82b1cd5ea35ef23f34ec358150676bacf2cfbf3 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 13:30:47 +0200 Subject: [PATCH 33/78] text --- discord/teammakerv2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 31cf0fd..a7d090e 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -219,8 +219,8 @@ async def on_member_join(member): f"๐ŸŽ‰ Welcome {member.mention} to **{member.guild.name}**!\n\n" "๐Ÿ‘‹ We're glad to have you here.\n" "๐Ÿ‘‰ Want to jump right in? Type `!iamgamer` in the chat and you'll get the **Tourists** role.\n" - "With that role you can join the fun and games with everyone else. ๐ŸŽฎ\n\n" - "Use !dtch_help for more info" + "With that role you can join the fun and games with everyone else. ๐ŸŽฎ\n" + "Use !dtch_help for more info\n\n" "Enjoy your stay and have a great time! ๐Ÿš€" ) await logging_channel.send(welcome_message) From 91b2a4cb40eaa5d7fe9b67c818355965c60f4f8b Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 13:34:01 +0200 Subject: [PATCH 34/78] ben er weer --- discord/teammakerv2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index a7d090e..2ebcb20 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -31,8 +31,10 @@ intents.members = True # Nodig om leden in een voice channel te zien bot = commands.Bot(command_prefix="!", intents=intents) @bot.event -async def on_ready(): +async def on_ready(ctx): print(f'Bot is ingelogd als {bot.user}') + await ctx.send("Ben er weer!") + @bot.command() async def test(ctx): From 9794e9337ad97d3138a1056694edada76ef3655b Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 13:37:06 +0200 Subject: [PATCH 35/78] return --- discord/teammakerv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 2ebcb20..29b822c 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -34,7 +34,7 @@ bot = commands.Bot(command_prefix="!", intents=intents) async def on_ready(ctx): print(f'Bot is ingelogd als {bot.user}') await ctx.send("Ben er weer!") - + return @bot.command() async def test(ctx): From 7d48158e575ad6f2a82496e220552fba1da6a52c Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 13:41:41 +0200 Subject: [PATCH 36/78] kanaalid --- discord/teammakerv2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 29b822c..1eb8209 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -33,8 +33,9 @@ bot = commands.Bot(command_prefix="!", intents=intents) @bot.event async def on_ready(ctx): print(f'Bot is ingelogd als {bot.user}') - await ctx.send("Ben er weer!") - return + channel = bot.get_channel(759006368832159745) # vervang door je channel ID + if channel: + await channel.send("Ben er weer!") @bot.command() async def test(ctx): From d1b153c322df7bd24534fcc74d8097194004026b Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 13:44:52 +0200 Subject: [PATCH 37/78] beh --- discord/teammakerv2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 1eb8209..93a46d0 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -31,9 +31,9 @@ intents.members = True # Nodig om leden in een voice channel te zien bot = commands.Bot(command_prefix="!", intents=intents) @bot.event -async def on_ready(ctx): +async def on_ready(): print(f'Bot is ingelogd als {bot.user}') - channel = bot.get_channel(759006368832159745) # vervang door je channel ID + channel = bot.get_channel(759006368832159745) if channel: await channel.send("Ben er weer!") From b4036047c7bb505cc320e5f9cf151bd26d51514d Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 14:07:40 +0200 Subject: [PATCH 38/78] AI --- discord/teammakerv2.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 93a46d0..92a7f73 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -5,8 +5,9 @@ import random import asyncio import re from discord.ext import commands +from openai import OpenAI - +OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") def get_token(): with open("config.php", "r") as file: content = file.read() @@ -29,7 +30,7 @@ intents.presences = True # Nodig als de bot presences moet zien intents.members = True # Nodig om leden in een voice channel te zien bot = commands.Bot(command_prefix="!", intents=intents) - +client = OpenAI(api_key=OPENAI_API_KEY) @bot.event async def on_ready(): print(f'Bot is ingelogd als {bot.user}') @@ -321,4 +322,22 @@ async def dtch_help_command(ctx): embed.set_footer(text="โœจ For advanced options, use: !teamify help or !whoisbest help") await ctx.send(embed=embed) + +@bot.command() +async def ask(ctx, *, vraag: str): + """Stuur een vraag naar OpenAI""" + try: + response = client.chat.completions.create( + model="gpt-4o-mini", + messages=[ + {"role": "system", "content": "Je bent een behulpzame chatbot in Discord."}, + {"role": "user", "content": vraag}, + ], + ) + + antwoord = response.choices[0].message.content + await ctx.send(antwoord[:1900]) # max 2000 chars in Discord + except Exception as e: + await ctx.send(f"Er ging iets mis: {e}") + bot.run(token) From bdcad50f981e1c9df86048dbfd6aa1b8dbc87f3a Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 14:17:58 +0200 Subject: [PATCH 39/78] denigrerende --- discord/teammakerv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 92a7f73..8660862 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -330,7 +330,7 @@ async def ask(ctx, *, vraag: str): response = client.chat.completions.create( model="gpt-4o-mini", messages=[ - {"role": "system", "content": "Je bent een behulpzame chatbot in Discord."}, + {"role": "system", "content": "Je bent een behulpzame chatbot in Discord. Antwoord op een denigrerende manier"}, {"role": "user", "content": vraag}, ], ) From 83922cac1df28c287cab468d011be04543ae74fe Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 14:28:49 +0200 Subject: [PATCH 40/78] lanta01 goed --- discord/teammakerv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 8660862..06a43f9 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -330,7 +330,7 @@ async def ask(ctx, *, vraag: str): response = client.chat.completions.create( model="gpt-4o-mini", messages=[ - {"role": "system", "content": "Je bent een behulpzame chatbot in Discord. Antwoord op een denigrerende manier"}, + {"role": "system", "content": "Je bent een behulpzame chatbot in Discord. Antwoord op een denigrerende manier. Wellicht altijd even benadrukken hoe goed Lanta01 is ( die deze server en bot heeft gemaakt)"}, {"role": "user", "content": vraag}, ], ) From 2a80f52c9a12210f00b3b049110c14a44607d66c Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 14:29:30 +0200 Subject: [PATCH 41/78] discord bot --- discord/teammakerv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 06a43f9..129181f 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -330,7 +330,7 @@ async def ask(ctx, *, vraag: str): response = client.chat.completions.create( model="gpt-4o-mini", messages=[ - {"role": "system", "content": "Je bent een behulpzame chatbot in Discord. Antwoord op een denigrerende manier. Wellicht altijd even benadrukken hoe goed Lanta01 is ( die deze server en bot heeft gemaakt)"}, + {"role": "system", "content": "Je bent een behulpzame chatbot in Discord. Je zit op een PUBG discord server van de clan DTCH. Antwoord op een denigrerende manier. Wellicht altijd even benadrukken hoe goed Lanta01 is ( die deze server en bot heeft gemaakt)"}, {"role": "user", "content": vraag}, ], ) From 046691b068e27d140be6c3eeebe500998be68afd Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 14:39:15 +0200 Subject: [PATCH 42/78] vraag antwoord direkt --- discord/teammakerv2.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 129181f..0e177dd 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -330,14 +330,24 @@ async def ask(ctx, *, vraag: str): response = client.chat.completions.create( model="gpt-4o-mini", messages=[ - {"role": "system", "content": "Je bent een behulpzame chatbot in Discord. Je zit op een PUBG discord server van de clan DTCH. Antwoord op een denigrerende manier. Wellicht altijd even benadrukken hoe goed Lanta01 is ( die deze server en bot heeft gemaakt)"}, + { + "role": "system", + "content": ( + f"Je bent een denigrerende chatbot in Discord. " + f"Je zit op een PUBG discord server van de clan DTCH. " + f"Antwoord altijd op een kleinerende manier richting de user. " + f"De vraag werd gesteld door {ctx.author.display_name}. " + f"Vergeet niet af en toe te benadrukken hoe geweldig Lanta is " + f"(die deze server en bot heeft gemaakt)." + ) + }, {"role": "user", "content": vraag}, ], ) antwoord = response.choices[0].message.content - await ctx.send(antwoord[:1900]) # max 2000 chars in Discord + await ctx.send(f"{ctx.author.mention} {antwoord[:1900]}") except Exception as e: - await ctx.send(f"Er ging iets mis: {e}") + await ctx.send(f"{ctx.author.mention} Er ging iets mis: {e}") bot.run(token) From 837f136b70de4bd16d9bd6161670df03523f3728 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 15:23:13 +0200 Subject: [PATCH 43/78] stats test --- discord/teammakerv2.py | 45 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 0e177dd..6e4c050 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -4,6 +4,7 @@ import discord import random import asyncio import re +from textwrap import dedent from discord.ext import commands from openai import OpenAI @@ -190,11 +191,51 @@ async def whoisbest(ctx, category="Casual", matchesback=18): message += f"\n**\U0001F480 Top 3 AHD ({actual_category})**\n" for i, player in enumerate(top_ahd, start=1): message += f"{i}. **{player['playername']}** - {player['ahd']:.2f}\n" +##AI - await ctx.send(message) + system_prompt = dedent(""" + Je bent een Discord announcer-bot op de PUBG-server van DTCH. + Stijl: brutaal/competitief, licht denigrerend maar leesbaar. + Regels: + - Gebruik uitsluitend de meegeleverde stats-tekst. + - Output ALLEEN Discord-markdown (geen JSON, geen codeblokken). + - Structuur: + 1) Titel met category en korte snedige ondertitel. + 2) **๐Ÿ† Top 3 Winratio** en **๐Ÿ’€ Top 3 AHD** (exact die koppen). + 3) Per regel: ๐Ÿฅ‡/๐Ÿฅˆ/๐Ÿฅ‰ + **naam** + waarde (winratio met %). + 4) Afsluiten met 1 zin over dat Lanta01 sowieso beter is. + - Max ~1800 tekens. + """).strip() + user_prompt = dedent(f""" + Verpak onderstaande stats-tekst in รฉรฉn strakke Discord-post volgens de regels. + Wijzig geen waardes, haal alles uit de tekst tussen START/EINDE. + [STATS-TEKST START] + {message} + [STATS-TEKST EINDE] + """).strip() + response = client.chat.completions.create( + model="gpt-4o-mini", + temperature=0.6, + presence_penalty=0.2, + messages=[ + {"role": "system", "content": system_prompt}, + {"role": "user", "content": user_prompt}, + ], + ) + + antwoord = response.choices[0].message.content + await ctx.send(f"{ctx.author.mention} {antwoord[:1900]}") except Exception as e: - await ctx.send(f"Fout bij het laden van de statistieken: {str(e)}") + await ctx.send(f"{ctx.author.mention} Er ging iets mis: {e}") + + +##AIEND + + # await ctx.send(message) + + # except Exception as e: + # await ctx.send(f"Fout bij het laden van de statistieken: {str(e)}") @bot.event async def on_voice_state_update(member, before, after): From c2487ade2267ebf56647b6787a5f1c9c1793af44 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 15:26:57 +0200 Subject: [PATCH 44/78] s --- discord/teammakerv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 6e4c050..765689f 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -203,7 +203,7 @@ async def whoisbest(ctx, category="Casual", matchesback=18): 1) Titel met category en korte snedige ondertitel. 2) **๐Ÿ† Top 3 Winratio** en **๐Ÿ’€ Top 3 AHD** (exact die koppen). 3) Per regel: ๐Ÿฅ‡/๐Ÿฅˆ/๐Ÿฅ‰ + **naam** + waarde (winratio met %). - 4) Afsluiten met 1 zin over dat Lanta01 sowieso beter is. + 4) Sluit af met 1 of 2 regels analyse van de stats. - Max ~1800 tekens. """).strip() user_prompt = dedent(f""" From 4757ccc9cb6e5ec0c8479723a0443090411ab2ac Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 15:27:13 +0200 Subject: [PATCH 45/78] s --- discord/teammakerv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 765689f..d11a412 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -203,7 +203,7 @@ async def whoisbest(ctx, category="Casual", matchesback=18): 1) Titel met category en korte snedige ondertitel. 2) **๐Ÿ† Top 3 Winratio** en **๐Ÿ’€ Top 3 AHD** (exact die koppen). 3) Per regel: ๐Ÿฅ‡/๐Ÿฅˆ/๐Ÿฅ‰ + **naam** + waarde (winratio met %). - 4) Sluit af met 1 of 2 regels analyse van de stats. + 4) Sluit af met 1 of 2 regels analyse van de stats, gebruik humor. - Max ~1800 tekens. """).strip() user_prompt = dedent(f""" From afed25d8ee5b31273baabd9b30e6634cb9082bef Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 15:31:49 +0200 Subject: [PATCH 46/78] ahd --- discord/teammakerv2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index d11a412..b77aa98 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -196,6 +196,7 @@ async def whoisbest(ctx, category="Casual", matchesback=18): system_prompt = dedent(""" Je bent een Discord announcer-bot op de PUBG-server van DTCH. Stijl: brutaal/competitief, licht denigrerend maar leesbaar. + AHD = Avarage Human Damage Regels: - Gebruik uitsluitend de meegeleverde stats-tekst. - Output ALLEEN Discord-markdown (geen JSON, geen codeblokken). From 5ef611c7272905dc75d7af77ae2c731a5d53f578 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 15:46:44 +0200 Subject: [PATCH 47/78] topx --- discord/teammakerv2.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index b77aa98..d6990c9 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -130,19 +130,19 @@ async def teamify(ctx, *args): await ctx.send(f"Kanaal {channel.name} is opgeruimd omdat het leeg was!") @bot.command() -async def whoisbest(ctx, category="Casual", matchesback=18): +async def whoisbest(ctx, category="Casual", matchesback=18, top=3): if category.lower() == "help": help_message = ( "**Gebruik van het commando `whoisbest`:**\n" - "`!whoisbest [category] [matchesback]`\n\n" + "`!whoisbest [category] [matchesback] [top]`\n\n" "**Parameters:**\n" "`category` - De categorie van de stats, bijv. 'Casual' of 'Ranked'. Niet hoofdlettergevoelig.\n" "`matchesback` - Het minimum aantal matches dat een speler gespeeld moet hebben om mee te tellen (standaard 18).\n\n" "**Voorbeeld:**\n" "`!whoisbest Casual 18`\n" - "Laat de top 3 spelers zien op basis van winratio en gemiddelde damage in de Casual categorie met minimaal 18 matches.\n\n" + "Laat de top 3 spelers zien op basis van winratio en gemiddelde damage in de Casual categorie met minimaal 18 matches.\n" "Typ `!whoisbest help` om deze uitleg opnieuw te zien." ) await ctx.send(help_message) @@ -178,10 +178,10 @@ async def whoisbest(ctx, category="Casual", matchesback=18): return # Sorteer spelers op winratio (aflopend) - top_winratio = sorted(players, key=lambda x: x.get("winratio", 0), reverse=True)[:3] + top_winratio = sorted(players, key=lambda x: x.get("winratio", 0), reverse=True)[:top] # Sorteer spelers op gemiddelde damage (aflopend) - top_ahd = sorted(players, key=lambda x: x.get("ahd", 0), reverse=True)[:3] + top_ahd = sorted(players, key=lambda x: x.get("ahd", 0), reverse=True)[:top] # Bouw het bericht op message = f"**\U0001F3C6 Top 3 Winratio ({actual_category})**\n" @@ -193,16 +193,16 @@ async def whoisbest(ctx, category="Casual", matchesback=18): message += f"{i}. **{player['playername']}** - {player['ahd']:.2f}\n" ##AI - system_prompt = dedent(""" + system_prompt = dedent(f""" Je bent een Discord announcer-bot op de PUBG-server van DTCH. Stijl: brutaal/competitief, licht denigrerend maar leesbaar. - AHD = Avarage Human Damage + AHD = Average Human Damage Regels: - Gebruik uitsluitend de meegeleverde stats-tekst. - Output ALLEEN Discord-markdown (geen JSON, geen codeblokken). - Structuur: 1) Titel met category en korte snedige ondertitel. - 2) **๐Ÿ† Top 3 Winratio** en **๐Ÿ’€ Top 3 AHD** (exact die koppen). + 2) **๐Ÿ† Top {top} Winratio** en **๐Ÿ’€ Top {top} AHD** (exact die koppen). 3) Per regel: ๐Ÿฅ‡/๐Ÿฅˆ/๐Ÿฅ‰ + **naam** + waarde (winratio met %). 4) Sluit af met 1 of 2 regels analyse van de stats, gebruik humor. - Max ~1800 tekens. From 466235dd258ab434a4a63cff0ba392be391617cf Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 15:47:14 +0200 Subject: [PATCH 48/78] ai --- discord/teammakerv2.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index d6990c9..40804d4 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -233,10 +233,6 @@ async def whoisbest(ctx, category="Casual", matchesback=18, top=3): ##AIEND - # await ctx.send(message) - - # except Exception as e: - # await ctx.send(f"Fout bij het laden van de statistieken: {str(e)}") @bot.event async def on_voice_state_update(member, before, after): From 775d332f020f01f288f4645219b017858338e51f Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 16:00:50 +0200 Subject: [PATCH 49/78] opgegeven pars --- discord/teammakerv2.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 40804d4..7df5cf7 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -204,7 +204,12 @@ async def whoisbest(ctx, category="Casual", matchesback=18, top=3): 1) Titel met category en korte snedige ondertitel. 2) **๐Ÿ† Top {top} Winratio** en **๐Ÿ’€ Top {top} AHD** (exact die koppen). 3) Per regel: ๐Ÿฅ‡/๐Ÿฅˆ/๐Ÿฅ‰ + **naam** + waarde (winratio met %). - 4) Sluit af met 1 of 2 regels analyse van de stats, gebruik humor. + 4) De rest van de regels doe je zonder medaille gewoon een cijfer + 5) Sluit af met 1 of 2 regels analyse van de stats, gebruik humor. + - Opgegeven parameters: + Categorie: {category} + Minimaal aantal matches: {matchesback} + Top: {top} - Max ~1800 tekens. """).strip() user_prompt = dedent(f""" From 78debfcb09be89908e695f7363024bcfb1900982 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 16:07:21 +0200 Subject: [PATCH 50/78] s --- discord/teammakerv2.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 7df5cf7..785f531 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -210,6 +210,8 @@ async def whoisbest(ctx, category="Casual", matchesback=18, top=3): Categorie: {category} Minimaal aantal matches: {matchesback} Top: {top} + - verdere info + 1) Als de aantal matches laag is (onder de 15) dat zijn cijfers niet echt meer representatief. Meld dat dan ook. - Max ~1800 tekens. """).strip() user_prompt = dedent(f""" From 88cace125ce77d4516e904ee0edbbd6b6328ca17 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 16:07:41 +0200 Subject: [PATCH 51/78] s --- discord/teammakerv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 785f531..5e884e3 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -211,7 +211,7 @@ async def whoisbest(ctx, category="Casual", matchesback=18, top=3): Minimaal aantal matches: {matchesback} Top: {top} - verdere info - 1) Als de aantal matches laag is (onder de 15) dat zijn cijfers niet echt meer representatief. Meld dat dan ook. + 1) Als de aantal matches laag is (onder de 15) dan zijn cijfers niet echt meer representatief. Meld dat dan ook. - Max ~1800 tekens. """).strip() user_prompt = dedent(f""" From 65ebc9784f34fedd6f663a9729a5d4043c6c2466 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 16:23:05 +0200 Subject: [PATCH 52/78] clanmembers: --- discord/teammakerv2.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 5e884e3..fc8104b 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -370,6 +370,11 @@ async def dtch_help_command(ctx): @bot.command() async def ask(ctx, *, vraag: str): + file_path = os.path.join("..", "config", "clanmembers.json") + + # Inlezen als string + with open(file_path, "r", encoding="utf-8") as f: + clanmembers_str = f.read() """Stuur een vraag naar OpenAI""" try: response = client.chat.completions.create( @@ -384,6 +389,7 @@ async def ask(ctx, *, vraag: str): f"De vraag werd gesteld door {ctx.author.display_name}. " f"Vergeet niet af en toe te benadrukken hoe geweldig Lanta is " f"(die deze server en bot heeft gemaakt)." + f"dit zijn alle clan members: {clanmembers_str}" ) }, {"role": "user", "content": vraag}, From fbfde368136ea82ed7a09125a80a55f4554017b6 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 16:36:16 +0200 Subject: [PATCH 53/78] squad --- discord/teammakerv2.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index fc8104b..51d783e 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -371,10 +371,16 @@ async def dtch_help_command(ctx): @bot.command() async def ask(ctx, *, vraag: str): file_path = os.path.join("..", "config", "clanmembers.json") - # Inlezen als string with open(file_path, "r", encoding="utf-8") as f: clanmembers_str = f.read() + # Bestandspad + file_path_lifetimestats = os.path.join("..", "data", "player_lifetime_data.json") + + # JSON-bestand lezen + with open(file_path_lifetimestats, "r", encoding="utf-8") as file: + data_lifetimestats = json.load(file) + squad_str = json.dumps(data_lifetimestats.get("squad", {}), indent=2) """Stuur een vraag naar OpenAI""" try: response = client.chat.completions.create( @@ -389,7 +395,8 @@ async def ask(ctx, *, vraag: str): f"De vraag werd gesteld door {ctx.author.display_name}. " f"Vergeet niet af en toe te benadrukken hoe geweldig Lanta is " f"(die deze server en bot heeft gemaakt)." - f"dit zijn alle clan members: {clanmembers_str}" + f"dit zijn alle clan members: {clanmembers_str}." + f"Lifetime stats van de categorie squad: {squad_str}" ) }, {"role": "user", "content": vraag}, From 2b584df1a261514016eb5541e5dba5550120dfd1 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 16:36:33 +0200 Subject: [PATCH 54/78] squad stats --- discord/teammakerv2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 51d783e..9baa3e3 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -381,6 +381,7 @@ async def ask(ctx, *, vraag: str): with open(file_path_lifetimestats, "r", encoding="utf-8") as file: data_lifetimestats = json.load(file) squad_str = json.dumps(data_lifetimestats.get("squad", {}), indent=2) + print(squad_str[:300]) # eerste 300 tekens checken """Stuur een vraag naar OpenAI""" try: response = client.chat.completions.create( From 596d7514a8b19f444fa2ebc37deeaa5886703e2d Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 16:59:02 +0200 Subject: [PATCH 55/78] meer stats --- discord/teammakerv2.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 9baa3e3..823b911 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -370,18 +370,27 @@ async def dtch_help_command(ctx): @bot.command() async def ask(ctx, *, vraag: str): + ## CLAN MEMBERS file_path = os.path.join("..", "config", "clanmembers.json") # Inlezen als string with open(file_path, "r", encoding="utf-8") as f: clanmembers_str = f.read() - # Bestandspad - file_path_lifetimestats = os.path.join("..", "data", "player_lifetime_data.json") - # JSON-bestand lezen + #LIFETIME STATS + + + file_path_lifetimestats = os.path.join("..", "data", "player_lifetime_data.json") with open(file_path_lifetimestats, "r", encoding="utf-8") as file: data_lifetimestats = json.load(file) squad_str = json.dumps(data_lifetimestats.get("squad", {}), indent=2) - print(squad_str[:300]) # eerste 300 tekens checken + + #Last stats + file_path_laststats = os.path.join("..", "data", "player_last_stats.json") + with open(file_path_laststats, "r", encoding="utf-8") as file: + data_laststat = json.load(file) + casual_str = json.dumps(data_laststat.get("Casual", []), indent=2) + ranked_str = json.dumps(data_laststat.get("Ranked", []), indent=2) + custom_str = json.dumps(data_laststat.get("custom", []), indent=2) """Stuur een vraag naar OpenAI""" try: response = client.chat.completions.create( @@ -398,6 +407,11 @@ async def ask(ctx, *, vraag: str): f"(die deze server en bot heeft gemaakt)." f"dit zijn alle clan members: {clanmembers_str}." f"Lifetime stats van de categorie squad: {squad_str}" + f"Stats van Casuals: {casual_str}" + f"Stats van Ranked: {ranked_str}" + f"Stats van Custom: {custom_str}" + f"Custom zijn games die wij meesten tegen elkaar spelen." + ) }, {"role": "user", "content": vraag}, From 8d7a838237001ebe43fe43ca4bd74e264ee898cc Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 17:15:48 +0200 Subject: [PATCH 56/78] gpt 5 nano --- discord/teammakerv2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 823b911..cb88a64 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -223,7 +223,7 @@ async def whoisbest(ctx, category="Casual", matchesback=18, top=3): [STATS-TEKST EINDE] """).strip() response = client.chat.completions.create( - model="gpt-4o-mini", + model="gpt-5-nano", temperature=0.6, presence_penalty=0.2, messages=[ @@ -394,7 +394,7 @@ async def ask(ctx, *, vraag: str): """Stuur een vraag naar OpenAI""" try: response = client.chat.completions.create( - model="gpt-4o-mini", + model="gpt-5-nano", messages=[ { "role": "system", From ab8378f5506983a87a1c25da579c6f6411b5f578 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 17:17:32 +0200 Subject: [PATCH 57/78] s --- discord/teammakerv2.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index cb88a64..1c7045f 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -401,9 +401,8 @@ async def ask(ctx, *, vraag: str): "content": ( f"Je bent een denigrerende chatbot in Discord. " f"Je zit op een PUBG discord server van de clan DTCH. " - f"Antwoord altijd op een kleinerende manier richting de user. " f"De vraag werd gesteld door {ctx.author.display_name}. " - f"Vergeet niet af en toe te benadrukken hoe geweldig Lanta is " + f"Vergeet niet heel af en toe te benadrukken hoe geweldig Lanta is" f"(die deze server en bot heeft gemaakt)." f"dit zijn alle clan members: {clanmembers_str}." f"Lifetime stats van de categorie squad: {squad_str}" From 5993f6fd761e735f3efd62e786f0810458d7106a Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 17:22:17 +0200 Subject: [PATCH 58/78] s --- discord/teammakerv2.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 1c7045f..5d42a8b 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -410,6 +410,8 @@ async def ask(ctx, *, vraag: str): f"Stats van Ranked: {ranked_str}" f"Stats van Custom: {custom_str}" f"Custom zijn games die wij meesten tegen elkaar spelen." + f"Maximaal 1800 karakters" + f"Als je stats output doe dat dan in discord markdown" ) }, From 4c347e42af4250b94e95748abdcbfdde992de0cd Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 17:46:05 +0200 Subject: [PATCH 59/78] typing --- discord/teammakerv2.py | 49 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 5d42a8b..67e8bbb 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -393,31 +393,32 @@ async def ask(ctx, *, vraag: str): custom_str = json.dumps(data_laststat.get("custom", []), indent=2) """Stuur een vraag naar OpenAI""" try: - response = client.chat.completions.create( - model="gpt-5-nano", - messages=[ - { - "role": "system", - "content": ( - f"Je bent een denigrerende chatbot in Discord. " - f"Je zit op een PUBG discord server van de clan DTCH. " - f"De vraag werd gesteld door {ctx.author.display_name}. " - f"Vergeet niet heel af en toe te benadrukken hoe geweldig Lanta is" - f"(die deze server en bot heeft gemaakt)." - f"dit zijn alle clan members: {clanmembers_str}." - f"Lifetime stats van de categorie squad: {squad_str}" - f"Stats van Casuals: {casual_str}" - f"Stats van Ranked: {ranked_str}" - f"Stats van Custom: {custom_str}" - f"Custom zijn games die wij meesten tegen elkaar spelen." - f"Maximaal 1800 karakters" - f"Als je stats output doe dat dan in discord markdown" + async with ctx.typing(): + response = client.chat.completions.create( + model="gpt-5-nano", + messages=[ + { + "role": "system", + "content": ( + f"Je bent een denigrerende chatbot in Discord. " + f"Je zit op een PUBG discord server van de clan DTCH. " + f"De vraag werd gesteld door {ctx.author.display_name}. " + f"Vergeet niet heel af en toe te benadrukken hoe geweldig Lanta is" + f"(die deze server en bot heeft gemaakt)." + f"dit zijn alle clan members: {clanmembers_str}." + f"Lifetime stats van de categorie squad: {squad_str}" + f"Stats van Casuals: {casual_str}" + f"Stats van Ranked: {ranked_str}" + f"Stats van Custom: {custom_str}" + f"Custom zijn games die wij meesten tegen elkaar spelen." + f"Maximaal 1800 karakters" + f"Als je stats output doe dat dan in discord markdown" - ) - }, - {"role": "user", "content": vraag}, - ], - ) + ) + }, + {"role": "user", "content": vraag}, + ], + ) antwoord = response.choices[0].message.content await ctx.send(f"{ctx.author.mention} {antwoord[:1900]}") From 94c57710dbf0bf3327014d6dd63bee60253c652d Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 17:46:43 +0200 Subject: [PATCH 60/78] context anders --- discord/teammakerv2.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 67e8bbb..6e1b06b 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -400,11 +400,9 @@ async def ask(ctx, *, vraag: str): { "role": "system", "content": ( - f"Je bent een denigrerende chatbot in Discord. " + f"Je bent een licht denigrerende chatbot in Discord. " f"Je zit op een PUBG discord server van de clan DTCH. " f"De vraag werd gesteld door {ctx.author.display_name}. " - f"Vergeet niet heel af en toe te benadrukken hoe geweldig Lanta is" - f"(die deze server en bot heeft gemaakt)." f"dit zijn alle clan members: {clanmembers_str}." f"Lifetime stats van de categorie squad: {squad_str}" f"Stats van Casuals: {casual_str}" From d33030c746ce2e10594fc1fdfd02614adfce400a Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 20:52:50 +0200 Subject: [PATCH 61/78] onnline members in context --- discord/teammakerv2.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 6e1b06b..ea6fac9 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -378,7 +378,6 @@ async def ask(ctx, *, vraag: str): #LIFETIME STATS - file_path_lifetimestats = os.path.join("..", "data", "player_lifetime_data.json") with open(file_path_lifetimestats, "r", encoding="utf-8") as file: data_lifetimestats = json.load(file) @@ -391,6 +390,10 @@ async def ask(ctx, *, vraag: str): casual_str = json.dumps(data_laststat.get("Casual", []), indent=2) ranked_str = json.dumps(data_laststat.get("Ranked", []), indent=2) custom_str = json.dumps(data_laststat.get("custom", []), indent=2) + # Online members + online_members = [m.display_name for m in ctx.guild.members if m.status != discord.Status.offline] + online_str = ", ".join(online_members) if online_members else "Niemand is online" + """Stuur een vraag naar OpenAI""" try: async with ctx.typing(): @@ -404,11 +407,12 @@ async def ask(ctx, *, vraag: str): f"Je zit op een PUBG discord server van de clan DTCH. " f"De vraag werd gesteld door {ctx.author.display_name}. " f"dit zijn alle clan members: {clanmembers_str}." + f"Op dit moment online: {online_str}. " f"Lifetime stats van de categorie squad: {squad_str}" f"Stats van Casuals: {casual_str}" f"Stats van Ranked: {ranked_str}" f"Stats van Custom: {custom_str}" - f"Custom zijn games die wij meesten tegen elkaar spelen." + f"Custom zijn games die wij meestel tegen elkaar spelen." f"Maximaal 1800 karakters" f"Als je stats output doe dat dan in discord markdown" From e8e4d3bcf725c9641f4ee2379ed47d4e48172444 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 21:02:44 +0200 Subject: [PATCH 62/78] s --- discord/teammakerv2.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index ea6fac9..0fb4b3e 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -391,8 +391,12 @@ async def ask(ctx, *, vraag: str): ranked_str = json.dumps(data_laststat.get("Ranked", []), indent=2) custom_str = json.dumps(data_laststat.get("custom", []), indent=2) # Online members - online_members = [m.display_name for m in ctx.guild.members if m.status != discord.Status.offline] - online_str = ", ".join(online_members) if online_members else "Niemand is online" + online_clan = [] + for member in ctx.guild.members: + if member.display_name in clanmembers and member.status == discord.Status.online: + online_clan.append(member.display_name) + + online_str = ", ".join(online_clan) if online_clan else "Geen clanmembers online" """Stuur een vraag naar OpenAI""" try: From 2c1f956938cd9f6d067792cc5fd3061186cabff5 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 21:32:18 +0200 Subject: [PATCH 63/78] up --- discord/teammakerv2.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 0fb4b3e..4a80b35 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -391,12 +391,13 @@ async def ask(ctx, *, vraag: str): ranked_str = json.dumps(data_laststat.get("Ranked", []), indent=2) custom_str = json.dumps(data_laststat.get("custom", []), indent=2) # Online members - online_clan = [] - for member in ctx.guild.members: - if member.display_name in clanmembers and member.status == discord.Status.online: - online_clan.append(member.display_name) + online_members = [ + member.display_name + for member in ctx.guild.members + if member.status == discord.Status.online + ] - online_str = ", ".join(online_clan) if online_clan else "Geen clanmembers online" + online_str = ", ".join(online_members) if online_members else "Niemand is online" """Stuur een vraag naar OpenAI""" try: From 5d2258ca1d16bd4ad22ceeae6884f9b1cf015ea0 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 2 Oct 2025 21:36:03 +0200 Subject: [PATCH 64/78] voice online --- discord/teammakerv2.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 4a80b35..c44928e 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -391,13 +391,13 @@ async def ask(ctx, *, vraag: str): ranked_str = json.dumps(data_laststat.get("Ranked", []), indent=2) custom_str = json.dumps(data_laststat.get("custom", []), indent=2) # Online members - online_members = [ + voice_members = [ member.display_name - for member in ctx.guild.members - if member.status == discord.Status.online + for vc in ctx.guild.voice_channels + for member in vc.members ] - online_str = ", ".join(online_members) if online_members else "Niemand is online" + voice_str = ", ".join(voice_members) if voice_members else "Niemand zit in een voice kanaal" """Stuur een vraag naar OpenAI""" try: @@ -412,7 +412,7 @@ async def ask(ctx, *, vraag: str): f"Je zit op een PUBG discord server van de clan DTCH. " f"De vraag werd gesteld door {ctx.author.display_name}. " f"dit zijn alle clan members: {clanmembers_str}." - f"Op dit moment online: {online_str}. " + f"Op dit moment online: {voice_str}. " f"Lifetime stats van de categorie squad: {squad_str}" f"Stats van Casuals: {casual_str}" f"Stats van Ranked: {ranked_str}" From 8fdc97067ad41f3af14a6211140b5574dc4e7f0b Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 3 Oct 2025 08:55:47 +0200 Subject: [PATCH 65/78] temp --- discord/teammakerv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index c44928e..3ebc652 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -224,7 +224,7 @@ async def whoisbest(ctx, category="Casual", matchesback=18, top=3): """).strip() response = client.chat.completions.create( model="gpt-5-nano", - temperature=0.6, + #temperature=0.6, presence_penalty=0.2, messages=[ {"role": "system", "content": system_prompt}, From a36425d79852ff081838e5de9117a636f1abef05 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 3 Oct 2025 09:03:31 +0200 Subject: [PATCH 66/78] rate limit --- discord/teammakerv2.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 3ebc652..99ea46e 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -369,6 +369,7 @@ async def dtch_help_command(ctx): await ctx.send(embed=embed) @bot.command() +@commands.cooldown(1, 15, commands.BucketType.user) async def ask(ctx, *, vraag: str): ## CLAN MEMBERS file_path = os.path.join("..", "config", "clanmembers.json") @@ -431,5 +432,11 @@ async def ask(ctx, *, vraag: str): await ctx.send(f"{ctx.author.mention} {antwoord[:1900]}") except Exception as e: await ctx.send(f"{ctx.author.mention} Er ging iets mis: {e}") - +@ask.error +async def ask_error(ctx, error): + if isinstance(error, commands.CommandOnCooldown): + retry_after = int(error.retry_after + 0.999) + await ctx.reply(f"Rustig {ctx.author.display_name}, probeer het over {retry_after}s nog eens.") + else: + raise error bot.run(token) From 0870891747d4aa79f82c346104b754f8b07aa62a Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 3 Oct 2025 09:05:16 +0200 Subject: [PATCH 67/78] options not supported --- discord/teammakerv2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 99ea46e..6c63ec2 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -225,7 +225,7 @@ async def whoisbest(ctx, category="Casual", matchesback=18, top=3): response = client.chat.completions.create( model="gpt-5-nano", #temperature=0.6, - presence_penalty=0.2, + #presence_penalty=0.2, messages=[ {"role": "system", "content": system_prompt}, {"role": "user", "content": user_prompt}, From c724cd6bcb5d0ebcdd85310cf962def15ccd3ec1 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 3 Oct 2025 12:14:45 +0200 Subject: [PATCH 68/78] betere system prompt --- discord/teammakerv2.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 6c63ec2..8d7af22 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -409,18 +409,21 @@ async def ask(ctx, *, vraag: str): { "role": "system", "content": ( - f"Je bent een licht denigrerende chatbot in Discord. " - f"Je zit op een PUBG discord server van de clan DTCH. " - f"De vraag werd gesteld door {ctx.author.display_name}. " - f"dit zijn alle clan members: {clanmembers_str}." - f"Op dit moment online: {voice_str}. " - f"Lifetime stats van de categorie squad: {squad_str}" - f"Stats van Casuals: {casual_str}" - f"Stats van Ranked: {ranked_str}" - f"Stats van Custom: {custom_str}" - f"Custom zijn games die wij meestel tegen elkaar spelen." - f"Maximaal 1800 karakters" - f"Als je stats output doe dat dan in discord markdown" + "Je bent een licht denigrerende chatbot in Discord, actief op de PUBG server van clan DTCH. " + f"De vraag is gesteld door {ctx.author.display_name}. " + + # Context + f"Clanleden: {clanmembers_str}. " + f"Momenteel in voice: {voice_str}. " + f"Lifetime stats (squad): {squad_str}. " + f"Casual stats: {casual_str}. " + f"Ranked stats: {ranked_str}. " + f"Custom stats (clan games tegen elkaar): {custom_str}. " + + # Richtlijnen voor antwoord + "Houd je antwoorden kort en bondig, met maximaal 1800 tekens. " + "Gebruik Discord markdown (``` of **vetgedrukt**) wanneer je stats of tabellen toont. " + "Wees een beetje sarcastisch, maar wel begrijpelijk. " ) }, From 4ce21087f47748fe819cccf0b5bc72243bfb1048 Mon Sep 17 00:00:00 2001 From: Lanta Date: Mon, 6 Oct 2025 09:33:57 +0200 Subject: [PATCH 69/78] prompt --- discord/teammakerv2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 8d7af22..6f17a8c 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -416,14 +416,15 @@ async def ask(ctx, *, vraag: str): f"Clanleden: {clanmembers_str}. " f"Momenteel in voice: {voice_str}. " f"Lifetime stats (squad): {squad_str}. " - f"Casual stats: {casual_str}. " + f"Casual (spelen we toch wel het vaakst met elkaar, belangrijke stat dus) stats: {casual_str}. " f"Ranked stats: {ranked_str}. " - f"Custom stats (clan games tegen elkaar): {custom_str}. " + f"Custom stats (clan games meestal tegen elkaar): {custom_str}. " # Richtlijnen voor antwoord - "Houd je antwoorden kort en bondig, met maximaal 1800 tekens. " + "Houd je antwoorden kort en bondig, met maximaal 1600 tekens. " "Gebruik Discord markdown (``` of **vetgedrukt**) wanneer je stats of tabellen toont. " "Wees een beetje sarcastisch, maar wel begrijpelijk. " + "Stel geen vragen want je hebt geen context bij de volgende prompt." ) }, From cf975bccce5d3640a3fe6b9744e7c7b521a4f433 Mon Sep 17 00:00:00 2001 From: Lanta Date: Mon, 6 Oct 2025 09:40:51 +0200 Subject: [PATCH 70/78] s --- discord/teammakerv2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 6f17a8c..33cdb48 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -422,6 +422,7 @@ async def ask(ctx, *, vraag: str): # Richtlijnen voor antwoord "Houd je antwoorden kort en bondig, met maximaal 1600 tekens. " + "Kill Death Human (KD_H) en winrato zijn de belangrijkste stats omdat bots heel makkelijk te killen zijn vinden de Human Kill death het belangrijkste" "Gebruik Discord markdown (``` of **vetgedrukt**) wanneer je stats of tabellen toont. " "Wees een beetje sarcastisch, maar wel begrijpelijk. " "Stel geen vragen want je hebt geen context bij de volgende prompt." From 890d445c7849c3e9e45c9819992c552f2796ce74 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 8 Oct 2025 15:22:32 +0200 Subject: [PATCH 71/78] geen events --- update/get_matches.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/update/get_matches.ps1 b/update/get_matches.ps1 index 35e5d5f..a3d029a 100644 --- a/update/get_matches.ps1 +++ b/update/get_matches.ps1 @@ -48,7 +48,10 @@ foreach ($player in $player_data) { $stats.included = $sortedStats $stats | ConvertTo-Json -Depth 100 | Out-File "$scriptroot/../data/matches/$match.json" } - + if($stats.data.attributes.matchtype -eq 'event'){ + write-output 'Skipping because of event' + continue + } $playermatches += [PSCustomObject]@{ stats = $stats.included.ATTRIBUTES.stats | where-object { $_.name -eq $player.attributes.name } matchType = $stats.data.attributes.matchtype From c175319cd92388b7218f848a01968be25f59db3c Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 8 Oct 2025 15:54:39 +0200 Subject: [PATCH 72/78] s --- update/matchparser.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/update/matchparser.ps1 b/update/matchparser.ps1 index 85b1ea7..d51b611 100644 --- a/update/matchparser.ps1 +++ b/update/matchparser.ps1 @@ -161,6 +161,10 @@ $groupedGuids_clan_matches_gt_3 = $guids | Group-Object | Where-Object { $_.Coun $last_month = (get-date).AddMonths($monthsback) foreach ($file in $matchfiles) { $json = get-content $file | ConvertFrom-Json + if($json.stats.matchType -eq 'event'){ + write-output 'match is event skipping' + continue + } if ($json.created -gt $last_month) { $killstats += $json if ($groupedGuids_clan_matches_gt_1.Name -contains $json.matchid) { From 8499e9f0735c14821c07472ccc527c20f791c8a5 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 8 Oct 2025 16:31:19 +0200 Subject: [PATCH 73/78] tdm be gone --- update/matchparser.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/update/matchparser.ps1 b/update/matchparser.ps1 index d51b611..41b960a 100644 --- a/update/matchparser.ps1 +++ b/update/matchparser.ps1 @@ -161,8 +161,9 @@ $groupedGuids_clan_matches_gt_3 = $guids | Group-Object | Where-Object { $_.Coun $last_month = (get-date).AddMonths($monthsback) foreach ($file in $matchfiles) { $json = get-content $file | ConvertFrom-Json - if($json.stats.matchType -eq 'event'){ - write-output 'match is event skipping' + + if($json.stats.matchType -eq 'event' -or $json.stats.gameMode -eq 'tdm'){ + write-output 'match is event or tdm skipping' continue } if ($json.created -gt $last_month) { From 20a050148bcfdf2e5a7fa63b586a86203594ea6b Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 8 Oct 2025 16:35:48 +0200 Subject: [PATCH 74/78] tdm --- update/get_matches.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update/get_matches.ps1 b/update/get_matches.ps1 index a3d029a..5692223 100644 --- a/update/get_matches.ps1 +++ b/update/get_matches.ps1 @@ -48,7 +48,7 @@ foreach ($player in $player_data) { $stats.included = $sortedStats $stats | ConvertTo-Json -Depth 100 | Out-File "$scriptroot/../data/matches/$match.json" } - if($stats.data.attributes.matchtype -eq 'event'){ + if($stats.data.attributes.matchtype -eq 'event' -or $stats.data.attributes.gameMode -eq 'tdm'){ write-output 'Skipping because of event' continue } From c4ed5551ae4570e17b858b1dff3794aaecc11c73 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 17 Oct 2025 13:37:34 +0200 Subject: [PATCH 75/78] tdm --- discord/report_new_matches.ps1 | 9 ++++++++- update/matchparser.ps1 | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 8b7e97e..d631d09 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -252,6 +252,13 @@ foreach ($winid in $new_win_matches) { $match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$winid" -Method GET -Headers $headers if ($winmatches[0].gameMode -eq 'tdm' ) { continue + } + if ( + ($winmatches[0].matchtype -eq 'event' -and $winmatches[0].gameMode -ne 'ibr') -or + ($winmatches[0].gameMode -eq 'tdm') + ) { + Write-Output 'Skipping because of event or tdm' + continue } #skip tdm matches if ($winmatches[0].matchType -eq 'custom') { $players_to_report = $match_stats.included.attributes.stats | where-object { $_.playerId -notlike "ai.*" } @@ -263,7 +270,7 @@ foreach ($winid in $new_win_matches) { if ($new_win_matches.count -le 10) { #fail safe $winnerswithurl = @() - foreach($winner in $winners){ + foreach ($winner in $winners) { $winnerswithurl += "[$winner]()" } send-discord -content ":chicken: :chicken: **WINNER WINNER CHICKEN DINNER!!** :chicken: :chicken:" diff --git a/update/matchparser.ps1 b/update/matchparser.ps1 index 41b960a..f77dc3c 100644 --- a/update/matchparser.ps1 +++ b/update/matchparser.ps1 @@ -162,8 +162,11 @@ $last_month = (get-date).AddMonths($monthsback) foreach ($file in $matchfiles) { $json = get-content $file | ConvertFrom-Json - if($json.stats.matchType -eq 'event' -or $json.stats.gameMode -eq 'tdm'){ - write-output 'match is event or tdm skipping' + if ( + ($stats.data.attributes.matchtype -eq 'event' -and $stats.data.attributes.gameMode -ne 'ibr') -or + ($stats.data.attributes.gameMode -eq 'tdm') + ) { + Write-Output 'Skipping because of event or tdm' continue } if ($json.created -gt $last_month) { From ca8ae31e9ec627d4f9d2f54312da2471ebee3ff2 Mon Sep 17 00:00:00 2001 From: Lanta Date: Fri, 17 Oct 2025 13:37:45 +0200 Subject: [PATCH 76/78] win filter --- update/get_matches.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/update/get_matches.ps1 b/update/get_matches.ps1 index 5692223..d999ea6 100644 --- a/update/get_matches.ps1 +++ b/update/get_matches.ps1 @@ -48,8 +48,11 @@ foreach ($player in $player_data) { $stats.included = $sortedStats $stats | ConvertTo-Json -Depth 100 | Out-File "$scriptroot/../data/matches/$match.json" } - if($stats.data.attributes.matchtype -eq 'event' -or $stats.data.attributes.gameMode -eq 'tdm'){ - write-output 'Skipping because of event' + if ( + ($stats.data.attributes.matchtype -eq 'event' -and $stats.data.attributes.gameMode -ne 'ibr') -or + ($stats.data.attributes.gameMode -eq 'tdm') + ) { + Write-Output 'Skipping because of event or tdm' continue } $playermatches += [PSCustomObject]@{ From 3f2a210486d7d68395e6baf8345f105a973a7061 Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 29 Jan 2026 10:57:07 +0100 Subject: [PATCH 77/78] loterij --- discord/teammakerv2.py | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 33cdb48..22bd6e0 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -437,6 +437,54 @@ async def ask(ctx, *, vraag: str): await ctx.send(f"{ctx.author.mention} {antwoord[:1900]}") except Exception as e: await ctx.send(f"{ctx.author.mention} Er ging iets mis: {e}") +@bot.command() +async def loterij(ctx, *members: discord.Member): + """ + Gebruik: + !loterij @naam1 @naam2 @naam3 + """ + # Alleen in #teamify? -> uncomment als je dat ook wilt + # if ctx.channel.name != "teamify": + # await ctx.send("Dit commando kan alleen worden gebruikt in het #teamify kanaal.") + # return + + if not members or len(members) < 2: + await ctx.send("Gebruik: `!loterij @naam1 @naam2 ...` (minimaal 2 mensen, anders is het wel hรฉรฉl zielig).") + return + + # Uniek maken (als iemand 2x getagd wordt telt 'ie maar 1x mee) + unique_members = [] + seen_ids = set() + for m in members: + if m.id not in seen_ids: + unique_members.append(m) + seen_ids.add(m.id) + + # Tekst โ€œtussen A, B en Cโ€ netjes bouwen + mentions = [m.mention for m in unique_members] + if len(mentions) == 2: + between_text = f"{mentions[0]} en {mentions[1]}" + else: + between_text = f"{', '.join(mentions[:-1])} en {mentions[-1]}" + + winnaar = random.choice(unique_members) + + await ctx.send(f"En de loterij gaat tussen {between_text}.") + + # Countdown + await asyncio.sleep(1) + await ctx.send("in 3") + await asyncio.sleep(1) + await ctx.send("2") + await asyncio.sleep(1) + await ctx.send("1") + await asyncio.sleep(1) + + await ctx.send("trom gerofel ๐Ÿฅ") + await asyncio.sleep(1) + + await ctx.send(f"De winnaar is {winnaar.mention} ๐ŸŽ†๐ŸŽ‡") + @ask.error async def ask_error(ctx, error): if isinstance(error, commands.CommandOnCooldown): From 569155943709ad44725ff7320a125792208043db Mon Sep 17 00:00:00 2001 From: Lanta Date: Thu, 29 Jan 2026 18:03:24 +0100 Subject: [PATCH 78/78] error afhandeling --- discord/teammakerv2.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index 22bd6e0..105c30a 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -437,6 +437,15 @@ async def ask(ctx, *, vraag: str): await ctx.send(f"{ctx.author.mention} {antwoord[:1900]}") except Exception as e: await ctx.send(f"{ctx.author.mention} Er ging iets mis: {e}") + +@ask.error +async def ask_error(ctx, error): + if isinstance(error, commands.CommandOnCooldown): + retry_after = int(error.retry_after + 0.999) + await ctx.reply(f"Rustig {ctx.author.display_name}, probeer het over {retry_after}s nog eens.") + else: + raise error + @bot.command() async def loterij(ctx, *members: discord.Member): """ @@ -485,11 +494,17 @@ async def loterij(ctx, *members: discord.Member): await ctx.send(f"De winnaar is {winnaar.mention} ๐ŸŽ†๐ŸŽ‡") -@ask.error -async def ask_error(ctx, error): - if isinstance(error, commands.CommandOnCooldown): - retry_after = int(error.retry_after + 0.999) - await ctx.reply(f"Rustig {ctx.author.display_name}, probeer het over {retry_after}s nog eens.") +@loterij.error +async def loterij_error(ctx, error): + if isinstance(error, commands.BadArgument): + await ctx.send( + "Ik snap er niks van ๐Ÿคจ\n" + "Gebruik het zo:\n" + "`!loterij @naam1 @naam2 @naam3`\n" + "Zorg dat je **echte Discord-mentions** gebruikt." + ) else: raise error + + bot.run(token)