@im-more/dsh-slack 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/cordis.patch.yml +13 -0
- package/lib/index.js +2659 -0
- package/lib/index.js.map +1 -0
- package/lib/types/bot.d.ts +66 -0
- package/lib/types/bot.d.ts.map +1 -0
- package/lib/types/bot.js +165 -0
- package/lib/types/bot.js.map +1 -0
- package/lib/types/config.d.ts +49 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +54 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/decode.d.ts +126 -0
- package/lib/types/decode.d.ts.map +1 -0
- package/lib/types/decode.js +396 -0
- package/lib/types/decode.js.map +1 -0
- package/lib/types/errors.d.ts +61 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +196 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/identity.d.ts +27 -0
- package/lib/types/identity.d.ts.map +1 -0
- package/lib/types/identity.js +35 -0
- package/lib/types/identity.js.map +1 -0
- package/lib/types/index.d.ts +14 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +14 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/modes/mrkdwn.d.ts +17 -0
- package/lib/types/modes/mrkdwn.d.ts.map +1 -0
- package/lib/types/modes/mrkdwn.js +123 -0
- package/lib/types/modes/mrkdwn.js.map +1 -0
- package/lib/types/modes/shared.d.ts +164 -0
- package/lib/types/modes/shared.d.ts.map +1 -0
- package/lib/types/modes/shared.js +411 -0
- package/lib/types/modes/shared.js.map +1 -0
- package/lib/types/mrkdwn.d.ts +41 -0
- package/lib/types/mrkdwn.d.ts.map +1 -0
- package/lib/types/mrkdwn.js +137 -0
- package/lib/types/mrkdwn.js.map +1 -0
- package/lib/types/request.d.ts +225 -0
- package/lib/types/request.d.ts.map +1 -0
- package/lib/types/request.js +330 -0
- package/lib/types/request.js.map +1 -0
- package/lib/types/send.d.ts +74 -0
- package/lib/types/send.d.ts.map +1 -0
- package/lib/types/send.js +200 -0
- package/lib/types/send.js.map +1 -0
- package/lib/types/transport/socket.d.ts +58 -0
- package/lib/types/transport/socket.d.ts.map +1 -0
- package/lib/types/transport/socket.js +297 -0
- package/lib/types/transport/socket.js.map +1 -0
- package/lib/types/transport/webhook.d.ts +48 -0
- package/lib/types/transport/webhook.d.ts.map +1 -0
- package/lib/types/transport/webhook.js +210 -0
- package/lib/types/transport/webhook.js.map +1 -0
- package/lib/types/types/admin.d.ts +682 -0
- package/lib/types/types/admin.d.ts.map +1 -0
- package/lib/types/types/admin.js +172 -0
- package/lib/types/types/admin.js.map +1 -0
- package/lib/types/types/api.d.ts +20 -0
- package/lib/types/types/api.d.ts.map +1 -0
- package/lib/types/types/api.js +7 -0
- package/lib/types/types/api.js.map +1 -0
- package/lib/types/types/apps.d.ts +138 -0
- package/lib/types/types/apps.d.ts.map +1 -0
- package/lib/types/types/apps.js +28 -0
- package/lib/types/types/apps.js.map +1 -0
- package/lib/types/types/auth.d.ts +36 -0
- package/lib/types/types/auth.d.ts.map +1 -0
- package/lib/types/types/auth.js +10 -0
- package/lib/types/types/auth.js.map +1 -0
- package/lib/types/types/bots.d.ts +32 -0
- package/lib/types/types/bots.d.ts.map +1 -0
- package/lib/types/types/bots.js +7 -0
- package/lib/types/types/bots.js.map +1 -0
- package/lib/types/types/calls.d.ts +82 -0
- package/lib/types/types/calls.d.ts.map +1 -0
- package/lib/types/types/calls.js +22 -0
- package/lib/types/types/calls.js.map +1 -0
- package/lib/types/types/chat.d.ts +208 -0
- package/lib/types/types/chat.d.ts.map +1 -0
- package/lib/types/types/chat.js +34 -0
- package/lib/types/types/chat.js.map +1 -0
- package/lib/types/types/conversations.d.ts +266 -0
- package/lib/types/types/conversations.d.ts.map +1 -0
- package/lib/types/types/conversations.js +58 -0
- package/lib/types/types/conversations.js.map +1 -0
- package/lib/types/types/definition.d.ts +505 -0
- package/lib/types/types/definition.d.ts.map +1 -0
- package/lib/types/types/definition.js +2 -0
- package/lib/types/types/definition.js.map +1 -0
- package/lib/types/types/dialog.d.ts +20 -0
- package/lib/types/types/dialog.d.ts.map +1 -0
- package/lib/types/types/dialog.js +7 -0
- package/lib/types/types/dialog.js.map +1 -0
- package/lib/types/types/dnd.d.ts +70 -0
- package/lib/types/types/dnd.d.ts.map +1 -0
- package/lib/types/types/dnd.js +19 -0
- package/lib/types/types/dnd.js.map +1 -0
- package/lib/types/types/emoji.d.ts +18 -0
- package/lib/types/types/emoji.d.ts.map +1 -0
- package/lib/types/types/emoji.js +7 -0
- package/lib/types/types/emoji.js.map +1 -0
- package/lib/types/types/events/base-events.d.ts +235 -0
- package/lib/types/types/events/base-events.d.ts.map +1 -0
- package/lib/types/types/events/base-events.js +3 -0
- package/lib/types/types/events/base-events.js.map +1 -0
- package/lib/types/types/events/index.d.ts +97 -0
- package/lib/types/types/events/index.d.ts.map +1 -0
- package/lib/types/types/events/index.js +3 -0
- package/lib/types/types/events/index.js.map +1 -0
- package/lib/types/types/events/message-events.d.ts +215 -0
- package/lib/types/types/events/message-events.d.ts.map +1 -0
- package/lib/types/types/events/message-events.js +3 -0
- package/lib/types/types/events/message-events.js.map +1 -0
- package/lib/types/types/files.d.ts +189 -0
- package/lib/types/types/files.d.ts.map +1 -0
- package/lib/types/types/files.js +43 -0
- package/lib/types/types/files.js.map +1 -0
- package/lib/types/types/index.d.ts +82 -0
- package/lib/types/types/index.d.ts.map +1 -0
- package/lib/types/types/index.js +29 -0
- package/lib/types/types/index.js.map +1 -0
- package/lib/types/types/internal.d.ts +17 -0
- package/lib/types/types/internal.d.ts.map +1 -0
- package/lib/types/types/internal.js +60 -0
- package/lib/types/types/internal.js.map +1 -0
- package/lib/types/types/migration.d.ts +25 -0
- package/lib/types/types/migration.d.ts.map +1 -0
- package/lib/types/types/migration.js +7 -0
- package/lib/types/types/migration.js.map +1 -0
- package/lib/types/types/oauth.d.ts +50 -0
- package/lib/types/types/oauth.d.ts.map +1 -0
- package/lib/types/types/oauth.js +13 -0
- package/lib/types/types/oauth.js.map +1 -0
- package/lib/types/types/pins.d.ts +39 -0
- package/lib/types/types/pins.d.ts.map +1 -0
- package/lib/types/types/pins.js +13 -0
- package/lib/types/types/pins.js.map +1 -0
- package/lib/types/types/reactions.d.ts +75 -0
- package/lib/types/types/reactions.d.ts.map +1 -0
- package/lib/types/types/reactions.js +16 -0
- package/lib/types/types/reactions.js.map +1 -0
- package/lib/types/types/reminders.d.ts +64 -0
- package/lib/types/types/reminders.d.ts.map +1 -0
- package/lib/types/types/reminders.js +19 -0
- package/lib/types/types/reminders.js.map +1 -0
- package/lib/types/types/rtm.d.ts +30 -0
- package/lib/types/types/rtm.d.ts.map +1 -0
- package/lib/types/types/rtm.js +7 -0
- package/lib/types/types/rtm.js.map +1 -0
- package/lib/types/types/search.d.ts +24 -0
- package/lib/types/types/search.d.ts.map +1 -0
- package/lib/types/types/search.js +7 -0
- package/lib/types/types/search.js.map +1 -0
- package/lib/types/types/stars.d.ts +56 -0
- package/lib/types/types/stars.d.ts.map +1 -0
- package/lib/types/types/stars.js +13 -0
- package/lib/types/types/stars.js.map +1 -0
- package/lib/types/types/team.d.ts +98 -0
- package/lib/types/types/team.d.ts.map +1 -0
- package/lib/types/types/team.js +19 -0
- package/lib/types/types/team.js.map +1 -0
- package/lib/types/types/usergroups.d.ts +103 -0
- package/lib/types/types/usergroups.d.ts.map +1 -0
- package/lib/types/types/usergroups.js +25 -0
- package/lib/types/types/usergroups.js.map +1 -0
- package/lib/types/types/users.d.ts +169 -0
- package/lib/types/types/users.d.ts.map +1 -0
- package/lib/types/types/users.js +40 -0
- package/lib/types/types/users.js.map +1 -0
- package/lib/types/types/views.d.ts +56 -0
- package/lib/types/types/views.d.ts.map +1 -0
- package/lib/types/types/views.js +16 -0
- package/lib/types/types/views.js.map +1 -0
- package/lib/types/types/workflows.d.ts +45 -0
- package/lib/types/types/workflows.d.ts.map +1 -0
- package/lib/types/types/workflows.js +13 -0
- package/lib/types/types/workflows.js.map +1 -0
- package/package.json +65 -3
- package/src/bot.ts +273 -0
- package/src/config.ts +92 -0
- package/src/decode.ts +489 -0
- package/src/errors.ts +230 -0
- package/src/identity.ts +59 -0
- package/src/index.ts +64 -0
- package/src/modes/mrkdwn.ts +159 -0
- package/src/modes/shared.ts +515 -0
- package/src/mrkdwn.ts +146 -0
- package/src/request.ts +449 -0
- package/src/send.ts +300 -0
- package/src/transport/socket.ts +393 -0
- package/src/transport/webhook.ts +269 -0
- package/src/types/admin.ts +910 -0
- package/src/types/api.ts +28 -0
- package/src/types/apps.ts +175 -0
- package/src/types/auth.ts +49 -0
- package/src/types/bots.ts +40 -0
- package/src/types/calls.ts +110 -0
- package/src/types/chat.ts +255 -0
- package/src/types/conversations.ts +342 -0
- package/src/types/definition.ts +530 -0
- package/src/types/dialog.ts +28 -0
- package/src/types/dnd.ts +94 -0
- package/src/types/emoji.ts +26 -0
- package/src/types/events/base-events.ts +281 -0
- package/src/types/events/index.ts +125 -0
- package/src/types/events/message-events.ts +253 -0
- package/src/types/files.ts +245 -0
- package/src/types/index.ts +84 -0
- package/src/types/internal.ts +60 -0
- package/src/types/migration.ts +34 -0
- package/src/types/oauth.ts +66 -0
- package/src/types/pins.ts +55 -0
- package/src/types/reactions.ts +95 -0
- package/src/types/reminders.ts +88 -0
- package/src/types/rtm.ts +38 -0
- package/src/types/search.ts +32 -0
- package/src/types/stars.ts +72 -0
- package/src/types/team.ts +122 -0
- package/src/types/usergroups.ts +135 -0
- package/src/types/users.ts +221 -0
- package/src/types/views.ts +76 -0
- package/src/types/workflows.ts +61 -0
- package/README.md +0 -3
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// https://github.com/slackapi/bolt-js/blob/main/src/types/events/base-events.ts
|
|
2
|
+
|
|
3
|
+
import { MessageEvent as AllMessageEvents } from './message-events.ts'
|
|
4
|
+
import { SlackUser } from '.'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* All known event types in Slack's Events API
|
|
8
|
+
* Please refer to https://api.slack.com/events for more details
|
|
9
|
+
*
|
|
10
|
+
* This is a discriminated union. The discriminant is the `type` property.
|
|
11
|
+
*/
|
|
12
|
+
export type SlackEvent =
|
|
13
|
+
| ChannelArchiveEvent
|
|
14
|
+
| ChannelCreatedEvent
|
|
15
|
+
| ChannelDeletedEvent
|
|
16
|
+
| ChannelIDChangedEvent
|
|
17
|
+
| ChannelLeftEvent
|
|
18
|
+
| ChannelRenameEvent
|
|
19
|
+
| EmojiChangedEvent
|
|
20
|
+
| FileChangeEvent
|
|
21
|
+
| InviteRequestedEvent
|
|
22
|
+
| MemberJoinedChannelEvent
|
|
23
|
+
| MemberLeftChannelEvent
|
|
24
|
+
| MessageEvent
|
|
25
|
+
| ReactionAddedEvent
|
|
26
|
+
| ReactionRemovedEvent
|
|
27
|
+
| UserChangeEvent
|
|
28
|
+
| UserProfileChangedEvent
|
|
29
|
+
| UserStatusChangedEvent
|
|
30
|
+
| HelloEvent
|
|
31
|
+
|
|
32
|
+
export type EventTypePattern = string | RegExp
|
|
33
|
+
|
|
34
|
+
export interface HelloEvent {
|
|
35
|
+
type: 'hello'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface BasicSlackEvent<Type extends string = string> {
|
|
39
|
+
type: Type
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ChannelArchiveEvent {
|
|
43
|
+
type: 'channel_archive'
|
|
44
|
+
channel: string
|
|
45
|
+
user: string
|
|
46
|
+
is_moved?: number
|
|
47
|
+
event_ts: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ChannelCreatedEvent {
|
|
51
|
+
type: 'channel_created'
|
|
52
|
+
channel: {
|
|
53
|
+
id: string
|
|
54
|
+
is_channel: boolean
|
|
55
|
+
name: string
|
|
56
|
+
name_normalized: string
|
|
57
|
+
created: number
|
|
58
|
+
creator: string // user ID
|
|
59
|
+
is_shared: boolean
|
|
60
|
+
is_org_shared: boolean
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface ChannelDeletedEvent {
|
|
65
|
+
type: 'channel_deleted'
|
|
66
|
+
channel: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface ChannelIDChangedEvent {
|
|
70
|
+
type: 'channel_id_changed'
|
|
71
|
+
old_channel_id: string
|
|
72
|
+
new_channel_id: string
|
|
73
|
+
event_ts: string
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ChannelLeftEvent {
|
|
77
|
+
type: 'channel_left'
|
|
78
|
+
channel: string
|
|
79
|
+
actor_id: string
|
|
80
|
+
event_ts: string
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface ChannelRenameEvent {
|
|
84
|
+
type: 'channel_rename'
|
|
85
|
+
channel: {
|
|
86
|
+
id: string
|
|
87
|
+
name: string
|
|
88
|
+
name_normalized: string
|
|
89
|
+
created: number
|
|
90
|
+
is_channel: boolean
|
|
91
|
+
is_mpim: boolean
|
|
92
|
+
}
|
|
93
|
+
event_ts: string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// NOTE: this should probably be broken into its two subtypes
|
|
97
|
+
export interface EmojiChangedEvent {
|
|
98
|
+
type: 'emoji_changed'
|
|
99
|
+
subtype: 'add' | 'remove' | 'rename'
|
|
100
|
+
names?: string[] // only for remove
|
|
101
|
+
name?: string // only for add
|
|
102
|
+
value?: string // only for add
|
|
103
|
+
old_name?: string
|
|
104
|
+
new_name?: string
|
|
105
|
+
event_ts: string
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface FileChangeEvent {
|
|
109
|
+
type: 'file_change'
|
|
110
|
+
file_id: string
|
|
111
|
+
file: {
|
|
112
|
+
id: string
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface InviteRequestedEvent {
|
|
117
|
+
type: 'invite_requested'
|
|
118
|
+
invite_request: {
|
|
119
|
+
id: string
|
|
120
|
+
email: string
|
|
121
|
+
date_created: number
|
|
122
|
+
requester_ids: string[]
|
|
123
|
+
channel_ids: string[]
|
|
124
|
+
invite_type: 'restricted' | 'ultra_restricted' | 'full_member'
|
|
125
|
+
real_name: string
|
|
126
|
+
date_expire: number
|
|
127
|
+
request_reason: string
|
|
128
|
+
team: {
|
|
129
|
+
id: string
|
|
130
|
+
name: string
|
|
131
|
+
domain: string
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface MemberJoinedChannelEvent {
|
|
137
|
+
type: 'member_joined_channel'
|
|
138
|
+
user: string
|
|
139
|
+
channel: string
|
|
140
|
+
channel_type: string
|
|
141
|
+
team: string
|
|
142
|
+
inviter?: string
|
|
143
|
+
event_ts: string
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface MemberLeftChannelEvent {
|
|
147
|
+
type: 'member_left_channel'
|
|
148
|
+
user: string
|
|
149
|
+
channel: string
|
|
150
|
+
channel_type: string
|
|
151
|
+
team: string
|
|
152
|
+
event_ts: string
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type MessageEvent = AllMessageEvents
|
|
156
|
+
|
|
157
|
+
export interface ReactionMessageItem {
|
|
158
|
+
type: 'message'
|
|
159
|
+
channel: string
|
|
160
|
+
ts: string
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface ReactionAddedEvent {
|
|
164
|
+
type: 'reaction_added'
|
|
165
|
+
user: string
|
|
166
|
+
reaction: string
|
|
167
|
+
item_user: string
|
|
168
|
+
item: ReactionMessageItem
|
|
169
|
+
event_ts: string
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface ReactionRemovedEvent {
|
|
173
|
+
type: 'reaction_removed'
|
|
174
|
+
user: string
|
|
175
|
+
reaction: string
|
|
176
|
+
item_user: string
|
|
177
|
+
item: ReactionMessageItem
|
|
178
|
+
event_ts: string
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface StatusEmojiDisplayInfo {
|
|
182
|
+
emoji_name?: string
|
|
183
|
+
display_alias?: string
|
|
184
|
+
display_url?: string
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface UserChangeEvent {
|
|
188
|
+
type: 'user_change'
|
|
189
|
+
user: SlackUser
|
|
190
|
+
cache_ts: number
|
|
191
|
+
event_ts: string
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface UserProfileChangedEvent {
|
|
195
|
+
type: 'user_profile_changed'
|
|
196
|
+
user: {
|
|
197
|
+
id: string
|
|
198
|
+
team_id: string
|
|
199
|
+
name: string
|
|
200
|
+
deleted: boolean
|
|
201
|
+
color: string
|
|
202
|
+
real_name: string
|
|
203
|
+
tz: string
|
|
204
|
+
tz_label: string
|
|
205
|
+
tz_offset: number
|
|
206
|
+
profile: {
|
|
207
|
+
title: string
|
|
208
|
+
phone: string
|
|
209
|
+
skype: string
|
|
210
|
+
real_name: string
|
|
211
|
+
real_name_normalized: string
|
|
212
|
+
display_name: string
|
|
213
|
+
display_name_normalized: string
|
|
214
|
+
status_text: string
|
|
215
|
+
status_text_canonical: string
|
|
216
|
+
status_emoji: string
|
|
217
|
+
status_emoji_display_info: StatusEmojiDisplayInfo[]
|
|
218
|
+
status_expiration: number
|
|
219
|
+
avatar_hash: string
|
|
220
|
+
huddle_state: string
|
|
221
|
+
huddle_state_expiration_ts: number
|
|
222
|
+
first_name: string
|
|
223
|
+
last_name: string
|
|
224
|
+
email?: string
|
|
225
|
+
image_original?: string
|
|
226
|
+
is_custom_image?: boolean
|
|
227
|
+
image_24: string
|
|
228
|
+
image_32: string
|
|
229
|
+
image_48: string
|
|
230
|
+
image_72: string
|
|
231
|
+
image_192: string
|
|
232
|
+
image_512: string
|
|
233
|
+
image_1024?: string
|
|
234
|
+
team: string
|
|
235
|
+
fields:
|
|
236
|
+
| {
|
|
237
|
+
[key: string]: {
|
|
238
|
+
value: string
|
|
239
|
+
alt: string
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
| []
|
|
243
|
+
| null
|
|
244
|
+
}
|
|
245
|
+
is_admin: boolean
|
|
246
|
+
is_owner: boolean
|
|
247
|
+
is_primary_owner: boolean
|
|
248
|
+
is_restricted: boolean
|
|
249
|
+
is_ultra_restricted: boolean
|
|
250
|
+
is_bot: boolean
|
|
251
|
+
is_stranger?: boolean
|
|
252
|
+
updated: number
|
|
253
|
+
is_email_confirmed: boolean
|
|
254
|
+
is_app_user: boolean
|
|
255
|
+
is_invited_user?: boolean
|
|
256
|
+
has_2fa?: boolean
|
|
257
|
+
locale: string
|
|
258
|
+
presence?: string
|
|
259
|
+
enterprise_user?: {
|
|
260
|
+
id: string
|
|
261
|
+
enterprise_id: string
|
|
262
|
+
enterprise_name: string
|
|
263
|
+
is_admin: boolean
|
|
264
|
+
is_owner: boolean
|
|
265
|
+
teams: string[]
|
|
266
|
+
}
|
|
267
|
+
two_factor_type?: string
|
|
268
|
+
has_files?: boolean
|
|
269
|
+
is_workflow_bot?: boolean
|
|
270
|
+
who_can_share_contact_card: string
|
|
271
|
+
}
|
|
272
|
+
cache_ts: number
|
|
273
|
+
event_ts: string
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface UserStatusChangedEvent {
|
|
277
|
+
type: 'user_status_changed'
|
|
278
|
+
user: SlackUser
|
|
279
|
+
cache_ts: number
|
|
280
|
+
event_ts: string
|
|
281
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// https://github.com/slackapi/bolt-js/blob/main/src/types/events/index.ts
|
|
2
|
+
|
|
3
|
+
import { BasicSlackEvent, SlackEvent, UserProfileChangedEvent } from './base-events.ts'
|
|
4
|
+
import { Block } from '@slack/types'
|
|
5
|
+
|
|
6
|
+
export type StringIndexed = Record<string, any>
|
|
7
|
+
|
|
8
|
+
export * from './base-events.ts'
|
|
9
|
+
export {
|
|
10
|
+
GenericMessageEvent,
|
|
11
|
+
BotMessageEvent,
|
|
12
|
+
ChannelJoinMessageEvent,
|
|
13
|
+
ChannelLeaveMessageEvent,
|
|
14
|
+
ChannelNameMessageEvent,
|
|
15
|
+
FileShareMessageEvent,
|
|
16
|
+
MeMessageEvent,
|
|
17
|
+
MessageChangedEvent,
|
|
18
|
+
MessageDeletedEvent,
|
|
19
|
+
File,
|
|
20
|
+
} from './message-events.ts'
|
|
21
|
+
|
|
22
|
+
export type SocketEvent = HelloEvent | EventsApiEvent | UrlVerificationEvent | EnvelopedEvent
|
|
23
|
+
|
|
24
|
+
export interface HelloEvent {
|
|
25
|
+
type: 'hello'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface EventsApiEvent {
|
|
29
|
+
type: 'events_api'
|
|
30
|
+
envelope_id: string
|
|
31
|
+
payload: EnvelopedEvent
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface UrlVerificationEvent {
|
|
35
|
+
type: 'url_verification'
|
|
36
|
+
token: string
|
|
37
|
+
challenge: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A Slack Events API event wrapped in the standard envelope.
|
|
42
|
+
*
|
|
43
|
+
* This describes the entire JSON-encoded body of a request from Slack's Events API.
|
|
44
|
+
*/
|
|
45
|
+
export interface EnvelopedEvent<Event extends BasicSlackEvent = SlackEvent> extends StringIndexed {
|
|
46
|
+
token: string
|
|
47
|
+
team_id: string
|
|
48
|
+
enterprise_id?: string
|
|
49
|
+
api_app_id: string
|
|
50
|
+
event: Event
|
|
51
|
+
type: 'event_callback'
|
|
52
|
+
event_id: string
|
|
53
|
+
event_time: number
|
|
54
|
+
// TODO: the two properties below are being deprecated on Feb 24, 2021
|
|
55
|
+
authed_users?: string[]
|
|
56
|
+
authed_teams?: string[]
|
|
57
|
+
is_ext_shared_channel?: boolean
|
|
58
|
+
authorizations?: Authorization[]
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface Authorization {
|
|
62
|
+
enterprise_id: string | null
|
|
63
|
+
team_id: string | null
|
|
64
|
+
user_id: string
|
|
65
|
+
is_bot: boolean
|
|
66
|
+
is_enterprise_install?: boolean
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface RichTextBlock extends Block {
|
|
70
|
+
type: 'rich_text'
|
|
71
|
+
elements: RichTextElement[]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** https://api.slack.com/changelog/2019-09-what-they-see-is-what-you-get-and-more-and-less#the_riches */
|
|
75
|
+
export type RichTextElement = RichTextElement.TextSection | RichTextElement.TextList
|
|
76
|
+
|
|
77
|
+
export type RichText = RichText.User | RichText.Text | RichText.Emoji | RichText.Link | RichText.Broadcast
|
|
78
|
+
|
|
79
|
+
export namespace RichTextElement {
|
|
80
|
+
export interface TextSection {
|
|
81
|
+
type: 'rich_text_section'
|
|
82
|
+
elements: RichText[]
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface TextList {
|
|
86
|
+
type: 'rich_text_list'
|
|
87
|
+
style: 'bullet' | 'ordered'
|
|
88
|
+
indent: number
|
|
89
|
+
border: 0
|
|
90
|
+
elements: TextSection[]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export namespace RichText {
|
|
95
|
+
export interface User {
|
|
96
|
+
type: 'user'
|
|
97
|
+
user_id: string
|
|
98
|
+
}
|
|
99
|
+
export interface Text {
|
|
100
|
+
text: string
|
|
101
|
+
type: 'text'
|
|
102
|
+
style?: {
|
|
103
|
+
bold?: boolean
|
|
104
|
+
italic?: boolean
|
|
105
|
+
strike?: boolean
|
|
106
|
+
code?: boolean
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export interface Emoji {
|
|
110
|
+
type: 'emoji'
|
|
111
|
+
unicode: string
|
|
112
|
+
name: string
|
|
113
|
+
}
|
|
114
|
+
export interface Link {
|
|
115
|
+
url: string
|
|
116
|
+
type: 'link'
|
|
117
|
+
text: string
|
|
118
|
+
}
|
|
119
|
+
export interface Broadcast {
|
|
120
|
+
type: 'broadcast'
|
|
121
|
+
range: 'here' | 'channel' | 'everyone'
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type SlackUser = UserProfileChangedEvent['user']
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
// https://github.com/slackapi/bolt-js/blob/main/src/types/events/message-events.ts
|
|
2
|
+
|
|
3
|
+
import { Block, KnownBlock, MessageAttachment } from '@slack/types'
|
|
4
|
+
|
|
5
|
+
export type MessageEvent =
|
|
6
|
+
// | GenericMessageEvent
|
|
7
|
+
| BotMessageEvent
|
|
8
|
+
| ChannelJoinMessageEvent
|
|
9
|
+
| ChannelLeaveMessageEvent
|
|
10
|
+
| ChannelNameMessageEvent
|
|
11
|
+
| FileShareMessageEvent
|
|
12
|
+
| MeMessageEvent
|
|
13
|
+
| MessageChangedEvent
|
|
14
|
+
| MessageDeletedEvent
|
|
15
|
+
|
|
16
|
+
export interface GenericMessageEvent {
|
|
17
|
+
type: 'message'
|
|
18
|
+
subtype: undefined
|
|
19
|
+
event_ts: string
|
|
20
|
+
team?: string
|
|
21
|
+
channel: string
|
|
22
|
+
user: string
|
|
23
|
+
bot_id?: string
|
|
24
|
+
app_id?: string
|
|
25
|
+
username?: string
|
|
26
|
+
bot_profile?: BotProfile
|
|
27
|
+
text?: string
|
|
28
|
+
ts: string
|
|
29
|
+
thread_ts?: string
|
|
30
|
+
channel_type: channelTypes
|
|
31
|
+
attachments?: MessageAttachment[]
|
|
32
|
+
blocks?: (KnownBlock | Block)[]
|
|
33
|
+
files?: File[]
|
|
34
|
+
edited?: {
|
|
35
|
+
user: string
|
|
36
|
+
ts: string
|
|
37
|
+
}
|
|
38
|
+
client_msg_id?: string
|
|
39
|
+
parent_user_id?: string
|
|
40
|
+
|
|
41
|
+
// TODO: optional types that maybe should flow into other subtypes?
|
|
42
|
+
is_starred?: boolean
|
|
43
|
+
pinned_to?: string[]
|
|
44
|
+
reactions?: {
|
|
45
|
+
name: string
|
|
46
|
+
count: number
|
|
47
|
+
users: string[]
|
|
48
|
+
}[]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface BotMessageEvent {
|
|
52
|
+
type: 'message'
|
|
53
|
+
subtype: 'bot_message'
|
|
54
|
+
event_ts: string
|
|
55
|
+
channel: string
|
|
56
|
+
channel_type: channelTypes
|
|
57
|
+
ts: string
|
|
58
|
+
text: string
|
|
59
|
+
bot_id: string
|
|
60
|
+
username?: string
|
|
61
|
+
icons?: {
|
|
62
|
+
[size: string]: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// copied from MessageEvent
|
|
66
|
+
// TODO: is a user really optional? likely for things like IncomingWebhook authored messages
|
|
67
|
+
user?: string
|
|
68
|
+
attachments?: MessageAttachment[]
|
|
69
|
+
blocks?: (KnownBlock | Block)[]
|
|
70
|
+
edited?: {
|
|
71
|
+
user: string
|
|
72
|
+
ts: string
|
|
73
|
+
}
|
|
74
|
+
thread_ts?: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface ChannelJoinMessageEvent {
|
|
78
|
+
type: 'message'
|
|
79
|
+
subtype: 'channel_join'
|
|
80
|
+
team: string
|
|
81
|
+
user: string
|
|
82
|
+
inviter: string
|
|
83
|
+
channel: string
|
|
84
|
+
channel_type: channelTypes
|
|
85
|
+
text: string
|
|
86
|
+
ts: string
|
|
87
|
+
event_ts: string
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface ChannelLeaveMessageEvent {
|
|
91
|
+
type: 'message'
|
|
92
|
+
subtype: 'channel_leave'
|
|
93
|
+
team: string
|
|
94
|
+
user: string
|
|
95
|
+
channel: string
|
|
96
|
+
channel_type: channelTypes
|
|
97
|
+
text: string
|
|
98
|
+
ts: string
|
|
99
|
+
event_ts: string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface ChannelNameMessageEvent {
|
|
103
|
+
type: 'message'
|
|
104
|
+
subtype: 'channel_name'
|
|
105
|
+
team: string
|
|
106
|
+
user: string
|
|
107
|
+
name: string
|
|
108
|
+
old_name: string
|
|
109
|
+
channel: string
|
|
110
|
+
channel_type: channelTypes
|
|
111
|
+
text: string
|
|
112
|
+
ts: string
|
|
113
|
+
event_ts: string
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface FileShareMessageEvent {
|
|
117
|
+
type: 'message'
|
|
118
|
+
subtype: 'file_share'
|
|
119
|
+
text: string
|
|
120
|
+
attachments?: MessageAttachment[]
|
|
121
|
+
blocks?: (KnownBlock | Block)[]
|
|
122
|
+
files?: File[]
|
|
123
|
+
upload?: boolean
|
|
124
|
+
display_as_bot?: boolean
|
|
125
|
+
x_files?: string[]
|
|
126
|
+
user: string
|
|
127
|
+
parent_user_id?: string
|
|
128
|
+
ts: string
|
|
129
|
+
thread_ts?: string
|
|
130
|
+
channel: string
|
|
131
|
+
channel_type: channelTypes
|
|
132
|
+
event_ts: string
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface MeMessageEvent {
|
|
136
|
+
type: 'message'
|
|
137
|
+
subtype: 'me_message'
|
|
138
|
+
event_ts: string
|
|
139
|
+
channel: string
|
|
140
|
+
channel_type: channelTypes
|
|
141
|
+
user: string
|
|
142
|
+
text: string
|
|
143
|
+
ts: string
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface MessageChangedEvent {
|
|
147
|
+
type: 'message'
|
|
148
|
+
subtype: 'message_changed'
|
|
149
|
+
event_ts: string
|
|
150
|
+
hidden: true
|
|
151
|
+
channel: string
|
|
152
|
+
channel_type: channelTypes
|
|
153
|
+
ts: string
|
|
154
|
+
message: GenericMessageEvent
|
|
155
|
+
previous_message: GenericMessageEvent
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface MessageDeletedEvent {
|
|
159
|
+
type: 'message'
|
|
160
|
+
subtype: 'message_deleted'
|
|
161
|
+
event_ts: string
|
|
162
|
+
hidden: true
|
|
163
|
+
channel: string
|
|
164
|
+
channel_type: channelTypes
|
|
165
|
+
ts: string
|
|
166
|
+
deleted_ts: string
|
|
167
|
+
// previous_message: MessageEvent
|
|
168
|
+
previous_message: GenericMessageEvent
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export type channelTypes = 'channel' | 'group' | 'im' | 'mpim' | 'app_home'
|
|
172
|
+
|
|
173
|
+
interface BotProfile {
|
|
174
|
+
id: string
|
|
175
|
+
name: string
|
|
176
|
+
app_id: string
|
|
177
|
+
team_id: string
|
|
178
|
+
icons: {
|
|
179
|
+
[size: string]: string
|
|
180
|
+
}
|
|
181
|
+
updated: number
|
|
182
|
+
deleted: boolean
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface File {
|
|
186
|
+
id: string
|
|
187
|
+
created: number
|
|
188
|
+
name: string | null
|
|
189
|
+
title: string | null
|
|
190
|
+
mimetype: string
|
|
191
|
+
filetype: string
|
|
192
|
+
pretty_type: string
|
|
193
|
+
user?: string
|
|
194
|
+
editable: boolean
|
|
195
|
+
size: number
|
|
196
|
+
mode: 'hosted' | 'external' | 'snippet' | 'post'
|
|
197
|
+
is_external: boolean
|
|
198
|
+
external_type: string | null
|
|
199
|
+
is_public: boolean
|
|
200
|
+
public_url_shared: boolean
|
|
201
|
+
display_as_bot: boolean
|
|
202
|
+
username: string | null
|
|
203
|
+
|
|
204
|
+
// Authentication required
|
|
205
|
+
url_private?: string
|
|
206
|
+
url_private_download?: string
|
|
207
|
+
|
|
208
|
+
// Thumbnails (authentication still required)
|
|
209
|
+
thumb_64?: string
|
|
210
|
+
thumb_80?: string
|
|
211
|
+
thumb_160?: string
|
|
212
|
+
thumb_360?: string
|
|
213
|
+
thumb_360_w?: number
|
|
214
|
+
thumb_360_h?: number
|
|
215
|
+
thumb_360_gif?: string
|
|
216
|
+
thumb_480?: string
|
|
217
|
+
thumb_720?: string
|
|
218
|
+
thumb_960?: string
|
|
219
|
+
thumb_1024?: string
|
|
220
|
+
permalink: string
|
|
221
|
+
permalink_public?: string
|
|
222
|
+
edit_link?: string
|
|
223
|
+
image_exif_rotation?: number
|
|
224
|
+
original_w?: number
|
|
225
|
+
original_h?: number
|
|
226
|
+
deanimate_gif?: string
|
|
227
|
+
|
|
228
|
+
// Posts
|
|
229
|
+
preview?: string
|
|
230
|
+
preview_highlight?: string
|
|
231
|
+
lines?: string
|
|
232
|
+
lines_more?: string
|
|
233
|
+
preview_is_truncated?: boolean
|
|
234
|
+
has_rich_preview?: boolean
|
|
235
|
+
|
|
236
|
+
shares?: {
|
|
237
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
238
|
+
[key: string]: any
|
|
239
|
+
}
|
|
240
|
+
channels: string[] | null
|
|
241
|
+
groups: string[] | null
|
|
242
|
+
users?: string[]
|
|
243
|
+
pinned_to?: string[]
|
|
244
|
+
reactions?: {
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
246
|
+
[key: string]: any
|
|
247
|
+
}[]
|
|
248
|
+
is_starred?: boolean
|
|
249
|
+
num_stars?: number
|
|
250
|
+
|
|
251
|
+
initial_comment?: string
|
|
252
|
+
comments_count?: string
|
|
253
|
+
}
|