Search code examples
pythonsocketsbotsirc

How do i program a simple IRC bot in python?


I need help writing a basic IRC bot that just connects to a channel.. is anyone able to explain this to me? I have managed to get it to connect to the IRC server but I am unable to join a channel and log on. The code I have thus far is:

import sockethost = 'irc.freenode.org'
port = 6667
join_sock = socket.socket()
join_sock.connect((host, port))
<code here> 

Any help would be greatly appreciated.


Solution

  • It'd probably be easiest to base it on twisted's implementation of the IRC protocol. Take a look at : http://github.com/brosner/bosnobot for inspiration.