From 15cabf8ba1b9daa7e28475ea46cc5a8fd478e174 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Thu, 18 Jan 2024 22:45:03 +0100 Subject: Support files in Slack Connect channels Files uploaded in Slack Connect channels doesn't contain any information, so we have to make a request to files.info in order to get the information to render it. See https://api.slack.com/apis/channels-between-orgs#check_file_info for more info. --- slack/slack_api.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'slack/slack_api.py') diff --git a/slack/slack_api.py b/slack/slack_api.py index c54268f..1faf4a2 100644 --- a/slack/slack_api.py +++ b/slack/slack_api.py @@ -29,6 +29,7 @@ if TYPE_CHECKING: from slack_api.slack_conversations_members import SlackConversationsMembersResponse from slack_api.slack_conversations_replies import SlackConversationsRepliesResponse from slack_api.slack_emoji import SlackEmojiListResponse + from slack_api.slack_files_info import SlackFilesInfoResponse from slack_api.slack_profile import SlackSetProfile, SlackUsersProfileSetResponse from slack_api.slack_rtm_connect import SlackRtmConnectResponse from slack_api.slack_team_info import SlackTeamInfoResponse @@ -321,6 +322,14 @@ class SlackApi(SlackApiCommon): raise SlackApiError(self.workspace, method, response) return response + async def fetch_files_info(self, file_id: str): + method = "files.info" + params: Params = {"file": file_id} + response: SlackFilesInfoResponse = await self._fetch(method, params) + if response["ok"] is False: + raise SlackApiError(self.workspace, method, response) + return response + async def fetch_emoji_list(self): method = "emoji.list" response: SlackEmojiListResponse = await self._fetch(method) -- cgit