Example #1
0
    def configure(self):
        if self.pluginPath:
            p = os.path.abspath(STR2SYSTEMSTR(self.pluginPath))
            if p not in sys.path:
                sys.path.insert(0, p)

        SetLogLevel(self.debug and 'DEBUG' or 'INFO')
Example #2
0
    def configure(self):
        p = self.absPath('plugins')
        if not os.path.exists(p):
            try:
                os.mkdir(p)
            except:
                pass

        if os.path.isdir(p):
            if p not in sys.path:
                sys.path.insert(0, p)
            self.pluginPath1 = SYSTEMSTR2STR(p)
        else:
            self.pluginPath1 = None

        if self.pluginPath:
            p = os.path.abspath(STR2SYSTEMSTR(self.pluginPath))
            if p not in sys.path:
                sys.path.insert(0, p)
            self.pluginPath = SYSTEMSTR2STR(p)

        try:
            import qqbotdefault as q
        except ImportError:
            pass
        else:
            for x, name, y in pkgutil.iter_modules(q.__path__,
                                                   q.__name__ + '.'):
                self.plugins.append(name)

        SetLogLevel(self.debug and 'DEBUG' or 'INFO')
Example #3
0
    def configure(self):
        if self.pluginPath:
            self.pluginPath = os.path.abspath(self.pluginPath)
            if self.pluginPath not in sys.path:
                sys.path.insert(0, self.pluginPath)

        SetLogLevel(self.debug and 'DEBUG' or 'INFO')
Example #4
0
    def configure(self):
        if self.pluginPath:
            self.pluginPath = os.path.abspath(self.pluginPath)
            if self.pluginPath not in sys.path:
                sys.path.insert(0, self.pluginPath)

        if 0 <= self.fetchInterval < 600:
            self.fetchInterval = 600

        SetLogLevel(self.debug and 'DEBUG' or 'INFO')
Example #5
0
    def configure(self):
        p = self.absPath('plugins')
        if not os.path.exists(p):
            try:
                os.mkdir(p)
            except:
                pass

        if os.path.isdir(p):
            if p not in sys.path:
                sys.path.insert(0, p)
            self.pluginPath1 = SYSTEMSTR2STR(p)
        else:
            self.pluginPath1 = None

        if self.pluginPath:
            p = os.path.abspath(STR2SYSTEMSTR(self.pluginPath))
            if p not in sys.path:
                sys.path.insert(0, p)
            self.pluginPath = STR2SYSTEMSTR(p)

        SetLogLevel(self.debug and 'DEBUG' or 'INFO')
Example #6
0
 def configure(self):
     if 0 <= self.fetchInterval < 60:
         self.fetchInterval = 60
     SetLogLevel(self.debug and 'DEBUG' or 'INFO')
Example #7
0
 def configure(self):
     SetLogLevel(self.debug and 'DEBUG' or 'INFO')
Example #8
0
            name = '#' + name
        elif contact.ctype == 'discuss':
            name = '#!' + name
        nick = name
        i = 1
        while nick in self.nicks:
            nick = name + str(i)
            i += 1
        self.nicks[nick] = contact
        contact.__dict__['nick'] = nick
        if contact.ctype in ('group', 'discuss'):
            contact.__dict__['membNicks'] = set()

    def get(self, nick=None, uin=None):
        if nick is not None:
            return self.nicks.get(nick, None)
        else:
            return self.uins.get(uin, None)

    @property
    def nicknames(self):
        return list(self.nicks.keys())


if __name__ == '__main__':
    from qqbot.utf8logger import SetLogLevel
    SetLogLevel('debug')
    from qqbot.mainloop import MainLoop
    StartDaemonThread(IRCServer('127.0.0.1', 6667).Run)
    MainLoop()
Example #9
0
        name = removeSpecial(contact.name)
        if contact.ctype == 'group':
            name = '#' + name
        elif contact.ctype == 'discuss':
            name = '#!' + name
        nick = name
        i = 1
        while nick in self.nicks:
            nick = name + str(i)
            i += 1
        self.nicks[nick] = contact
        contact.__dict__['nick'] = nick
        if contact.ctype in ('group', 'discuss'):
            contact.__dict__['membNicks'] = set()
    
    def get(self, nick=None, uin=None):
        if nick is not None:
            return self.nicks.get(nick, None)
        else:
            return self.uins.get(uin, None)
    
    @property
    def nicknames(self):
        return list(self.nicks.keys())

if __name__ == '__main__':
    from qqbot.utf8logger import SetLogLevel; SetLogLevel('debug')
    from qqbot.mainloop import MainLoop
    StartDaemonThread(IRCServer('127.0.0.1', 6667).Run)
    MainLoop()