public async Task Do(LoggerBotContext context) { var logCategories = context.GetUserState <LoggerBotUserState>().FollowedLogCategories; var buttons = logCategories.Select(category => { return(new CardAction() { Type = ActionTypes.ImBack, Title = category, DisplayText = "Log " + category, Text = "Text Log " + category, Value = "Log " + category }); }).ToList(); var response = context.Activity.CreateReply(); var attachment = new ThumbnailCard() { Title = "", Subtitle = "", Text = "", Buttons = buttons }.ToAttachment(); response.Attachments = new List <Attachment>() { attachment }; await context.SendActivity(response); }
public async Task Handle(LoggerBotContext context) { // If Text is null, then the payload is from an adaptive card submission if (context.Activity.Text == null) { await this.HandleAdaptiveMessage(context); } else { await this.HandleTextMessage(context); } }
private async Task HandleTextMessage(LoggerBotContext context) { var msgText = context.Activity.Text; // Get the first trigger's Action whose Regex matches the incoming text var triggeredAction = this.TextTriggers.FirstOrDefault( trigger => trigger.Key.Match(msgText).Success).Value; // Answer with the default action if no trigger match was found triggeredAction = triggeredAction ?? new DefaultAction(); await triggeredAction.Do(context); }
public async Task Do(LoggerBotContext context) { var response = context.Activity.CreateReply(); var attachment = this.Card2(); response.Attachments = new List <Attachment>() { attachment }; await context.SendActivity(response); }
public async Task Do(LoggerBotContext context) { ////await context.SendActivity("Hello! (From HelloAction)"); var response = ""; foreach (var category in context.LogCategories) { response += category.Name + "\n"; } await context.SendActivity(response); }
public async Task Do(LoggerBotContext context) { var userId = context.Activity.From.Id; var serviceUrl = context.Activity.ServiceUrl; var botId = "28:" + LoggerBot.MicrosoftAppCredentials.MicrosoftAppId; var botName = "PlaceholderName"; var connectorClient = new ConnectorClient( baseUri: new Uri(serviceUrl), microsoftAppId: LoggerBot.MicrosoftAppCredentials.MicrosoftAppId, microsoftAppPassword: LoggerBot.MicrosoftAppCredentials.MicrosoftAppPassword); dynamic channelDataNew = new ExpandoObject(); dynamic tenantObj = new ExpandoObject(); tenantObj.id = "72f988bf-86f1-41af-91ab-2d7cd011db47"; channelDataNew.tenant = tenantObj; var parameters = new ConversationParameters { Bot = new ChannelAccount(botId, botName), Members = new ChannelAccount[] { new ChannelAccount(userId) }, ChannelData = channelDataNew, }; ConversationResourceResponse conversationResource = await connectorClient.Conversations.CreateConversationAsync(parameters); if (conversationResource != null) { var createdActivity = new Activity { From = new ChannelAccount(userId), Recipient = new ChannelAccount(botId, botName), Conversation = new ConversationAccount( id: conversationResource.Id, isGroup: false, name: "PlaceholderName"), ChannelId = "msteams", ServiceUrl = serviceUrl, }; ConversationReference conversationReference = TurnContext.GetConversationReference(createdActivity); await context.Adapter.ContinueConversation( LoggerBot.MicrosoftAppCredentials.MicrosoftAppId, conversationReference, async (ctx) => { await ctx.SendActivity("Proactive Message"); }); } }
private async Task HandleAdaptiveMessage(LoggerBotContext context) { dynamic value = context.Activity.Value; var adaptiveTrigger = value.AdaptiveTrigger; // Get the first trigger's Action whose trigger matches the incoming flag var triggeredAction = this.AdaptiveTriggers.FirstOrDefault( trigger => trigger == adaptiveTrigger).Value; // Answer with the default action if no trigger match was found triggeredAction = triggeredAction ?? new AdaptiveDefaultAction(); await triggeredAction.Do(context); }
public async Task Do(LoggerBotContext context) { await context.SendActivity("Sorry, I didn't understand."); }