Add some error handling to weather. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit d7431c63770a238bf812722b145c1b5841377229 | |
parent 7ab66a57767d5d4a52b3b3cbe5533983691fd6d1 | |
Author: eidolon <[email protected]> | |
Date: Sun, 27 Aug 2023 15:41:08 -0400 | |
Add some error handling to weather. | |
Signed-off-by: Annna Robert-Houdin <[email protected]> | |
Diffstat: | |
M annna-message-common | 5 +++-- | |
M weather | 2 +- | |
2 files changed, 4 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -570,10 +570,11 @@ case "${text}" in | |
weatherplace="$(printf "%s\n" "${text}" \ | |
| sed 's,.*weather at \(.*\),\1,' \ | |
| tr -d '?')" | |
- weathertext="$(weather "${weatherplace}")" | |
- if [ -n "${weathertext}" ]; | |
+ if weathertext="$(weather "${weatherplace}")" | |
then | |
annna-say -s "${server}" -c "${channel}" "${user}, the… | |
+ else | |
+ annna-say -s "${server}" -c "${channel}" "${user}, the… | |
fi | |
} & | |
;; | |
diff --git a/weather b/weather | |
@@ -2,7 +2,7 @@ | |
[ -z "$1" ] && { | |
printf 'usage: %s <location>\n' "${0##*/}" >&2 | |
- exit | |
+ exit 1 | |
} | |
location=$(printf %s "$1" | sed 's, ,\%20,g') |