def lineReceived(self, line): if not line.strip(): return try: line = ("<%s> !" % config.COMMANDER) + line.lstrip() self.world.chat.on_chat_message(line) except Exception as e: logbot.exit_on_error(e)
def dataReceived(self, bytestream): try: self.parser(bytestream) except: logbot.exit_on_error()
type=int, help='Packet IDs to filter for processor. ex 14 15') args = parser.parse_args() try: _procmod = __import__('twistedbot.proxy_processors', globals(), locals(), [args.processor], -1) processor = getattr(_procmod, args.processor) if args.ignore_packets: logbot.msg("Ignore packet ids %s" % args.ignore_packets) if args.filter_packets: logbot.msg("Filter packet ids %s" % args.filter_packets) processor.ignore_packets = args.ignore_packets processor.filter_packets = args.filter_packets except: logbot.exit_on_error(_why="Cannot import %s" % ( 'proxy_processors.' + args.processor,)) exit() try: if args.log2file: logbot.start_filelog() except: logbot.exit_on_error(_why="Cannot open log file for writing") exit() endpoint = TCP4ServerEndpoint(reactor, args.proxyport) d = endpoint.listen(ProxyClientFactory(args.serverhost, args.serverport)) d.addErrback(logbot.exit_on_error, "Client network error") reactor.addSystemEventTrigger('after', 'shutdown', processor.finish) reactor.run()
def lineReceived(self, line): try: self.world.chat.process_command(line) except Exception as e: logbot.exit_on_error(e)
def lineReceived(self, line): try: self.world.chat.process_command_line(line) except Exception as e: logbot.exit_on_error(e)
nargs='+', type=int, help='Packet IDs to filter for processor. ex 14 15') args = parser.parse_args() try: _procmod = __import__('twistedbot.proxy_processors', globals(), locals(), [args.processor], -1) processor = getattr(_procmod, args.processor) if args.ignore_packets: logbot.msg("Ignore packet ids %s" % args.ignore_packets) if args.filter_packets: logbot.msg("Filter packet ids %s" % args.filter_packets) processor.ignore_packets = args.ignore_packets processor.filter_packets = args.filter_packets except: logbot.exit_on_error(_why="Cannot import %s" % ('proxy_processors.' + args.processor, )) exit() try: if args.log2file: logbot.start_proxy_filelog() except: logbot.exit_on_error(_why="Cannot open log file for writing") exit() reactor.listenTCP(args.proxyport, ProxyClientFactory(args.serverhost, args.serverport)) reactor.addSystemEventTrigger('after', 'shutdown', processor.finish) reactor.run()