Internet Relay Chat (IRC) protocol client library
The home of irclib is:
You can `download project releases from PyPI
Some legacy content is still available at the `foundational SourceForge site
This library is intended to encapsulate the IRC protocol at a quite
low level. It provides an event-driven IRC client framework. It has
a fairly thorough support for the basic IRC protocol, CTCP and DCC
In order to understand how to make an IRC client, I'm afraid you more
or less must understand the IRC specifications. They are available
* Python 2.6 or newer (including Python 3!).
You have several options to install the IRC project.
* Use "easy_install irc" or "pip install irc" to grab the latest
version from the cheeseshop (recommended).
* Run "python setup.py install" (from the source distribution) or
* Run "paver install" (from repo checkout, requires paver) or
* Copy irc directory to appropriate site-packages directory.
The main features of the IRC client framework are:
* Abstraction of the IRC protocol.
* Handles multiple simultaneous IRC server connections.
* Handles server PONGing transparently.
* Messages to the IRC server are done by calling methods on an IRC
* Messages from an IRC server triggers events, which can be caught
by event handlers.
* Reading from and writing to IRC server sockets are normally done
by an internal select() loop, but the select()ing may be done by
an external main loop.
* Functions can be registered to execute at specified times by the
* Decodes CTCP tagging correctly (hopefully); I haven't seen any
other IRC client implementation that handles the CTCP
* A kind of simple, single-server, object-oriented IRC client class
that dispatches events to instance methods is included.
* DCC connection support.
* The IRC protocol shines through the abstraction a bit too much.
* Data is not written asynchronously to the server (and DCC peers),
i.e. the write() may block if the TCP buffers are stuffed.
* Like most projects, documentation is lacking...
Unfortunately, this library isn't as well-documented as I would like
it to be. I think the best way to get started is to read and
understand the example program irccat, which is included in the
The following files might be of interest:
The library itself. Read the code along with comments and
docstrings to get a grip of what it does. Use it at your own risk
and read the source, Luke!
An IRC bot implementation.
Example scripts in the scripts directory:
A simple example of how to use the IRC client. irccat reads text from
stdin and writes it to a specified user or channel on an IRC
The same as above, but using the SimpleIRCClient class.
Another simple example. servermap connects to an IRC server,
finds out what other IRC servers there are in the net and prints
a tree-like map of their interconnections.
An example bot that uses the SingleServerIRCBot class from
irc.bot. The bot enters a channel and listens for commands in
private messages or channel traffic. It also accepts DCC
invitations and echos back sent DCC chat messages.
Receives a file over DCC.
Sends a file over DCC.
NOTE: If you're running one of the examples on a unix command line, you need to escape the # symbol in the channel. For example, use \#test instead of #test.
Jason R. Coombs <email@example.com>
Joel Rosdahl <firstname.lastname@example.org>