Exemplo n.º 1
0
def remove_handler(state, value):
    repo = get_repo(value.text)
    if repo:
        conf = get_chat_conf(value.chat_id, module_name, default_options)
        watch_list = set(conf['watch_list'])
        if repo in watch_list:
            watch_list.remove(repo)
            set_chat_conf(value.chat_id, module_name, watch_list=list(watch_list))
            return Response(text='Deleted.')
        else:
            return Response(text='Repository not in watchlist.')
    else:
        return Response(text=error_msg)
Exemplo n.º 2
0
def add_handler(state, value):
    repo = get_repo(value.text)
    if repo:
        conf = get_chat_conf(value.chat_id, module_name, default_options)
        watch_list = list(conf['watch_list'])
        watch_list.append(repo)
        set_chat_conf(value.chat_id, module_name, watch_list=watch_list)

        msg = ('I will notify about all pull requests in %s repository'
               % '/'.join(repo))

        return Response(text=msg)
    else:
        return Response(text=error_msg, next=add_handler)