stormbot/modules/fortune/fortune.sh

13 lines
359 B
Bash
Raw Normal View History

2016-09-03 19:38:05 -04:00
[ -f functions.sh ] && source functions.sh
2016-09-03 18:57:19 -04:00
2016-09-03 19:38:05 -04:00
fortune="$(command -v fortune)"
target="${3#fortune}"
2016-09-03 18:57:19 -04:00
2016-09-03 19:38:05 -04:00
if [ -z "$fortune" ]; then
msg "$2" "I do not have access to fortune."
else
fortuneText="$($fortune -a -e -s -n 512 $target || echo "No fortunes found.")"
fortuneText="$(echo "$fortuneText" | tr '[:space:]' ' ' | sed -e 's/"/\"/g')"
msg "$2" "$fortuneText"
2016-09-03 19:38:05 -04:00
fi