diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-01-15 21:19:58 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | 5b15729e8bce1a951b741e3e983d14fd7913f879 (patch) | |
tree | 3b8dd5d6bdb3e4d382120e910f5bab108bce0efb | |
parent | 432d7ffdaf701df556a6d4e45b8e0b75bd887597 (diff) | |
download | wee-slack-5b15729e8bce1a951b741e3e983d14fd7913f879.tar.gz |
Use setter instead of __setattr__ for is_connected
-rw-r--r-- | slack/slack_workspace.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py index f2eedb0..77c9e46 100644 --- a/slack/slack_workspace.py +++ b/slack/slack_workspace.py @@ -41,16 +41,19 @@ class SlackWorkspace: self.name = name self.config = shared.config.create_workspace_config(self.name) self.api = SlackApi(self) - self.is_connected = False + self._is_connected = False self.users = SlackUsersOrBots(self, SlackUser) self.bots = SlackUsersOrBots(self, SlackBot) self.conversations: Dict[str, SlackConversation] = {} - def __setattr__(self, __name: str, __value: Any) -> None: - super().__setattr__(__name, __value) + @property + def is_connected(self): + return self._is_connected - if __name == "is_connected": - weechat.bar_item_update("input_text") + @is_connected.setter + def is_connected(self, value: bool): + self._is_connected = value + weechat.bar_item_update("input_text") async def connect(self): rtm_connect = await self.api.fetch_rtm_connect() |