aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2018-09-04 20:18:52 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2018-09-04 20:48:27 +0200
commit90cea03220b1607a8c05d93e79bd5cf99fc3c2e7 (patch)
tree85c3a3d6937f5113d2942a22c87ee3abdf510b61 /wee_slack.py
parent871781879c2a19877a19be8d59bf5938f57f5d58 (diff)
downloadwee-slack-90cea03220b1607a8c05d93e79bd5cf99fc3c2e7.tar.gz
Print result from /slack mute command
Prints either "Muted channel #x" or "Unmuted channel #x" to the team buffer.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 6962c4b..b2c8d72 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3541,15 +3541,16 @@ def command_slash(data, current_buffer, args):
@slack_buffer_required
def command_mute(data, current_buffer, args):
- current = w.current_buffer()
- channel_id = EVENTROUTER.weechat_controller.buffers[current].identifier
- team = EVENTROUTER.weechat_controller.buffers[current].team
- if channel_id not in team.muted_channels:
- team.muted_channels.add(channel_id)
- else:
- team.muted_channels.discard(channel_id)
- s = SlackRequest(team.token, "users.prefs.set", {"name": "muted_channels", "value": ",".join(team.muted_channels)}, team_hash=team.team_hash, channel_identifier=channel_id)
+ channel = EVENTROUTER.weechat_controller.buffers[current_buffer]
+ team = channel.team
+ team.muted_channels ^= {channel.identifier}
+ muted_str = "Muted" if channel.identifier in team.muted_channels else "Unmuted"
+ team.buffer_prnt("{} channel {}".format(muted_str, channel.name))
+ s = SlackRequest(team.token, "users.prefs.set",
+ {"name": "muted_channels", "value": ",".join(team.muted_channels)},
+ team_hash=team.team_hash, channel_identifier=channel.identifier)
EVENTROUTER.receive(s)
+ return w.WEECHAT_RC_OK_EAT
@slack_buffer_required