index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-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]' |