aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_workspace.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-08-26 22:50:30 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commit6722517e91c19cc7c1d39335a1b64020ac7c0b9b (patch)
treeacf1b38f7b31692dc2d8d76dada08e14af53dd0e /slack/slack_workspace.py
parentfe5bc258fdef24fb063305080a309336244dbfb2 (diff)
downloadwee-slack-6722517e91c19cc7c1d39335a1b64020ac7c0b9b.tar.gz
Fetch usergroups at startup if edgeapi isn't available
Diffstat (limited to 'slack/slack_workspace.py')
-rw-r--r--slack/slack_workspace.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py
index d659317..a570658 100644
--- a/slack/slack_workspace.py
+++ b/slack/slack_workspace.py
@@ -216,6 +216,13 @@ class SlackWorkspace:
await self._connect_ws(rtm_connect["url"])
+ if not self.api.edgeapi.is_available:
+ usergroups = await self.api.fetch_usergroups_list()
+ for usergroup in usergroups["usergroups"]:
+ future = Future[SlackUsergroup]()
+ future.set_result(SlackUsergroup(self, usergroup))
+ self.usergroups[usergroup["id"]] = future
+
users_conversations_response = await self.api.fetch_users_conversations(
"public_channel,private_channel,mpim,im"
)