Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/ii-answer
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ii-answer')
-rwxr-xr-xbin/ii-answer22
1 files changed, 22 insertions, 0 deletions
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]'