-
-
Save brunsgaard/6c9d3f2c6dd344180430 to your computer and use it in GitHub Desktop.
This file contains 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 | |
from twisted.words.protocols import irc | |
from twisted.internet.protocol import ClientFactory | |
SERVER = "irc.freenode.net" | |
NICKNAME = 'the_username' | |
PASSWORD = 'password' | |
class Bot(irc.IRCClient): | |
nickname = NICKNAME | |
password = PASSWORD | |
def dataReceived(self, data): | |
print(data) | |
irc.IRCClient.dataReceived(self, data) | |
def signedOn(self): | |
print("\033[91m\n\nYOLO, I was signed on to the server!!!\n\033[0m") | |
self.quit() | |
def connectionLost(self, reason): | |
irc.IRCClient.connectionLost(self, reason) | |
reactor.stop() | |
class BotFactory(ClientFactory): | |
protocol = Bot | |
if __name__ == "__main__": | |
reactor.connectTCP(SERVER, 6667, BotFactory()) | |
reactor.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment