aboutsummaryrefslogtreecommitdiffstats
path: root/typings/slack_rtm/slack_rtm_message.pyi
blob: 64dc64e25c27c61fd08be9b6b7a12e5a2931c380 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
from slack_api.slack_conversations_history import (
    SlackMessage,
    SlackMessageMe,
    SlackMessageStandardCommon,
    SlackMessageSubtypeBotAdd,
    SlackMessageSubtypeBotMessage,
    SlackMessageSubtypeBotRemove,
    SlackMessageSubtypeChannelJoin,
    SlackMessageSubtypeChannelLeave,
    SlackMessageSubtypeHuddleThread,
    SlackMessageSubtypeHuddleThreadRoom,
    SlackMessageThreadParentCommon,
    SlackMessageThreadParentNotSubscribed,
    SlackMessageThreadParentSubscribed,
    SlackMessageWithFiles,
)
from slack_api.slack_conversations_replies import SlackMessageThreadCommon
from typing_extensions import Literal, NotRequired, 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 SlackMessageMeRtm(SlackMessageMe):
    channel: str

@final
class SlackMessageThreadParentNotSubscribedRtm(SlackMessageThreadParentNotSubscribed):
    channel: str

@final
class SlackMessageThreadParentSubscribedRtm(SlackMessageThreadParentSubscribed):
    channel: str

@final
class SlackMessageThreadRtm(SlackMessageThreadCommon):
    channel: str
    event_ts: str
    source_team: str
    suppress_notification: bool
    user_team: str

@final
class SlackMessageWithFilesRtm(SlackMessageWithFiles):
    channel: str

@final
class SlackMessageSubtypeHuddleThreadRtm(SlackMessageSubtypeHuddleThread):
    event_ts: str
    suppress_notification: bool

@final
class SlackMessageSubtypeBotMessageRtm(SlackMessageSubtypeBotMessage):
    channel: str

@final
class SlackMessageSubtypeBotRemoveRtm(SlackMessageSubtypeBotRemove):
    channel: str

@final
class SlackMessageSubtypeBotAddRtm(SlackMessageSubtypeBotAdd):
    channel: str

@final
class SlackMessageSubtypeChannelJoinRtm(SlackMessageSubtypeChannelJoin):
    channel: str

@final
class SlackMessageSubtypeChannelLeaveRtm(SlackMessageSubtypeChannelLeave):
    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: SlackMessageThreadParentCommon
    channel: str
    hidden: bool
    ts: str
    event_ts: str

@final
class SlackReactionItem(TypedDict):
    type: Literal["message", "file", "file_comment"]
    channel: str
    ts: str

@final
class SlackReactionAdded(TypedDict):
    type: Literal["reaction_added"]
    user: str
    reaction: str
    item: SlackReactionItem
    item_user: NotRequired[str]
    event_ts: str
    ts: str

@final
class SlackReactionRemoved(TypedDict):
    type: Literal["reaction_removed"]
    user: str
    reaction: str
    item: SlackReactionItem
    item_user: NotRequired[str]
    event_ts: str
    ts: str

class SlackShRoomHuddle(TypedDict):
    channel_id: str

@final
class SlackShRoomJoin(TypedDict):
    type: Literal["sh_room_join"]
    room: SlackMessageSubtypeHuddleThreadRoom
    user: str
    huddle: SlackShRoomHuddle
    event_ts: str
    ts: str

@final
class SlackShRoomUpdate(TypedDict):
    type: Literal["sh_room_update"]
    room: SlackMessageSubtypeHuddleThreadRoom
    user: str
    huddle: SlackShRoomHuddle
    event_ts: str
    ts: str

@final
class SlackUserTyping(TypedDict):
    type: Literal["user_typing"]
    channel: str
    thread_ts: NotRequired[str]
    id: int
    user: str

SlackMessageRtm = (
    SlackMessageStandardRtm
    | SlackMessageMeRtm
    | SlackMessageThreadParentNotSubscribedRtm
    | SlackMessageThreadParentSubscribedRtm
    | SlackMessageThreadRtm
    | SlackMessageWithFilesRtm
    | SlackMessageSubtypeHuddleThreadRtm
    | SlackMessageSubtypeBotMessageRtm
    | SlackMessageSubtypeBotRemoveRtm
    | SlackMessageSubtypeBotAddRtm
    | SlackMessageSubtypeChannelJoinRtm
    | SlackMessageSubtypeChannelLeaveRtm
)

SlackRtmMessage = (
    SlackRtmHello
    | SlackMessageRtm
    | SlackMessageChanged
    | SlackMessageDeleted
    | SlackMessageReplied
    | SlackReactionAdded
    | SlackReactionRemoved
    | SlackShRoomJoin
    | SlackShRoomUpdate
    | SlackUserTyping
)