diff options
author | quiliro <quiliro@riseup.net> | 2020-10-06 19:34:17 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-10-06 20:52:41 -0400 |
commit | 55cd3ec4a964b69775c2d570004b099986604fff (patch) | |
tree | 052bb3df1ff1c2928762abff9b369612c4b004fa | |
parent | 1e141d263303747f1bf5368e4ed392856968cdf6 (diff) | |
download | hyperbot-55cd3ec4a964b69775c2d570004b099986604fff.tar.lz hyperbot-55cd3ec4a964b69775c2d570004b099986604fff.tar.xz hyperbot-55cd3ec4a964b69775c2d570004b099986604fff.zip |
Add list factoids function
Thanks to bill-auger for this function from pbot-ng which works also in hyperbot
-rw-r--r-- | process_event | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/process_event b/process_event index bdb47cc..8014092 100644 --- a/process_event +++ b/process_event @@ -321,6 +321,22 @@ function process_event # factoids # ############ + # list factoids + ',' | ',list' | ',factoids' | "${my_own_name}: list factoids" ) + local factoids=( $(ls info/) ) + local n_factoids=${#factoids[*]} + local begin_msg="ask me about:" + local end_msg="e.g. ${server_nick_current}: what is ${factoids[0]} (or ,${factoids[0]})" + + send_msg "${personoslash}" "${begin_msg}" + for (( factoid_n = 0 ; factoid_n < n_factoids ; factoid_n = factoid_n 10 )) + do send_msg "${personoslash}" " ${factoids[*]:${factoid_n}:10}" + sleep 1 + done + send_msg "${personoslash}" "${end_msg}" + ;; + + # set factoid "${my_own_name}: "+([!/])" is "+([![:space:]])* ) declare -l thing="${sentence#${my_own_name}: }" thing="${thing%% is *}" @@ -349,6 +365,8 @@ function process_event forget_fact ;; + + # display factoid ','+([!/]) ) thing="${sentence#,}" |