summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Graham <joseph@fibreglass.tunachunks>2013-08-30 09:22:21 +0100
committerJoseph Graham <joseph@fibreglass.tunachunks>2013-08-30 09:22:21 +0100
commit961269ae0a2e0102204649cd0a4a4b884d8eda42 (patch)
treed3c67aa16d2a8b2748ed5ae3e55d0997e6d6c29e
parent63f6ca810270c57eccf625243cedb21d42a99581 (diff)
made him not add duplicate facts
-rw-r--r--hack_of_all_hacks18
1 files 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}: }"