dot

packages and services management
Log | Files | Refs | README

commit 28ee2d1bf90cfcafc97793eaf39d3b11bdd99d58
parent 162349b3034a94980c13edee1db1f4cbde43bca7
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Tue,  8 Aug 2017 23:25:44 +0200

libbearssl/bin/bot: it can get connected to a chan

Diffstat:
Alibbearssl/bin/bot | 33+++++++++++++++++++++++++++++++++
Alibbearssl/start | 5+++++
2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/libbearssl/bin/bot b/libbearssl/bin/bot @@ -0,0 +1,33 @@ +DESC='a small git that prints bot status' +HOST=unix.chat +CHAN=#commits +NICK=${0##*/} +PASS=$PASS + +[ -p in ] || mkfifo in + +tail -f in | tee /dev/stderr | 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 & + +sleep 10 +printf 'USER %s +i * :%s\n' "$NICK" "$DESC" > in +printf 'NICK %s\n' "$NICK" > in +sleep 10 +printf 'PRIVMSG NickServ :IDENTIFY %s\n' "$PASS" > in +sleep 10 +printf 'JOIN %s\n' "$CHAN" > in + +wait diff --git a/libbearssl/start b/libbearssl/start @@ -0,0 +1,5 @@ +case "$1" in +( bot ) + PASS="$2" bot + ;; +esac & PID=$!