Add a way to stop the last emoji prompt. - 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 20c8c162b764e43f8e68c2c4d8cdaf324b13c91f DIR parent 74e020ed7d8b6f0ed3436250d9129d2e14c82c25 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 25 Feb 2024 10:47:57 +0100 Add a way to stop the last emoji prompt. Thanks ggg for the suggestion! Diffstat: M annna-message-common | 10 ++++++++++ M stable-diffusion-emoji | 11 +++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -362,6 +362,16 @@ case "${text}" in annna-say -s "${server}" -c "${channel}" "${user}, ${upcuri}" fi ;; +"${ircuser}, please stop the last emoji prompt.") + lastemojipromptpid="$(pgrep -f stable-diffusion-emoji | sort -n | tail -n 1)" + if [ -n "${lastemojipromptpid}" ]; + then + pstree -A -p "${lastemojipromptpid}" | grep -Eow "[0-9]+" | xargs kill + annna-say -s "${server}" -c "${channel}" "${user}, I HUPed ${lastemojipromptpid} and all its children for you." + else + annna-say -s "${server}" -c "${channel}" "${user}, sorry, no instances found." + fi + ;; "${ircuser}, play despacito plz.") annna-say -s "${server}" -c "${channel}" "${user}, gophers://bitreich.org/9/memecache/despacito.mkv" ;; DIR diff --git a/stable-diffusion-emoji b/stable-diffusion-emoji @@ -27,7 +27,14 @@ if [ ! -e "${emojidb}/${emojifile}" ]; then SD_MODEL="/br/ai/stable-diffusion.cpp/models/epicphotogasm_x-ggml-model-f16.bin" \ stable-diffusion "${emojidb}/${emojifile}" "${emojiprompt}" - printf "%s\n" "${emojiprompt}" >> "${emojidb}/${emojiorig}" + if [ -e "${emojidb}/${emojifile}" ]; + then + printf "%s\n" "${emojiprompt}" >> "${emojidb}/${emojiorig}" + fi fi -[ $? -eq 0 ] && printf "%s/%s\n" "${emojiuribase}" "${emojifile}" +if [ -e "${emojidb}/${emojifile}" ]; +then + printf "%s/%s\n" "${emojiuribase}" "${emojifile}" +fi +