First thing: you should not be using SDK-V3 if you are starting now: use v4, which is generally available for a few months. v3 will not evolve in the future (apart from a few patches).
Then, have a look to the samples of v4 using QnA Maker
, here: https://github.com/Microsoft/BotBuilder-Samples/blob/master/samples/csharp_dotnetcore/11.qnamaker/QnAMaker/QnABot.cs
In this sample, you can see that you can implement your logic in QnABot.cs
:
public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
{
if (turnContext.Activity.Type == ActivityTypes.Message)
{
var response = await _services.QnAServices[QnAMakerKey].GetAnswersAsync(turnContext);
if (response != null && response.Length > 0)
{
}
else
{
var msg = @"No QnA Maker answers were found. This example uses a QnA Maker Knowledge Base that focuses on smart light bulbs.
To see QnA Maker in action, ask the bot questions like 'Why won't it turn on?' or 'I need help'.";
await turnContext.SendActivityAsync(msg, cancellationToken: cancellationToken);
}
}
else if (turnContext.Activity.Type == ActivityTypes.ConversationUpdate)
{
if (turnContext.Activity.MembersAdded != null)
{
await SendWelcomeMessageAsync(turnContext, cancellationToken);
}
}
else
{
await turnContext.SendActivityAsync($"{turnContext.Activity.Type} event detected", cancellationToken: cancellationToken);
}
}