2009-03-02 23:26:04 -07:00
|
|
|
bot
|
|
|
|
===
|
2008-02-08 15:38:31 -07:00
|
|
|
|
2011-01-06 22:21:32 -07:00
|
|
|
This is a suite of simple programs which allow you to write an IRC bot.
|
|
|
|
It is based on the Unix principle that one program should do one thing,
|
|
|
|
and makes extensive use of pipes, child processes, and passing of file
|
|
|
|
descriptors.
|
|
|
|
|
|
|
|
Unless you are a seasoned Unix programmer or are willing to become one,
|
|
|
|
this is not the bot you're looking for.
|
|
|
|
|
|
|
|
|
|
|
|
dispatch
|
|
|
|
--------
|
|
|
|
|
|
|
|
Reads lines from stdin (or fd 6). Each line causes a fork and exec of a
|
|
|
|
specified program; the line is sent as the last argument. Any output
|
|
|
|
from children is passed through to stdout (or fd 7), optionally rate
|
|
|
|
limited. A fifo can optionally be specified on the command line;
|
|
|
|
anything written to it is treated identically to child output.
|
|
|
|
|
|
|
|
|
|
|
|
irc
|
|
|
|
---
|
|
|
|
|
|
|
|
Parses its last argument as a line from IRC. Determines prefix,
|
|
|
|
command, sender, forum (channel or user), and text; then invokes a
|
|
|
|
specified program with these as arguments. Also responds to server
|
|
|
|
pings as a convenience.
|
|
|
|
|
|
|
|
|
2011-06-09 21:27:24 -06:00
|
|
|
run
|
2011-01-06 22:21:32 -07:00
|
|
|
---
|
|
|
|
|
2011-06-09 21:27:24 -06:00
|
|
|
[run BOTDIR] will run the bot contained in $BOTDIR. It should contain
|
|
|
|
the following files (see cobalt in the distribution for examples):
|
2011-01-06 22:25:02 -07:00
|
|
|
|
2011-06-09 21:27:24 -06:00
|
|
|
* connect : program to open connection
|
|
|
|
* login : program to log in to IRC
|
|
|
|
* handler : program to handle IRC messages
|
2011-01-06 22:25:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
firebot
|
|
|
|
-------
|
|
|
|
|
|
|
|
A private message handler providing a few handy commands.
|
|
|
|
|
|
|
|
|
|
|
|
infobot
|
|
|
|
-------
|
|
|
|
|
|
|
|
A private message handler providing infobot-like functionality.
|
|
|
|
|
|
|
|
|
|
|
|
notes
|
|
|
|
-----
|
|
|
|
|
|
|
|
A private message handler allowing users to leave notes for each other.
|
|
|
|
|
|
|
|
|
|
|
|
whuffie
|
|
|
|
-------
|
|
|
|
|
|
|
|
A private message handler keeping track of whuffe (also known as karma),
|
|
|
|
which is really just a meaningless number associated with your nick,
|
|
|
|
which other people can manipulate but you can't.
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-06 22:21:32 -07:00
|
|
|
Putting it all together
|
|
|
|
=======================
|
|
|
|
|
|
|
|
A full chain of programs would look something like
|
|
|
|
|
2011-06-09 21:27:24 -06:00
|
|
|
tcpclient -> connect-handler -> dispatch -> handler
|
2011-01-06 22:21:32 -07:00
|
|
|
|
|
|
|
and would be invoked as
|
|
|
|
|
2011-06-09 21:27:24 -06:00
|
|
|
$ tcpclient irc.host.org 6667 ./connect-handler cobalt
|
2009-03-02 23:26:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
Author
|
|
|
|
------
|
|
|
|
|
|
|
|
Neale Pickett <neale@woozle.org>
|
|
|
|
|
2008-02-08 15:38:31 -07:00
|
|
|
|
|
|
|
|