From 961269ae0a2e0102204649cd0a4a4b884d8eda42 Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Fri, 30 Aug 2013 09:22:21 +0100 Subject: made him not add duplicate facts --- hack_of_all_hacks | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hack_of_all_hacks b/hack_of_all_hacks index 705beb6..11d1962 100644 --- a/hack_of_all_hacks +++ b/hack_of_all_hacks @@ -261,16 +261,26 @@ EOF thing="${thing%% is *}" is="${sentence#* is }" - echo "${is}" >> "info/${thing}" - send_msg "${channel_it_came_from}" "${personoslash}: Remembered." + if grep "^${is}$" "info/${thing}" &>/dev/null + then + send_msg "${channel_it_came_from}" "${personoslash}: I know." + else + echo "${is}" >> "info/${thing}" + send_msg "${channel_it_came_from}" "${personoslash}: Remembered." + fi ;; "${my_own_name}: "+([![:space:]])" is: "+([![:space:]])* ) declare -l thing="${sentence#${my_own_name}: }" thing="${thing%% is: *}" is="${sentence#* is: }" - echo "${is}" >> "info/${thing}" - send_msg "${channel_it_came_from}" "${personoslash}: Remembered." + if grep "^${is}$" "info/${thing}" &>/dev/null + then + send_msg "${channel_it_came_from}" "${personoslash}: I know." + else + echo "${is}" >> "info/${thing}" + send_msg "${channel_it_came_from}" "${personoslash}: Remembered." + fi ;; "${my_own_name}: "+([![:space:]])" isn't "+([![:space:]])* ) declare -l thing="${sentence#${my_own_name}: }" -- cgit v1.2.2