From a7b617b886c3f56165a5aeb27631520a6e6e5d96 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sat, 14 Jan 2023 07:51:59 +0100 Subject: Create functions for fetch requests --- slack/slack_conversation.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'slack/slack_conversation.py') diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py index f616eb9..e92ddcf 100644 --- a/slack/slack_conversation.py +++ b/slack/slack_conversation.py @@ -12,8 +12,6 @@ from slack.task import gather from slack.util import get_callback_name if TYPE_CHECKING: - from slack_api import SlackConversationInfoResponse - from slack.slack_api import SlackApi from slack.slack_workspace import SlackWorkspace @@ -60,7 +58,7 @@ class SlackConversation: async def init(self): with self.loading(): - info = await self.fetch_info() + info = await self.api.fetch_conversations_info(self) if info["ok"] != True: # TODO: Handle error return @@ -78,11 +76,6 @@ class SlackConversation: ) weechat.buffer_set(self.buffer_pointer, "localvar_set_nick", "nick") - async def fetch_info(self) -> SlackConversationInfoResponse: - with self.loading(): - info = await self.api.fetch("conversations.info", {"channel": self.id}) - return info - async def fill_history(self): if self.history_filled or self.history_pending: return @@ -90,9 +83,7 @@ class SlackConversation: with self.loading(): self.history_pending = True - history = await self.api.fetch( - "conversations.history", {"channel": self.id} - ) + history = await self.api.fetch_conversations_history(self) start = time.time() messages = [SlackMessage(self, message) for message in history["messages"]] -- cgit