PowerShell/Scripts/check-sunrise.ps1

22 lines
570 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 sunrise
2021-12-04 14:02:56 +01:00
.DESCRIPTION
2021-12-05 11:28:14 +01:00
This script queries the time of sunrise 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-sunrise
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="Sunrise is at %S." -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
}