From ba40c9bf70d25c1ed797b8638eda5b71bd0f8caf Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 2 Jun 2021 19:26:52 +0200 Subject: bin/ii-answer: do not greet if person left <5 minutes ago --- bin/ii-answer | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'bin/ii-answer') 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}" | \ -- cgit v1.2.3-70-g09d2