From b7350e081916775c873415db7b060aff879d012c Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sun, 21 Mar 2021 17:58:11 +0100 Subject: Call conversations.members for all channel types I'm not sure when members for a channel is included in rtm.start, but it seems like shared and private channels doesn't include the field at all, while some other channels have started to only include the user. Therefore, call conversations.members if a channel doesn't have any members or if the only member is the user. Hopefully this fixes #829 --- wee_slack.py | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/wee_slack.py b/wee_slack.py index c9d0c60..50ce389 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2466,6 +2466,15 @@ class SlackChannel(SlackChannelCommon): self.print_getting_history() self.pending_history_requests.add(self.identifier) + if not self.members or self.members == set(self.team.myidentifier): + s = SlackRequest( + self.team, + "conversations.members", + {"channel": self.identifier, "limit": 1000}, + channel=self, + ) + self.eventrouter.receive(s) + post_data = {"channel": self.identifier, "count": config.history_fetch_count} if self.got_history and self.messages and not full: post_data["oldest"] = next(reversed(self.messages)) @@ -2821,17 +2830,6 @@ class SlackPrivateChannel(SlackGroupChannel): def __init__(self, eventrouter, **kwargs): super(SlackPrivateChannel, self).__init__(eventrouter, "private", **kwargs) - def get_history(self, slow_queue=False, full=False, no_log=False): - # Fetch members since they aren't included in rtm.start - s = SlackRequest( - self.team, - "conversations.members", - {"channel": self.identifier}, - channel=self, - ) - self.eventrouter.receive(s) - super(SlackPrivateChannel, self).get_history(slow_queue, full, no_log) - class SlackMPDMChannel(SlackChannel): """ @@ -2875,17 +2873,6 @@ class SlackSharedChannel(SlackChannel): def __init__(self, eventrouter, **kwargs): super(SlackSharedChannel, self).__init__(eventrouter, "shared", **kwargs) - def get_history(self, slow_queue=False, full=False, no_log=False): - # Fetch members since they aren't included in rtm.start - s = SlackRequest( - self.team, - "conversations.members", - {"channel": self.identifier, "limit": 1000}, - channel=self, - ) - self.eventrouter.receive(s) - super(SlackSharedChannel, self).get_history(slow_queue, full, no_log) - class SlackThreadChannel(SlackChannelCommon): """ -- cgit