All pastes #174614 Raw Edit

Untitled

public python v1 · immutable
·published 2006-09-18 02:15 UTC
rendered paste body
from twisted.words.protocols import ircfrom twisted.internet import reactor, protocolimport time, sys, osclass NthMachine(irc.IRCClient):  nickname = 'NthMachine'  realname = 'NthDegree Bot'  channel = 'gNewSense'          def connectionMade(self): irc.IRCClient.connectionMade(self)          def connectionLost(self, reason):    irc.IRCClient.connectionLost(self, reason)          def signedOn(self): self.join(self.channel)          def privmsg(self, user, channel, msg):    user = user.split('!', 1)[0]            if channel == self.nickname:      msg = 'I dont respond to PMs'      self.msg(user, msg)      return            if msg.startswith('~'):      botfile = open("botchat.txt")      chatback = (botfile.readline() msg)      self.msg(channel, '%s try wiki.gnewsense.org/Help %s' % (user, msg[len(self.nickname + ':'):]))      return            if msg.startswith('~' + ''):      self.msg(channel, '%s try wiki.gnewsense.org/Help %s' % (user, msg[len(self.nickname + ':'):]))      return        class NthMachineFactory(protocol.ClientFactory):  protocol = NthMachine  def __init__(self): pass          def clientConnectionLost(self, connector, reason): connector.connect()          def clientConnectionFailed(self, connector, reason): reactor.stop()        if __name__ == '__main__':  f = NthMachineFactory()  reactor.connectTCP('chat.eu.freenode.net', 6667, f)  reactor.run()