summaryrefslogtreecommitdiff
path: root/bin/ii-answer
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ii-answer')
-rwxr-xr-xbin/ii-answer20
1 files changed, 9 insertions, 11 deletions
diff --git a/bin/ii-answer b/bin/ii-answer
index ec234f1..5a7bc53 100755
--- a/bin/ii-answer
+++ b/bin/ii-answer
@@ -10,17 +10,15 @@
# welcome devs (in #archlinux32 only)
welcome_user_regex='^\S\+ -!- \(abaumann\|deep42thought\|tyzoid\|phrik\)(.* has joined \S\+$'
new_users=$(
- sed -n '
+ sed -i '
s/'"${welcome_user_regex}"'/\1/
T
- p
+ w /dev/stdout
+ d
' "${irc_dir}/#archlinux32/out" | \
sort -u
)
if [ -n "${new_users}" ]; then
- sed -i '
- /'"${welcome_user_regex}"'/ d
- ' "${irc_dir}/#archlinux32/out"
printf '%s\n' "${new_users}" | \
sed '
s/^/Hi /
@@ -46,10 +44,11 @@ find "${irc_dir}" \
# answer "why don't you?"
regex='^\(\S\+ \)\?\S\+ <\S\+> '"${prefix}"'why[- ]don'"'"'\?t[- ]you \(build\|stabilize\|unstage\|keep\|stubbornly_keep\) '
if grep -q "${regex}" "${out_file}"; then
- sed -n '
+ sed -i '
s/'"${regex}"'/\2 /
T
- p
+ w /dev/stdout
+ d
' "${out_file}" | \
while read -r line; do
reason=$(
@@ -65,15 +64,15 @@ find "${irc_dir}" \
fi | \
irc_say "${channel}" 'copy'
done
- sed -i "/${regex}/d" "${out_file}"
fi
# answer "wtf?"
regex='^\(\S\+ \)\?\S\+ <\S\+> '"${prefix}"'wtf '
if grep -q "${regex}" "${out_file}"; then
- sed -n '
+ sed -i '
s/'"${regex}"'//
T
- p
+ w /dev/stdout
+ d
' "${out_file}" | \
while read -r line; do
reason=$("${base_dir}/bin/wtf" "${line}");
@@ -89,7 +88,6 @@ find "${irc_dir}" \
fi | \
irc_say "${channel}" 'copy'
done
- sed -i "/${regex}/d" "${out_file}"
fi
# answer "What's up?"
regex='^\(\S\+ \)\?\S\+ <\S\+> .*[Ww]hat'"'"'\?s *[Uu]p'