Welcome messages are cool , but you don't necessarily need them . In my case i have multiple dialog's , with a MainDialog which is suppose to trigger other dialog's .
The issue i am having is ( using bot emulator) that the user has to type something before the main dialog is triggered .
cant we trigger a dialog when members are added ? Thanks for reading through :).Here is my entire class :
this bot code , derived from the richcardsbot sample here :
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using HackBot.Dialogs;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Schema;
using Microsoft.BotBuilderSamples.Bots;
using Microsoft.Extensions.Logging;
namespace HackBot.Bots
{
public class RichCardsBot : DialogBot<MainDialog>
{
public RichCardsBot(ConversationState conversationState, UserState userState, MainDialog dialog, ILogger<DialogBot<MainDilaog>> logger)
: base(conversationState, userState, dialog, logger)
{
}
protected override async Task OnMembersAddedAsync(IList<ChannelAccount> membersAdded, ITurnContext<IConversationUpdateActivity> turnContext, CancellationToken cancellationToken)
{
foreach (var member in membersAdded)
{
var attachments = new List<Attachment>();
// Greet anyone that was not the target (recipient) of this message.
// To learn more about Adaptive Cards, see https://aka.ms/msbot-adaptivecards for more details.
if (member.Id != turnContext.Activity.Recipient.Id)
{
var reply = MessageFactory.Attachment(attachments);
//var reply= MessageFactory.Text("The following flight has been cancelled ."
// + " You have a Hotel booking for the Destination."
// + "what would you like to do with the booking ?.");
reply.Attachments.Add(Cards.FirstCard().ToAttachment());
await turnContext.SendActivityAsync(reply, cancellationToken);
}
}
}
}
}