Fix meme filters for other recipient. - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit 7ba45fbd502d675bf075776af99e51491679b41d
(DIR) parent db77492b082445773ac7c31767c3996c98db0518
(HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Sun, 19 Oct 2025 09:39:01 +0200
Fix meme filters for other recipient.
* Shorten the cases a bit, thus removing sloc.
Diffstat:
M annna-message-common | 41 +++++++++----------------------
1 file changed, 11 insertions(+), 30 deletions(-)
---
(DIR) diff --git a/annna-message-common b/annna-message-common
@@ -1671,6 +1671,7 @@ case "${IRC_PRIVMSG_TEXT}" in
"${IRC_USER}, please random #"*)
hashtag="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's/.*#//; s/ .*//' )"
recipient="$(printf "%s\n" "${IRC_PRIVMSG_TEXT}" | sed 's/.* for //' )"
+ [ -z "${recipient}" ] && recipient="${IRC_CMD_USER}"
origext="$(grep -E "^#${hashtag} " "${hashtagfile}" | sed 's/.*\.//')"
{
filter="$(printf '%s\n' "${IRC_PRIVMSG_TEXT}" | cut -d' ' -f3)"
@@ -1726,58 +1727,38 @@ case "${IRC_PRIVMSG_TEXT}" in
;;
esac
esac
-
- if [ "${recipient}" != "${IRC_PRIVMSG_TEXT}" ];
- then
- user="${recipient}"
- fi
-
# Cleanup if outpath file is empty.
[ -f "${outpath}" ] && [ ! -s "${outpath}" ] && rm "${outpath}"
# determine gopher type for output file
outmimetype="$(file -ib "${outpath}")"
case "$outmimetype" in
- image/*)
- outtype="I";;
- *)
- outtype="9";;
+ image/*) outtype="I";;
+ *) outtype="9";;
esac
if [ -s "${outpath}" ];
then
- annna-say "${IRC_CMD_USER}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
+ annna-say "${recipient}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
exit 0
fi
case "${filter}" in
- antidepressant)
- antidepressant "${inpath}" "${outpath}" >/dev/null 2>&1
- ;;
- ritual)
- satanic-ritual "${inpath}" "${outpath}" >/dev/null 2>&1
- ;;
- putin)
- putin-os "${inpath}" "${outpath}" >/dev/null 2>&1
- ;;
- tshirt)
- tshirt-design "${inpath}" "${outpath}" >/dev/null 2>&1
- ;;
- *)
- ffmpeg-effect "${filter}" "${inpath}" "${outpath}" >/dev/null 2>&1
- ;;
+ antidepressant) antidepressant "${inpath}" "${outpath}" >/dev/null 2>&1;;
+ ritual) satanic-ritual "${inpath}" "${outpath}" >/dev/null 2>&1;;
+ putin) putin-os "${inpath}" "${outpath}" >/dev/null 2>&1;;
+ tshirt) tshirt-design "${inpath}" "${outpath}" >/dev/null 2>&1;;
+ *) ffmpeg-effect "${filter}" "${inpath}" "${outpath}" >/dev/null 2>&1;;
esac
# Remove temporary png for deface.
case "${inpath}" in
- /tmp/*.png)
- [ -e "${inpath}" ] && rm "${inpath}"
- ;;
+ /tmp/*.png) [ -e "${inpath}" ] && rm "${inpath}";;
esac
if [ -s "${outpath}" ];
then
- annna-say "${IRC_CMD_USER}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
+ annna-say "${recipient}, gophers://bitreich.org/${outtype}/memecache/filter/${outfile}"
fi
} &
exit 0