Python twisted irc client
sudo yum install python-twisted-words
sudo apt-get install python-twisted-words
API
http://twistedmatrix.com/documents/8.2.0/api/twisted.words.protocols.irc.IRCClient.html
from twisted.internet import reactor, protocol
from twisted.words.protocols import irc
class IRCLogger(irc.IRCClient):
logfile = file('/tmp/freenode.txt', 'a+')
nick = 'davey_jones_logger'
def signedOn(self):
self.join('#scala')
def privmsg(self, user, channel, message):
print "Got msg %s " % message
self.logfile.write(" %s said %s \n" % ( user.split('!')[0], message ))
self.logfile.flush()
def main():
f = protocol.ReconnectingClientFactory()
f.protocol = IRCLogger
reactor.connectTCP('irc.freenode.net', 6667, f)
reactor.run()
if __name__ == '__main__':
main()