Beispiel #1
0
    # Load the config file
    config = alea.config.AleabotConfig(rng)
    config.load(basepath)

    # Set up console and file logging
    Report.setOutputLevel(config.get("report_level"))
    log_file = config.get("log_file")
    if log_file != "":
        log_file_full_path = os.path.join(basepath, log_file)
        Report.registerLog(
            os.path.dirname(log_file_full_path), os.path.basename(log_file_full_path), ["*"], config.get("log_level")
        )

    # Create and register our custom bot filter
    alea.AleabotFilter.init(rng, config)
    FilterManager.registerFilterForEvent(alea.AleabotFilter, "botProcessChat")
    FilterManager.registerFilterForEvent(alea.AleabotFilter, "botProcessKmail")
    FilterManager.registerFilterForEvent(alea.AleabotFilter, "botEndCycle")
    FilterManager.registerFilterForEvent(alea.AleabotFilter, "botPreLogin")

    # Start the bot manager
    BotManager.init()

    # Create and run the bot
    params = {}
    params["doWork:chat"] = True
    params["doWork:kmail"] = True
    params["userName"] = config.get("username")
    params["userPassword"] = config.get("password")
    params["timeToSleep"] = config.get("time_to_sleep")
    b = Bot(params)