Added error checking to jokes.

This commit is contained in:
Storm Dragon 2017-05-20 11:10:07 -04:00
parent 96b4400f5e
commit 0aaef3c43a

View File

@ -1,5 +1,5 @@
[ -f functions.sh ] && source functions.sh
joke="$(curl -s 'https://thatsagooden.tk/?api=txt&type=all&exclude=sex,little_johnny')"
joke="$(curl -s --connect-timeout 5 'https://thatsagooden.tk/?api=txt&type=all&exclude=sex,little_johnny')"
joke="${joke//[[:space:]]/ }"
msg "$2" "$joke"
[ -n "$joke" ] && msg "$2" "$joke" || msg "$2" "No jokes found."