From b425a3acad185c314c9a2f607bb8309f8bbd3658 Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Sun, 20 Jun 2021 01:31:04 -0500 Subject: [PATCH] Implement a shiny new sysfacts --- rowbot | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rowbot b/rowbot index 7d28be7..cd1d499 100755 --- a/rowbot +++ b/rowbot @@ -640,6 +640,18 @@ hook_cmd_factoids() { esac } +hook_cmd_sysroot() { + if [[ -d $sys_root && $action = sysfact ]]; then + local files=( "$sys_root"/* ) idx msg + + if (( ${#files[@]} )); then + (( idx = RANDOM % ${#files[@]} )) + msg=$(<"${files[$idx]}") + privmsg "$to" "sysfact #$(( idx + 1 )): $msg" + fi + fi +} + hook_cmd_control_panel() { if [[ $from != "$owner" && $dev != yes ]]; then return 0