aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_api.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2024-01-18 22:45:03 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 12:56:59 +0100
commit15cabf8ba1b9daa7e28475ea46cc5a8fd478e174 (patch)
treef65e557a115b0f83d13cb6d4b9943ddbd273268c /slack/slack_api.py
parentbb80ee68763233930a6f4169b07a029cd99b589d (diff)
downloadwee-slack-15cabf8ba1b9daa7e28475ea46cc5a8fd478e174.tar.gz
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.
Diffstat (limited to 'slack/slack_api.py')
-rw-r--r--slack/slack_api.py9
1 files changed, 9 insertions, 0 deletions
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)