aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-01-23 17:10:29 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-01-23 17:13:16 +0100
commit4f9863d992e549ceff38c26d08e435f14bbfc597 (patch)
treef6b72d9e4cca32164bae1ea64c6447c50fabb4a6 /wee_slack.py
parent8c509af8c82ce3f75671e51651d82c3fda99d00f (diff)
downloadwee-slack-4f9863d992e549ceff38c26d08e435f14bbfc597.tar.gz
Print error message when reaction couldn't be added/removed
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index f35a2af..8e35ab1 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -275,6 +275,10 @@ class ProxyWrapper(object):
##### Helpers
+def print_error(message, buffer=''):
+ w.prnt(buffer, '{}Error: {}'.format(w.prefix('error'), message))
+
+
def format_exc_tb():
return decode_from_utf8(traceback.format_exc())
@@ -1478,7 +1482,7 @@ class SlackChannelCommon(object):
else:
return
data = {"channel": self.identifier, "timestamp": timestamp, "name": reaction}
- s = SlackRequest(self.team.token, method, data)
+ s = SlackRequest(self.team.token, method, data, reaction=reaction)
self.eventrouter.receive(s)
def edit_nth_previous_message(self, msg_id, old, new, flags):
@@ -2880,6 +2884,18 @@ def handle_chatcommand(json, eventrouter, **kwargs):
.format(command, json['error'], response_text))
+def handle_reactionsadd(json, eventrouter, **kwargs):
+ if not json['ok']:
+ request_metadata = json['wee_slack_request_metadata']
+ print_error("Couldn't add reaction {}: {}".format(request_metadata.reaction, json['error']))
+
+
+def handle_reactionsremove(json, eventrouter, **kwargs):
+ if not json['ok']:
+ request_metadata = json['wee_slack_request_metadata']
+ print_error("Couldn't remove reaction {}: {}".format(request_metadata.reaction, json['error']))
+
+
###### New/converted process_ and subprocess_ methods
def process_hello(message_json, eventrouter, **kwargs):
kwargs['team'].subscribe_users_presence()