diff options
Diffstat (limited to 'slack/slack_user.py')
-rw-r--r-- | slack/slack_user.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/slack/slack_user.py b/slack/slack_user.py index 4386657..8fcd445 100644 --- a/slack/slack_user.py +++ b/slack/slack_user.py @@ -10,15 +10,18 @@ class SlackUser: def __init__(self, workspace: SlackWorkspace, id: str): self.workspace = workspace self.id = id - self.name: str @property - def api(self) -> SlackApi: + def _api(self) -> SlackApi: return self.workspace.api + @property + def nick(self): + return self._info["name"] + async def init(self): - info = await self.api.fetch_users_info(self) + info = await self._api.fetch_users_info(self) if info["ok"] is False: # TODO: Handle error raise Exception("Failed fetching user info") - self.name = info["user"]["name"] + self._info = info["user"] |