aboutsummaryrefslogtreecommitdiffstats
path: root/slack
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-08-21 18:32:17 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commitf5dc1e5601a441a2378298e7b15490faab904584 (patch)
tree233ca253648b7d5516bd260157f9ae96706c5c3f /slack
parentf3f97e5cbb97ed7a04bc3e40a110805ff0ae53c8 (diff)
downloadwee-slack-f5dc1e5601a441a2378298e7b15490faab904584.tar.gz
Render me/action messages correctly
Diffstat (limited to 'slack')
-rw-r--r--slack/slack_message.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/slack/slack_message.py b/slack/slack_message.py
index 64214c5..d1d29fe 100644
--- a/slack/slack_message.py
+++ b/slack/slack_message.py
@@ -143,11 +143,15 @@ class SlackMessage:
tags.append("slack_privmsg")
if self.is_bot_message:
tags.append("bot_message")
- if shared.weechat_version >= 0x04000000:
- if user:
- tags.append(f"prefix_nick_{user.nick_color()}")
- else:
- tags.append(f"prefix_nick_{nick_color(nick)}")
+
+ if self._message_json.get("subtype") == "me_message":
+ tags.append("slack_action")
+ else:
+ if shared.weechat_version >= 0x04000000:
+ if user:
+ tags.append(f"prefix_nick_{user.nick_color()}")
+ else:
+ tags.append(f"prefix_nick_{nick_color(nick)}")
if user and user.is_self:
tags.append("self_msg")
@@ -191,6 +195,8 @@ class SlackMessage:
return removesuffix(weechat.prefix("join"), "\t")
elif self._message_json.get("subtype") in ["channel_leave", "group_leave"]:
return removesuffix(weechat.prefix("quit"), "\t")
+ elif self._message_json.get("subtype") == "me_message":
+ return removesuffix(weechat.prefix("action"), "\t")
else:
return await self._nick(colorize=colorize, only_nick=only_nick)
@@ -229,6 +235,10 @@ class SlackMessage:
inviter_text = ""
return f"{await self._nick()} {text_action} {text_conversation_name}{inviter_text}"
+
+ elif self._message_json.get("subtype") == "me_message":
+ text = await self._unfurl_refs(self._message_json["text"])
+ return f"{await self._nick()} {text}"
else:
return await self._unfurl_refs(self._message_json["text"])