brunsgaard / test.py secret
Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View test.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
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
Something went wrong with that request. Please try again.