private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result) { var activity = await result as Activity; // calculate something for us to return //Lets use something like this to prevent over long input. int length = (activity.Text ?? string.Empty).Length; //var response = "ElderBot is responding"; //This will call an method that will pull from the database. var topic = activity.Text; var response = GetBotResponse.Response(topic); // return bot reply to the user await context.PostAsync($"{response}"); //write bot replay to MessageLogDatabase LogMessageToDb.WriteToDatabase ( conversationid: activity.Conversation.Id , username: "******" , channel: activity.ChannelId , message: response ); context.Wait(MessageReceivedAsync); }
public async Task None(IDialogContext context, LuisResult result) { t = result.TopScoringIntent.Intent; string topic = t; string message = GetBotResponse.Response(topic); //write to database LogMessageToDb.WriteToDatabase ( conversationid: context.Activity.Conversation.Id , username: "******" , channel: context.Activity.ChannelId , message: message ); await context.PostAsync(message); context.Wait(this.MessageReceived); }