def __init__(self, bot): desc = _(u"Pipo does not like trolls.") ListenModule.__init__(self, bot, name='troll', desc=desc) config = ListConfigParser() config.read(self.config_path) self.words = [w.lower() for w in config.get('trolls', 'words')] self.friday = config.get('trolls', 'friday') self.others = config.get('trolls', 'others')
def readconf(self): config_file = os.path.join(os.path.dirname(__file__), 'kaamelott.cfg') names = {} self.dico = {} config = ListConfigParser() config.read(config_file) self.genericCmd = config.sections() for c in self.genericCmd: command_name = c.decode("utf-8") self.dico[command_name] = {} self.dico[command_name]['desc'] = config.get(c, 'desc') quote = config.get(c, 'citation') self.dico[command_name]['citation'] = quote if type(quote) is list else [config.get(c, 'citation')] names[command_name] = self.dico[command_name]['desc'] return names
def readconf(self, bot): # name, description and actions associated to each command self.dico = {} # To initialize MultiSyncModule names = {} config = ListConfigParser() config.read(self.config_path) for c in config.sections(): command_name = c.decode("utf-8") self.dico[command_name] = {} self.dico[command_name]['desc'] = config.get(c, 'desc') names[command_name] = self.dico[command_name]['desc'] if type(config.get(c, 'toNobody')) == list: self.dico[command_name]['toNobody'] = config.get(c, 'toNobody') else: self.dico[command_name]['toNobody'] = [config.get(c, 'toNobody')] self.extract_to(config, c, "toSender", "toNobody") self.extract_to(config, c, "toBot", "toNobody") self.extract_to(config, c, "toSomebody", "toNobody") return names
def readconf(self): config_file = os.path.join(os.path.dirname(__file__), 'kaamelott.cfg') names = {} self.dico = {} config = ListConfigParser() config.read(config_file) self.genericCmd = config.sections() for c in self.genericCmd: self.dico[c] = {} self.dico[c]['desc'] = config.get(c, 'desc') quote = config.get(c, 'citation') self.dico[c]['citation'] = quote if type(quote) is list else [config.get(c, 'citation')] names[c] = self.dico[c]['desc'] return names