diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2019-04-09 14:36:00 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-06-02 23:09:20 +0200 |
commit | 63382c54682b5cb07bdce18e40d30f09c1dd241d (patch) | |
tree | 8749608f6c41ffa9db1b85a08d74594267160bfd /wee_slack.py | |
parent | 5a407b71cba56a1804fac2dfeb1bdb6687fac7cb (diff) | |
download | wee-slack-63382c54682b5cb07bdce18e40d30f09c1dd241d.tar.gz |
Simplify process_subteam_updated
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/wee_slack.py b/wee_slack.py index 280f079..59583d5 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -3017,20 +3017,15 @@ def process_subteam_created(subteam_json, eventrouter, **kwargs): def process_subteam_updated(subteam_json, eventrouter, **kwargs): team = kwargs['team'] - usergroups = team.generate_usergroup_map() - new_subteam_info = subteam_json['subteam'] - - current_subteam_info = team.subteams[new_subteam_info.get('id')] + current_subteam_info = team.subteams[subteam_json['subteam']['id']] + new_subteam_info = SlackSubteam(team.identifier, **subteam_json['subteam']) + team.subteams[subteam_json['subteam']['id']] = new_subteam_info - if config.notify_usergroup_handle_updated and current_subteam_info.handle != new_subteam_info['handle']: - usergroups[new_subteam_info['handle']] = new_subteam_info.get('id') - template = 'User group @{old_handle} has updated its handle to @{new_handle} in team {team}' - message = template.format(old_handle=current_subteam_info.handle, new_handle=new_subteam_info['handle'], - team=team.preferred_name) + if config.notify_usergroup_handle_updated and current_subteam_info.handle != new_subteam_info.handle: + message = 'User group @{old_handle} has updated its handle to @{new_handle} in team {team}.'.format( + name=current_subteam_info.handle, handle=new_subteam_info.handle, team=team.preferred_name) team.buffer_prnt(message, message=True) - team.subteams[new_subteam_info.get('id')] = SlackSubteam(team.identifier, **new_subteam_info) - def process_emoji_changed(message_json, eventrouter, **kwargs): team = kwargs['team'] |