コード例 #1
0
ファイル: commands.py プロジェクト: Eijebong/BeetleBot
def cmd_rm_project(self, project, room, sender):
    """ Usage: !remove_project project_name room """
    from bot import _save_config, cnf
    for b in self.bots:
        if b.room == room and b.api.project_name == project:
            b.disconnect()
            break
    else:
        return "Project not found"
    del cnf['rooms'][room][project]
    _save_config()
    return "Ok"
コード例 #2
0
ファイル: commands.py プロジェクト: Eijebong/BeetleBot
def cmd_add_project(self, project, branches, room, sender):
    """ Usage: !add_project project_name branches room """
    from bot import Bot, _save_config, cnf
    try:
        self.apis[project] = api.GitlabAPI(cnf['gitlab']['base_url'], cnf['gitlab']['main_key'], cnf['keys'], project, branches, use_cache=False)
    except api.ProjectNotFound:
        return "Project not found"
    self.bots.append(Bot(room, project.split('/')[1], self.apis[project]))
    self.bots[-1].apis = self.apis
    self.bots[-1].bots = self.bots
    self.bots[-1].start()
    if room not in cnf['rooms']:
        cnf['rooms'][room] = {}
    cnf['rooms'][room][project] = [branches]
    _save_config()