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
7b296d5f
Commit
7b296d5f
authored
Jan 05, 2023
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plural cards added
parent
266918b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
app.py
app.py
+2
-1
messaging_extension_action_preview_bot.py
bots/messaging_extension_action_preview_bot.py
+8
-8
pa_message.py
entities/json/pa_message.py
+2
-1
No files found.
app.py
View file @
7b296d5f
...
...
@@ -259,7 +259,8 @@ async def v1_pa_message(request: Request) -> Response:
response
=
await
BOT
.
send_message
(
pa_message
.
conversation_id
,
pa_message
.
tenant_id
,
pa_message
.
text
,
pa_message
.
card
)
pa_message
.
card
,
pa_message
.
cards
)
Log
.
d
(
TAG
,
f
"v1_pa_message::notification: '{response}'"
)
return
make_response
(
200
,
"OK"
)
except
Exception
:
...
...
bots/messaging_extension_action_preview_bot.py
View file @
7b296d5f
...
...
@@ -85,7 +85,8 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
def
send_message
(
self
,
conversation_id
:
str
,
tenant_id
:
str
,
text
:
str
=
None
,
card
:
Optional
[
Union
[
List
,
Dict
[
any
,
any
]]]
=
None
card
:
Optional
[
Dict
[
any
,
any
]]
=
None
,
cards
:
Optional
[
List
[
Dict
[
any
,
any
]]]
=
None
)
->
Future
[
ResourceResponse
]:
""" Send message as a bot """
io_loop
=
asyncio
.
get_event_loop
()
...
...
@@ -108,13 +109,12 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
""" Turn Context callback. Kinda awful syntax, I know """
try
:
attachments
=
None
if
card
is
not
None
:
if
isinstance
(
card
,
list
):
attachments
=
[
CardFactory
.
adaptive_card
(
x
)
for
x
in
card
]
else
:
attachments
=
[
CardFactory
.
adaptive_card
(
card
)]
if
cards
is
not
None
:
attachments
=
[
CardFactory
.
adaptive_card
(
x
)
for
x
in
cards
]
elif
card
is
not
None
:
attachments
=
[
CardFactory
.
adaptive_card
(
card
)]
response
=
await
turn_context
.
send_activity
(
Activity
(
type
=
ActivityTypes
.
message
,
...
...
entities/json/pa_message.py
View file @
7b296d5f
...
...
@@ -11,4 +11,5 @@ class PAMessage(CamelCaseMixin):
conversation_id
:
str
tenant_id
:
str
text
:
Optional
[
str
]
card
:
Optional
[
Union
[
Dict
,
List
]]
card
:
Optional
[
Dict
]
cards
:
Optional
[
List
[
Dict
]]
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