add irc logger
This commit is contained in:
parent
16760bddd9
commit
20794cd63f
23
~/Bash/irc_logger.sh
Executable file
23
~/Bash/irc_logger.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
nick="blb$$"
|
||||
channel=admin
|
||||
server=iiiypuk.me
|
||||
config=/tmp/irclog
|
||||
[ -n "$1" ] && channel=$1
|
||||
[ -n "$2" ] && server=$2
|
||||
config="${config}_${channel}"
|
||||
echo "NICK $nick" > $config
|
||||
echo "USER $nick +i * :$0" >> $config
|
||||
echo "JOIN #$channel" >> $config
|
||||
trap "rm -f $config;exit 0" INT TERM EXIT
|
||||
tail -f $config | nc $server 6667 | while read MESSAGE
|
||||
do
|
||||
case "$MESSAGE" in
|
||||
PING*) echo "PONG${MESSAGE#PING}" >> $config;; *QUIT*) ;;
|
||||
*PART*) ;;
|
||||
*JOIN*) ;;
|
||||
*NICK*) ;;
|
||||
*PRIVMSG*) echo "${MESSAGE}" | sed -nr "s/^:([^!]+).*PRIVMSG[^:]+:(.*)/[$(date '+%R')] \1> \2/p" >> $config;;
|
||||
*) echo "${MESSAGE}";;
|
||||
esac
|
||||
done
|
Loading…
Reference in New Issue
Block a user