aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshish Kulkarni <ashish@kulkarni.dev>2020-12-02 13:17:09 +0530
committerTrygve Aaberge <trygveaa@gmail.com>2021-02-20 16:08:17 +0100
commit101518f0d3a790c775cc2123675ae17bf6b04fc2 (patch)
tree09095409fd416736e1886d5ade1e60a54a01c2a8
parentc345e49bc066d2960638d7f7776789ddf0b8ee4a (diff)
downloadwee-slack-101518f0d3a790c775cc2123675ae17bf6b04fc2.tar.gz
lookup message via hash with fallback to count
-rw-r--r--docs/Commands.md2
-rw-r--r--wee_slack.py7
2 files changed, 6 insertions, 3 deletions
diff --git a/docs/Commands.md b/docs/Commands.md
index bb78359..7eb3c8e 100644
--- a/docs/Commands.md
+++ b/docs/Commands.md
@@ -201,7 +201,7 @@ List the connected Slack teams.
### thread
```
-/thread [message_id]
+/thread [count/message_id]
```
Open the thread for the message.
diff --git a/wee_slack.py b/wee_slack.py
index 215c31d..b5714f7 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -4578,7 +4578,7 @@ def command_showmuted(data, current_buffer, args):
@utf8_decode
def command_thread(data, current_buffer, args):
"""
- /thread [message_id]
+ /thread [count/message_id]
Open the thread for the message.
If no message id is specified the last thread in channel will be opened.
"""
@@ -4588,7 +4588,10 @@ def command_thread(data, current_buffer, args):
print_error('/thread can not be used in the team buffer, only in a channel')
return w.WEECHAT_RC_ERROR
- message = channel.message_from_hash_or_index(args)
+ message = channel.message_from_hash(args)
+ if not message:
+ message_filter = lambda message: message.number_of_replies()
+ message = channel.message_from_hash_or_index(args, message_filter)
if message:
message.open_thread(switch=config.switch_buffer_on_join)