mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-08 17:28:18 +02:00
Update good-night.ps1
This commit is contained in:
parent
6320b1f287
commit
36938724dc
@ -1,8 +1,8 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Say an answer to 'good night'
|
Answers to 'good night'
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This script answers "good night" by text-to-speech (TTS).
|
This script answers to "good night" by text-to-speech (TTS).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./good-night
|
PS> ./good-night
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -12,7 +12,14 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
& "$PSScriptRoot/speak-english.ps1" "Good night to you, my friend."
|
$Generator = New-Object System.Random
|
||||||
|
$Answer = switch([int]$Generator.next(0, 3)) {
|
||||||
|
0 { "Good night to you, too." }
|
||||||
|
1 { "Good night to you, my friend." }
|
||||||
|
2 { "Have a good night. Sleep well." }
|
||||||
|
3 { "Good night and sweet dreams." }
|
||||||
|
}
|
||||||
|
& "$PSScriptRoot/speak-english.ps1" "$Answer"
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
Loading…
Reference in New Issue
Block a user