devaru <ajoys...@gmail.com> wrote: > I am new to Python language. I want to capture(either in database or a > file) the conversation in IRC. > Please suggest me some simple IRC library or code snippet for this.
I recommend the circuits[1] library, which contains a sample irc bot [2]. You'll want to override the message method to do something with the data captured. #!/usr/bin/env python from circuits import Component, Debugger from circuits.net.sockets import TCPClient, Connect from circuits.net.protocols.irc import IRC, Message, User, Nick class Bot(Component): def __init__(self, host, port=6667, channel=None): super(Bot, self).__init__(channel=channel) self += TCPClient(channel=channel) + IRC(channel=channel) self.push(Connect(host, port), "connect") def connected(self, host, port): self.push(User("test", host, host, "Test Bot"), "USER") self.push(Nick("test"), "NICK") def numeric(self, source, target, numeric, args, message): if numeric == 433: self.push(Nick("%s_" % self("getNick")), "NICK") def message(self, source, target, message): self.push(Message(source[0], message), "PRIVMSG") bot = Bot("irc.freenode.net", channel="bot") + Debugger() bot.run() [1]: http://pypi.python.org/pypi/circuits [2]: http://trac.softcircuit.com.au/circuits/browser/examples/ircbot.py -- http://mail.python.org/mailman/listinfo/python-list