PowerShell/Scripts/check-dusk.ps1

23 lines
560 B
PowerShell
Raw Normal View History

2021-12-04 14:02:56 +01:00
<#
.SYNOPSIS
2021-12-05 11:28:14 +01:00
Checks the time of dusk
2021-12-04 14:02:56 +01:00
.DESCRIPTION
2021-12-05 11:28:14 +01:00
This script queries the time of dusk and answers by text-to-speech (TTS).
2021-12-04 14:02:56 +01:00
.EXAMPLE
2021-12-05 11:28:14 +01:00
PS> ./check-dusk
2021-12-04 14:02:56 +01:00
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
2021-12-05 11:28:14 +01:00
$Reply = (Invoke-WebRequest http://wttr.in/?format="Dusk is at %d." -UserAgent "curl" -useBasicParsing).Content
2021-12-06 17:00:49 +01:00
& "$PSScriptRoot/give-reply.ps1" "$Reply"
2021-12-04 14:02:56 +01:00
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}