diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2020-03-18 00:26:46 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2020-03-18 01:02:54 +0100 |
commit | 8e13b38200f83d4a6fde15188aa00f7679eb17d7 (patch) | |
tree | d3ec7fb6587b87cb96120f209aaf836ed252a597 /wee_slack.py | |
parent | f61e946f647b797e4268405df8160dae818e19ab (diff) | |
download | wee-slack-8e13b38200f83d4a6fde15188aa00f7679eb17d7.tar.gz |
Reply to parent message if trying to reply to thread message
Opening a thread on a thread message is not possible, so the logical
thing to do if a user tries to reply to a thread message is to put the
message in the same thread as the message that is replied to.
Slack currently has a bug which causes thread messages to be converted
to normal messages if you try to reply to them (that is, send a message
with thread_ts set to the ts of the thread message), but the message you
reply with will end up in the original thread. I filed an issue and they
confirmed that it is a bug, and that you should not send messages with
thread_ts set to the ts of a thread message.
Fixes #751
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index 82a91b4..3dd10cc 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -4075,7 +4075,10 @@ def command_reply(data, current_buffer, args): msg = get_msg_from_id(channel, msg_id) if msg: - parent_id = str(msg.ts) + if isinstance(msg, SlackThreadMessage): + parent_id = str(msg.parent_message.ts) + else: + parent_id = str(msg.ts) elif msg_id.isdigit() and int(msg_id) >= 1: mkeys = channel.main_message_keys_reversed() parent_id = str(next(islice(mkeys, int(msg_id) - 1, None))) |