Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from twisted.words.protocols import irc
- from twisted.internet import protocol, reactor
- import re
- import datetime
- def startup():
- reactor.connectTCP("irc.freenode.net", 6667, botstarter())
- reactor.run()
- class URLTracker(irc.IRCClient):
- nickname = "mwbot"
- def getURL(self, message):
- if 'freenode.pl' in message:
- return True
- if 'we\\\'re' in message:
- return True
- if 'javascript based flood spam' in message:
- return True
- def signedOn(self):
- self.join("#plone")
- def connectionMade(self):
- irc.IRCClient.connectionMade(self)
- def connectionLost(self, reason):
- irc.IRCClient.connectionLost(self, reason)
- def privmsg(self, user, channel, msg):
- url = self.getURL(msg)
- if url:
- self.mode(channel, True, 'b', user=user)
- class botstarter(protocol.ClientFactory):
- protocol = URLTracker
- def clientConnectionLost(self, connector, reason):
- connector.connect()
- def clientConnectionFailed(self, connector, reason):
- print "Could not connect, %s" % (reason)
- startup()
Add Comment
Please, Sign In to add comment