PowerShell/Scripts/check-dawn.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 dawn
2021-12-04 14:02:56 +01:00
.DESCRIPTION
2021-12-05 11:28:14 +01:00
This script queries the time of dawn 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-dawn
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="Dawn 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
}