예제 #1
0
파일: Quotes.py 프로젝트: olasd/pythagore
    def __init__(self, pythagore):
        PythagoreModule.__init__(self, pythagore)
        # export commands (keywords)
        self.exports['addquote'] = "addQuote"
        self.exports['delquote'] = "removeQuote"
        self.exports['lastquote'] = "lastQuote"
        self.exports['quoteinfo'] = "quoteInfo"
        self.exports['quote'] = "getQuote"
        self.exports['randquote'] = "randomQuote"
        self.exports['findquote'] = "searchQuote"

        self.qtable = sa.Table(self.config["qtable"], self.bot.metadata,
            sa.Column('qid', sa.Integer, primary_key=True),
            sa.Column('content', sa.Unicode(400)),
            sa.Column('author', sa.String(60)),
            sa.Column('cid', sa.Integer, sa.ForeignKey('%s.cid' % self.bot.conf["table_names"]["channels"])),
            sa.Column('timestamp', sa.DateTime, default=datetime.datetime.now),
            sa.Column('deleted', sa.Boolean, default=False))

        sao.mapper(Quote, self.qtable, properties={
            'channel': sao.relation(Channel),
            })

        try:
            self.config['minWordsInQuotes']
        except KeyError:
            self.config['minWordsInQuotes'] = 1
예제 #2
0
파일: RSS.py 프로젝트: olasd/pythagore
    def __init__(self, pythagore):
        PythagoreModule.__init__(self, pythagore)
        self.exports['addrss'] = "addRSS"
        self.exports['delrss'] = "deleteRSS"
        self.exports['enablefeed'] = "enableFeed"
        self.exports['disablefeed'] = "disableFeed"
        self.exports['listrss'] = "listFeeds"
        self.cacheFile = ""


        # SQLAlchemy : description of tables
        self.ftable = sa.Table(self.config["feeds_table"], self.bot.metadata, autoload=True)
        # FIXME : necessary to redescribe in details ?
        #    sa.Column('fid', sa.Integer, primary_key=True),
        #    sa.Column('name', sa.Unicode(60)),
        #    sa.Column('url', sa.Unicode(2000)))
        self.sel_ftable = sa.Table(self.config["selected_feeds_table"], self.bot.metadata, autoload=True)

        sao.mapper(Feed, self.ftable, properties={
            'channels' : sao.relation(Channel, secondary=self.sel_ftable, backref='feeds')
        })

        try: self.config['modes2Admin']
        except: self.config['modes2Admin'] = 'qao'
        try: self.cacheDir = self.config['cacheDir']
        except: self.cacheDir = self.config['cacheDir'] = '.'
        if os.path.exists(self.cacheDir) is None:
            os.mkdir(cacheDir)
        try: self.interval = self.config['time_interval']
        except: self.interval = 10*60

        #Starts the reactor which processes feeds each self.interval seconds
        main(self.cacheDir, self.ftable, self.sel_ftable, self.bot, self.interval)
예제 #3
0
파일: Admin.py 프로젝트: olasd/pythagore
 def __init__(self, pythagore):
     PythagoreModule.__init__(self, pythagore)
     self.exports['loadmodule'] = "loadModule"
     self.exports['unloadmodule'] = "unloadModule"
     self.exports['die'] = "die"
     self.exports['addchannel'] = "addChannel"
     self.exports['enablechannel'] = "enableChannel"
     self.exports['enable'] = "enableModule"
     self.exports['disable'] = "disableModule"
예제 #4
0
파일: Uptime.py 프로젝트: olasd/pythagore
 def __init__(self, pythagore):
     PythagoreModule.__init__(self, pythagore)
     self.exports['uptime'] = 'uptime'
     self.creat_t = time()
예제 #5
0
파일: Sample.py 프로젝트: olasd/pythagore
 def __init__(self, pythagore):
     PythagoreModule.__init__(self, pythagore)
     self.exports['firstmethod'] = "firstMethod"
     self.exports['secondmethod'] = "secondMethod"
예제 #6
0
파일: Logger.py 프로젝트: olasd/pythagore
 def __init__(self, pythagore):
     PythagoreModule.__init__(self, pythagore)
     self.conf = pythagore.conf
     self.chans = {}
예제 #7
0
파일: ShortURL.py 프로젝트: olasd/pythagore
 def __init__(self, pythagore):
     PythagoreModule.__init__(self, pythagore)
     self.exports['short'] = "shorturl"
예제 #8
0
 def __init__(self, pythagore):
     PythagoreModule.__init__(self, pythagore)
     self.pattern = re.compile(
         r'"GsearchResultClass":"GwebSearch","unescapedUrl":"(?P<unescapedUrl>.*?)","url":"(?P<url>.*?)","visibleUrl":"(?P<visibleUrl>.*?)","cacheUrl":"(?P<cacheUrl>.*?)","title":"(?P<title>.*?)","titleNoFormatting":"(?P<titleNoFormatting>.*?)","content":"(?P<content>.*?)"}'
     )
     self.exports = {"google": "googlequery"}