aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-05-05 23:50:12 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-05-05 23:55:15 +0200
commitc6b4d2e1387d84545ba731201c5dcd46fa91b6ed (patch)
tree48836b06bd9c8e182af976455731efb86256dd37 /wee_slack.py
parent8379f8a5ee270625afd3ac427ed8ee7f03ac2501 (diff)
downloadwee-slack-c6b4d2e1387d84545ba731201c5dcd46fa91b6ed.tar.gz
Document usage of session tokens
Fixes #764
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py
index d6b5763..097cf37 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2947,12 +2947,18 @@ def handle_subscriptionsthreadmark(json, eventrouter, team, channel, metadata):
def handle_subscriptionsthreadadd(json, eventrouter, team, channel, metadata):
if not json["ok"]:
- print_error("Couldn't add thread subscription: {}".format(json['error']))
+ if json['error'] == 'not_allowed_token_type':
+ print_error("Can only subscribe to a thread when using a session token, see the readme: https://github.com/wee-slack/wee-slack#4-add-your-slack-api-tokens")
+ else:
+ print_error("Couldn't add thread subscription: {}".format(json['error']))
def handle_subscriptionsthreadremove(json, eventrouter, team, channel, metadata):
if not json["ok"]:
- print_error("Couldn't remove thread subscription: {}".format(json['error']))
+ if json['error'] == 'not_allowed_token_type':
+ print_error("Can only unsubscribe from a thread when using a session token, see the readme: https://github.com/wee-slack/wee-slack#4-add-your-slack-api-tokens")
+ else:
+ print_error("Couldn't remove thread subscription: {}".format(json['error']))
###### New/converted process_ and subprocess_ methods
@@ -4275,8 +4281,10 @@ def subscribe_helper(current_buffer, args, usage, api):
def command_subscribe(data, current_buffer, args):
"""
/slack subscribe <thread>
- Subscribe to a thread, so that you are alerted to new messages. When in a
+ Subscribe to a thread, so that you are alerted to new messages. When in a
thread buffer, you can omit the thread id.
+
+ Only works when using a session token, see the readme: https://github.com/wee-slack/wee-slack#4-add-your-slack-api-tokens"
"""
return subscribe_helper(current_buffer, args, 'Usage: /slack subscribe <thread>', "subscriptions.thread.add")
@@ -4289,8 +4297,10 @@ def command_unsubscribe(data, current_buffer, args):
"""
/slack unsubscribe <thread>
Unsubscribe from a thread that has been previously subscribed to, so that
- you are not alerted to new messages. When in a thread buffer, you can omit
+ you are not alerted to new messages. When in a thread buffer, you can omit
the thread id.
+
+ Only works when using a session token, see the readme: https://github.com/wee-slack/wee-slack#4-add-your-slack-api-tokens"
"""
return subscribe_helper(current_buffer, args, 'Usage: /slack unsubscribe <thread>', "subscriptions.thread.remove")