Do away with dict(1) and use netcat. - annna - Annna the nice friendly bot.
HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
DIR commit f6d9fcb783f2a57ceb89e8a282f8752d3aef436d
DIR parent e71c6746ae86f639be9e6a5d444e472ce4894ccb
HTML Author: eidolon <nou@meme.me>
Date: Tue, 29 Aug 2023 20:28:04 -0400
Do away with dict(1) and use netcat.
Signed-off-by: Annna Robert-Houdin <annna@bitreich.org>
Diffstat:
M annna-message-common | 32 ++++++++++++-------------------
1 file changed, 12 insertions(+), 20 deletions(-)
---
DIR 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.org 2628)"
+
+ 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-paste)"
+ 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-paste)"
- ;;
- 20)
- puri="No matches found."
- ;;
- 1)
- puri="Parse error."
- ;;
- *)
- puri="Parazyd destroyed the server. Nothing to see here."
- ;;
- esac
esac
annna-say -s "${server}" -c "${channel}" "${puri}"
;;