botbuilder-core package
類別
| ActivityFactory |
ActivityFactory 產生文字,然後使用簡單的 Markdown 語意,例如 chatdown 來建立 Activity。 |
| ActivityHandler |
Bot 的事件發出活動處理程式。 擴充 ActivityHandlerBase。 |
| ActivityHandlerBase |
定義 Bot 事件發出活動處理程式的核心行為。 |
| AutoSaveStateMiddleware |
中間件,會在回合結束時自動儲存任何狀態變更。 |
| BotAdapter |
定義可將 Bot 連線至服務端點之 Bot 配接器的核心行為。 |
| BotComponent |
允許註冊服務、自定義動作、記憶體範圍和配接器之 BotComponent 的定義。 若要讓您的元件可供系統使用,請衍生自 BotComponent 並註冊服務以新增功能。 這些元件接著會由需要這些元件的系統在適當的位置取用。 使用 Composer 時,只要元件已在元件中註冊,Bot 運行時間就會在元件上自動呼叫 configureServices。 |
| BotState |
架構狀態保存範圍的基類。 |
| BotStatePropertyAccessor |
|
| BotStateSet |
|
| NullTelemetryClient |
實作 BotTelemetryClient的 Null Bot 遙測用戶端。 |
| BrowserLocalStorage |
使用瀏覽器本機記憶體的記憶體提供者。 |
| BrowserSessionStorage |
使用瀏覽器會話記憶體的記憶體提供者。 |
| CardFactory |
提供方法,以格式化 Bot 可以傳回的各種卡片類型。 |
| CloudAdapterBase |
實作 Bot Framework 通訊協定的配接器,而且可以裝載於公用和私人的不同雲端環境中。 |
| ComponentRegistration |
ComponentRegistration 是用來探索元件資產的簽章類別。 |
| ConfigurationBotFrameworkAuthentication |
使用驗證值或 組態 實例,從物件建立 BotFrameworkAuthentication 實例。 |
| ConfigurationServiceClientCredentialFactory |
使用 ConfigurationServiceClientCredentialFactoryOptions 或 Configuration 實例來建置 ServiceClientCredentials 與 AppId 和應用程式密碼的 ServiceClientCredentials 的 ServiceClientCredentials。 |
| ConversationState |
讀取和寫入 Bot 的交談狀態至記憶體。 |
| InvokeException |
叫用回應錯誤的自定義例外狀況。 |
| MemoryStorage |
Bot 的記憶體型記憶體型記憶體提供者。 |
| MemoryTranscriptStore |
記憶體文字記錄存放區會將文字記錄儲存在 Map 中的揮發性記憶體中。 |
| MessageFactory |
一組公用程式函式,可協助 Bot 傳回的各種訊息類型格式設定。 |
| MiddlewareSet |
一組 |
| PrivateConversationState |
讀取和寫入 Bot 的 PrivateConversation 狀態至記憶體。 |
| QueueStorage |
將活動加入佇列以便稍後處理的基類。 |
| RegisterClassMiddleware |
中間件,用於將物件新增至或向目前的回合內容註冊服務。 |
| ShowTypingMiddleware |
中間件,會自動為每個訊息傳送輸入指標。 |
| SkillConversationIdFactory |
SkillConversationIdFactory,可儲存和擷取 ConversationReference 實例。 |
| SkillConversationIdFactoryBase |
定義處理站的方法,用來為技能交談建立唯一的交談標識符。 |
| SkypeMentionNormalizeMiddleware |
要修補的中間件提及來自 Skype 的實體,因為它們不符合預期值。 如果使用提及,與 Skype 互動的 Bot 應該使用此中間件。 |
| StringUtils |
包含字串公用程式方法的 Helper 類別。 |
| TelemetryConstants |
定義與 BotTelemetryClient 物件搭配使用的通用屬性名稱。 |
| TelemetryLoggerMiddleware |
用於記錄傳入、傳出、更新或刪除活動訊息的中間件。 使用 botTelemetryClient 介面。 |
| TestAdapter |
用於單元測試的測試配接器。 此配接器可用來模擬將訊息從用戶傳送至 Bot。 |
| TestFlow |
允許簡單建構一系列測試之 |
| ConsoleTranscriptLogger |
ConsoleTranscriptLogger 會將活動寫入主控台輸出。 |
| TranscriptLoggerMiddleware |
將傳入和傳出活動記錄至 TranscriptStore。 |
| TurnContext |
提供 Bot 回合的內容。 |
| TurnContextStateCollection |
回合存留期所保存的值,做為 TurnContext的一部分。 |
| UserState |
讀取和寫入 Bot 至記憶體的用戶狀態。 |
介面
| CachedBotState |
|
| 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 |
具名 |
| PagedResult |
結果的頁面。 |
| TranscriptInfo |
預存文字記錄的元數據。 |
| TranscriptLogger |
文字記錄器會儲存交談的活動以供召回。 |
| TranscriptStore |
文字記錄器會儲存交談的活動以供召回。 |
| IUserTokenProvider |
適用於 BotAdapters 的使用者令牌 OAuth API 介面 |
| TokenPollingSettings |
提供令牌輪詢的詳細數據。 |
類型別名
| BotHandler |
描述 Bot 活動事件處理程式,以搭配 ActivityHandler 物件使用。 |
| ConfigurationBotFrameworkAuthenticationOptions |
包含用來設定 ConfigurationBotFrameworkAuthentication 實例的設定。 |
| ConfigurationServiceClientCredentialFactoryOptions |
包含用來設定 ConfigurationServiceClientCredentialFactory 實例的設定。 |
| MiddlewareHandler |
函式中間件所實作的簽章。
|
| StorageKeyFactory |
回呼以計算機金鑰。
|
| TestActivityInspector |
函式的簽章,可用來檢查 Bot 使用
|
| DeleteActivityHandler |
處理程式,可以參與目前回合的刪除活動事件。 |
| SendActivitiesHandler |
可參與目前回合之傳送活動事件的處理程式。 |
| UpdateActivityHandler |
處理程式,可以參與目前回合的更新活動事件。 |
列舉
| Severity |
定義事件的嚴重性層級。 |
函式
| use |
將中間件新增至配接器,以在回合內容上註冊一或多個 BotState 物件。 中間件會在每次回合開始時,於回合內容上註冊狀態物件。 |
| assert |
|
| telemetry |
如果已實作 BotPageViewTelemetryClient,請使用 BotTelemetryClient 上的 trackPageView 方法記錄 DialogView。 或者,透過 TrackTrace 記錄資訊。 |
| create |
建立 ConfigurationBotFrameworkAuthentication 類別的新實例。 |
| create |
建立 ConfigurationServiceClientCredentialFactory 類別的新實例。 |
| assert |
|
| calculate |
公用程式函式,用來計算 |
函式詳細資料
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
- 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
- authConfiguration
-
AuthenticationConfiguration
Configuration 物件。
- botFrameworkClientFetch
-
(input: RequestInfo, init?: RequestInit) => Promise<Response>
要用於 BotFrameworkClient的自定義 Fetch 實作。
- connectorClientOptions
-
ConnectorClientOptions
傳回
BotFrameworkAuthentication
ConfigurationBotFrameworkAuthentication 實例。
備註
提供給建構函式的 組態 實例應具有根目錄所需的驗證值,並使用 configurationBotFrameworkAuthenticationOptions 的屬性作為其索引鍵。
createServiceClientCredentialFactoryFromConfiguration(Configuration)
建立 ConfigurationServiceClientCredentialFactory 類別的新實例。
function createServiceClientCredentialFactoryFromConfiguration(configuration: Configuration): ConfigurationServiceClientCredentialFactory
參數
- configuration
-
Configuration
組態 實例。
傳回
ConfigurationServiceClientCredentialFactory 實例。
備註
提供給建構函式的 Configuration 實例應具有根目錄所需的驗證值,並使用 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 });
}