private string GetFinalInformation(OneMeetEvent detectedInformation) { var finalMessage = "I have all the needed data! "; finalMessage += "Your activity is " + detectedInformation.Activity + ". "; finalMessage += "Your event place is " + detectedInformation.EventPlace + ". "; finalMessage += "You want to meet at " + detectedInformation.Time + " in the place: " + detectedInformation.MeetingPlace + ". "; if (detectedInformation.MaxNumberOfPeople > 0 && detectedInformation.MaxNumberOfPeople < Int32.MaxValue) { finalMessage += "Attendees limit is " + detectedInformation.MaxNumberOfPeople.ToString() + ". "; } else { finalMessage += "Number of attendees is unlimited. "; } finalMessage += "Please confirm if I understood correctly, so I can create the event \U0001F60A"; return(finalMessage); }
private async static Task <OneMeetEvent> ParseNewEvent(ITurnContext context, string message, LUIS.Connector connector) { var pattern = "groupmeet go (.*) for (.*) at (.*) meet (.*) max (.*)"; var match = Regex.Match(message, pattern); if (!match.Success) { match = Regex.Match(message, "groupmeet go (.*) for (.*) at (.*)"); } if (!match.Success) { return(null); } var timeString = await connector.GetNLPTime(context, match.Groups[3].Value); var oneMeetEvent = new OneMeetEvent() { EventPlace = match.Groups[1].Value, Activity = match.Groups[2].Value, Time = timeString, MeetingPlace = match.Groups[1].Value + " (at location)" }; if (match.Groups.Count == 4) { return(oneMeetEvent); } int maximum = 0; int.TryParse(match.Groups[5].Value, out maximum); oneMeetEvent.MeetingPlace = match.Groups[4].Value; oneMeetEvent.MaxNumberOfPeople = maximum; return(oneMeetEvent); }
private async Task SendEventToTeams(ITurnContext context, OneMeetEvent newEvent) { await SendPrivateMessage(context, "I am creating the event! \U0001F389"); var cardData = new EventCardData { CreatorName = context.Activity.From.Name, Attendees = new List <Atendee> { new Atendee(context.Activity.From.Name) }, EventData = newEvent }; var activity = CreateActivityForEvent(context, cardData); if (Configuration.TeamsConversationId != null) { var serviceUri = new Uri(context.Activity.ServiceUrl, UriKind.Absolute); using (var client = new ConnectorClient(serviceUri, credentials)) { activity.Conversation.Id = Configuration.TeamsConversationId; var resource = await client.Conversations.SendToConversationAsync(activity); cardData.ResourceResponseId = resource.Id; activity.Id = resource.Id; activity.Attachments[0] = CreateCard(cardData).ToAttachment(); await client.Conversations.UpdateActivityAsync(activity); database.Put(cardData); } await SendPrivateMessage(context, "I have notified the channel! \U0001F91F"); } else { await SendPrivateMessage(context, "Channel / group is not initialized. Type <em>here @OneMeet 365</em> in a channel!"); } }