From 78d168b972d2d5c6875a30f467fa361ab3a67227 Mon Sep 17 00:00:00 2001 From: Radovan Bezak Date: Mon, 25 Jul 2016 09:28:41 +0200 Subject: [PATCH] command hook: respond to privmsg Fixed bug: when YAUIB receives a private message, it responds to itself instead of the sender. Signed-off-by: Argentus --- hooks-available/command | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hooks-available/command b/hooks-available/command index b690c06..4458eb4 100755 --- a/hooks-available/command +++ b/hooks-available/command @@ -26,6 +26,17 @@ sentence="$*" command="$(echo "${1%% *}" | sed 's#/#__SLASH__#g')" args="$(echo "$1" | sed 's/[^ ]*//')" +# In case target does not start with # (a channel), assume it's a private message +# and respond to the sender +case "$t_user" in + \#*) + ;; + + *) + t_user=$s_user + ;; +esac + if [ -x "advanced-commands-enabled/$command" ] && [ -f "advanced-commands-enabled/$command" ] then printf '%s\n' "Running advanced command '$command' with '$args'" >&2