[ACCEPTED]-IRC client in python-irc

Accepted answer
Score: 11

The IRC RFC documentation is an important 30 reference, but the most helpful first introduction 29 I've found on communication between IRC 28 client and server was really simple.

First, you 27 need access to a *nix shell (e.g. ssh into 26 your web host running Linux).

In the command 25 line, open up a direct connection to an 24 IRC server using the program 'nc'. Then 23 you can type RFC commands directly, and 22 see the response. Try typing

$ nc wright.freenode.net 6667
PASS whateveryoulike
NICK yournick
USER username 0 * :Real Name

There is output 21 from the server amidst this, but now you've 20 logged into and "registered" your 19 user. Note: your nick isn't registered (ala 18 NickServ), I'm referring to registering 17 a user as outlined in section 3.1 of the 16 RFC 2812 IRC Client Protocol.

You can now join a channel:

JOIN #yourtestchannel

See who's in 15 the channel:

WHO #yourtestchannel

Send yourself a msg:

PRIVMSG yournick Message Text Here

Chat into 14 the channel (send the channel a msg):

PRIVMSG #yourtestchannel Message Text Here

This 13 is especially helpful if you're connected 12 to the same server and channel with a different 11 nick in a real IRC client. You can chat 10 with yourself and msg one nick to the other, and 9 see the "raw" IRC output that 8 you'll have to parse to write your own client 7 or bot.

For example, someone chatting in 6 a channel looks something like this:

:SomeDude28!SomeDude28@hoststring-with_various_parts PRIVMSG #channel :Hey guys, what's up?

Using 5 the RFC, you can play around with whatever 4 functionality you want, and, more importantly, figure 3 out how you'll need to parse things.

Oh, and 2 don't forget to PONG occasionally, or when 1 prompted with a PING, to avoid ping timeout.

Score: 10

If you want to reinvent the wheel, then 5 you have to implement the RFC and do everything 4 from scratch.

If you don't want to do that 3 and would require some level of abstraction 2 to ease your development (and which you 1 should), then see Twisted.

There is also a Python IRC client library.

Score: 5

For most protocols a good way to start is 4 to look for a document called RFC. There's 3 one for many protocols and it defines - in 2 depth - how it should behave.

You can find 1 the one for IRC here.

More Related questions