summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-06-02 19:26:52 +0200
committerErich Eckner <git@eckner.net>2021-06-02 19:26:52 +0200
commitba40c9bf70d25c1ed797b8638eda5b71bd0f8caf (patch)
treeb02ff9fa6c0ddccaefc67cc90cc155e2febf9dd1
parent0ad995b63b093eaa077fd5056e3895c544ecdd3a (diff)
downloadbuilder-ba40c9bf70d25c1ed797b8638eda5b71bd0f8caf.tar.xz
bin/ii-answer: do not greet if person left <5 minutes ago
-rwxr-xr-xbin/ii-answer18
1 files changed, 17 insertions, 1 deletions
diff --git a/bin/ii-answer b/bin/ii-answer
index 40e40ea..e621682 100755
--- a/bin/ii-answer
+++ b/bin/ii-answer
@@ -17,7 +17,23 @@ for channel in '#archlinux32:Hi \0!\n!rq \0' '#archlinux32-devops:Hi \0!'; do
w /dev/stdout
d
' "${irc_dir}/${channel%%:*}/out" \
- | sort -u
+ | sort -u \
+ | grep -vxF "$(
+ {
+ printf '%s SNIP\n' $(($(date +%s)-5*60))
+ cat "${irc_dir}/out"
+ } \
+ | sort -k1nr,1 \
+ | sed '
+ /^\S\+ SNIP$/q
+ ' \
+ | sed '
+ s/^\S\+\s\+-!- \([^([:space:]]\+\)\((\S\+\)\? has quit.*$/\1/
+ t
+ d
+ ' \
+ | sort -u
+ )"
)
if [ -n "${new_users}" ]; then
printf '%s\n' "${new_users}" | \