From d5048184a67c44a792078b22b103da5860278df1 Mon Sep 17 00:00:00 2001 From: lhark Date: Wed, 12 Apr 2017 22:03:00 +0200 Subject: [PATCH] Initial commit --- macron-bot.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 macron-bot.sh diff --git a/macron-bot.sh b/macron-bot.sh new file mode 100755 index 0000000..71dfda8 --- /dev/null +++ b/macron-bot.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +srv=irc.rezometz.org +chan="#rezo" +name="Macron" + +monitor() { + tail -f -n1 "$srv/$chan/out" | \ + while read -r date time nick msg + do + if echo "$msg" | grep -Eiq 'tocard' + then + echo "Est-ce que je peux dire autocar ?" + elif echo "$msg" | grep -Eiq '^'"$name"'.*\?' + then + echo "PARCE QUE C'EST NOTRE PROJEEEET !" + fi + done > "$srv/$chan/in" +} + +while true; do + ii -s "$srv" -n "$name" -f "Et Manuels Macront" -i . & + iipid="$!" + sleep 5 + printf "/j %s\n" "$chan" > "$srv/in" + monitor& + monitpid="$!" + wait "$iipid" + pkill -P "$monitpid" +done +