botbuilder-core package

ActivityFactory

ActivityFactory 用于生成文本,然后使用简单的 markdown 语义(如 chatdown)创建活动。

ActivityHandler

机器人的事件发出活动处理程序。 扩展 ActivityHandlerBase

ActivityHandlerBase

定义机器人的事件发出活动处理程序的核心行为。

AutoSaveStateMiddleware

将在轮次结束时自动保存任何状态更改的中间件。

BotAdapter

定义可将机器人连接到服务终结点的机器人适配器的核心行为。

BotComponent

BotComponent 的定义,允许注册服务、自定义作、内存范围和适配器。 若要使组件可供系统使用,请派生自 BotComponent 并注册服务以添加功能。 然后,这些组件由需要它们的系统在适当的位置使用。 使用 Composer 时,只要在配置中注册了组件,configureServices 就会在机器人运行时自动调用组件。

BotState

框架状态持久化范围的基类。

BotStatePropertyAccessor

StatePropertyAccessor 接口的特定实现 BotState

BotStateSet

应作为单个单元并行加载或保存的 BotState 插件的集合。 有关此类的实现,请参阅 AutoSaveStateMiddleware

NullTelemetryClient

实现 BotTelemetryClient的 null 机器人遥测客户端。

BrowserLocalStorage

使用浏览器本地存储的存储提供程序。

BrowserSessionStorage

使用浏览器会话存储的存储提供程序。

CardFactory

提供用于设置机器人可以返回的各种卡类型的格式的方法。

CloudAdapterBase

实现 Bot Framework 协议的适配器,可托管在公共和专用的不同云环境中。

ComponentRegistration

ComponentRegistration 是用于从组件中发现资产的签名类。

ConfigurationBotFrameworkAuthentication

使用身份验证值或 配置 实例从对象创建 BotFrameworkAuthentication 实例。

ConfigurationServiceClientCredentialFactory

ServiceClientCredentialsFactory,它使用 ConfigurationServiceClientCredentialFactoryOptionsConfiguration 实例,以使用 AppId 和应用密码生成 ServiceClientCredentials。

ConversationState

读取和写入机器人到存储的对话状态。

InvokeException

调用响应错误的自定义异常。

MemoryStorage

机器人的基于内存的存储提供程序。

MemoryTranscriptStore

内存脚本存储将脚本存储在 Map 中的易失性内存中。

MessageFactory

一组实用工具函数,可帮助机器人返回的各种消息类型的格式设置。

MiddlewareSet

一组 Middleware 插件。

PrivateConversationState

读取和写入机器人到存储的 PrivateConversation 状态。

QueueStorage

一个基类,用于排队活动以供以后处理。

RegisterClassMiddleware

用于向当前轮次上下文添加对象或向服务注册的中间件。

ShowTypingMiddleware

将为每个消息自动发送键入指示器的中间件。

SkillConversationIdFactory

一个 SkillConversationIdFactory,用于存储和检索 ConversationReference 实例。

SkillConversationIdFactoryBase

定义用于为技能会话创建唯一聊天 ID 的工厂的方法。

SkypeMentionNormalizeMiddleware

用于修补 Skype 中的实体的中间件,因为它们不符合预期值。 如果使用提及,与 Skype 交互的机器人应使用此中间件。

StringUtils

包含字符串实用工具方法的帮助程序类。

TelemetryConstants

定义用于 BotTelemetryClient 对象的常用属性的名称。

TelemetryLoggerMiddleware

用于记录传入、传出、更新或删除活动消息的中间件。 使用 botTelemetryClient 接口。

TestAdapter

用于单元测试的测试适配器。 此适配器可用于模拟将消息从用户发送到机器人。

TestFlow

允许简单构造一系列测试的 TestAdapter 支持类。

ConsoleTranscriptLogger

ConsoleTranscriptLogger,将活动写入控制台输出。

TranscriptLoggerMiddleware

将传入和传出活动记录到 TranscriptStore。

TurnContext

提供机器人轮次的上下文。

TurnContextStateCollection

作为 TurnContext的一部分,在轮次生存期内保留的值。

UserState

读取机器人的用户状态并将其写入存储。

接口

CachedBotState

BotState 实例缓存的上下文对象的状态信息。

StatePropertyAccessor

定义用于访问在 BotState 对象中创建的状态属性的方法。

BotPageViewTelemetryClient
BotTelemetryClient
TelemetryDependency
TelemetryEvent
TelemetryException
TelemetryPageView
TelemetryTrace
CoreAppCredentials

CoreAppCredentials

CoreWebResource

表示来自 @azure/ms-rest-js 的“WebResource”的内部接口

ExtendedUserTokenProvider

BotAdapters 的用户令牌 OAuth 单一登录和令牌交换 API 的接口

IntentScore

分数加上有关意向的任何其他信息。

Middleware

接口由基于对象的中间件实现。

PropertyManager

由能够分解属性访问器的类实现的接口。

RecognizerResult

从识别器返回的值。

BotFrameworkSkill

注册基于 BotFrameworkHttpProtocol 的技能终结点。

SkillConversationIdFactoryOptions
SkillConversationReference
Storage

存储提供程序的接口,用于存储和检索纯旧 JSON 对象。

StoreItem

存储在存储中的可选 eTag 的对象。

StoreItems

命名 StoreItem 对象的映射。

PagedResult

结果页。

TranscriptInfo

存储脚本的元数据。

TranscriptLogger

脚本记录器存储对话活动以供召回。

TranscriptStore

脚本记录器存储对话活动以供召回。

IUserTokenProvider

BotAdapters 的用户界面 OAuth API

TokenPollingSettings

提供有关令牌轮询的详细信息。

类型别名

BotHandler

描述用于 ActivityHandler 对象的机器人活动事件处理程序。

ConfigurationBotFrameworkAuthenticationOptions

包含用于配置 ConfigurationBotFrameworkAuthentication 实例的设置。

ConfigurationServiceClientCredentialFactoryOptions

包含用于配置 ConfigurationServiceClientCredentialFactory 实例的设置。

MiddlewareHandler

由基于函数的中间件实现的签名。

type MiddlewareHandler = (context: TurnContext, next: () => Promise<void>) => Promise<void>;
StorageKeyFactory

用于计算存储密钥的回调。

type StorageKeyFactory = (context: TurnContext) => Promise<string>;
TestActivityInspector

可用于检查使用 TestAdapter测试的机器人返回的单个活动的函数的签名。

type TestActivityInspector = (activity: Partial<Activity>, description: string) => void;
DeleteActivityHandler

可以参与当前轮次的删除活动事件的处理程序。

SendActivitiesHandler

可以参与当前轮次的发送活动事件的处理程序。

UpdateActivityHandler

可以参与当前轮次更新活动事件的处理程序。

枚举

Severity

定义事件的严重性级别。

函数

useBotState(BotAdapter, BotState[])

将中间件添加到适配器,以在轮次上下文上注册一个或多个 BotState 对象。 中间件在每个轮次开始时在轮次上下文上注册状态对象。

assertBotComponent(unknown, unknown[])
telemetryTrackDialogView(BotTelemetryClient, string, [key: string]: any, [key: string]: number)

如果已实现 BotPageViewTelemetryClient,则使用 BotTelemetryClient 上的 trackPageView 方法记录 DialogView。 或者通过 TrackTrace 记录信息。

createBotFrameworkAuthenticationFromConfiguration(Configuration, ServiceClientCredentialsFactory, AuthenticationConfiguration, (input: RequestInfo, init?: RequestInit) => Promise<Response>, ConnectorClientOptions)

创建 ConfigurationBotFrameworkAuthentication 类的新实例。

createServiceClientCredentialFactoryFromConfiguration(Configuration)

创建 ConfigurationServiceClientCredentialFactory 类的新实例。

assertStoreItems(unknown, unknown[])
calculateChangeHash(StoreItem)

用于计算 StoreItem更改哈希的实用工具函数。

函数详细信息

useBotState(BotAdapter, BotState[])

将中间件添加到适配器,以在轮次上下文上注册一个或多个 BotState 对象。 中间件在每个轮次开始时在轮次上下文上注册状态对象。

function useBotState(botAdapter: BotAdapter, botStates: BotState[]): BotAdapter

参数

botAdapter
BotAdapter

要在其中注册状态对象的适配器。

botStates

BotState[]

要注册的状态对象。

返回

更新的适配器。

assertBotComponent(unknown, unknown[])

警告

现已弃用此 API。

Use BotComponent.z.parse() instead.

function assertBotComponent(val: unknown, _args: unknown[]): asserts

参数

val

unknown

_args

unknown[]

返回

asserts

telemetryTrackDialogView(BotTelemetryClient, string, [key: string]: any, [key: string]: number)

如果已实现 BotPageViewTelemetryClient,则使用 BotTelemetryClient 上的 trackPageView 方法记录 DialogView。 或者通过 TrackTrace 记录信息。

function telemetryTrackDialogView(telemetryClient: BotTelemetryClient, dialogName: string, properties?: [key: string]: any, metrics?: [key: string]: number)

参数

telemetryClient
BotTelemetryClient

实现 botTelemetryClient TelemetryClient。

dialogName

string

要记录条目/起始项的对话框的名称。

properties

[key: string]: any

可用于搜索和分类事件的命名字符串值。

metrics

[key: string]: number

与此事件关联的度量值。

createBotFrameworkAuthenticationFromConfiguration(Configuration, ServiceClientCredentialsFactory, AuthenticationConfiguration, (input: RequestInfo, init?: RequestInit) => Promise<Response>, ConnectorClientOptions)

创建 ConfigurationBotFrameworkAuthentication 类的新实例。

function createBotFrameworkAuthenticationFromConfiguration(configuration: Configuration, credentialsFactory?: ServiceClientCredentialsFactory, authConfiguration?: AuthenticationConfiguration, botFrameworkClientFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, connectorClientOptions?: ConnectorClientOptions): BotFrameworkAuthentication

参数

configuration

Configuration

配置 实例。

credentialsFactory

ServiceClientCredentialsFactory

ServiceClientCredentialsFactory 实例。

authConfiguration

AuthenticationConfiguration

配置 对象。

botFrameworkClientFetch

(input: RequestInfo, init?: RequestInit) => Promise<Response>

要用于 BotFrameworkClient的自定义 Fetch 实现。

connectorClientOptions

ConnectorClientOptions

ConnectorClientOptions 对象。

返回

BotFrameworkAuthentication

ConfigurationBotFrameworkAuthentication 实例。

注解

提供给构造函数的 配置 实例应具有所需的身份验证值,使用 ConfigurationBotFrameworkAuthenticationOptions 的属性作为其密钥。

createServiceClientCredentialFactoryFromConfiguration(Configuration)

创建 ConfigurationServiceClientCredentialFactory 类的新实例。

function createServiceClientCredentialFactoryFromConfiguration(configuration: Configuration): ConfigurationServiceClientCredentialFactory

参数

configuration

Configuration

配置 实例。

返回

ConfigurationServiceClientCredentialFactory 实例。

注解

提供给构造函数的 配置 实例应具有根目录中所需的身份验证值,使用 ConfigurationServiceClientCredentialFactoryOptions 的属性作为其密钥。

assertStoreItems(unknown, unknown[])

警告

现已弃用此 API。

Use zod.record(zod.unknown()) instead.

function assertStoreItems(val: unknown, _args: unknown[]): asserts

参数

val

unknown

_args

unknown[]

返回

asserts

calculateChangeHash(StoreItem)

用于计算 StoreItem更改哈希的实用工具函数。

function calculateChangeHash(item: StoreItem): string

参数

item
StoreItem

要计算其更改哈希的项。

返回

string

更改哈希字符串

注解

本示例计算已读入对象的更改哈希,然后仅将其写回(如果已修改):

// Calculate state objects initial hash
const hash = calculateChangeHash(state);

// Process the received activity
await processActivity(context, state);

// Save state if changed
if (calculateChangeHash(state) !== hash) {
   await storage.write({ 'botState': state });
}