diff --git a/slack/__init__.py b/slack/__init__.py index f8305f3..7dd929b 100644 --- a/slack/__init__.py +++ b/slack/__init__.py @@ -11,6 +11,7 @@ os.chdir(os.path.dirname(path)) from . import api from . import auth from . import channels +from . import users # @@ -25,7 +26,11 @@ __auth = auth.test() if __auth == None: sys.exit(1) __TEAM = __auth["team"] +__USER = users.info(__auth["user_id"]) def team(): return __TEAM + +def user(): + return __USER diff --git a/slack/users.py b/slack/users.py index 285d80e..12389ea 100644 --- a/slack/users.py +++ b/slack/users.py @@ -12,12 +12,16 @@ class User: self.__user = json.get("name", "") self.__first = json["profile"].get("first_name", "") self.__last = json["profile"].get("last_name", "") + self.__email = json["profile"].get("email", "") def name(self): if self.__first == "" and self.__last == "": return self.__user return ("%s %s" % (self.__first, self.__last)).strip() + def email(self): + return self.__email + def info(user):