def start(self): self.register_ctl_command(self.reload) self.commands = {} file = self.bot.config.getPath("file", datadir, "commands.txt", "commands") self.commands["general"] = functions.loadProperties(file, True) file = self.bot.config.getPath("file", datadir, "commands.txt", "commands", self.bot.network) self.commands["network"] = functions.loadProperties(file, True) for chan in self.bot.channels: self.joined(chan)
def joined(self, channel): filename = self.bot.config.getPath("file", datadir, "commands.txt", "commands", self.bot.network, channel) enc = self.bot.config.get("fileencoding", "iso-8859-15", "commands", self.bot.network, channel) self.commands[channel] = functions.loadProperties(filename, True, enc)
def start(self): self.register_ctl_command(self.reload) self.commands = {} enc = self.bot.config.get("fileencoding", "iso-8859-15", "commands") file = self.bot.config.getPath("file", datadir, "commands.txt", "commands") self.commands["general"] = functions.loadProperties(file, True, enc) enc = self.bot.config.get("fileencoding", "iso-8859-15", "commands", self.bot.network) file = self.bot.config.getPath("file", datadir, "commands.txt", "commands", self.bot.network) self.commands["network"] = \ functions.loadProperties(file, True, enc) for chan in self.bot.channels: self.joined(chan)
def start(self): self.channels = [] self.wordpairsFile = self.bot.config.getPath("wordpairsFile", datadir, "wordpairs.txt") self.wordpairs = functions.loadProperties(self.wordpairsFile, self.bot.config.get("wordpairsEncoding", "UTF-8", "ki", self.bot.network) ) #TODO: use self.bot.user_list self.nicklist = [string.lower(self.bot.nickname)] module = self.bot.config.get("module", "megahal", "ki", self.bot.network) self.logger.debug("ki: using module " + module + ",megahal=" + str(MEGAHAL) + ",niall=" + str(NIALL)) if module == "niall": if NIALL: self.responder = niallResponder(self.bot, datadir) self.logger.info("ki: using niall module") else: self.logger.warning("Cannot use niall. Module niall not availible.") if MEGAHAL: self.logger.info("Using Megahal instead") self.responder = megahalResponder(self.bot) else: self.logger.info("Using no KI.") self.responder = responder() #null responder elif module == "megahal": if MEGAHAL: self.responder = megahalResponder(self.bot) else: self.logger.warning("Cannot use megahal. Module mh_python not availible.") self.responder = responder() #null responder #Fallback if NIALL: self.logger.warning("Trying niall instead.") self.responder = niallResponder(self.bot, datadir) elif module == "web": self.responder = webResponder(self.bot) elif module == "udp": self.responder = udpResponder(self.bot) elif module == "eliza": self.responder = elizaResponder(self.bot, datadir) atexit.register(self.responder.cleanup)
def start(self): self.channels = [] self.wordpairsFile = self.bot.config.getPath("wordpairsFile", datadir, "wordpairs.txt") self.wordpairs = functions.loadProperties(self.wordpairsFile, self.bot.config.get("wordpairsEncoding", "UTF-8", "ki", self.bot.network) ) #TODO: use self.bot.user_list self.nicklist = [self.bot.nickname.lower()] module = self.bot.config.get("module", "megahal", "ki", self.bot.network) self.logger.debug("ki: using module " + module + ",megahal=" + str(MEGAHAL) + ",niall=" + str(NIALL)) if module == "niall": if NIALL: self.responder = niallResponder(self.bot, datadir) self.logger.info("ki: using niall module") else: self.logger.warning("Cannot use niall. Module niall not availible.") if MEGAHAL: self.logger.info("Using Megahal instead") self.responder = megahalResponder(self.bot) else: self.logger.info("Using no KI.") self.responder = responder() #null responder elif module == "megahal": if MEGAHAL: self.responder = megahalResponder(self.bot) else: self.logger.warning("Cannot use megahal. Module mh_python not availible.") self.responder = responder() #null responder #Fallback if NIALL: self.logger.warning("Trying niall instead.") self.responder = niallResponder(self.bot, datadir) elif module == "web": self.responder = webResponder(self.bot) elif module == "udp": self.responder = udpResponder(self.bot) elif module == "eliza": self.responder = elizaResponder(self.bot, datadir) atexit.register(self.responder.cleanup)
def reload(self): """ load the answers from the configured file """ self.answers = functions.loadProperties(self.answersFile)
def joined(self, channel): filename = self.bot.config.getPath("file", datadir, "commands.txt", "commands", self.bot.network, channel) self.commands[channel] = functions.loadProperties(filename, True)