Skip to content

Instantly share code, notes, and snippets.

@markrwilliams
Created December 22, 2013 23:00
Show Gist options
  • Select an option

  • Save markrwilliams/8089465 to your computer and use it in GitHub Desktop.

Select an option

Save markrwilliams/8089465 to your computer and use it in GitHub Desktop.
from twisted.internet import reactor, defer, protocol, task
from twisted.internet.ssl import ClientContextFactory
from twisted.words.protocols import irc
class NoPingBotProtocol(irc.IRCClient):
def __init__(self, *args, **kwargs):
self.nickname = 'noping'
self.password = 'balloonatics'
def startHeartbeat(self):
return
def stopHeartbeat(self):
return
def signedOn(self):
print 'ON'
for channel, modes in self.factory.channels:
self.join(channel)
self.mode(channel, set=True, modes=modes)
def handleCommand(self, command, prefix, params):
print 'handleCommand:', `command`, `prefix`, `params`
irc.IRCClient.handleCommand(self, command, prefix, params)
def irc_PING(self, prefix, params):
print 'purposely ignoring PING:', repr(prefix), repr(params)
class NoPingBotFactory(protocol.ReconnectingClientFactory):
protocol = NoPingBotProtocol
channels = [('#vent', [])]
if __name__ == '__main__':
reactor.connectSSL('hatnote.com', 6697, NoPingBotFactory(),
ClientContextFactory())
reactor.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment