예제 #1
0
 def package_manager(config, commands, catch=False):
     try:
         package_manager_inst = TentacleManager(config)
         package_manager_inst.parse_commands(commands)
     except Exception as e:
         if not catch:
             raise e
예제 #2
0
def register_and_install(path_or_url):
    config = get_bot().get_config()
    config[CONFIG_TENTACLES_KEY].append(path_or_url)
    # TODO update config.json

    tentacles_manager = TentacleManager(config)
    tentacles_manager.install_tentacle_package(path_or_url, True)
    return True
예제 #3
0
def uninstall_modules(modules):
    try:
        tentacles_manager = TentacleManager(get_bot().get_config())
        tentacles_manager.update_list()
        nb_uninstalled = tentacles_manager.uninstall_parser(modules, False)
        return f"{nb_uninstalled} uninstalled module(s)" if nb_uninstalled > 1 else f"{modules[0]} uninstalled"
    except Exception as e:
        logger.error(f"Error when uninstalling modules: {e}")
        logger.exception(e)
        return None
예제 #4
0
def update_modules(modules):
    try:
        tentacles_manager = TentacleManager(get_bot().get_config())
        tentacles_manager.update_list()
        tentacles_manager.set_force_actions(True)
        nb_updated = tentacles_manager.update_parser(modules, False)
        return f"{nb_updated} up to date module(s)" if nb_updated > 1 else f"{modules[0]} up to date"
    except Exception as e:
        logger.error(f"Error when updating modules: {e}")
        logger.exception(e)
        return None
예제 #5
0
def reset_packages():
    try:
        tentacles_manager = TentacleManager(get_bot().get_config())
        tentacles_manager.update_list()
        tentacles_manager.reset_tentacles()
        return "reset successful"
    except Exception as e:
        logger.error(f"Error when resetting packages: {e}")
        logger.exception(e)
        return None
예제 #6
0
def update_packages():
    try:
        tentacles_manager = TentacleManager(get_bot().get_config())
        tentacles_manager.update_list()
        tentacles_manager.set_force_actions(True)
        return f"{tentacles_manager.update_parser(None, True)} tentacles up to date"
    except Exception as e:
        logger.error(f"Error when updating packages: {e}")
        logger.exception(e)
        return None
예제 #7
0
def install_packages():
    try:
        tentacles_manager = TentacleManager(get_bot().get_config())
        tentacles_manager.update_list()
        tentacles_manager.set_force_actions(True)
        return f"{tentacles_manager.install_parser(None, True)} installed tentacles"
    except Exception as e:
        logger.error(f"Error when installing packages: {e}")
        logger.exception(e)
        return False