diff options
author | Erich Eckner <git@eckner.net> | 2021-06-02 19:26:52 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2021-06-02 19:26:52 +0200 |
commit | ba40c9bf70d25c1ed797b8638eda5b71bd0f8caf (patch) | |
tree | b02ff9fa6c0ddccaefc67cc90cc155e2febf9dd1 | |
parent | 0ad995b63b093eaa077fd5056e3895c544ecdd3a (diff) | |
download | builder-ba40c9bf70d25c1ed797b8638eda5b71bd0f8caf.tar.xz |
bin/ii-answer: do not greet if person left <5 minutes ago
-rwxr-xr-x | bin/ii-answer | 18 |
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}" | \ |