Try to stop weird symbols from quotes crashing the bot.

This commit is contained in:
Storm Dragon 2020-08-10 18:24:05 -04:00
parent a917ff513d
commit 9d503d2196
1 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
[ -f functions.sh ] && source functions.sh
set -f
quote="$(curl -s http://bash.org/?random)"
quote="$(echo "$quote" | grep -m 1 -A 10 '"Permanent link to this quote."')"
quote="${quote#*class=\"qt\">}"
@ -7,5 +8,5 @@ quote="${quote//&lt;/<}"
quote="${quote//&gt;/>}"
quote="${quote%%<p class*}"
quote="$(echo "$quote" | pandoc -t plain)"
msg "$2" "$(echo "$quote" | tr -s '[:space:]' ' ')"
exit 0
msg "$2" "$(echo "$quote" | tr -cd '[:print:]')"
set +f