aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2021-03-06 13:46:46 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2021-03-06 13:46:46 +0100
commit99b49540a148d59adfe8f9ec67a1ed97eb66a98e (patch)
tree89e7d39aa3d8113c50d4bebfec23569bd93e9e66 /wee_slack.py
parent7174d5b008611effa84abeef4fb196bd46711b73 (diff)
downloadwee-slack-99b49540a148d59adfe8f9ec67a1ed97eb66a98e.tar.gz
Get message sender nick from profile for unknown users
If a message is sent from an external user, the message will include the user profile, so we can use that to display the correct name if we haven't fetched the user info yet.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index be7e3d6..e083939 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2809,6 +2809,13 @@ class SlackMessage(object):
if user.is_external:
name += config.external_user_suffix
return name
+ elif 'user_profile' in self.message_json:
+ nick = nick_from_profile(self.message_json['user_profile'], self.user_identifier)
+ color_name = get_nick_color(nick)
+ name = nick if plain else colorize_string(color_name, nick)
+ if self.message_json.get('user_team') != self.message_json.get('team'):
+ name += config.external_user_suffix
+ return name
elif 'username' in self.message_json:
username = self.message_json["username"]
if plain: