CloudAdapterBase 类
构造函数
CloudAdapterBase(bot_framework_authentication: BotFrameworkAuthentication)
参数
| 名称 | 说明 |
|---|---|
|
bot_framework_authentication
必需
|
|
方法
| continue_conversation |
向对话发送主动消息。 调用此方法以主动将消息发送到对话。 大多数通道要求用户启动与机器人的对话,然后机器人才能向用户发送活动。 并且通常位于 config.pyMicrosoftAppId 参数中。 :type bot_app_id:<xref:typing.str> |
| continue_conversation_with_claims | |
| create_claims_identity | |
| create_conversation | |
| delete_activity | |
| process_activity |
创建轮次上下文并运行传入活动的中间件管道。 |
| process_proactive | |
| send_activities | |
| update_activity |
continue_conversation
向对话发送主动消息。 调用此方法以主动将消息发送到对话。 大多数通道要求用户启动与机器人的对话,然后机器人才能向用户发送活动。
并且通常位于 config.pyMicrosoftAppId 参数中。 :type bot_app_id:<xref:typing.str>
async continue_conversation(reference: ConversationReference, callback: Callable, bot_app_id: str = None, claims_identity: ClaimsIdentity = None, audience: str = None)
参数
| 名称 | 说明 |
|---|---|
|
reference
必需
|
要继续的对对话的引用。 |
|
callback
必需
|
调用生成的机器人轮次的方法。 |
|
bot_app_id
|
机器人的应用程序 ID。 这是 Azure 门户注册返回的 appId, 默认值: None
|
|
claims_identity
|
默认值: None
|
|
audience
|
默认值: None
|
continue_conversation_with_claims
async continue_conversation_with_claims(claims_identity: ClaimsIdentity, reference: ConversationReference, audience: str, logic: Callable[[TurnContext], Awaitable])
参数
| 名称 | 说明 |
|---|---|
|
claims_identity
必需
|
|
|
reference
必需
|
|
|
audience
必需
|
|
|
logic
必需
|
|
create_claims_identity
create_claims_identity(bot_app_id: str = '') -> ClaimsIdentity
参数
| 名称 | 说明 |
|---|---|
|
bot_app_id
|
|
create_conversation
async create_conversation(bot_app_id: str, callback: Callable[[TurnContext], Awaitable] = None, conversation_parameters: ConversationParameters = None, channel_id: str = None, service_url: str = None, audience: str = None)
参数
| 名称 | 说明 |
|---|---|
|
bot_app_id
必需
|
|
|
callback
|
默认值: None
|
|
conversation_parameters
|
默认值: None
|
|
channel_id
|
默认值: None
|
|
service_url
|
默认值: None
|
|
audience
|
默认值: None
|
delete_activity
async delete_activity(context: TurnContext, reference: ConversationReference)
参数
| 名称 | 说明 |
|---|---|
|
context
必需
|
|
|
reference
必需
|
|
process_activity
创建轮次上下文并运行传入活动的中间件管道。
async process_activity(auth_header_or_authenticate_request_result: str | AuthenticateRequestResult, activity: Activity, logic: Callable[[TurnContext], Awaitable])
参数
| 名称 | 说明 |
|---|---|
|
auth_header
必需
|
Union[<xref:typing.str>,<xref: AuthenticateRequestResult>]
请求的 HTTP 身份验证标头 |
|
activity
必需
|
<xref:botbuilder.core.Activity>
传入活动 |
|
logic
必需
|
在适配器中间件管道末尾执行的逻辑。 |
|
auth_header_or_authenticate_request_result
必需
|
|
返回
| 类型 | 说明 |
|---|---|
|
表示要执行的工作的任务。 |
注解
此类处理机器人 Web 服务器接收的活动。 这包括从用户发送的任何消息,也是驱动通常称为机器人的方法,反应式消息传送 流。 调用此方法以被动方式将消息发送到对话。 如果任务成功完成,则返回 InvokeResponse;否则。 返回 null。
process_proactive
async process_proactive(claims_identity: ClaimsIdentity, continuation_activity: Activity, audience: str, logic: Callable[[TurnContext], Awaitable])
参数
| 名称 | 说明 |
|---|---|
|
claims_identity
必需
|
|
|
continuation_activity
必需
|
|
|
audience
必需
|
|
|
logic
必需
|
|
send_activities
async send_activities(context: TurnContext, activities: List[Activity]) -> List[ResourceResponse]
参数
| 名称 | 说明 |
|---|---|
|
context
必需
|
|
|
activities
必需
|
|
update_activity
async update_activity(context: TurnContext, activity: Activity)
参数
| 名称 | 说明 |
|---|---|
|
context
必需
|
|
|
activity
必需
|
|
属性
CONNECTOR_FACTORY_KEY
CONNECTOR_FACTORY_KEY = 'ConnectorFactory'
USER_TOKEN_CLIENT_KEY
USER_TOKEN_CLIENT_KEY = 'UserTokenClient'