diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-01-15 01:59:30 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | 38d2e4154b31d1a95084c53eabf09af03c323a19 (patch) | |
tree | c03f4f332c1a8cded22aae9af05847f9a8a065b0 /slack/slack_workspace.py | |
parent | 9ad8757ab557995a049736ca784b770ce95e377b (diff) | |
download | wee-slack-38d2e4154b31d1a95084c53eabf09af03c323a19.tar.gz |
Auto update input bar item when is_connected changes
Diffstat (limited to 'slack/slack_workspace.py')
-rw-r--r-- | slack/slack_workspace.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py index 87861c8..4e18634 100644 --- a/slack/slack_workspace.py +++ b/slack/slack_workspace.py @@ -42,6 +42,12 @@ class SlackWorkspace: self.users = SlackUsers(self) self.conversations: Dict[str, SlackConversation] = {} + def __setattr__(self, __name: str, __value: Any) -> None: + super().__setattr__(__name, __value) + + if __name == "is_connected": + weechat.bar_item_update("input_text") + async def connect(self): rtm_connect = await self.api.fetch_rtm_connect() if rtm_connect["ok"] is False: @@ -68,10 +74,7 @@ class SlackWorkspace: self.conversations[channel["id"]] = conversation create_task(conversation.init()) - # print(rtm_connect) - # print([c["name"] for c in user_channels]) self.is_connected = True - weechat.bar_item_update("input_text") async def connect_ws(self, url: str): sslopt_ca_certs = {} |