aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-04-29 00:59:08 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-04-29 01:01:00 +0200
commit926b9eac7aa9e87fb0fe859d34e10195a2153a63 (patch)
tree95508c22151eb98f5fbd18207a25f2c07a8bdceb /wee_slack.py
parent73d84a726f1120c26c8e117b7ff4ad408e8fca84 (diff)
downloadwee-slack-926b9eac7aa9e87fb0fe859d34e10195a2153a63.tar.gz
Print error message when changing a message fails
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 5619360..3cacb7e 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -848,7 +848,8 @@ def buffer_input_callback(signal, buffer_ptr, data):
try:
old, new, flags = re.split(r'(?<!\\)/', data)[1:]
except ValueError:
- pass
+ print_error('Incomplete regex for changing a message, '
+ 'it should be in the form s/old text/new text/')
else:
# Replacement string in re.sub() is a string, not a regex, so get
# rid of escapes.
@@ -1555,6 +1556,8 @@ class SlackChannelCommon(object):
s = SlackRequest(self.team, "chat.update",
{"channel": self.identifier, "ts": message['ts'], "text": new_message}, channel=self)
self.eventrouter.receive(s)
+ else:
+ print_error("The regex didn't match any part of the message")
def my_last_message(self, msg_id):
if type(msg_id) is not int:
@@ -2914,6 +2917,16 @@ def handle_chatcommand(json, eventrouter, team, channel, metadata):
.format(command, json['error'], response_text))
+def handle_chatdelete(json, eventrouter, team, channel, metadata):
+ if not json['ok']:
+ print_error("Couldn't delete message: {}".format(json['error']))
+
+
+def handle_chatupdate(json, eventrouter, team, channel, metadata):
+ if not json['ok']:
+ print_error("Couldn't change message: {}".format(json['error']))
+
+
def handle_reactionsadd(json, eventrouter, team, channel, metadata):
if not json['ok']:
print_error("Couldn't add reaction {}: {}".format(metadata['reaction'], json['error']))