Commit 7b296d5f by Oleksandr Barabash

plural cards added

parent 266918b3
......@@ -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:
......
......@@ -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,
......
......@@ -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]]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment