summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2018-09-06 18:20:05 +0000
committerbill-auger <mr.j.spam.me@gmail.com>2018-10-02 19:02:24 -0400
commit63a28cc90bca774a51cd26ab531f43b14ede5739 (patch)
tree8bb8fee7e157843d46ae97edffc6dc27999bea10
parent1a05f98b33d11f9fe64eae4e51306a5fd2b34539 (diff)
make colon char optional for 'tell' command
-rw-r--r--process_event28
1 files changed, 15 insertions, 13 deletions
diff --git a/process_event b/process_event
index 494ddcd..0f62ed7 100644
--- a/process_event
+++ b/process_event
@@ -329,33 +329,35 @@ function process_event
# tell #
########
- "${my_own_name}: tell "+([![:space:]])":"+([[:space:]])+([![:space:]])* )
+ "${server_nick_current}: tell "+([![:space:]:])?(:)+([[:space:]])+([![:space:]])* )
# The line will be something such as:
# pbot: tell fauno: you suck
- process="${sentence##${my_own_name}: tell }"
- subject="${process%%:*}"
- message="${process#*:}"
- message="${message# }"
+ # pbot: tell xylon i have heard that lemons are yummy
+ local query="${sentence}"
+ local bot_nick=${server_nick_current}
+ local receiver=$(expr match "$query" ${bot_nick}': tell \([^\ :]*\):\? ')
+ local message=$( expr match "$query" ${bot_nick}': tell [^\ ]* \(.*\)' )
- if [[ "${subject}" == "${my_own_name}" ]]
+ if [[ "${receiver}" == "${bot_nick}" ]]
then
- send_msg "${channel_it_came_from}" "${my_own_name}: ${personoslash} told me to tell you, (0 seconds ago): ${message}"
+ send_msg "${channel_it_came_from}" "${bot_nick}: ${personoslash} told me to tell you, (0 seconds ago): ${message}"
else
- declare -l subjectlower="${subject}"
+ declare -l receiver_lower=${receiver//\/}
+ local receiver_dir="announcements/people/${receiver_lower}"
- [[ -d "announcements/people/${subjectlower}" ]] || mkdir -p "announcements/people/${subjectlower}"
+ [[ -d "${receiver_dir}" ]] || mkdir -p "${receiver_dir}"
# The time in *nix seconds is saved there so that
# pbot can say how long ago the massage was sent
# when he gives it to it's recipient.
- echo "$(date +%s) ${personoslash} ${message}" >> "announcements/people/${subjectlower}/messages"
+ echo "$(date +%s) ${personoslash} ${message}" >> "${receiver_dir}/messages"
- response='certainly'
+ local response="Certainly! I will relay your message to ${receiver} the next time i see activity by that nick."
send_msg "${channel_it_came_from}" "${personoslash}: ${response}"
- if ! [[ -f "announcements/people/${subjectlower}/seen" ]]
+ if ! [[ -f "${receiver_dir}/seen" ]]
then
- send_msg "${channel_it_came_from}" "${personoslash}: WARNING: I HAVE NEVER SEEN \"${subject}\" HERE BEFORE. CHECK YOUR SPELLING."
+ send_msg "${channel_it_came_from}" "${personoslash}: WARNING: I HAVE NEVER SEEN \"${receiver}\" HERE BEFORE. CHECK YOUR SPELLING."
fi
fi
;;