aboutsummaryrefslogtreecommitdiffstats
path: root/typings
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-02-03 01:27:31 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commit4de39f91d9d8942816b8967a115010c466b8f252 (patch)
treee019d0f6437f131ce3192991b17ef2263ee442e8 /typings
parent684e7d701a4eb21c3b95954c3ca2e38d78ee451c (diff)
downloadwee-slack-4de39f91d9d8942816b8967a115010c466b8f252.tar.gz
Add messages received over rtm to channels
Diffstat (limited to 'typings')
-rw-r--r--typings/slack_api/slack_conversations_history.pyi40
-rw-r--r--typings/slack_rtm/slack_rtm_message.pyi105
2 files changed, 135 insertions, 10 deletions
diff --git a/typings/slack_api/slack_conversations_history.pyi b/typings/slack_api/slack_conversations_history.pyi
index 1e8634b..04a48e1 100644
--- a/typings/slack_api/slack_conversations_history.pyi
+++ b/typings/slack_api/slack_conversations_history.pyi
@@ -3,6 +3,7 @@ from __future__ import annotations
from typing import Dict, List
from slack_api.slack_common import SlackErrorResponse
+from slack_rtm.slack_rtm_message import SlackMessageRtm
from typing_extensions import Literal, NotRequired, TypedDict, final
@final
@@ -93,7 +94,7 @@ class SlackMessageStandardCommon(SlackMessageCommon):
team: str
@final
-class SlackMessageStandard(SlackMessageStandardCommon):
+class SlackMessageStandardFinal(SlackMessageStandardCommon):
pass
class SlackMessageThreadParentCommon(SlackMessageStandardCommon):
@@ -104,24 +105,32 @@ class SlackMessageThreadParentCommon(SlackMessageStandardCommon):
reply_users: List[str]
is_locked: bool
-@final
class SlackMessageThreadParentNotSubscribed(SlackMessageThreadParentCommon):
subscribed: Literal[False]
@final
+class SlackMessageThreadParentNotSubscribedFinal(SlackMessageThreadParentNotSubscribed):
+ pass
+
class SlackMessageThreadParentSubscribed(SlackMessageThreadParentCommon):
subscribed: Literal[True]
last_read: str
@final
+class SlackMessageThreadParentSubscribedFinal(SlackMessageThreadParentSubscribed):
+ pass
+
class SlackMessageWithFiles(SlackMessageCommon):
user: str
files: List[SlackMessageFile]
upload: bool
display_as_bot: bool
-# TODO: Add other subtypes
@final
+class SlackMessageWithFilesFinal(SlackMessageWithFiles):
+ pass
+
+# TODO: Add other subtypes
class SlackMessageSubtypeBotMessage(SlackMessageCommon):
subtype: Literal["bot_message"]
bot_id: str
@@ -129,6 +138,9 @@ class SlackMessageSubtypeBotMessage(SlackMessageCommon):
icons: NotRequired[Dict[str, str]]
@final
+class SlackMessageSubtypeBotMessageFinal(SlackMessageSubtypeBotMessage):
+ pass
+
class SlackMessageSubtypeBotRemove(SlackMessageCommon):
subtype: Literal["bot_remove"]
user: str
@@ -136,20 +148,28 @@ class SlackMessageSubtypeBotRemove(SlackMessageCommon):
bot_link: str
@final
+class SlackMessageSubtypeBotRemoveFinal(SlackMessageSubtypeBotRemove):
+ pass
+
class SlackMessageSubtypeBotAdd(SlackMessageCommon):
subtype: Literal["bot_add"]
user: str
bot_id: str
bot_link: str
+@final
+class SlackMessageSubtypeBotAddFinal(SlackMessageSubtypeBotAdd):
+ pass
+
SlackMessage = (
- SlackMessageStandard
- | SlackMessageThreadParentNotSubscribed
- | SlackMessageThreadParentSubscribed
- | SlackMessageWithFiles
- | SlackMessageSubtypeBotMessage
- | SlackMessageSubtypeBotRemove
- | SlackMessageSubtypeBotAdd
+ SlackMessageStandardFinal
+ | SlackMessageThreadParentNotSubscribedFinal
+ | SlackMessageThreadParentSubscribedFinal
+ | SlackMessageWithFilesFinal
+ | SlackMessageSubtypeBotMessageFinal
+ | SlackMessageSubtypeBotRemoveFinal
+ | SlackMessageSubtypeBotAddFinal
+ | SlackMessageRtm
)
@final
diff --git a/typings/slack_rtm/slack_rtm_message.pyi b/typings/slack_rtm/slack_rtm_message.pyi
new file mode 100644
index 0000000..0f8d397
--- /dev/null
+++ b/typings/slack_rtm/slack_rtm_message.pyi
@@ -0,0 +1,105 @@
+from slack_api.slack_conversations_history import (
+ SlackMessage,
+ SlackMessageStandardCommon,
+ SlackMessageSubtypeBotAdd,
+ SlackMessageSubtypeBotMessage,
+ SlackMessageSubtypeBotRemove,
+ SlackMessageThreadParentNotSubscribed,
+ SlackMessageThreadParentSubscribed,
+ SlackMessageWithFiles,
+)
+from typing_extensions import Literal, TypedDict, final
+
+class SlackRtmHello(TypedDict):
+ type: Literal["hello"]
+ fast_reconnect: bool
+ region: str
+ start: bool
+ host_id: str
+
+@final
+class SlackMessageStandardRtm(SlackMessageStandardCommon):
+ channel: str
+
+@final
+class SlackMessageThreadParentNotSubscribedRtm(SlackMessageThreadParentNotSubscribed):
+ channel: str
+
+@final
+class SlackMessageThreadParentSubscribedRtm(SlackMessageThreadParentSubscribed):
+ channel: str
+
+@final
+class SlackMessageWithFilesRtm(SlackMessageWithFiles):
+ channel: str
+
+@final
+class SlackMessageSubtypeBotMessageRtm(SlackMessageSubtypeBotMessage):
+ channel: str
+
+@final
+class SlackMessageSubtypeBotRemoveRtm(SlackMessageSubtypeBotRemove):
+ channel: str
+
+@final
+class SlackMessageSubtypeBotAddRtm(SlackMessageSubtypeBotAdd):
+ channel: str
+
+@final
+class SlackMessageChanged(TypedDict):
+ type: Literal["message"]
+ subtype: Literal["message_changed"]
+ message: SlackMessage
+ previous_message: SlackMessage
+ channel: str
+ hidden: bool
+ ts: str
+ event_ts: str
+
+@final
+class SlackMessageDeleted(TypedDict):
+ type: Literal["message"]
+ subtype: Literal["message_deleted"]
+ previous_message: SlackMessage
+ channel: str
+ hidden: bool
+ ts: str
+ deleted_ts: str
+ event_ts: str
+
+@final
+class SlackMessageReplied(TypedDict):
+ type: Literal["message"]
+ subtype: Literal["message_replied"]
+ message: SlackMessage
+ channel: str
+ hidden: bool
+ ts: str
+ event_ts: str
+
+@final
+class SlackUserTyping(TypedDict):
+ type: Literal["user_typing"]
+ channel: str
+ thread_ts: str
+ id: int
+ user: str
+
+SlackMessageRtm = (
+ SlackMessageStandardRtm
+ | SlackMessageThreadParentNotSubscribedRtm
+ | SlackMessageThreadParentSubscribedRtm
+ | SlackMessageWithFilesRtm
+ | SlackMessageSubtypeBotMessageRtm
+ | SlackMessageSubtypeBotRemoveRtm
+ | SlackMessageSubtypeBotAddRtm
+)
+
+SlackRtmMessage = (
+ SlackRtmHello
+ | SlackMessageRtm
+ | SlackMessageChanged
+ | SlackMessageDeleted
+ | SlackMessageReplied
+ | SlackUserTyping
+)