# # Copyright 2015 (c) Anna Schumaker # import sys import os path = os.path.realpath(sys.argv[0]) os.chdir(os.path.dirname(path)) from . import api from . import auth from . import channels from . import groups from . import im from . import users # # Verify connection and setup team information. # if api.test() == False: print("Connection error, cannot continue.") sys.exit(1) __auth = auth.test() if __auth == None: sys.exit(1) __TEAM = __auth["team"] __URL = __auth["url"].rstrip("/") __USER = users.info(__auth["user_id"]) def team(): return __TEAM def url(): return __URL def user(): return __USER def find_thread(thread_id): for c in channels.list(): if c.id() == thread_id: return c for g in groups.list(): if g.id() == thread_id: return g for i in im.list(): if i.id() == thread_id: return i return None