| Fix meme filters for other recipient. - annna - Annna the nice friendly bot. | |
| git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| --- | |
| commit 7ba45fbd502d675bf075776af99e51491679b41d | |
| parent db77492b082445773ac7c31767c3996c98db0518 | |
| Author: Annna Robert-Houdin <[email protected]> | |
| 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(-) | |
| --- | |
| 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/${o… | |
| + annna-say "${recipient}, gophers://bitreich.org/${outt… | |
| 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}" >/d… | |
| - ;; | |
| + antidepressant) antidepressant "${inpath}" "${outpath}" >/dev/… | |
| + ritual) satanic-ritual "${inpath}" "${outpath}" >/dev/null 2>&… | |
| + putin) putin-os "${inpath}" "${outpath}" >/dev/null 2>&1;; | |
| + tshirt) tshirt-design "${inpath}" "${outpath}" >/dev/null 2>&1… | |
| + *) ffmpeg-effect "${filter}" "${inpath}" "${outpath}" >/dev/nu… | |
| 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/${o… | |
| + annna-say "${recipient}, gophers://bitreich.org/${outt… | |
| fi | |
| } & | |
| exit 0 |