index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-01-10 14:14:18 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-01-10 14:14:18 +0100 |
commit | 61c3c5c3a35d3f2cc4022b3f96742734b154eea4 (patch) | |
tree | f19f69addfe1efbc1eefb16c4ad659282550c11d /bin | |
parent | 1b8aea42314197d4258e8dd218b2eb5af9a7dfc9 (diff) |
-rw-r--r-- | bin/.gitignore | 1 | ||||
-rwxr-xr-x | bin/ii-answer | 22 |
diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..c94b1c4 --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1 @@ +markov diff --git a/bin/ii-answer b/bin/ii-answer index 7db226f..de6d3c9 100755 --- a/bin/ii-answer +++ b/bin/ii-answer @@ -146,6 +146,28 @@ find "${irc_dir}" \ sort -u | \ irc_say "${channel}" 'copy' fi + # answer "say/tell ... new/random/more" + regex="${sloppy_salutation}"'.*\(say\|tell\).*\(new\|random\|more\).*' + askers=$( + sed -i ' + /'"${regex}"'/ { + s/'"${regex}"'/\1/ + w /dev/stdout + d + } + ' "${out_file}" | \ + sort -u + ) + if [ -n "${askers}" ]; then + "${base_dir}/bin/markov" ~/.words.irc 3 "$(printf '%s\n' "${askers}" | wc -l)" | \ + for asker in ${askers}; do + if ! read -r random; then + continue + fi + printf '%s: %s\n' "${asker}" "${random}" + done | \ + irc_say "${channel}" 'copy' + fi if [ -z "${channel%%#*}" ]; then # answer "Shut up!" regex='^\S\+ <\S\+> \(.* \)\?[Ss][Hh][Uu][Tt] \?[Uu][Pp]' |