Introduction
Introduction Statistics Contact Development Disclaimer Help
Allow international dice notation support to annna dice support. - annna - Annn…
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit 082001360c20fe94cdc9ab9235ccc4a3279a4a9c
parent ae2032f1795a3c25dbf1c5f64390f54dc4d2e2ae
Author: Annna Robert-Houdin <[email protected]>
Date: Sun, 25 Aug 2024 20:27:27 +0200
Allow international dice notation support to annna dice support.
Diffstat:
M annna-message-common | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/annna-message-common b/annna-message-common
@@ -1064,8 +1064,18 @@ case "${text}" in
;;
esac
;;
-"${ircuser}, please roll a dice for me.")
- annna-say -s "${server}" -c "${channel}" "$((($RANDOM % 6) + 1))"
+"${ircuser}, please roll "*" for me.")
+ q="${text#* roll }"
+ q="${q%for*}"
+
+ # https://en.wikipedia.org/wiki/Dice_notation
+ # six-sided dice one time
+ [ -z "${q}" ] && q="d6"
+ [ "${q}" = "a dice " ] && q="d6"
+ [ "${q}" = "dice " ] && q="d6"
+
+ dicescore="$(dice "${q}")"
+ annna-say -s "${server}" -c "${channel}" "${dicescore}"
;;
"${ircuser}, please tell me your favourite flower.")
annna-say -s "${server}" -c "${channel}" "My favourite flower is the b…
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.