Ejemplo n.º 1
0
def main_loop():
    while True:
        try:
            bot.Run()
        except Exception as e:
            ERROR(e)
            time.sleep(3)
Ejemplo n.º 2
0
    def _startup(self,cond):

        # --bench .cache    临时目录在哪里?
        # --cmdQrcode       使用Console的二维码
        # --pluginPath      插件放在哪个目录

        if not self.conf.debug:
            logger.debug("QQ启动生产模式")
            args = "--bench .cache/qbot/ --mailAccount [email protected] --mailAuthCode sxlxhrgeqvzoiaba --pluginPath qbot/plugs --plugins message_processor".split(" ")
        else:
            logger.debug("QQ启动调试模式,QQ号:%s",self.conf.debug_qq)
            __arg = "--bench .cache/qbot/ --debug --cmdQrcode -q " + self.conf.debug_qq + " --pluginPath qbot/plugs --plugins message_processor"
            args = __arg.split(" ")
        logger.info("启动bot.Login登录,args:%s",args)
        # bot.rasa_server = rasa_server #bot这个实例身上给生生安上了一个rasa_server的实例

        cond.acquire()
        bot.Login(args)
        cond.notify()
        cond.release()

        logger.debug("进入bot.Run 死循环等待中...")
        logging.getLogger("Utf8Logger").setLevel(logging.WARNING)#去掉QQ的debug日志
        bot.Run()
        '''
Ejemplo n.º 3
0
def execute_v2(qqbot_port, qqbot_num, qqbot_mailauth):
    if not os.path.exists(QRCODE_PATH + qqbot_port):
        os.system('mkdir ' + QRCODE_PATH + qqbot_port)
    bot.Login(['-p', qqbot_port, '-b', QRCODE_PATH+qqbot_port, \
            '-r', '-q', qqbot_num, \
            '-m', qqbot_num+'@qq.com', '-mc', qqbot_mailauth, \
            '-dm'])
    bot.Plug('receiveQQGroupMessage')
    bot.Run()
Ejemplo n.º 4
0
def main():
    init()
    #
    # 登录
    bot.Login(['-r', '-q', '1821367759'])

    # 插件
    bot.Plug("plugin")
    # 主循环
    bot.Run()
    return
Ejemplo n.º 5
0
 def run(self):
     bot.Login(['-u', str(self.qq)])
     bot.Run()
Ejemplo n.º 6
0
def execute():
    bot.Login()
    bot.Plug('receiveQQGroupMessage')
    bot.Run()
Ejemplo n.º 7
0
# 指定启动参数。详细请参见 qqbot 命令的帮助 (qqbot --help)。
args = [
    # 用户名
    '--user',
    'username',

    #  QQ 号码
    '--qq',
    '12345678',

    # 插件目录
    '--pluginPath',
    '/my/plugin/path',

    # 启动时自动加载的插件
    '--plugins',
    'plugin1,plugin2,plugin3',

    # 启动方式:慢启动(获取全部联系人之后再启动)
    '--startAfterFetch',

    # 打印调试信息
    '--debug',
]

if __name__ == "__main__":
    # 注意:此时重启功能无法使用
    from qqbot import _bot as bot
    bot.Login(args)
    bot.Run()
Ejemplo n.º 8
0
def main():
    # 参数 -q <QQ号> 可以指定使用之前登录过的账号
    argv = ['-pp', FILE_DIR, '-pl', 'from_smartqq'] + sys.argv[1:]
    bot.Login(argv)
    bot.Run()