Add list factoids function
Thanks to bill-auger for this function from pbot-ng which works also in hyperbot
This commit is contained in:
parent
1e141d2633
commit
55cd3ec4a9
@ -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#,}"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user