diff options
author | Ryan Huber <rhuber@gmail.com> | 2017-02-10 10:23:51 -0800 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2017-02-10 10:23:51 -0800 |
commit | e5b09f71c9281e4c6cf9c2937382ed581d54be19 (patch) | |
tree | ebc939cb2359d48c30aa4d53d548c52a7fa2dfc7 /wee_slack.py | |
parent | 190e8da85c582d9f387fa321395e95287b32b40a (diff) | |
download | wee-slack-e5b09f71c9281e4c6cf9c2937382ed581d54be19.tar.gz |
fix slash commands
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py index a192881..c139692 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2476,9 +2476,7 @@ def command_talk(data, current_buffer, args): """ e = EVENTROUTER team = e.weechat_controller.buffers[current_buffer].team - dbg(team, 5) channel_name = args.split(' ')[1] - dbg(channel_name, 5) c = team.get_channel_map() if channel_name not in c: u = team.get_username_map() @@ -2573,6 +2571,28 @@ def save_distracting_channels(): w.config_set_plugin('distracting_channels', ','.join(config.distracting_channels)) @slack_buffer_required +def command_slash(data, current_buffer, args): + """ + Support for custom slack commands + /slack slash /customcommand arg1 arg2 arg3 + """ + e = EVENTROUTER + channel = e.weechat_controller.buffers.get(current_buffer, None) + if channel: + team = channel.team + + if args is None: + server.buffer_prnt("Usage: /slack slash /someslashcommand [arguments...].") + return + + split_args = args.split(None, 2) + command = split_args[1] + text = split_args[2] if len(split_args) > 2 else "" + + s = SlackRequest(team.token, "chat.command", {"command": command, "text": text, 'channel': channel.identifier}, team_hash=team.team_hash, channel_identifier=channel.identifier) + EVENTROUTER.receive(s) + +@slack_buffer_required def command_mute(data, current_buffer, args): current = w.current_buffer() channel_id = EVENTROUTER.weechat_controller.buffers[current].identifier |