コード例 #1
0
ファイル: Redmine.py プロジェクト: ComicIronic/vgstation13
    def __init__(self, bot):
        IPlugin.__init__(self, bot)

        self.data = {"last-bug-created": 0, "ignored-names": ["/^Not\-[0-9]+/"]}  # Notifico bots

        self.LoadPluginData()

        self.url = globalConfig.get("plugins.redmine.url", None)
        if self.url is None:
            logging.error("Redmine: Disabled.")
            return
        self.ignored = []
        for ignoretok in self.data.get("ignored-names", ["/^Not\-[0-9]/"]):
            if ignoretok.startwith("/") and ignoretok.endwith("/"):
                self.ignored += [re.compile(ignoretok[1:-1])]
            else:
                self.ignored += [re.compile("^" + re.escape(ignoretok) + "$")]
        self.auth = BasicAuth(globalConfig.get("plugins.redmine.apikey", None), str(random.random()))
        self.project_id = globalConfig.get("plugins.redmine.project", None)
        if self.project_id is None:
            logging.warning("Redmine: Not going to check for bug updates.")
        self.bug_info_format = globalConfig.get(
            "plugins.redmine.bug-info-format", "Redmine #{ID} - {AUTHOR} - {STATUS} - {SUBJECT}{CRLF}{URL}"
        )
        self.new_bug_format = globalConfig.get("plugins.redmine.new-bug-format", "NEW ISSUE: {URL} (#{ID}: {SUBJECT})")
        self.resource = Resource(self.url, filters=[self.auth])

        self.bug_regex = re.compile(r"#(\d+)\b")

        self.lastCheck = 0
コード例 #2
0
 def __init__(self, bot):
     IPlugin.__init__(self, bot)
     
     self.data = {
         'last-bug-created': 0,
         'ignored-names': [
             '/^Not\-[0-9]+/' # Notifico bots
         ]
     }
     
     self.LoadPluginData()
     
     self.url = globalConfig.get('plugins.redmine.url', None)
     if self.url is None:
         logging.error('Redmine: Disabled.') 
         return
     self.ignored = []
     for ignoretok in self.data.get('ignored-names',['/^Not\-[0-9]/']):
         if ignoretok.startwith('/') and ignoretok.endwith('/'):
             self.ignored+=[re.compile(ignoretok[1:-1])]
         else:
             self.ignored+=[re.compile('^'+re.escape(ignoretok)+'$')]
     self.auth = BasicAuth(globalConfig.get('plugins.redmine.apikey', None), str(random.random()))
     self.project_id = globalConfig.get('plugins.redmine.project', None)
     if self.project_id is None: logging.warning('Redmine: Not going to check for bug updates.')
     self.bug_info_format = globalConfig.get('plugins.redmine.bug-info-format', 'Redmine #{ID} - {AUTHOR} - {STATUS} - {SUBJECT}{CRLF}{URL}')
     self.new_bug_format = globalConfig.get('plugins.redmine.new-bug-format', 'NEW ISSUE: {URL} (#{ID}: {SUBJECT})')
     self.resource = Resource(self.url, filters=[self.auth])
     
     self.bug_regex = re.compile(r'#(\d+)\b')
     
     self.lastCheck = 0
コード例 #3
0
    def __init__(self, bot):
        IPlugin.__init__(self, bot)

        self.data = None
        self.config = None
        self.url = None
        self.ignored = []
        self.auth = None
        self.project_id = None
        self.resource = None
        self.lastCheck = 0

        self.tree = None
        self.nextTreeDownload = 0

        self.config = globalConfig.get('plugins.github')
        if self.config is None:
            logging.warn('GitHub: Disabled.')
            return

        self.data = {
            'last-bug-created': 0,
            'ignored-names': [
                '/^Not\-[0-9]+/'  # Notifico bots
            ]
        }

        self.LoadPluginData()

        self.url = globalConfig.get('plugins.github.url', None)
        if self.url is None:
            logging.error('GitHub: Disabled.')
            return
        # http://github.com/user/repo
        repodata = self.url[18:]
        if repodata.startswith('/'):
            repodata = repodata[1:]
        repoChunks = repodata.split('/')
        self.user_id = repoChunks[0]
        self.repo_id = repoChunks[1]

        self.ignored = []
        for ignoretok in self.data.get('ignored-names', ['/^Not\-[0-9]/']):
            if ignoretok.startswith('/') and ignoretok.endswith('/'):
                self.ignored += [re.compile(ignoretok[1:-1])]
            else:
                self.ignored += [re.compile('^' + re.escape(ignoretok) + '$')]

        self.bug_info_format = globalConfig.get(
            'plugins.github.bug-info-format',
            'GitHub #{ID}: \'{SUBJECT}\' - {URL} ({STATUS})')

        #auth_user = globalConfig.get('plugins.github.username', None)
        auth_key = globalConfig.get('plugins.github.apikey', None)
        self.github = github3.login(token=auth_key)
        self.repo = self.github.repository(self.user_id, self.repo_id)
        self.default_branch = globalConfig.get('plugins.github.default_branch',
                                               'master')

        self.getTree()
コード例 #4
0
ファイル: GitHub.py プロジェクト: EgorkillerUA/vg
 def __init__(self, bot):
     IPlugin.__init__(self, bot)
     
     self.data=None
     self.config=None
     self.url=None
     self.ignored=[]
     self.auth=None
     self.project_id=None
     self.resource=None
     self.lastCheck=0
     
     self.tree = None
     self.nextTreeDownload=0
     
     self.config = globalConfig.get('plugins.github')
     if self.config is None:
         logging.warn('GitHub: Disabled.') 
         return
     
     self.data = {
         'last-bug-created': 0,
         'ignored-names': [
             '/^Not\-[0-9]+/' # Notifico bots
         ]
     }
     
     self.LoadPluginData()
     
     self.url = globalConfig.get('plugins.github.url', None)
     if self.url is None:
         logging.error('GitHub: Disabled.') 
         return
     # http://github.com/user/repo
     repodata = self.url[18:]
     if repodata.startswith('/'):
         repodata = repodata[1:]
     repoChunks = repodata.split('/')
     self.user_id = repoChunks[0]
     self.repo_id = repoChunks[1]
     
     self.ignored = []
     for ignoretok in self.data.get('ignored-names',['/^Not\-[0-9]/']):
         if ignoretok.startswith('/') and ignoretok.endswith('/'):
             self.ignored+=[re.compile(ignoretok[1:-1])]
         else:
             self.ignored+=[re.compile('^'+re.escape(ignoretok)+'$')]
             
     self.bug_info_format = globalConfig.get('plugins.github.bug-info-format', 'GitHub #{ID}: \'{SUBJECT}\' - {URL} ({STATUS})')
             
     #auth_user = globalConfig.get('plugins.github.username', None)
     auth_key = globalConfig.get('plugins.github.apikey', None)
     self.github = github3.login(token=auth_key)
     self.repo = self.github.repository(self.user_id, self.repo_id)
     self.default_branch = globalConfig.get('plugins.github.default_branch','master')
     
     self.getTree()
コード例 #5
0
ファイル: Redmine.py プロジェクト: Jaketheblake/vgstation13
 def __init__(self, bot):
     IPlugin.__init__(self,bot)
  
     self.url = globalConfig.get('plugins.redmine.url',None)
     if self.url is None:
         logging.error('Redmine: Disabled.') 
         return
     self.auth = BasicAuth(globalConfig.get('plugins.redmine.apikey',None), str(random.random()))
     self.bug_msg_format = globalConfig.get('plugins.redmine.response-format','Redmine #{ID} - {AUTHOR} - {STATUS} - {SUBJECT}{CRLF}{URL}')
     self.resource = Resource(self.url, filters=[self.auth])
     
     self.bug_regex = re.compile(r'#(\d+)\b')
     
     self.bugs_being_fetched=[]
コード例 #6
0
ファイル: Nudge.py プロジェクト: A4Brogan/vgstation13
 def nudge_listener(self):
     import pickle
     nudgeconfig = globalConfig.get('plugins.nudge')
     port = nudgeconfig['port']
     host = nudgeconfig['hostname']
     backlog = 5
     size = 1024
     s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     s.bind((host, port))
     s.listen(backlog)
     while True:
         # Second arg is address.
         client, _ = s.accept()  # Address == "?.?.?.?"
         data = client.recv(size)
         client.close()  # Throw the bum out!
         truedata = pickle.loads(data)
         to = None
         msg = None
         if truedata.get('key', '') != nudgeconfig['key']:
             logging.info('Dropped nudge (BAD KEY): {0}'.format(repr(truedata)))
             continue
         if truedata.get("channel", None) is not None:
             to = truedata["channel"]
         msg = 'AUTOMATIC ANNOUNCEMENT: [{0}] {1}'.format(truedata['id'], truedata["data"])
             
         if self.dropNudges:
             if to == None:
                 to = 'All'
             logging.info('Dropped nudge to {0}: {1}'.format(to, msg))
             continue
         else:
             if to is None:
                 self.bot.sendToAllFlagged('nudges', msg)
             else:
                 self.bot.sendToAllFlagged(to, msg)
コード例 #7
0
ファイル: Tell.py プロジェクト: sucrilhos0/lanstation13
 def SendMessages(self, channel, nick):
     if nick in self.data:
         if len(self.data[nick]) > 0:
             self.bot.privmsg(
                 channel,
                 '{0}, you have {1} messages.  Say "{2}, received" to clear them.'
                 .format(nick, len(self.data[nick]),
                         globalConfig.get('names', ['nt'])[0]))
             for message in self.data[nick]:
                 self.bot.privmsg(channel,
                                  '{from}: {message}'.format(**message))
コード例 #8
0
ファイル: bot.py プロジェクト: Jaketheblake/vgstation13
 def on_pubmsg(self, c, msg):
     #logging.info(msg.source)
     logging.info('PUBMSG: <{0}:{1}> {2}'.format(msg.source.nick, msg.target, msg.arguments[0]))
     if ',' in msg.arguments[0]:
         args = msg.arguments[0].split(',', 1)
         logging.debug(repr(args))
         if len(args) > 1 and args[0] in globalConfig.get('names', []):
             self.do_command(msg, args[1].strip())
     else:
         for plugin in self.plugins:
             if plugin.OnChannelMessage(c, msg): break
     return
コード例 #9
0
ファイル: Redmine.py プロジェクト: str4t0s/vgstation13
 def __init__(self, bot):
     IPlugin.__init__(self, bot)
     
     self.data = {
         'last-bug-created': 0
     }
     
     self.LoadPluginData()
     
     self.url = globalConfig.get('plugins.redmine.url', None)
     if self.url is None:
         logging.error('Redmine: Disabled.') 
         return
     self.auth = BasicAuth(globalConfig.get('plugins.redmine.apikey', None), str(random.random()))
     self.project_id = globalConfig.get('plugins.redmine.project', None)
     if self.project_id is None: logging.warning('Redmine: Not going to check for bug updates.')
     self.bug_info_format = globalConfig.get('plugins.redmine.bug-info-format', 'Redmine #{ID} - {AUTHOR} - {STATUS} - {SUBJECT}{CRLF}{URL}')
     self.new_bug_format = globalConfig.get('plugins.redmine.new-bug-format', 'NEW ISSUE: {URL} (#{ID}: {SUBJECT})')
     self.resource = Resource(self.url, filters=[self.auth])
     
     self.bug_regex = re.compile(r'#(\d+)\b')
     
     self.lastCheck = 0
コード例 #10
0
ファイル: Nudge.py プロジェクト: A4Brogan/vgstation13
 def __init__(self, bot):
     IPlugin.__init__(self, bot)
     
     self.RegisterCommand('shaddap', self.OnShaddap, help='Bot will stop processing nudges.')
     self.RegisterCommand('speak', self.OnSpeak, help='Bot will start processing nudges.')
     
     self.dropNudges = False
     
     self.config = globalConfig.get('plugins.nudge')
     if self.config is None:
         logging.warning('plugin.nudge not present in config.  Aborting load.')
         return
     
     thread.start_new_thread(self.nudge_listener, ())
コード例 #11
0
ファイル: MediaWiki.py プロジェクト: EgorkillerUA/vg
 def __init__(self, bot):
     IPlugin.__init__(self, bot)
     
     self.data = None
     self.config = None
     self.url = 'http://tgstation13.org/wiki/'
     
     self.config = globalConfig.get('plugins.mediawiki')
     if self.config is None:
         logging.warn('MediaWiki: Disabled.') 
         return
     
     if 'url' in self.config:
         self.url = self.config['url']
コード例 #12
0
    def __init__(self, bot):
        IPlugin.__init__(self, bot)

        self.data = None
        self.config = None
        self.url = 'http://tgstation13.org/wiki/'

        self.config = globalConfig.get('plugins.mediawiki')
        if self.config is None:
            logging.warn('MediaWiki: Disabled.')
            return

        if 'url' in self.config:
            self.url = self.config['url']
コード例 #13
0
ファイル: Redmine.py プロジェクト: Aranclanos/Baystation12
    def __init__(self, bot):
        IPlugin.__init__(self, bot)

        self.data = {"last-bug-created": 0}

        self.LoadPluginData()

        self.url = globalConfig.get("plugins.redmine.url", None)
        if self.url is None:
            logging.error("Redmine: Disabled.")
            return
        self.auth = BasicAuth(globalConfig.get("plugins.redmine.apikey", None), str(random.random()))
        self.project_id = globalConfig.get("plugins.redmine.project", None)
        if self.project_id is None:
            logging.warning("Redmine: Not going to check for bug updates.")
        self.bug_info_format = globalConfig.get(
            "plugins.redmine.bug-info-format", "Redmine #{ID} - {AUTHOR} - {STATUS} - {SUBJECT}{CRLF}{URL}"
        )
        self.new_bug_format = globalConfig.get("plugins.redmine.new-bug-format", "NEW ISSUE: {URL} (#{ID}: {SUBJECT})")
        self.resource = Resource(self.url, filters=[self.auth])

        self.bug_regex = re.compile(r"#(\d+)\b")

        self.lastCheck = 0
コード例 #14
0
ファイル: bot.py プロジェクト: sucrilhos0/lanstation13
 def on_pubmsg(self, c, e):
     # logging.info(msg.source)
     msg = e.arguments[0]
     msg = self.stripUnprintable(msg)
     logging.info('PUBMSG: <{0}:{1}> {2}'.format(e.source.nick, e.target,
                                                 msg))
     if ',' in msg:
         args = msg.split(',', 1)
         logging.debug(repr(args))
         if len(args) > 1 and args[0] in globalConfig.get('names', []):
             self.do_command(e, args[1].strip())
     else:
         for plugin in self.plugins:
             if plugin.OnChannelMessage(c, e): break
     return
コード例 #15
0
ファイル: Nudge.py プロジェクト: sucrilhos0/lanstation13
    def __init__(self, bot):
        IPlugin.__init__(self, bot)

        self.RegisterCommand('shaddap',
                             self.OnShaddap,
                             help='Bot will stop processing nudges.')
        self.RegisterCommand('speak',
                             self.OnSpeak,
                             help='Bot will start processing nudges.')

        self.dropNudges = False

        self.config = globalConfig.get('plugins.nudge')
        if self.config is None:
            logging.warning(
                'plugin.nudge not present in config.  Aborting load.')
            return

        thread.start_new_thread(self.nudge_listener, ())
コード例 #16
0
ファイル: Redmine.py プロジェクト: A4Brogan/vgstation13
 def __init__(self, bot):
     IPlugin.__init__(self, bot)
     
     self.data=None
     self.config=None
     self.url=None
     self.ignored=[]
     self.auth=None
     self.project_id=None
     self.resource=None
     self.lastCheck=0
     
     self.config = globalConfig.get('plugins.redmine')
     if self.config is None:
         logging.error('Redmine: Disabled.') 
         return
     
     self.data = {
         'last-bug-created': 0,
         'ignored-names': [
             '/^Not\-[0-9]+/' # Notifico bots
         ]
     }
     
     self.LoadPluginData()
     
     self.url = globalConfig.get('plugins.redmine.url', None)
     if self.url is None:
         logging.error('Redmine: Disabled.') 
         
         return
     self.ignored = []
     for ignoretok in self.data.get('ignored-names',['/^Not\-[0-9]/']):
         if ignoretok.startwith('/') and ignoretok.endwith('/'):
             self.ignored+=[re.compile(ignoretok[1:-1])]
         else:
             self.ignored+=[re.compile('^'+re.escape(ignoretok)+'$')]
     self.auth = BasicAuth(globalConfig.get('plugins.redmine.apikey', None), str(random.random()))
     self.project_id = globalConfig.get('plugins.redmine.project', None)
     if self.project_id is None: logging.warning('Redmine: Not going to check for bug updates.')
     self.bug_info_format = globalConfig.get('plugins.redmine.bug-info-format', 'Redmine #{ID} - {AUTHOR} - {STATUS} - {SUBJECT}{CRLF}{URL}')
     self.new_bug_format = globalConfig.get('plugins.redmine.new-bug-format', 'NEW ISSUE: {URL} (#{ID}: {SUBJECT})')
     self.resource = Resource(self.url, filters=[self.auth])
     
     self.bug_regex = re.compile(r'#(\d+)\b')
     
     self.lastCheck = 0
コード例 #17
0
ファイル: Nudge.py プロジェクト: sucrilhos0/lanstation13
    def nudge_listener(self):
        import pickle
        nudgeconfig = globalConfig.get('plugins.nudge')
        port = nudgeconfig['port']
        host = nudgeconfig['hostname']
        backlog = 5
        size = 1024
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.bind((host, port))
        s.listen(backlog)
        while True:
            # Second arg is address.
            client, _ = s.accept()  # Address == "?.?.?.?"
            data = client.recv(size)
            client.close()  # Throw the bum out!
            truedata = pickle.loads(data)
            to = None
            msg = None
            if truedata.get('key', '') != nudgeconfig['key']:
                logging.info('Dropped nudge (BAD KEY): {0}'.format(
                    repr(truedata)))
                continue
            if truedata.get("channel", None) is not None:
                to = truedata["channel"]
            msg = 'AUTOMATIC ANNOUNCEMENT: [{0}] {1}'.format(
                truedata['id'], truedata["data"])

            if self.dropNudges:
                if to == None:
                    to = 'All'
                logging.info('Dropped nudge to {0}: {1}'.format(to, msg))
                continue
            else:
                if to is None:
                    self.bot.sendToAllFlagged('nudges', msg)
                else:
                    self.bot.sendToAllFlagged(to, msg)
コード例 #18
0
ファイル: Tell.py プロジェクト: A4Brogan/vgstation13
 def SendMessages(self,channel,nick):
     if nick in self.data:
         if len(self.data[nick]) > 0:
             self.bot.privmsg(channel, '{0}, you have {1} messages.  Say "{2}, received" to clear them.'.format(nick, len(self.data[nick]), globalConfig.get('names', ['nt'])[0]))
             for message in self.data[nick]:
                 self.bot.privmsg(channel, '{from}: {message}'.format(**message))