Do away with dict(1) and use netcat. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit f6d9fcb783f2a57ceb89e8a282f8752d3aef436d | |
parent e71c6746ae86f639be9e6a5d444e472ce4894ccb | |
Author: eidolon <[email protected]> | |
Date: Tue, 29 Aug 2023 20:28:04 -0400 | |
Do away with dict(1) and use netcat. | |
Signed-off-by: Annna Robert-Houdin <[email protected]> | |
Diffstat: | |
M annna-message-common | 32 ++++++++++++-----------------… | |
1 file changed, 12 insertions(+), 20 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -315,28 +315,20 @@ case "${text}" in | |
;; | |
*) | |
puri="" | |
- dresult="$(dict -h parazyd.org "${word}" 2>/dev/null)" | |
- derr=$? | |
- if [ $derr -eq 20 ]; | |
+ dresult="$(printf '%s\n' "define * $word" QUIT | nc parazyd.or… | |
+ | |
+ if printf '%s\n' "$dresult" | grep -q '^150' | |
+ then | |
+ n="$(printf '%s\n' "$dresult" | grep -c '^151')" | |
+ nmessage="$n definition(s) found." | |
+ paste="$(printf '%s\n' "$dresult" | /br/bin/bitreich-p… | |
+ puri="$nmessage $paste" | |
+ elif printf '%s\n' "$dresult" | grep -q '^552' | |
then | |
- dresult="$(dict -h parazyd.org "${word}" 2>/dev/null)" | |
- derr2="$?" | |
- [ $derr2 -ne $derr ] && derr=$derr2 | |
+ puri="No match found." | |
+ else | |
+ puri="Server destroyed. Nothing to see here." | |
fi | |
- case "$derr" in | |
- 0|21) | |
- puri="$(printf "%s" "${dresult}" | /br/bin/bitreich-pa… | |
- ;; | |
- 20) | |
- puri="No matches found." | |
- ;; | |
- 1) | |
- puri="Parse error." | |
- ;; | |
- *) | |
- puri="Parazyd destroyed the server. Nothing to see her… | |
- ;; | |
- esac | |
esac | |
annna-say -s "${server}" -c "${channel}" "${puri}" | |
;; |