dot

packages and services management
Log | Files | Refs | README

commit 2ed0c7322b38f53f2e14c2b7a4a7644927d07c80
parent 5e7430571271ac4ecdc06553b4060042520313a4
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Thu, 10 Aug 2017 00:04:50 +0200

libbearssl/bin/bot: added an irc bot based off brssl

Diffstat:
Alibbearssl/bin/bot | 36++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+), 0 deletions(-)

diff --git a/libbearssl/bin/bot b/libbearssl/bin/bot @@ -0,0 +1,36 @@ +DESC='a small git that prints bot status' +HOST=unix.chat +CHAN=#commits +NICK=${0##*/} +PASS=$PASS + +mkdir -p "$VAR/irc/bot" +cd "$VAR/irc/bot" || exit + +[ -p in ] || mkfifo in + +tail -f in | brssl client "$HOST:6697" | +while IFS='' read -r line +do + case "$line" in + ('PING :'*) + printf '%s\n' "$line" + sleep 1 + printf 'PONG%s\n' "${line#PING}" > in + printf 'PONG%s\n' "${line#PING}" + ;; + (*) + printf '%s\n' "$line" + ;; + esac +done | sed -r -n 's/^:?[^:]*:// p' >> out & + +sleep 5 +printf 'USER %s +i * :%s\n' "$NICK" "$DESC" > in +printf 'NICK %s\n' "$NICK" > in +sleep 5 +printf 'PRIVMSG NickServ :IDENTIFY %s\n' "$PASS" > in +sleep 5 +printf 'JOIN %s\n' "$CHAN" > in + +wait