marvvin

IRC bot
Log | Files | Refs | README | LICENSE

commit 1828fd5291c3cce4690a012ddc18dcfcd9f337e7
parent ec1cadc772b6d5e6987ea22c7b69fbb721bd85a2
Author: Hayden Hamilton <hayden@haydenvh.com>
Date:   Sat, 10 Apr 2021 23:59:26 +0100

functions.sh: add send_action() and psend_action()

Diffstat:
Mfunctions.sh | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/functions.sh b/functions.sh @@ -112,6 +112,23 @@ match_action(){ } } +# send_action(dest, line) +send_action(){ + dest=$(echo "$1" | tr -d '\r\n') + shift + sline=$(echo "$@" | tr -d '\r\n') + printf "PRIVMSG %s :ACTION %s\r\n" "$dest" "$sline" >> $input +} + +# | psend_action(dest) +psend_action(){ + dest=$(echo "$1" | tr -d '\r\n') + while IFS= read -r pline + do + printf "PRIVMSG %s :ACTION %s\r\n" "$dest" "$pline" >> $input + done +} + # repl_action(line) repl_action(){ sline=$(echo "$@" | tr -d '\r\n')