irctk

libircclient binding for scripts
git clone https://a3nm.net/git/irctk/
Log | Files | Refs | README

commit 1657b8961d367ce18a26f909ed76d231c417cdba
parent 3cdf35a9467341ac7d5788a3c5bf797372db7f5f
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 28 Jul 2012 00:33:59 +0200

fix formatting of examples, add TODOs

Diffstat:
README | 66+++++++++++++++++++++++++++++++++++-------------------------------
1 file changed, 35 insertions(+), 31 deletions(-)

diff --git a/README b/README @@ -42,7 +42,7 @@ support for make install, so things are less pleasant than they could be.) Log what is said on #chan1 and #chan2 on example.com. Lines will be of the form "[#chan1] <nick> message". - $ irctk logger@example.com #chan1 #chan2 | while read line; do + $ irctk logger@example.com #chan1 #chan2 | while read line; do CHAN=$(echo "$line" | cut -d ']' -f 1 | cut -d '[' -f 2) MSG=$(echo "$line" | cut -d ' ' -f 2-) echo "`date +%s` $MSG" >> "$CHAN.log" @@ -53,15 +53,15 @@ Same, but write in one file per chan, and add timestamps. $ cat message.txt | irctk you@example.com #chat Send the contents of a file to a channel. - - $ cat message.txt | while read line; do cowsay "$line"; done \ - | irctk you@example.com #chat + + $ cat message.txt | while read line; do cowsay "$line"; done | + irctk you@example.com #chat Send the contents of a file to a channel, where each line is said by a cow. - $ rsstail -u 'http://feeds2.feedburner.com/fmylife' -NdzH -n 1 -i 300 \ - | grep --line-buffered '^ Today' \ - | ./irctk fmlbot@example.com '#fml' + $ rsstail -u 'http://feeds2.feedburner.com/fmylife' -NdzH -n 1 -i 300 | + grep --line-buffered '^ Today' | + ./irctk fmlbot@example.com '#fml' Post FMLs on irc. @@ -69,59 +69,63 @@ Post FMLs on irc. This creates a named FIFO which you will need for the next examples. - $ cat fifo | ./irctk pongbot@example.com '#chat' \ - | cut -d '>' -f 2- \ - | grep --line-buffered 'ping' \ - | while read line; do echo "pong"; done \ - | tee fifo + $ cat fifo | ./irctk pongbot@example.com '#chat' | + cut -d '>' -f 2- | + grep --line-buffered 'ping' | + while read line; do echo "pong"; done | + tee fifo Answer "pong" whenever someone says something containing "ping" (or if his nick contains "ping"). - $ cat fifo | ./irctk -r pongbot@example.com '#chat' \ - | grep --line-buffered 'ping' \ - | while read line; do echo "pong"; echo; done \ - | tee fifo + $ cat fifo | ./irctk -r pongbot@example.com '#chat' | + grep --line-buffered 'ping' | + while read line; do echo "pong"; echo; done | + tee fifo Same, but address the message specifically to the person. The empty "echo" indicates the end of our answer to the person. (This is important so that irctk can keep track of the person you are answering.) - $ cat fifo | irctk -Ffr wikibot@example.com '#chat' \ - | while read line; do - Q=$(echo "$line" | tr ' ' '_' | tr -dc 'a-zA-Z_()'); - dig +short txt $Q.wp.dg.cx; echo; - done | tee fifo + $ cat fifo | irctk -Ffr wikibot@example.com '#chat' | + while read line; do + Q=$(echo "$line" | tr ' ' '_' | tr -dc 'a-zA-Z_()'); + dig +short txt $Q.wp.dg.cx; echo; + done | tee fifo A bot which queries on wikipedia whatever is said to him. - $ cat fifo | irctk -Ff DM@example.com '#adventure' \ - | while true; do - socat EXEC:adventure,pty,ctty,echo=0 STDIO; - done | tee fifo + $ cat fifo | irctk -Ff DM@example.com '#adventure' | + while true; do + socat EXEC:adventure,pty,ctty,echo=0 STDIO; + done | tee fifo Multiplayer adventure! (Beware, people can overwrite files when saving their game, so run as a suitably unpriviledged user.) The "while true" loop is to restart the game whenever it exits. The socat invocation is used to disable buffering. - $ irctk listener@source.com '#chan1' '#chan2' \ - | irctk repeater@destination.com + $ irctk listener@source.com '#chan1' '#chan2' | + irctk repeater@destination.com Repeat on destination.com whatever is said on channels #chan1 and #chan2 of source.com. - $ cat fifo | irctk -fF0 gateway@server1.com '#chan1' \ - | irctk -fF0 gateway@server2.com '#chan2' | tee fifo + $ cat fifo | irctk -fF0 gateway@server1.com '#chan1' | + irctk -fF0 gateway@server2.com '#chan2' | tee fifo Two-way gateway: gateway posts on #chan1 on server1.com whatever is said to him on #chan2 on server2.com, and vice-versa. - $ tail -f /var/log/syslog \ - | irctk syslog@example.com '#syslog' + $ tail -f /var/log/syslog | + irctk syslog@example.com '#syslog' Send your syslog messages to a channel. +TODO poor man's irc client with screen +TODO an IRC shell +TODO an IRC shell running irctk (irception!) + == 4. Caveats == irctk has not been audited thoroughly for bugs or security vulnerabilities. Be