send a single joke

This commit is contained in:
onyx-and-iris 2026-02-18 21:30:39 +00:00
parent eeae1c76b4
commit 5192c9f694

View File

@ -16,7 +16,7 @@ function Send-Message {
param($rcon)
$msg = Get-DadJoke
$msg | Write-Debug
Write-Debug "Sending message: $msg"
$rcon.Say($msg)
}
@ -25,13 +25,7 @@ try {
$conn = Get-ConnFromPSD1
$rcon = Connect-Rcon -hostname $conn.host -port $conn.port -passwd $conn.passwd
$stopWatch = [system.diagnostics.stopwatch]::StartNew()
$timeSpan = New-TimeSpan -Seconds 30
do {
Send-Message -rcon $rcon
Start-Sleep -Seconds 10
} until ($stopWatch.Elapsed -ge $timeSpan)
$stopWatch.Stop()
}
finally {
Disconnect-Rcon -rcon $rcon