Add #expand feature for memes. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit f6e79e5c8ee01fb3feb8f279e8f05419b77e2935 | |
parent f368378e0c7a575d13f0dd1c19c6e640c0418ad4 | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Tue, 16 Aug 2022 13:11:09 +0200 | |
Add #expand feature for memes. | |
Diffstat: | |
M annna-message-common | 21 ++++++++++++++------- | |
1 file changed, 14 insertions(+), 7 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -35,10 +35,14 @@ regeximatch() { | |
uriexpansion=0 | |
nospoil=0 | |
+doexpand=0 | |
case "${text}" in | |
*\#nospoil*) | |
nospoil=1 | |
;; | |
+*\#expand*) | |
+ doexpand=1 | |
+ ;; | |
*::*::*) | |
query=${text#**::} query=${query%%::*} | |
annna-say -s "${server}" -c "${channel}" "$(dalle-gen-emoji "${query}"… | |
@@ -1089,6 +1093,8 @@ $0 !~ /#nospoil/ { | |
} | |
}' | while read -r tag; | |
do | |
+ [ "${tag}" == "#expand" ] && continue | |
+ | |
if tagline="$(grep "${tag} " "${hashtagfile}")"; | |
then | |
if [ $nospoil -eq 0 ]; | |
@@ -1096,15 +1102,16 @@ do | |
annna-say -s "${server}" -c "${channel}" "${tagline% *… | |
fi | |
else | |
- # Do not recommend memes in case we got some URI expansion and… | |
- # tag is less than four utf8 chars long. | |
- taglength=$(utf8expr length "${tag}") | |
- if [ $uriexpansion -eq 0 -a $taglength -gt 3 -a $nospoil -eq 0… | |
+ if [ $doexpand -eq 1 ]; | |
then | |
- didyoumean="$(annna-meme-recommend "${tag}")" | |
- if [ -n "${didyoumean}" ]; | |
+ taglength=$(utf8expr length "${tag}") | |
+ if [ $uriexpansion -eq 0 -a $taglength -gt 3 ]; | |
then | |
- annna-say -c "${server}" -c "${channel}" "Did … | |
+ didyoumean="$(annna-meme-recommend "${tag}")" | |
+ if [ -n "${didyoumean}" ]; | |
+ then | |
+ annna-say -c "${server}" -c "${channel… | |
+ fi | |
fi | |
fi | |
fi |