diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-08-20 21:09:10 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | f3f97e5cbb97ed7a04bc3e40a110805ff0ae53c8 (patch) | |
tree | d6abf2212800d82e3e845a4ec5f70dd031fa5f94 /slack/slack_conversation.py | |
parent | 9a92344a77731f443d19dfdb24a6a47a1b7dc9ce (diff) | |
download | wee-slack-f3f97e5cbb97ed7a04bc3e40a110805ff0ae53c8.tar.gz |
Render reactions after messages
Diffstat (limited to 'slack/slack_conversation.py')
-rw-r--r-- | slack/slack_conversation.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py index ddc2054..9b49466 100644 --- a/slack/slack_conversation.py +++ b/slack/slack_conversation.py @@ -375,19 +375,36 @@ class SlackConversation: f"{self.buffer_pointer};off;{user.nick()}", ) + async def rerender_message(self, message: SlackMessage): + modify_buffer_line( + self.buffer_pointer, message.ts, await message.render_message(rerender=True) + ) + async def change_message(self, data: SlackMessageChanged): ts = SlackTs(data["ts"]) message = self._messages.get(ts) if message: message.update_message_json(data["message"]) - modify_buffer_line(self.buffer_pointer, ts, await message.render_message()) + await self.rerender_message(message) async def delete_message(self, data: SlackMessageDeleted): ts = SlackTs(data["deleted_ts"]) message = self._messages.get(ts) if message: message.deleted = True - modify_buffer_line(self.buffer_pointer, ts, await message.render_message()) + await self.rerender_message(message) + + async def reaction_add(self, message_ts: SlackTs, reaction: str, user_id: str): + message = self._messages.get(message_ts) + if message: + message.reaction_add(reaction, user_id) + await self.rerender_message(message) + + async def reaction_remove(self, message_ts: SlackTs, reaction: str, user_id: str): + message = self._messages.get(message_ts) + if message: + message.reaction_remove(reaction, user_id) + await self.rerender_message(message) async def typing_add_user(self, user_id: str, thread_ts: Optional[str]): if not shared.config.look.typing_status_nicks.value: |