Created
December 22, 2013 23:00
-
-
Save markrwilliams/8089465 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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