Add check-*.ps1 scripts

This commit is contained in:
Markus Fleschutz
2021-12-05 11:53:00 +01:00
parent 5690484b39
commit d977df7ce0
4 changed files with 49 additions and 2 deletions

View File

@ -13,7 +13,7 @@
try {
$Rates = (Invoke-WebRequest -uri "https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD,EUR" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
$Reply = "Bitcoin is at $($Rates.USD) US$ and $($Rates.EUR) Euro."
$Reply = "Bitcoin is currently at $($Rates.USD) US$ and $($Rates.EUR) Euro."
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success

View File

@ -0,0 +1,23 @@
<#
.SYNOPSIS
Checks the Dogecoin rate
.DESCRIPTION
This script queries the current Dogecoin exchange rates and answers by text-to-speech (TTS).
.EXAMPLE
PS> ./check-dogecoin
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$Rates = (Invoke-WebRequest -uri "https://min-api.cryptocompare.com/data/price?fsym=DOGE&tsyms=USD,EUR" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
$Reply = "Dogecoin is currently at $($Rates.USD) US$ and $($Rates.EUR) Euro."
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}

View File

@ -0,0 +1,23 @@
<#
.SYNOPSIS
Checks the Ethereum rate
.DESCRIPTION
This script queries the current Ethereum exchange rates and answers by text-to-speech (TTS).
.EXAMPLE
PS> ./check-ethereum
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$Rates = (Invoke-WebRequest -uri "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
$Reply = "Ethereum is currently at $($Rates.USD) US$ and $($Rates.EUR) Euro."
"✔️ $Reply"
& "$PSScriptRoot/speak-english.ps1" "$Reply"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
exit 1
}