From 2e64309e8094fe7409a0d97d32dfe8d35fed689c Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sat, 14 Jan 2023 12:38:25 +0100 Subject: Add typings for users.conversations --- slack/slack_api.py | 3 ++- slack/slack_workspace.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'slack') diff --git a/slack/slack_api.py b/slack/slack_api.py index 4d8df43..aeaf6be 100644 --- a/slack/slack_api.py +++ b/slack/slack_api.py @@ -9,6 +9,7 @@ from slack.shared import shared if TYPE_CHECKING: from slack_api.slack_conversations_info import SlackConversationsInfoResponse + from slack_api.slack_users_conversations import SlackUsersConversationsResponse from slack.slack_conversation import SlackConversation from slack.slack_user import SlackUser @@ -65,7 +66,7 @@ class SlackApi: exclude_archived: bool = True, limit: int = 1000, pages: int = -1, - ) -> Any: + ) -> SlackUsersConversationsResponse: return await self._fetch_list( "users.conversations", "channels", diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py index 72ffc7d..e659eba 100644 --- a/slack/slack_workspace.py +++ b/slack/slack_workspace.py @@ -42,6 +42,10 @@ class SlackWorkspace: user_channels_response = await self.api.fetch_users_conversations( "public_channel" ) + if user_channels_response["ok"] is False: + # TODO: Handle error + return + user_channels = user_channels_response["channels"] for channel in user_channels: -- cgit