diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-01-14 07:51:59 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | a7b617b886c3f56165a5aeb27631520a6e6e5d96 (patch) | |
tree | 06f0a3203991244f9c76eb1fdc4cb8d5f79df19c /slack/slack_conversation.py | |
parent | 70eaa484831106cb5df6eeb3d7b7fe5ef9b65d0c (diff) | |
download | wee-slack-a7b617b886c3f56165a5aeb27631520a6e6e5d96.tar.gz |
Create functions for fetch requests
Diffstat (limited to 'slack/slack_conversation.py')
-rw-r--r-- | slack/slack_conversation.py | 13 |
1 files changed, 2 insertions, 11 deletions
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"]] |