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