Add 8ball and coin commands to annna. - 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 c07c0cb26ace7b48a7f2008db3f4f1af2315e5da
(DIR) parent a831c7a909e29b08cd5053c46b60da57ef10043b
(HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Tue, 30 Jul 2024 14:31:07 +0200
Add 8ball and coin commands to annna.
Diffstat:
A 8ball | 27 +++++++++++++++++++++++++++
M annna-message-common | 17 +++++++++++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/8ball b/8ball
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+answers=(
+ "It is certain."
+ "It is decidedly so."
+ "Without a doubt."
+ "Yes -- definitely."
+ "You may rely on it."
+ "As I see it, yes."
+ "Most likely."
+ "Outlook good."
+ "Yes."
+ "Signs point to yes."
+ "Reply hazy, try again."
+ "Ask again later."
+ "Better not tell you now."
+ "Cannot predict now."
+ "Concentrate and ask again."
+ "Don't count on it."
+ "My reply is no."
+ "My sources say no."
+ "Outlook not so good."
+ "Very doubtful.")
+
+question="$@"
+printf "%s\n" "${answers[$RANDOM % ${#answers[@]} ]}"
+
(DIR) diff --git a/annna-message-common b/annna-message-common
@@ -944,6 +944,23 @@ case "${text}" in
;;
esac
;;
+"${ircuser}, 8ball "*)
+ eightballanswer="$(8ball)"
+ if [ -n "${eightballanswer}" ];
+ then
+ annna-say -s "${server}" -c "${channel}" "${eightballanswer}"
+ fi
+ ;;
+"${ircuser}, please throw a coin for me.")
+ case "$((($RANDOM % 2) + 1))" in
+ 1)
+ annna-say -s "${server}" -c "${channel}" "face"
+ ;;
+ 2)
+ annna-say -s "${server}" -c "${channel}" "number"
+ ;;
+ esac
+ ;;
"${ircuser}, please roll a dice for me.")
annna-say -s "${server}" -c "${channel}" "$((($RANDOM % 6) + 1))"
;;