aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorAidan Epstein <aidan@jmad.org>2020-03-01 13:42:10 -0800
committerAidan Epstein <aidan@jmad.org>2020-03-01 13:42:10 -0800
commit719eca612cf037a3ccf7e5b1fc99b6f1182af557 (patch)
tree5c5696e1e69c581688df79687ef7a87b78ca08e4 /wee_slack.py
parentbdf83ddf0b1842c26c9122603df342c96db87a7b (diff)
downloadwee-slack-719eca612cf037a3ccf7e5b1fc99b6f1182af557.tar.gz
Clarify documentation of /reply command, and refactor msg logic.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 8b411b6..7f01550 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -4006,10 +4006,17 @@ command_thread.completion = '%(threads)'
@utf8_decode
def command_reply(data, current_buffer, args):
"""
+ When in a channel buffer:
/reply [-alsochannel] <count/message_id> <text>
- Reply in a thread on the message. Specify either the message id, a count
- upwards to the message from the last message, or, if you are already in a
- thread, nothing.
+ Reply in a thread on the message. Specify either the message id or a count
+ upwards to the message from the last message.
+
+ When in a thread buffer:
+ /reply [-alsochannel] <text>
+ Reply to the current thread. This can be used to send the reply to the
+ rest of the channel.
+
+ In either case, -alsochannel also sends the reply to the parent channel.
"""
channel = EVENTROUTER.weechat_controller.buffers[current_buffer]
parts = args.split(None, 1)
@@ -4019,18 +4026,15 @@ def command_reply(data, current_buffer, args):
else:
broadcast = False
- try:
- if isinstance(channel, SlackThreadChannel):
- text = args
- else:
- msg_id, text = args.split(None, 1)
- except ValueError:
- w.prnt('', 'Usage: /reply [-alsochannel] <count/id> <message>')
- return w.WEECHAT_RC_OK_EAT
-
if isinstance(channel, SlackThreadChannel):
+ text = args
msg = channel.parent_message
else:
+ try:
+ msg_id, text = args.split(None, 1)
+ except ValueError:
+ w.prnt('', 'Usage (when in a channel buffer): /reply [-alsochannel] <count/id> <message>')
+ return w.WEECHAT_RC_OK_EAT
msg = get_msg_from_id(channel, msg_id)
if msg: