def _update_config(self): if not self._config_update_queue: return 5 obj_name = self._config_update_queue.popleft() config = load_from_file('config.json') if (obj_name not in config): return None config[obj_name] = getattr(self.Hakcbot, obj_name) write_to_file(config, 'config.json')
def file_task(self, obj_name): config = load_from_file('config') if (obj_name not in config): return None updated_attribute = getattr(self.Hakcbot, obj_name) if isinstance(updated_attribute, set): updated_attribute = list(updated_attribute) config[obj_name] = updated_attribute write_to_file(config, 'config')
def _load_json_data(self): stored_data = load_from_file('config') self.Hakcbot.titles = stored_data['titles'] self.Hakcbot.quotes = stored_data['quotes'] self.Hakcbot.url_whitelist = set( stored_data['url_whitelist']) # easier to deal with a set self.Hakcbot.word_filter = stored_data['word_filter'] self._host = stored_data['twitch']['host'] self._port = stored_data['twitch']['port']
def adjust_blacklist(self, url=None, action=None): config = load_from_file('config.json') self.blacklist = set(config['blacklist'])