6
6
from botbuilder .core .turn_context import TurnContext
7
7
from botbuilder .core import ActivityHandler , InvokeResponse , BotFrameworkAdapter
8
8
from botbuilder .schema .teams import (
9
+ AppBasedLinkQuery ,
9
10
TeamInfo ,
10
11
ChannelInfo ,
12
+ FileConsentCardResponse ,
11
13
TeamsChannelData ,
12
14
TeamsChannelAccount ,
15
+ MessageActionsPayload ,
16
+ MessagingExtensionAction ,
17
+ MessagingExtensionQuery ,
18
+ O365ConnectorCardActionQuery ,
19
+ TaskModuleRequest
13
20
)
14
21
from botframework .connector import Channels
15
22
import json
@@ -56,26 +63,26 @@ async def on_invoke_activity(self, turn_context: TurnContext):
56
63
57
64
if turn_context .activity .name == "fileConsent/invoke" :
58
65
return await self .on_teams_file_consent (
59
- turn_context , turn_context .activity .value
66
+ turn_context , FileConsentCardResponse ( ** turn_context .activity .value )
60
67
)
61
68
62
69
if turn_context .activity .name == "actionableMessage/executeAction" :
63
70
await self .on_teams_o365_connector_card_action (
64
- turn_context , turn_context .activity .value
71
+ turn_context , O365ConnectorCardActionQuery ( ** turn_context .activity .value )
65
72
)
66
73
return self ._create_invoke_response ()
67
74
68
75
if turn_context .activity .name == "composeExtension/queryLink" :
69
76
return self ._create_invoke_response (
70
77
await self .on_teams_app_based_link_query (
71
- turn_context , turn_context .activity .value
78
+ turn_context , AppBasedLinkQuery ( ** turn_context .activity .value )
72
79
)
73
80
)
74
81
75
82
if turn_context .activity .name == "composeExtension/query" :
76
83
return self ._create_invoke_response (
77
84
await self .on_teams_messaging_extension_query (
78
- turn_context , turn_context .activity .value
85
+ turn_context , MessagingExtensionQuery ( ** turn_context .activity .value )
79
86
)
80
87
)
81
88
@@ -89,21 +96,21 @@ async def on_invoke_activity(self, turn_context: TurnContext):
89
96
if turn_context .activity .name == "composeExtension/submitAction" :
90
97
return self ._create_invoke_response (
91
98
await self .on_teams_messaging_extension_submit_action_dispatch (
92
- turn_context , turn_context .activity .value
99
+ turn_context , MessagingExtensionAction ( ** turn_context .activity .value )
93
100
)
94
101
)
95
102
96
103
if turn_context .activity .name == "composeExtension/fetchTask" :
97
104
return self ._create_invoke_response (
98
105
await self .on_teams_messaging_extension_fetch_task (
99
- turn_context , turn_context .activity .value
106
+ turn_context , Messa
67ED
gingExtensionAction ( ** turn_context .activity .value )
100
107
)
101
108
)
102
109
103
110
if turn_context .activity .name == "composeExtension/querySettingUrl" :
104
111
return self ._create_invoke_response (
105
112
await self .on_teams_messaging_extension_configuration_query_settings_url (
106
- turn_context , turn_context .activity .value
113
+ turn_context , MessagingExtensionQuery ( ** turn_context .activity .value )
107
114
)
108
115
)
109
116
@@ -122,14 +129,14 @@ async def on_invoke_activity(self, turn_context: TurnContext):
122
129
if turn_context .activity .name == "task/fetch" :
123
130
return self ._create_invoke_response (
124
131
await self .on_teams_task_module_fetch (
125
- turn_context , turn_context .activity .value
132
+ turn_context , TaskModuleRequest ( ** turn_context .activity .value )
126
133
)
127
134
)
128
135
129
136
if turn_context .activity .name == "task/submit" :
130
137
return self ._create_invoke_response (
131
138
await self .on_teams_task_module_submit (
132
- turn_context , turn_context .activity .value
139
+ turn_context , TaskModuleRequest ( ** turn_context .activity .value )
133
140
)
134
141
)
135
142
@@ -144,7 +151,7 @@ async def on_teams_signin_verify_state(self, turn_context: TurnContext):
144
151
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
145
152
146
153
async def on_teams_file_consent (
147
- self , turn_context : TurnContext , file_consent_card_response
154
+ self , turn_context : TurnContext , file_consent_card_response : FileConsentCardResponse
148
155
):
149
156
if file_consent_card_response .action == "accept" :
150
157
await self .on_teams_file_consent_accept_activity (
@@ -164,39 +171,39 @@ async def on_teams_file_consent(
164
171
)
165
172
F438
td>166
173
async def on_teams_file_consent_accept_activity ( # pylint: disable=unused-argument
167
- self , turn_context : TurnContext , file_consent_card_response
174
+ self , turn_context : TurnContext , file_consent_card_response : FileConsentCardResponse
168
175
):
169
176
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
170
177
171
178
async def on_teams_file_consent_decline_activity ( # pylint: disable=unused-argument
172
- self , turn_context : TurnContext , file_consent_card_response
179
+ self , turn_context : TurnContext , file_consent_card_response : FileConsentCardResponse
173
180
):
174
181
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
175
182
176
183
async def on_teams_o365_connector_card_action ( # pylint: disable=unused-argument
177
- self , turn_context : TurnContext , query
184
+ self , turn_context : TurnContext , query : O365ConnectorCardActionQuery
178
185
):
179
186
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
180
187
181
188
async def on_teams_app_based_link_query ( # pylint: disable=unused-argument
182
- self , turn_context : TurnContext , query
189
+ self , turn_context : TurnContext , query : AppBasedLinkQuery
183
190
):
184
191
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
185
192
186
193
async def on_teams_messaging_extension_query ( # pylint: disable=unused-argument
187
- self , turn_context : TurnContext , query
194
+ self , turn_context : TurnContext , query : MessagingExtensionQuery
188
195
):
189
196
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
190
197
191
198
async def on_teams_messaging_extension_select_item ( # pylint: disable=unused-argument
192
- self , turn_context : TurnContext , query
199
+ self , turn_context : TurnContext , query
193
200
):
194
201
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
195
202
196
203
async def on_teams_messaging_extension_submit_action_dispatch (
197
- self , turn_context : TurnContext , action
204
+ self , turn_context : TurnContext , action : MessagingExtensionAction
198
205
):
199
- if not action :
206
+ if not action . bot_message_preview_action :
200
207
return await self .on_teams_messaging_extension_submit_action_activity (
201
208
turn_context , action
202
209
)
@@ -227,17 +234,17 @@ async def on_teams_messaging_extension_bot_message_send_activity( # pylint: dis
227
234
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
228
235
229
236
async def on_teams_messaging_extension_submit_action_activity ( # pylint: disable=unused-argument
230
- self , turn_context : TurnContext , action
237
+ self , turn_context : TurnContext , action : MessagingExtensionAction
231
238
):
232
239
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
233
240
234
241
async def on_teams_messaging_extension_fetch_task ( # pylint: disable=unused-argument
235
- self , turn_context : TurnContext , task_module_request
242
+ self , turn_context : TurnContext , action : MessagingExtensionAction
236
243
):
237
244
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
238
245
239
246
async def on_teams_messaging_extension_configuration_query_settings_url ( # pylint: disable=unused-argument
240
- self , turn_context : TurnContext , query
247
+ self , turn_context : TurnContext , query : MessagingExtensionQuery
241
248
):
242
249
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
243
250
@@ -252,12 +259,12 @@ async def on_teams_messaging_extension_card_button_clicked( # pylint: disable=u
252
259
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
253
260
254
261
async def on_teams_task_module_fetch ( # pylint: disable=unused-argument
255
- self , turn_context : TurnContext , task_module_request
262
+ self , turn_context : TurnContext , task_module_request : TaskModuleRequest
256
263
):
257
264
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
258
265
259
266
async def on_teams_task_module_submit ( # pylint: disable=unused-argument
260
- self , turn_context : TurnContext , task_module_request
267
+ self , turn_context : TurnContext , task_module_request : TaskModuleRequest
261
268
):
262
269
raise _InvokeResponseException (status_code = HTTPStatus .NOT_IMPLEMENTED )
263
270
@@ -290,7 +297,7 @@ async def on_conversation_update_activity(self, turn_context: TurnContext):
290
297
return await self .on_teams_channel_renamed_activity (
291
298
channel_data .channel , channel_data .team , turn_context
292
299
)
293
- if channel_data .eventType == "teamRenamed" :
300
+ if channel_data .event_type == "teamRenamed" :
294
301
return await self .on_teams_team_renamed_activity (channel_data .team , turn_context )
295
302
return await super ().on_conversation_update_activity (turn_context )
296
303