mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-08 20:54:38 +02:00
Add check-*.ps1 scripts
This commit is contained in:
@ -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
|
||||
|
23
Scripts/check-dogecoin.ps1
Normal file
23
Scripts/check-dogecoin.ps1
Normal 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
|
||||
}
|
23
Scripts/check-ethereum.ps1
Normal file
23
Scripts/check-ethereum.ps1
Normal 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
|
||||
}
|
Reference in New Issue
Block a user