diff --git a/Docs/VoiceControl.md b/Docs/VoiceControl.md index 7134a9de..3ec1beed 100644 --- a/Docs/VoiceControl.md +++ b/Docs/VoiceControl.md @@ -25,7 +25,7 @@ More supported voice commands are: `Computer, check` [name] ------------------------ -Lets the computer check something, replace [name] by: `Christmas`, `CPU`, `date`, `DNS`, `dawn`, `drives`, `dusk`, `Earth` (fun), `headlines`, `ISS`, `moon phase`, `New Year`, `operating system`, `ping`, `sunrise`, `sunset`, `swap space`, `time`, `time zone`, `up-time`, `VPN`, `weather`, or `zenith`. +Lets the computer check something, replace [name] by: `Bitcoin`, `Christmas`, `CPU`, `date`, `DNS`, `dawn`, `drives`, `dusk`, `Earth` (fun), `headlines`, `ISS`, `moon phase`, `New Year`, `operating system`, `ping`, `sunrise`, `sunset`, `swap space`, `time`, `time zone`, `up-time`, `VPN`, `weather`, or `zenith`. `Computer, open` [name] `browser` diff --git a/Scripts/check-bitcoin.ps1 b/Scripts/check-bitcoin.ps1 new file mode 100644 index 00000000..7be51337 --- /dev/null +++ b/Scripts/check-bitcoin.ps1 @@ -0,0 +1,23 @@ +<# +.SYNOPSIS + Checks the Bitcoin rate +.DESCRIPTION + This script queries the current Bitcoin exchange rates and answers by text-to-speech (TTS). +.EXAMPLE + PS> ./check-bitcoin +.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=BTC&tsyms=USD,EUR" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json + $Reply = "Bitcoin is 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 +}