irc-bot/README

80 lines
1.9 KiB
Plaintext
Raw Normal View History

2012-05-14 13:37:28 -06:00
firebot
=======
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.
2012-05-14 13:37:28 -06:00
Getting Started Quickly
=======================
2011-01-06 22:21:32 -07:00
2012-05-14 13:37:28 -06:00
The `newmont` directory contains a very simple example, which you can
extend while it's running. It will connect to an IRC network, join
the channel `#dumont`, and respond to any channel massage containing
the substring "strawberry".
2011-01-06 22:21:32 -07:00
2012-05-14 13:37:28 -06:00
You should probably edit newmont/nickname and newmont/server before
trying this out. Set it to something hopefully unique on the network
you intend to join.
2011-01-06 22:21:32 -07:00
2012-05-14 13:37:28 -06:00
Start it like so:
2011-01-06 22:21:32 -07:00
2012-05-14 13:37:28 -06:00
./firebot newmont
2011-01-06 22:25:02 -07:00
2012-05-14 13:37:28 -06:00
What Everything Does
====================
2011-01-06 22:25:02 -07:00
2012-05-14 13:37:28 -06:00
The core fuctionality exists as two C programs and a couple scripts:
2011-01-06 22:25:02 -07:00
2012-05-14 13:37:28 -06:00
firebot
2011-01-06 22:25:02 -07:00
-------
2012-05-14 13:37:28 -06:00
Reads in nick and realname, sets up a fifo, connects to the server
(or runs `$botdir/connect`), and hands off to `connect-handler`.
2011-01-06 22:25:02 -07:00
2012-05-14 13:37:28 -06:00
connect-handler
---------------
2011-01-06 22:25:02 -07:00
2012-05-14 13:37:28 -06:00
Sends the `NICK` and `USER` commands to the server (or runs
`$botdir/login`), then hands off to `dispatch irc-filter
$botdir/handler`.
2011-01-06 22:25:02 -07:00
2012-05-14 13:37:28 -06:00
dispatch
--------
2011-01-06 22:25:02 -07:00
2012-05-14 13:37:28 -06:00
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.
2011-01-06 22:21:32 -07:00
2012-05-14 13:37:28 -06:00
irc-filter
----------
2011-01-06 22:21:32 -07:00
2012-05-14 13:37:28 -06:00
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-01-06 22:21:32 -07:00
Author
2012-05-14 13:37:28 -06:00
======
Neale Pickett <neale@woozle.org>