diff --git a/rowbot b/rowbot index e1d8dbb..77055c1 100755 --- a/rowbot +++ b/rowbot @@ -924,6 +924,45 @@ on_late_msg_NICK_alternick() { fi } +# factoids + +factoids_cmd_is() { + local fact_name=${action_line%% *} + + if [[ $fact_name = "$action_line" || $fact_name = "$action_line " ]]; then + irc_privmsg "${msg[to]}" "Can you repeat that?" + return 0 + fi + + local fact_value=${action_line#"$fact_name"} + fact_value=${fact_value# } + irc_privmsg "${msg[to]}" "I'm sure I'll remember that." + mkdir -p "${config[fact-root]}"/"${msg[to]}" + printf %s "$fact_value" > "${config[fact-root]}"/"${msg[to]}"/"$fact_name" +} + +factoids_cmd_isnt() { + true +} + +factoids_cmd_ls() { + true +} + +plugin_not_found_factoids() { + true +} + +on_init_factoids() { + get_option fact-root "" + + if [[ ${config[fact-root]} && -d ${config[fact-root]} ]]; then + plugin_reg is factoids_cmd_is + plugin_reg isnt factoids_cmd_isnt + plugin_reg ls factoids_cmd_ls + fi +} + ### # cleanup ###