aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2021-03-21 17:58:11 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2021-03-21 17:58:11 +0100
commitb7350e081916775c873415db7b060aff879d012c (patch)
tree82859dab326d9d6800a1de8435553c72922c3d56
parenteca1a5ae0202008a6685195e7c4e76ceae06f77a (diff)
downloadwee-slack-b7350e081916775c873415db7b060aff879d012c.tar.gz
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
-rw-r--r--wee_slack.py31
1 files 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):
"""