def handle(self, data): data = Message.parse(line) if msg.source is not None: msg.source = User(msg.source) else: msg.source = User(self.host) if msg.command in events.keys(): for event in handlers: event(self, msg)
def write(self, *args): msg = Message.from_args(args) self._send(str(msg))