Add command to show number of known memes. - 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 1ba8cea1c19d957ef3d8d1bd5629aea9e0b69887 DIR parent a6dcadfdfe85e7056b35f76ff25773a2d9fe43a6 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sat, 28 Dec 2019 23:08:00 +0100 Add command to show number of known memes. Diffstat: M annna-start-services | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- DIR diff --git a/annna-start-services b/annna-start-services @@ -19,9 +19,14 @@ botname="annna" iiroot="/home/annna/irc" iibase="/home/annna/irc/chat.freenode.net" modbase="/home/annna/bin/modules/" +hashtagfile="${modbase}/hashtags/hashtags.txt" hashtags() { - cat ${modbase}/hashtags/hashtags.txt 2>/dev/null + cat ${hashtagfile} 2>/dev/null +} + +hashtagcount() { + wc -l ${hashtagfile} | cut -d' ' -f 1 } # Permissions @@ -333,6 +338,12 @@ then continue; fi + if [ "${text}" = "${botname}, how many memes do you know?" ]; + then + annna-say -c "#bitreich-en" "I know $(hashtagcount) memes." + continue; + fi + if [ "${text}" = "${botname}, can you show me the uptime please?" ]; then annna-say -c "#bitreich-en" "$(hostname) uptime: $(uptime)" @@ -427,6 +438,8 @@ then if [ "${text}" = "${botname}, please help." ]; then # TODO: Add multiple line support to annna-say -c(1) with sleep. + annna-say -c "${user}" "Âhow many memes do you know?« gets you thenumber of memes annna knows, ${user}." + sleep 0.5 annna-say -c "${user}" "»can you show me the uptime please?« gets you the uptime, ${user}." sleep 0.5 annna-say -c "${user}" "»please show me the load, ${user}."