Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def should_register_bot(config):
existing_id = CommunityManager._init_config_bot_id(config)
return not existing_id
def background_get_id_and_register_bot(octobot_api):
community_manager = CommunityManager(octobot_api)
threading.Thread(target=community_manager._blocking_get_id_and_register).start()
def manage_metrics(enable_metrics):
current_edited_config = get_edited_config()
if CONFIG_METRICS not in current_edited_config:
current_edited_config[CONFIG_METRICS] = {CONFIG_ENABLED_OPTION: enable_metrics}
else:
current_edited_config[CONFIG_METRICS][CONFIG_ENABLED_OPTION] = enable_metrics
if enable_metrics and CommunityManager.should_register_bot(current_edited_config):
CommunityManager.background_get_id_and_register_bot(get_bot_api())
config_manager.simple_save_config_update(current_edited_config)
def manage_metrics(enable_metrics):
current_edited_config = get_edited_config()
if CONFIG_METRICS not in current_edited_config:
current_edited_config[CONFIG_METRICS] = {CONFIG_ENABLED_OPTION: enable_metrics}
else:
current_edited_config[CONFIG_METRICS][CONFIG_ENABLED_OPTION] = enable_metrics
if enable_metrics and CommunityManager.should_register_bot(current_edited_config):
CommunityManager.background_get_id_and_register_bot(get_bot_api())
config_manager.simple_save_config_update(current_edited_config)