語言

BotFrameworkAdapter 類別

定義

可將 Bot 連線至服務端點的 Bot 配接器。

public class BotFrameworkAdapter : Microsoft.Bot.Builder.BotAdapter, Microsoft.Bot.Builder.IExtendedUserTokenProvider, Microsoft.Bot.Builder.Integration.IAdapterIntegration, Microsoft.Bot.Builder.OAuth.IConnectorClientBuilder
type BotFrameworkAdapter = class
    inherit BotAdapter
    interface IAdapterIntegration
    interface IExtendedUserTokenProvider
    interface IUserTokenProvider
    interface IConnectorClientBuilder
Public Class BotFrameworkAdapter
Inherits BotAdapter
Implements IAdapterIntegration, IConnectorClientBuilder, IExtendedUserTokenProvider
繼承
BotFrameworkAdapter
衍生
實作

備註

仍支援 BotFrameworkAdapter,但建議的適配卡是 'CloudAdapter'。 Bot 配接器會封裝驗證程式,並將活動傳送至 Bot Connector Service 並從中接收活動。 當 Bot 收到活動時,配接器會建立內容物件、將它傳遞給 Bot 的應用程式邏輯,並將回應傳回使用者的通道。

用 Use(IMiddleware) 來將物件加入 IMiddleware 你的轉接器的中介軟體集合。 配接器會透過 Bot 中間件管線將傳入的活動處理並導向至 Bot 的邏輯,然後再次返回。 當每個活動進出 Bot 時,每個中間件都可以在 Bot 邏輯執行前後檢查或處理活動。

建構函式

名稱 Description
BotFrameworkAdapter(AppCredentials, AuthenticationConfiguration, IChannelProvider, RetryPolicy, HttpClient, IMiddleware, ILogger)

使用認證提供者,初始化 BotFrameworkAdapter 類別的新實例。

BotFrameworkAdapter(ICredentialProvider, AuthenticationConfiguration, IChannelProvider, RetryPolicy, HttpClient, IMiddleware, ILogger)

使用認證提供者,初始化 BotFrameworkAdapter 類別的新實例。

BotFrameworkAdapter(ICredentialProvider, IChannelProvider, RetryPolicy, HttpClient, IMiddleware, ILogger)

使用認證提供者,初始化 BotFrameworkAdapter 類別的新實例。

欄位

名稱 Description
BotIdentityKey

Bot 識別金鑰的字串值。

(繼承來源 BotAdapter)
InvokeResponseKey

任何位於 TurnState 上的 InvokeResponseActivity 索引鍵值。

(繼承來源 BotAdapter)
OAuthScopeKey

OAuth 範圍密鑰的字串值。

(繼承來源 BotAdapter)

屬性

名稱 Description
AppCredentialMap

它會取得這個轉接器應用程式的 AppCredentials 映射。

ChannelProvider

取得這個配接器的通道提供者。

CredentialProvider

取得這個配接器的認證提供者。

HttpClient

如果有指定,我會取得這個轉接器的客製化 HttpClient 版本。

Logger

取得這個配接器的記錄器。

MiddlewareSet

取得配接器管線中的中間件集合。

(繼承來源 BotAdapter)
OnTurnError

取得或設定錯誤處理程式,這個處理程式可以攔截中間件或應用程式中的例外狀況。

(繼承來源 BotAdapter)

方法

名稱 Description
BuildCredentialsAsync(String, String)

邏輯用來建立 AppCredentials 一個物件,用於取得此 HttpClient 的標記。

CanProcessOutgoingActivity(Activity)

子類別加入處理傳出活動的機會。

ContinueConversationAsync(ClaimsIdentity, Activity, BotCallbackHandler, CancellationToken)

將主動式訊息傳送至交談。

(繼承來源 BotAdapter)
ContinueConversationAsync(ClaimsIdentity, Activity, String, BotCallbackHandler, CancellationToken)

將主動式訊息傳送至交談。

(繼承來源 BotAdapter)
ContinueConversationAsync(ClaimsIdentity, ConversationReference, BotCallbackHandler, CancellationToken)

將主動式訊息從 Bot 傳送至交談。

ContinueConversationAsync(ClaimsIdentity, ConversationReference, String, BotCallbackHandler, CancellationToken)

將主動式訊息從 Bot 傳送至交談。

ContinueConversationAsync(String, Activity, BotCallbackHandler, CancellationToken)

將主動式訊息傳送至交談。

(繼承來源 BotAdapter)
ContinueConversationAsync(String, ConversationReference, BotCallbackHandler, CancellationToken)

將主動式訊息從 Bot 傳送至交談。

CreateConversationAsync(String, String, AppCredentials, ConversationParameters, BotCallbackHandler, CancellationToken)

在指定的通道上建立交談。

CreateConversationAsync(String, String, AppCredentials, ConversationParameters, BotCallbackHandler, ConversationReference, CancellationToken)
已淘汰.

在指定的通道上建立交談。 多載會接收 ConversationReference,包括租使用者。

CreateConversationAsync(String, String, MicrosoftAppCredentials, ConversationParameters, BotCallbackHandler, CancellationToken)

在指定的通道上建立交談。

CreateConversationAsync(String, String, MicrosoftAppCredentials, ConversationParameters, BotCallbackHandler, ConversationReference, CancellationToken)
已淘汰.

在指定的通道上建立交談。 多載會接收 ConversationReference,包括租使用者。

CreateConversationAsync(String, String, String, String, ConversationParameters, BotCallbackHandler, CancellationToken)

在指定的通道上建立交談。

(繼承來源 BotAdapter)
CreateOAuthApiClientAsync(ITurnContext, AppCredentials)

使用認證建立 Bot 的 OAuth 用戶端。

CreateOAuthApiClientAsync(ITurnContext)

建立 Bot 的 OAuth 用戶端。

DeleteActivityAsync(ITurnContext, ConversationReference, CancellationToken)

刪除交談中的現有活動。

DeleteConversationMemberAsync(ITurnContext, String, CancellationToken)

從目前的交談中移除成員。

ExchangeTokenAsync(ITurnContext, AppCredentials, String, String, TokenExchangeRequest, CancellationToken)

執行令牌交換作業,例如單一登錄。

ExchangeTokenAsync(ITurnContext, String, String, TokenExchangeRequest, CancellationToken)

執行令牌交換作業,例如單一登錄。

GetAadTokensAsync(ITurnContext, AppCredentials, String, String[], String, CancellationToken)

使用自定義的 AppCredentials,擷取已設定連線上特定資源的 Azure Active Directory 令牌。

GetAadTokensAsync(ITurnContext, String, String[], String, CancellationToken)

使用 Bot 的 AppCredentials,擷取已設定連線上特定資源的 Azure Active Directory 令牌。

GetActivityMembersAsync(ITurnContext, String, CancellationToken)

列出指定活動的成員。

GetConversationMembersAsync(ITurnContext, CancellationToken)

列出目前交談的成員。

GetConversationsAsync(ITurnContext, String, CancellationToken)

列出此 Bot 參與指定通道伺服器的交談。 通道伺服器以頁面形式回傳結果,每個頁面都會包含 continuationToken 可用來從伺服器取得下一頁結果的

GetConversationsAsync(String, MicrosoftAppCredentials, String, CancellationToken)

列出此 Bot 參與指定通道伺服器的交談。 通道伺服器以頁面形式回傳結果,每個頁面都會包含 continuationToken 可用來從伺服器取得下一頁結果的

GetOauthSignInLinkAsync(ITurnContext, AppCredentials, String, CancellationToken)

使用自定義的 AppCredentials,取得要傳送給使用者以登入連線名稱的原始登入連結。

GetOauthSignInLinkAsync(ITurnContext, AppCredentials, String, String, String, CancellationToken)

使用自定義的 AppCredentials,取得要傳送給使用者以登入連線名稱的原始登入連結。

GetOauthSignInLinkAsync(ITurnContext, String, CancellationToken)

使用 Bot 的 AppCredentials,取得要傳送給使用者以登入連線名稱的原始登入連結。

GetOauthSignInLinkAsync(ITurnContext, String, String, String, CancellationToken)

使用 Bot 的 AppCredentials,取得要傳送給使用者以登入連線名稱的原始登入連結。

GetSignInResourceAsync(ITurnContext, AppCredentials, String, String, String, CancellationToken)

取得要傳送給使用者以登入以取得連線名稱的原始登入連結。

GetSignInResourceAsync(ITurnContext, String, CancellationToken)

取得要傳送給使用者以登入以取得連線名稱的原始登入連結。

GetSignInResourceAsync(ITurnContext, String, String, String, CancellationToken)

取得要傳送給使用者以登入以取得連線名稱的原始登入連結。

GetTokenStatusAsync(ITurnContext, AppCredentials, String, String, CancellationToken)

使用自定義的AppCredentials,擷取指定使用者每個已設定連線的令牌狀態。

GetTokenStatusAsync(ITurnContext, String, String, CancellationToken)

使用 Bot 的 AppCredentials,擷取指定使用者每個已設定連線的令牌狀態。

GetUserTokenAsync(ITurnContext, AppCredentials, String, String, CancellationToken)

嘗試使用自定義的AppCredentials擷取登入流程中使用者的令牌。

GetUserTokenAsync(ITurnContext, String, String, CancellationToken)

嘗試使用 Bot 的 AppCredentials 擷取登入流程中使用者的令牌。

ProcessActivityAsync(ClaimsIdentity, Activity, BotCallbackHandler, CancellationToken)

建立回合內容,並執行傳入活動的中間件管線。

ProcessActivityAsync(String, Activity, BotCallbackHandler, CancellationToken)

建立回合內容,並執行傳入活動的中間件管線。

ProcessOutgoingActivityAsync(ITurnContext, Activity, CancellationToken)

傳送傳出活動的自定義邏輯。 子類別可以覆寫這個方法以及 CanProcessOutgoingActivity,以擁有自定義邏輯來處理傳出活動。

RunPipelineAsync(ITurnContext, BotCallbackHandler, CancellationToken)

啟動目前 Bot 回合的活動處理。

(繼承來源 BotAdapter)
SendActivitiesAsync(ITurnContext, Activity[], CancellationToken)

將活動傳送至交談。

SignOutUserAsync(ITurnContext, AppCredentials, String, String, CancellationToken)

使用自定義的 AppCredentials,以令牌伺服器將用戶登出。

SignOutUserAsync(ITurnContext, String, String, CancellationToken)

使用 Bot 的 AppCredentials,以令牌伺服器將用戶註銷。

UpdateActivityAsync(ITurnContext, Activity, CancellationToken)

取代交談中的現有活動。

Use(IMiddleware)

將中間件新增至配接器的管線。

明確介面實作

名稱 Description
IConnectorClientBuilder.CreateConnectorClientAsync(String, ClaimsIdentity, String, CancellationToken)

可將 Bot 連線至服務端點的 Bot 配接器。

擴充方法

名稱 Description
UseBotState(BotAdapter, BotState[])

在轉接器中加入中介軟體,以便在回合上下文中註冊一個或多個 BotState 物件。 中間件會在每次回合開始時,於回合內容上註冊狀態物件。

UseState(BotAdapter, UserState, ConversationState, Boolean)
已淘汰.

向配接器註冊用戶和交談狀態物件。 這些物件將透過回合上下文的 TurnState.Get<T>() 方法 提供。

UseStorage(BotAdapter, IStorage)

在轉接器中加入中介軟體,以便在回合上下文中註冊 IStorage 物件。 中間件會在每次回合開始時,於回合內容上註冊狀態物件。

適用於

另請參閱