aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_user.py
blob: 18c897ffffb6591c2cbb8e34b49e14837bb8844c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from slack.slack_workspace import SlackApi, SlackWorkspace


class SlackUser:
    def __init__(self, workspace: SlackWorkspace, id: str):
        self.workspace = workspace
        self.id = id
        self.name: str

    @property
    def api(self) -> SlackApi:
        return self.workspace.api

    async def init(self):
        info = await self.api.fetch_users_info(self)
        self.name = info["user"]["name"]