Spaces:
Build error
Build error
File size: 1,300 Bytes
0827183 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import uuid
from botbuilder.core import (
ActivityHandler,
TurnContext,
MessageFactory,
)
from botbuilder.integration import BotFrameworkHttpClient
from botbuilder.schema import DeliveryModes
class ParentBot(ActivityHandler):
def __init__(
self, skill_client: BotFrameworkHttpClient,
):
self.client = skill_client
async def on_message_activity(self, turn_context: TurnContext):
await turn_context.send_activity("parent: before child")
activity = MessageFactory.text("parent to child")
TurnContext.apply_conversation_reference(
activity, TurnContext.get_conversation_reference(turn_context.activity)
)
activity.delivery_mode = DeliveryModes.expect_replies
activities = await self.client.post_buffered_activity(
None,
"toBotId",
"http://localhost:3979/api/messages",
"http://tempuri.org/whatever",
str(uuid.uuid4()),
activity,
)
if activities:
await turn_context.send_activities(activities)
await turn_context.send_activity("parent: after child")
|