コード例 #1
0
        private async Task <DialogTurnResult> CardStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            trackInfoCardDetail.Major = stepContext.Context.Activity.Text;

            string        cardPath      = "";
            CardGenerator cardGenerator = new CardGenerator();

            switch (trackInfoCardDetail.Major)
            {
            case "공과대학":
                cardPath = "HSUbot.Cards.TrackInfoCards.ITGongdeaCard.json";
                break;

            case "인문예술대학":
                cardPath = "HSUbot.Cards.TrackInfoCards.InMoonYeSoolDaeCard.json";
                break;

            case "디자인대학":
                cardPath = "HSUbot.Cards.TrackInfoCards.DesignDaeCard.json";
                break;

            case "사회과학대학":
                cardPath = "HSUbot.Cards.TrackInfoCards.SocialScienceDaeCard.json";
                break;
            }

            await cardGenerator.AttachAdaptiveCard(stepContext.Context, cardPath, cancellationToken);

            return(await stepContext.EndDialogAsync(null, cancellationToken));
        }
コード例 #2
0
        //인터럽트 시 취할 행동
        private async Task <DialogTurnResult> InterruptAsync(DialogContext innerDc, CancellationToken cancellationToken)
        {
            if (innerDc.Context.Activity.Type == ActivityTypes.Message)
            {
                var text = innerDc.Context.Activity.Text?.ToLowerInvariant();

                switch (text)
                {
                case "help":
                case "?":
                case "도움말":
                    CardGenerator cardGenerator = new CardGenerator();
                    await cardGenerator.AttachAdaptiveCard(innerDc.Context, "HSUbot.Cards.HelpCard.json", cancellationToken);

                    return(null);

                case "cancel":
                case "quit":
                case "취소":
                    await innerDc.Context.SendActivityAsync($"Cancelling", cancellationToken : cancellationToken);

                    return(await innerDc.CancelAllDialogsAsync());
                }
            }

            return(null);
        }
コード例 #3
0
ファイル: HSUbot.cs プロジェクト: didwodnr123/HSU_ChatBot
 protected override async Task OnMembersAddedAsync(IList <ChannelAccount> membersAdded, ITurnContext <IConversationUpdateActivity> turnContext, CancellationToken cancellationToken)
 {
     foreach (var member in membersAdded)
     {
         if (member.Id != turnContext.Activity.Recipient.Id)
         {
             CardGenerator cardGenerator = new CardGenerator();
             await cardGenerator.AttachAdaptiveCard(turnContext, ADAPTIVEINTROCARDPATH, cancellationToken);
         }
     }
 }