From 0aaef3c43a0e4e376310cb34ec8091017b6e3196 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 20 May 2017 11:10:07 -0400 Subject: [PATCH] Added error checking to jokes. --- modules/joke/joke.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/joke/joke.sh b/modules/joke/joke.sh index 4068aa7..5d5c681 100755 --- a/modules/joke/joke.sh +++ b/modules/joke/joke.sh @@ -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."