aboutsummaryrefslogtreecommitdiffstats
path: root/slack/slack_message.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-07-11 00:37:14 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commit675d28844004a1acb3bb573c52f69efe5e094f07 (patch)
tree6e23fc5c9f98fbd3959d9fb65762ab7289dc9e11 /slack/slack_message.py
parentf522a1340e6d72f2e7090772379ff25aeb590bcf (diff)
downloadwee-slack-675d28844004a1acb3bb573c52f69efe5e094f07.tar.gz
Don't print message to buffer if history isn't printed
If new messages are printed before the history, they will remain at the top of the buffer after the history is printed.
Diffstat (limited to 'slack/slack_message.py')
-rw-r--r--slack/slack_message.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/slack/slack_message.py b/slack/slack_message.py
index dc7d79d..1a3365f 100644
--- a/slack/slack_message.py
+++ b/slack/slack_message.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import re
+from enum import Enum
from typing import TYPE_CHECKING, List, Match, Optional
from slack.log import print_exception_once
@@ -17,6 +18,13 @@ if TYPE_CHECKING:
from slack.slack_workspace import SlackWorkspace
+class MessagePriority(Enum):
+ LOW = 0
+ MESSAGE = 1
+ PRIVATE = 2
+ HIGHLIGHT = 3
+
+
class SlackMessage:
def __init__(self, conversation: SlackConversation, message_json: SlackMessageDict):
self._message_json = message_json
@@ -31,6 +39,10 @@ class SlackMessage:
def sender_user_id(self) -> Optional[str]:
return self._message_json.get("user")
+ @property
+ def priority(self) -> MessagePriority:
+ return MessagePriority.MESSAGE
+
async def render_message(self) -> str:
prefix_coro = self._prefix()
message_coro = self._unfurl_refs(self._message_json["text"])