mirror of
https://github.com/onyx-and-iris/q3rcon-ps.git
synced 2026-02-21 00:59:11 +00:00
send a single joke
This commit is contained in:
parent
eeae1c76b4
commit
5192c9f694
@ -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()
|
||||
Send-Message -rcon $rcon
|
||||
}
|
||||
finally {
|
||||
Disconnect-Rcon -rcon $rcon
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user