コード例 #1
0
ファイル: commands.py プロジェクト: Farthen/OTFBot
 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)
コード例 #2
0
 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)
コード例 #3
0
    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)
コード例 #4
0
ファイル: ki.py プロジェクト: otfbot/otfbot
    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)
コード例 #5
0
    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)
コード例 #6
0
ファイル: commands.py プロジェクト: otfbot/otfbot
 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)
コード例 #7
0
ファイル: answers.py プロジェクト: otfbot/otfbot
 def reload(self):
     """
         load the answers from the configured file
     """
     self.answers = functions.loadProperties(self.answersFile)
コード例 #8
0
ファイル: answers.py プロジェクト: allo-/otfbot
 def reload(self):
     """
         load the answers from the configured file
     """
     self.answers = functions.loadProperties(self.answersFile)
コード例 #9
0
ファイル: commands.py プロジェクト: Farthen/OTFBot
 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)