Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cake-bot
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
cake-bot
Commits
c6248e99
Commit
c6248e99
authored
May 11, 2022
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hotfix on IDs
parent
dd601efc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
messaging_extension_action_preview_bot.py
bots/messaging_extension_action_preview_bot.py
+3
-0
cosmos_client.py
utils/cosmos_client.py
+7
-3
No files found.
bots/messaging_extension_action_preview_bot.py
View file @
c6248e99
...
@@ -98,12 +98,15 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
...
@@ -98,12 +98,15 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
""" Turn Context callback. Kinda awful syntax, I know """
""" Turn Context callback. Kinda awful syntax, I know """
# TODO(s1z): Add exception handler
# TODO(s1z): Add exception handler
# (like conversation not found etc...)
# (like conversation not found etc...)
try
:
card
=
CardHelper
.
create_notification_card
(
notification
)
card
=
CardHelper
.
create_notification_card
(
notification
)
attachments
=
[
CardFactory
.
adaptive_card
(
card
)]
attachments
=
[
CardFactory
.
adaptive_card
(
card
)]
message
=
Activity
(
type
=
ActivityTypes
.
message
,
message
=
Activity
(
type
=
ActivityTypes
.
message
,
attachments
=
attachments
)
attachments
=
attachments
)
await
turn_context
.
send_activity
(
message
)
await
turn_context
.
send_activity
(
message
)
future
.
set_result
(
notification
.
id
)
future
.
set_result
(
notification
.
id
)
except
Exception
as
e
:
future
.
set_exception
(
e
)
await
self
.
adapter
.
continue_conversation
(
reference
,
callback
,
await
self
.
adapter
.
continue_conversation
(
reference
,
callback
,
self
.
settings
.
app_id
)
self
.
settings
.
app_id
)
...
...
utils/cosmos_client.py
View file @
c6248e99
...
@@ -182,8 +182,13 @@ class CosmosClient:
...
@@ -182,8 +182,13 @@ class CosmosClient:
)
)
tries
=
0
tries
=
0
max_tries
=
max
(
kwargs
.
pop
(
"max_tries"
,
3
),
1
)
max_tries
=
max
(
kwargs
.
pop
(
"max_tries"
,
3
),
1
)
while
tries
<
max_tries
:
item_id
=
body
.
get
(
"id"
,
None
)
if
item_id
is
None
:
body
.
update
(
dict
(
id
=
uuid
.
uuid4
()
.
__str__
()))
body
.
update
(
dict
(
id
=
uuid
.
uuid4
()
.
__str__
()))
while
tries
<
max_tries
:
try
:
try
:
return
await
self
.
execute_blocking
(
bl
)
return
await
self
.
execute_blocking
(
bl
)
except
exceptions
.
CosmosHttpResponseError
as
e
:
except
exceptions
.
CosmosHttpResponseError
as
e
:
...
@@ -308,9 +313,8 @@ class CosmosClient:
...
@@ -308,9 +313,8 @@ class CosmosClient:
notification_id
:
str
)
->
None
:
notification_id
:
str
)
->
None
:
""" Save initiation """
""" Save initiation """
container
=
await
self
.
get_initiation_container
()
container
=
await
self
.
get_initiation_container
()
timestamp
=
timestamp_factory
()
initiation
=
Initiation
(
initiator
=
initiator
,
initiation
=
Initiation
(
initiator
=
initiator
,
timestamp
=
timestamp
,
timestamp
=
timestamp
_factory
()
,
notification_id
=
notification_id
)
notification_id
=
notification_id
)
data
=
Initiation
.
get_schema
()
.
dump
(
initiation
)
data
=
Initiation
.
get_schema
()
.
dump
(
initiation
)
await
self
.
create_item
(
container
,
body
=
data
)
await
self
.
create_item
(
container
,
body
=
data
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment