aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2019-04-09 14:27:25 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2019-06-02 23:09:20 +0200
commit5a407b71cba56a1804fac2dfeb1bdb6687fac7cb (patch)
tree80b3fd6646571ff6441930172a8003b501a3e7cd /wee_slack.py
parent5d9aa14a3af89d76e6e5fa526390759d284e1917 (diff)
downloadwee-slack-5a407b71cba56a1804fac2dfeb1bdb6687fac7cb.tar.gz
Move subteam created/updated functions
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py45
1 files changed, 24 insertions, 21 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 5d54cf9..280f079 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2762,27 +2762,6 @@ def process_message(message_json, eventrouter, store=True, download=True, **kwar
if download:
download_files(message_json, **kwargs)
-def process_subteam_created(subteam_json, eventrouter, **kwargs):
- team = kwargs['team']
- subteam_json_info = subteam_json['subteam']
- subteam = SlackSubteam(team.identifier, **subteam_json_info)
- team.subteams[subteam_json_info['id']] = subteam
-
-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')]
-
- 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)
- team.buffer_prnt(message, message=True)
-
- team.subteams[new_subteam_info.get('id')] = SlackSubteam(team.identifier, **new_subteam_info)
def download_files(message_json, **kwargs):
team = kwargs["team"]
@@ -3029,6 +3008,30 @@ def process_reaction_removed(message_json, eventrouter, **kwargs):
dbg("Reaction to item type not supported: " + str(message_json))
+def process_subteam_created(subteam_json, eventrouter, **kwargs):
+ team = kwargs['team']
+ subteam_json_info = subteam_json['subteam']
+ subteam = SlackSubteam(team.identifier, **subteam_json_info)
+ team.subteams[subteam_json_info['id']] = subteam
+
+
+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')]
+
+ 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)
+ 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']
team.load_emoji_completions()