aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_workspace.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-08-20 17:21:00 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commit9a736ce08f19bc4cd5be63d7b87af3d6e1a8741b (patch)
tree5834130580558005c00ad35ef7e072f48826cdec /slack/slack_workspace.py
parente71e04f1ed15dfa5348350a1f2921458ade3e77a (diff)
downloadwee-slack-9a736ce08f19bc4cd5be63d7b87af3d6e1a8741b.tar.gz
Support rendering message edits and deletions
Diffstat (limited to 'slack/slack_workspace.py')
-rw-r--r--slack/slack_workspace.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/slack/slack_workspace.py b/slack/slack_workspace.py
index 0d9405f..4b045e1 100644
--- a/slack/slack_workspace.py
+++ b/slack/slack_workspace.py
@@ -279,20 +279,18 @@ class SlackWorkspace:
else:
channel = None
- if data["type"] == "message":
+ if data["type"] == "message" and channel is not None:
if "subtype" in data and data["subtype"] == "message_changed":
- pass
+ await channel.change_message(data)
elif "subtype" in data and data["subtype"] == "message_deleted":
- pass
+ await channel.delete_message(data)
elif "subtype" in data and data["subtype"] == "message_replied":
pass
else:
- if channel:
- message = SlackMessage(channel, data)
- await channel.add_message(message)
- elif data["type"] == "user_typing":
- if channel:
- await channel.typing_add_user(data["user"], data.get("thread_ts"))
+ message = SlackMessage(channel, data)
+ await channel.add_message(message)
+ elif data["type"] == "user_typing" and channel is not None:
+ await channel.typing_add_user(data["user"], data.get("thread_ts"))
else:
weechat.prnt("", f"\t{self.name} received: {json.dumps(data)}")
except Exception as e: