A few updates, cleanup updated weather module.

This commit is contained in:
Storm Dragon
2025-10-24 17:14:52 -04:00
parent 221e14a85a
commit 3669e07a9a
43 changed files with 794 additions and 153 deletions

View File

@@ -1,12 +1,25 @@
#!/usr/bin/env bash
[ -f functions.sh ] && source functions.sh
# Dependencies required by this module
dependencies=("curl" "w3m" "grep" "sed" "iconv")
set -f
quote="$(curl -s http://bash.org/?random)"
quote="$(curl -s --connect-timeout 5 --max-time 10 http://bash.org/?random)"
if [[ -z "$quote" ]]; then
msg "$2" "$1: Sorry, couldn't fetch a bash.org quote right now."
set +f
exit 1
fi
quote="$(echo "$quote" | grep -m 1 -A 10 '"Permanent link to this quote."')"
quote="${quote#*class=\"qt\">}"
quote="${quote//&lt;/ <}"
quote="${quote//&gt;/> }"
quote="${quote%%<p class*}"
quote="$(echo "$quote" | w3m -dump -T text/html)"
msg "$2" "$(echo "$quote" | iconv -f utf-8 -t ascii)"
if [[ ${#quote} -lt 5 ]]; then
msg "$2" "$1: Sorry, couldn't parse the bash.org quote."
else
msg "$2" "$(echo "$quote" | iconv -f utf-8 -t ascii)"
fi
set +f