From 5b15729e8bce1a951b741e3e983d14fd7913f879 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sun, 15 Jan 2023 21:19:58 +0100 Subject: Use setter instead of __setattr__ for is_connected --- slack/slack_workspace.py | 13 ++++++++----- 1 file 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() -- cgit