rendered paste bodyfrom twisted.internet.protocol import Factoryfrom twisted.protocols.basic import LineReceiverfrom twisted.internet import reactorclass IRC(LineReceiver): def connectionMade(self): print "yay"class Boo(LineReceiver): def __init__(self): self.supportAnsi = 0 self.state = 0 def connectionMade(self): self.sendLine("Welcome.") self.sendLine("Does your terminal support ANSI Colors? Please answer \"Yes\" or \"No\"") def lineReceived(self,line): if self.state == 0: temp = line.lower() if temp == "no" or temp == "yes": if temp == "no": self.supportAnsi = 0 elif temp == "yes": self.supportAnsi = 1 self.sendLine("Ok. which server would you like to join?") self.state = 1 else: self.sendLine("Does your terminal support ANSI Colors? Please answer \"Yes\" or \"No\"") elif self.state == 1: reactor.connectTCP("127.0.0.1",6667,IRCFag())class IRCFag(Factory): protocol = IRCclass CLFag(Factory): protocol = Booreactor.listenTCP(8007, CLFag())reactor.run()