commit 06185ff2f7c2c1e5c62120e78e786a103812b22e
parent ca5a89c9633e7e6319c0f805a68f715546e62392
Author: hhvn <dev@hhvn.uk>
Date: Sun, 3 Apr 2022 22:59:48 +0100
Send multiline content
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/handler.rc b/handler.rc
@@ -48,6 +48,12 @@ fn send_msg {
send_raw 'PRIVMSG %s :%s\r\n' $1 $2
}
+fn send_stdin {
+ for (line in `$nl{cat}) {
+ send_msg $TARGET $line
+ }
+}
+
fn send_notice {
send_raw 'NOTICE %s :%s\r\n' $1 $2
}
@@ -156,7 +162,7 @@ if (~ $PARAMS(1) 'PING') {
} else if (match_hilight -iE '^(' ^ `$nl{builtin ls bin/ | tr '\n' '|' | sed 's/|*$//'} ^ ')') {
CMD = `{echo $MSG | sed 's/ .*//'}
ARGS = `{echo $MSG | sed 's/[^ ]*//'}
- send_msg $TARGET `$nl{./bin/$CMD $ARGS}
+ ./bin/$CMD $ARGS | send_stdin $TARGET
} else if (match_hilight -E '^welcome back') {
send_msg $TARGET 'Thanks, ' ^ $NICK
} else if (match_hilight -E '^wtf|^what') {
@@ -203,6 +209,5 @@ if (~ $PARAMS(1) 'PING') {
urls = `$nl{echo $MSG | grep -Eo 'https?://[^ ]*'}
for (url in $urls) {
title $url
- echo $url >/dev/stderr
}
}