diff options
author | David Vo <auscompgeek@users.noreply.github.com> | 2019-06-15 22:14:49 +1000 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-06-15 14:14:49 +0200 |
commit | 76ccd47a404b9f2ad8ba34750b473371b6cff5a6 (patch) | |
tree | 06f90d31969bb94eb5bddd544d0d861b836e6909 /wee_slack.py | |
parent | bf931150a2050688b4213d803eba5bffbd951a39 (diff) | |
download | wee-slack-76ccd47a404b9f2ad8ba34750b473371b6cff5a6.tar.gz |
Expose more information in /whois (#700)
Also hide any unset fields.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py index 8110ee7..e291636 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2311,6 +2311,7 @@ class SlackUser(object): setattr(self, key, value) self.name = nick_from_profile(self.profile, kwargs["name"]) + self.username = kwargs["name"] self.update_color() def __repr__(self): @@ -3606,14 +3607,24 @@ def whois_command_cb(data, current_buffer, command): team = EVENTROUTER.weechat_controller.buffers[current_buffer].team u = team.users.get(team.get_username_map().get(user)) if u: + def print_profile(field): + value = u.profile.get(field) + if value: + team.buffer_prnt("[{}]: {}: {}".format(user, field, value)) + team.buffer_prnt("[{}]: {}".format(user, u.real_name)) status_emoji = u.profile.get("status_emoji", "") status_text = u.profile.get("status_text", "") if status_emoji or status_text: team.buffer_prnt("[{}]: {} {}".format(user, status_emoji, status_text)) - team.buffer_prnt("[{}]: Title: {}".format(user, u.profile.get('title', ''))) - team.buffer_prnt("[{}]: Email: {}".format(user, u.profile.get('email', ''))) - team.buffer_prnt("[{}]: Phone: {}".format(user, u.profile.get('phone', ''))) + + team.buffer_prnt("[{}]: username: {}".format(user, u.username)) + team.buffer_prnt("[{}]: id: {}".format(user, u.identifier)) + + print_profile('title') + print_profile('email') + print_profile('phone') + print_profile('skype') else: team.buffer_prnt("[{}]: No such user".format(user)) return w.WEECHAT_RC_OK_EAT |