From 8d48b4aadf4b3bf0074abfa337b82e955447640a Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Sun, 18 Jul 2021 23:11:05 -0500 Subject: [PATCH] Add a command for recalling one of Rowbot's memories --- rowbot | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/rowbot b/rowbot index f80b501..e8a29b5 100755 --- a/rowbot +++ b/rowbot @@ -954,7 +954,17 @@ factoids_cmd_ls() { } plugin_not_found_factoids() { - true + if [[ -f "${config[fact-root]}"/"${msg[to]}"/"$action" ]]; then + # The exit status isn't important here. + # shellcheck disable=SC2155 + local fact=$(<"${config[fact-root]}"/"${msg[to]}"/"$action") + + if [[ ${action_args[0]} = \> ]] && (( ${#action_args[@]} > 1 )); then + irc_privmsg "${msg[to]}" "${action_args[-1]}: $fact" + else + irc_privmsg "${msg[to]}" "${msg[from]}: $fact" + fi + fi } on_init_factoids() {