예제 #1
0
파일: webqq.py 프로젝트: DorChen/pual_bot
def main():
    webqq = Client(config.QQ, config.QQ_PWD)
    try:
        if getattr(config, "HTTP_CHECKIMG", False):
            http_server_run(webqq)
        else:
            webqq.run()
    except KeyboardInterrupt:
        print("Exiting...", file =  sys.stderr)
    except SystemExit:
        os.execv(sys.executable, [sys.executable] + sys.argv)
예제 #2
0
def main():
    webqq = Client(config.QQ, config.QQ_PWD,
                   debug=getattr(config, "TRACE", False))
    try:
        if getattr(config, "HTTP_CHECKIMG", False):
            http_server_run(webqq)
        else:
            webqq.run()
    except KeyboardInterrupt:
        print("Exiting...", file=sys.stderr)
    except SystemExit:
        logger.error("检测到退出, 重新启动")
        os.execv(sys.executable, [sys.executable] + sys.argv)
예제 #3
0
파일: webqq_bak.py 프로젝트: udbmnm/twqq
 def _main():
     retry = True
     try:
         if HTTP_CHECKIMG:
             http_server_run(webqq)
         else:
             webqq.run()
     except KeyboardInterrupt:
         retry = False
         print >>sys.stderr, "Exiting..."
     except SystemExit as e:
         if e.code in [2, 0, 1]:
             retry = False
     except:
         retry = True
         traceback.print_exc()
     finally:
         if retry:
             os.execv(sys.executable, [sys.executable] + sys.argv)
예제 #4
0
파일: webqq_bak.py 프로젝트: huangfs/twqq
 def _main():
     retry = True
     try:
         if HTTP_CHECKIMG:
             http_server_run(webqq)
         else:
             webqq.run()
     except KeyboardInterrupt:
         retry = False
         print >> sys.stderr, "Exiting..."
     except SystemExit as e:
         if e.code in [2, 0, 1]:
             retry = False
     except:
         retry = True
         traceback.print_exc()
     finally:
         if retry:
             os.execv(sys.executable, [sys.executable] + sys.argv)
예제 #5
0
파일: qq2.py 프로젝트: luokeychen/TomBot
        try:
            msg_body = json.loads(msg[0])
        except ValueError as e:
            logger.warn('消息解析失败:{0}'.format(e))
        logger.info('adapter收到消息:{0}'.format(msg_body))
        _content = msg_body.get('content')
        _id = msg_body.get('id')
        _style = msg_body.get('style')
        _type = msg_body.get('type')

        #        _content = _content.decode('utf-8')
        if _type == 'buddy':
            webqq.hub.send_buddy_msg(int(_id), _content, _style)
        elif _type == 'group':
            webqq.hub.send_group_msg(int(_id), _content, _style)
        elif _type == 'discu':
            webqq.hub.send_discu_msg(int(_id), _content, _style)
        else:
            logger.error('zmq message format error')

    stream = zmqstream.ZMQStream(socket)
    stream.on_recv(zmq_handler)

    try:
        if USE_HTTP:
            http_server_run(webqq)
        else:
            webqq.run()
    except KeyboardInterrupt:
        logger.info("收到退出信号,程序退出...")
예제 #6
0
        try:
            msg_body = json.loads(msg[0])
        except ValueError as e:
            logger.warn('消息解析失败:{0}'.format(e))
        logger.info('adapter收到消息:{0}'.format(msg_body))
        _content = msg_body.get('content')
        _id = msg_body.get('id')
        _style = msg_body.get('style')
        _type = msg_body.get('type')

        #        _content = _content.decode('utf-8')
        if _type == 'buddy':
            webqq.hub.send_buddy_msg(int(_id), _content, _style)
        elif _type == 'group':
            webqq.hub.send_group_msg(int(_id), _content, _style)
        elif _type == 'discu':
            webqq.hub.send_discu_msg(int(_id), _content, _style)
        else:
            logger.error('zmq message format error')

    stream = zmqstream.ZMQStream(socket)
    stream.on_recv(zmq_handler)

    try:
        if USE_HTTP:
            http_server_run(webqq)
        else:
            webqq.run()
    except KeyboardInterrupt:
        logger.info("收到退出信号,程序退出...")