aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2021-03-06 13:54:22 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2021-03-06 14:13:37 +0100
commitfab39b2e642b70a3f6bd510de0fb1b6034eb4ed0 (patch)
tree85f00d70e0e390965d44f2f24e125f434d01de2f
parent249853a0366a055078eb6b5286adf96596fa0cd6 (diff)
downloadwee-slack-fab39b2e642b70a3f6bd510de0fb1b6034eb4ed0.tar.gz
Get user info for unknown users after getting channel members
Since all members might not be known yet in get_history (which is why we call conversations.members), if we look up unknown users there, we won't look up all the unknown users. Check for unknown users when receiving the response for conversations.members instead.
-rw-r--r--wee_slack.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py
index b6cc2f8..1b0ba54 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2423,10 +2423,6 @@ class SlackSharedChannel(SlackChannel):
super(SlackSharedChannel, self).__init__(eventrouter, "shared", **kwargs)
def get_history(self, slow_queue=False, full=False, no_log=False):
- # Get info for external users in the channel
- for user in self.members - set(self.team.users.keys()):
- s = SlackRequest(self.team, 'users.info', {'user': user}, channel=self)
- self.eventrouter.receive(s)
# 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)
@@ -3179,6 +3175,10 @@ def handle_conversationsreplies(message_json, eventrouter, team, channel, metada
def handle_conversationsmembers(members_json, eventrouter, team, channel, metadata):
if members_json['ok']:
channel.set_members(members_json['members'])
+ unknown_users = set(members_json['members']) - set(team.users.keys())
+ for user in unknown_users:
+ s = SlackRequest(team, 'users.info', {'user': user}, channel=channel)
+ eventrouter.receive(s)
else:
w.prnt(team.channel_buffer, '{}Couldn\'t load members for channel {}. Error: {}'
.format(w.prefix('error'), channel.name, members_json['error']))