def load_module(self, *args, **kwargs): MessagingModule.load_module(self, *args, **kwargs) if 'webchat' not in self._loaded_modules: raise ModuleLoadException("Unable to find webchat module that is needed for level module") else: self._loaded_modules['webchat']['class'].add_depend('levels') conf_dict = self._conf_params['config'] self.experience = conf_dict['config'].get('experience') self.exp_for_level = float(conf_dict['config'].get('exp_for_level')) self.exp_for_message = float(conf_dict['config'].get('exp_for_message')) self.level_file = None self.levels = [] self.special_levels = {} self.db_location = os.path.join(conf_dict['config'].get('db')) self.decrease_window = int(conf_dict['config'].get('decrease_window')) self.threshold_users = {} # Load levels webchat_location = self._loaded_modules['webchat']['style_settings']['gui']['location'] if webchat_location and os.path.exists(webchat_location): self.level_file = os.path.join(webchat_location, 'levels.xml') else: log.error("{0} not found, generating from template".format(self.level_file)) raise ModuleLoadException("{0} not found, generating from template".format(self.level_file)) if self.experience == 'random': self.db_location += '.random' self.create_db(self.db_location) self.load_levels()
def __init__(self, *args, **kwargs): MessagingModule.__init__(self, *args, **kwargs) self._load_priority = 9001 self._category = 'main' conf_params = self._conf_params['config'] self._conf_params.update({ 'host': str(conf_params['server']['host']), 'port': str(conf_params['server']['port']), 'style_settings': { 'gui': { 'style_name': None, 'location': None, 'keys': {} }, 'chat': { 'style_name': None, 'location': None, 'keys': {} } } }) self.prepare_style_settings() self.style_settings = self._conf_params['style_settings'] self.s_thread = None self.queue = kwargs.get('queue') self.message_threads = [] # Rest Api Settings self.rest_add('GET', 'style', self.rest_get_style_settings) self.rest_add('GET', 'style_gui', self.rest_get_style_settings) self.rest_add('GET', 'history', self.rest_get_history) self.rest_add('DELETE', 'chat', self.rest_delete_history)
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Dwarf professions. conf_file = os.path.join(conf_folder, CONFIG_FILE) # Ordered because order matters conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'test', 'id': DEFAULT_PRIORITY } config = load_from_config_file(conf_file, conf_dict) self._conf_params.update({ 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': conf_dict['gui_information']['id'], 'config': OrderedDict(conf_dict), 'custom_renderer': True })
def __init__(self, *args, **kwargs): MessagingModule.__init__(self, *args, **kwargs) self.experience = None self.exp_for_level = None self.exp_for_message = None self.level_file = None self.levels = None self.special_levels = None self.db_location = None self.decrease_window = None self.threshold_users = None
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Dwarf professions. conf_file = os.path.join(conf_folder, "blacklist.cfg") # Ordered because order matters conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'messaging', 'id': DEFAULT_PRIORITY } conf_dict['main'] = {'message': 'ignored message'} conf_dict['users_hide'] = [] conf_dict['users_block'] = [] conf_dict['words_hide'] = [] conf_dict['words_block'] = [] conf_gui = { 'words_hide': { 'addable': True, 'view': 'list' }, 'words_block': { 'addable': True, 'view': 'list' }, 'users_hide': { 'view': 'list', 'addable': 'true' }, 'users_block': { 'view': 'list', 'addable': 'true' }, 'non_dynamic': ['main.*'] } config = load_from_config_file(conf_file, conf_dict) self._conf_params.update({ 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': conf_dict['gui_information']['id'], 'config': OrderedDict(conf_dict), 'gui': conf_gui })
def __init__(self, *args, **kwargs): MessagingModule.__init__(self, *args, **kwargs) # Dwarf professions. self.file = CONF_DICT['grep']['file'] dir_name = os.path.dirname(self.file) if not os.path.exists(dir_name): os.makedirs(os.path.dirname(self.file)) if not os.path.isfile(self.file): with open(self.file, 'w'): pass
def __init__(self, *args, **kwargs): MessagingModule.__init__(self, *args, **kwargs) self._load_priority = 20 # Creating filter and replace strings. self.format = CONF_DICT['config']['file_format'] self.ts_format = CONF_DICT['config']['message_date_format'] self.logging = CONF_DICT['config']['logging'] self.rotation = CONF_DICT['config']['rotation'] self.folder = 'logs' self.destination = os.path.join(CONF_FOLDER, '..', self.folder) if not os.path.exists(self.destination): os.makedirs(self.destination)
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Creating filter and replace strings. conf_file = os.path.join(conf_folder, "logger.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'messaging', 'id': DEFAULT_PRIORITY } conf_dict['config'] = OrderedDict() conf_dict['config']['logging'] = True conf_dict['config']['file_format'] = '%Y-%m-%d' conf_dict['config']['message_date_format'] = '%Y-%m-%d %H:%M:%S' conf_dict['config']['rotation'] = 'daily' conf_gui = {'non_dynamic': ['config.*']} config = load_from_config_file(conf_file, conf_dict) self._conf_params.update({ 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': conf_dict['gui_information']['id'], 'config': conf_dict, 'gui': conf_gui }) self.format = conf_dict['config']['file_format'] self.ts_format = conf_dict['config']['message_date_format'] self.logging = conf_dict['config']['logging'] self.rotation = conf_dict['config']['rotation'] self.folder = 'logs' self.destination = os.path.join(conf_folder, '..', self.folder) if not os.path.exists(self.destination): os.makedirs(self.destination)
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Dwarf professions. conf_file = os.path.join(conf_folder, "df.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = {'category': 'messaging'} conf_dict['grep'] = OrderedDict() conf_dict['grep']['symbol'] = '#' conf_dict['grep']['file'] = 'logs/df.txt' conf_dict['prof'] = OrderedDict() conf_gui = { 'prof': { 'view': 'list_dual', 'addable': True }, 'non_dynamic': ['grep.*'] } config = load_from_config_file(conf_file, conf_dict) self._conf_params.update({ 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'config': conf_dict, 'gui': conf_gui }) self.file = conf_dict['grep']['file'] dir_name = os.path.dirname(self.file) if not os.path.exists(dir_name): os.makedirs(os.path.dirname(self.file)) if not os.path.isfile(self.file): with open(self.file, 'w'): pass
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Creating filter and replace strings. conf_file = os.path.join(conf_folder, "mentions.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = {'category': 'messaging'} conf_dict['mentions'] = [] conf_dict['address'] = [] conf_gui = { 'mentions': { 'addable': 'true', 'view': 'list'}, 'address': { 'addable': 'true', 'view': 'list'}} config = load_from_config_file(conf_file, conf_dict) self._conf_params.update( {'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'config': conf_dict, 'gui': conf_gui})
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Creating filter and replace strings. conf_file = os.path.join(conf_folder, "c2b.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'messaging', 'id': DEFAULT_PRIORITY } conf_dict['config'] = {} conf_gui = { 'config': { 'addable': 'true', 'view': 'list_dual' }, 'non_dynamic': ['config.*'] } config = load_from_config_file(conf_file, conf_dict) self._conf_params.update({ 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'id': conf_dict['gui_information']['id'], 'config': conf_dict, 'gui': conf_gui })
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) # Module configuration conf_file = os.path.join(conf_folder, "webchat.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = { 'category': 'main', 'id': DEFAULT_PRIORITY } conf_dict['server'] = OrderedDict() conf_dict['server']['host'] = '127.0.0.1' conf_dict['server']['port'] = '8080' conf_dict['style_gui'] = DEFAULT_STYLE conf_dict['style_gui_settings'] = OrderedDict() conf_dict['style'] = DEFAULT_STYLE conf_dict['style_settings'] = OrderedDict() conf_dict['style_settings']['show_system_msg'] = True conf_gui = { 'style_gui': { 'check': 'http', 'check_type': 'dir', 'view': 'choose_single' }, 'style_gui_settings': {}, 'style': { 'check': 'http', 'check_type': 'dir', 'view': 'choose_single' }, 'style_settings': {}, 'non_dynamic': ['server.*'], 'ignored_sections': ['style_settings', 'style_gui_settings'], 'redraw': { 'style_settings': { 'redraw_trigger': ['style'], 'type': 'chat', 'get_config': self.load_style_settings, 'get_gui': self.get_style_gui_from_file }, 'style_gui_settings': { 'redraw_trigger': ['style_gui'], 'type': 'gui', 'get_config': self.load_style_settings, 'get_gui': self.get_style_gui_from_file }, } } parser = load_from_config_file(conf_file, conf_dict) self._conf_params.update({ 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': parser, 'id': conf_dict['gui_information']['id'], 'config': conf_dict, 'gui': conf_gui, 'host': conf_dict['server']['host'], 'port': conf_dict['server']['port'], 'style_settings': { 'gui': { 'style_name': None, 'location': None, 'keys': {} }, 'chat': { 'style_name': None, 'location': None, 'keys': {} } } }) self.prepare_style_settings() self.s_thread = None self.queue = None self.message_threads = [] # Rest Api Settings self.rest_add('GET', 'style', self.rest_get_style_settings) self.rest_add('GET', 'style_gui', self.rest_get_style_settings) self.rest_add('GET', 'history', self.rest_get_history) self.rest_add('DELETE', 'chat', self.rest_delete_history)
def load_module(self, *args, **kwargs): MessagingModule.load_module(self, *args, **kwargs) self.start_webserver()
def __init__(self, *args, **kwargs): MessagingModule.__init__(self, hidden=True, *args, **kwargs) self.s_thread = None self.queue = kwargs.get('queue') self.message_threads = []
def __init__(self, *args, **kwargs): MessagingModule.__init__(self, *args, **kwargs)
def load_module(self, *args, **kwargs): MessagingModule.load_module(self, *args, **kwargs) self.queue = kwargs.get('queue') self.start_webserver()
def __init__(self, conf_folder, **kwargs): MessagingModule.__init__(self) conf_file = os.path.join(conf_folder, "levels.cfg") conf_dict = OrderedDict() conf_dict['gui_information'] = {'category': 'messaging'} conf_dict['config'] = OrderedDict() conf_dict['config']['message'] = u'{0} has leveled up, now he is {1}' conf_dict['config']['db'] = os.path.join('conf', u'levels.db') conf_dict['config']['experience'] = u'geometrical' conf_dict['config']['exp_for_level'] = 200 conf_dict['config']['exp_for_message'] = 1 conf_dict['config']['decrease_window'] = 60 conf_gui = { 'non_dynamic': [ 'config.db', 'config.experience', 'config.exp_for_level', 'config.exp_for_message', 'decrease_window' ], 'config': { 'experience': { 'view': 'dropdown', 'choices': ['static', 'geometrical', 'random'] }, 'exp_for_level': { 'view': 'spin', 'min': 0, 'max': 100000 }, 'exp_for_message': { 'view': 'spin', 'min': 0, 'max': 100000 }, 'decrease_window': { 'view': 'spin', 'min': 0, 'max': 100000 } } } config = load_from_config_file(conf_file, conf_dict) self._conf_params.update({ 'folder': conf_folder, 'file': conf_file, 'filename': ''.join(os.path.basename(conf_file).split('.')[:-1]), 'parser': config, 'config': conf_dict, 'gui': conf_gui }) self.conf_folder = None self.experience = None self.exp_for_level = None self.exp_for_message = None self.level_file = None self.levels = None self.special_levels = None self.db_location = None self.decrease_window = None self.threshold_users = None