Пример #1
0
        private static async Task Wellcome(IDialogContext context)
        {
            var msg0 = context.MakeMessage();

            msg0.Text = StringMessages.Versao;
            await context.PostAsync(msg0);

            var msg1 = CardMessages.GetAboutCards(context);
            await context.PostAsync(msg1);

            var msg2 = CardMessages.GetHelpCards(context);
            await context.PostAsync(msg2);
        }
Пример #2
0
        public static async Task HandleSystemMessage(Activity activity)
        {
            switch (activity.Type)
            {
            case ActivityTypes.DeleteUserData:
                // Implement user deletion here
                // If we handle user deletion, return a real message
                break;

            case ActivityTypes.ConversationUpdate:

                IConversationUpdateActivity iConversationUpdated = activity as IConversationUpdateActivity;
                if (iConversationUpdated != null)
                {
                    ConnectorClient connector = new ConnectorClient(new System.Uri(activity.ServiceUrl));
                    foreach (var member in iConversationUpdated.MembersAdded ?? System.Array.Empty <ChannelAccount>())
                    {
                        if (member.Id == iConversationUpdated.Recipient.Id)
                        {
                            Activity msg0 = activity.CreateReply();
                            msg0.Text = StringMessages.Versao;
                            connector.Conversations.SendToConversation(msg0);

                            Activity msg1 = CardMessages.GetAboutCards(activity);
                            connector.Conversations.SendToConversation(msg1);

                            Activity msg2 = CardMessages.GetHelpCards(activity);
                            connector.Conversations.SendToConversation(msg2);
                        }
                    }
                }
                break;

            case ActivityTypes.ContactRelationUpdate:
                // Handle add/remove from contact lists
                break;

            case ActivityTypes.Typing:
                // Handle knowing that the user is typing
                break;

            case ActivityTypes.Ping:
                break;
            }
        }