Add the necessary shikhin patch

This commit is contained in:
Nick Chambers 2021-06-19 18:38:19 -05:00
parent 78750190ad
commit f47ba69629
1 changed files with 12 additions and 6 deletions

18
rowbot
View File

@ -561,9 +561,15 @@ hook_pre_PRIVMSG_CTCP() {
}
hook_post_PRIVMSG_factoids() {
if [[ ${params[0]:0:1} != \# ]]; then
if [[ ${params[0]:0:1} != \# && $from != shikhin ]]; then
return 0
elif [[ ${words[0]} = "$trigger"* ]]; then
local to=${params[0]}
if [[ ${params[0]:0:1} != \# ]]; then
to=$from
fi
case ${words[0]:${#trigger}} in
is)
if (( ${#words[@]} < 3 )); then
@ -575,7 +581,7 @@ hook_post_PRIVMSG_factoids() {
val=${key#* } key=${key%% *}
info "%s said in %s to remember %s as %s" "$from" "${params[0]}" "$key" "$val"
privmsg "${params[0]}" "I'm sure I'll remember that."
privmsg "$to" "I'm sure I'll remember that."
mkdir -p "$fact_root"/"${params[0]}"
printf %s "$val" > "$fact_root"/"${params[0]}"/"$key"
;;
@ -589,13 +595,13 @@ hook_post_PRIVMSG_factoids() {
if [[ -f $fact_root/${params[0]}/$key ]]; then
info "%s said in %s to delete %s" "$from" "${params[0]}" "$key"
privmsg "${params[0]}" "I forgot what that was anyways."
privmsg "$to" "I forgot what that was anyways."
rm -f "$fact_root"/"${params[0]}"/"$key"
fi
;;
ls)
local facts=( "$fact_root"/"${params[0]}"/* )
privmsg "${params[0]}" "${facts[*]##*/}"
privmsg "$to" "${facts[*]##*/}"
;;
*)
local key=${words[0]:${#trigger}}
@ -607,9 +613,9 @@ hook_post_PRIVMSG_factoids() {
if (( ${#words[@]} > 1 )) && [[ ${words[1]} = \> ]]; then
local target
target=${params[1]#*\>} target=${target# } target=${target% }
privmsg "${params[0]}" "$target: $msg"
privmsg "$to" "$target: $msg"
else
privmsg "${params[0]}" "$from: $msg"
privmsg "$to" "$from: $msg"
fi
fi
esac