コード例 #1
0
ファイル: LUISManager.cs プロジェクト: sebagomez/GX26Bot
        async Task SendMessage(IDialogContext context, string message, string image, string original, string intent)
        {
            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            IMessageActivity msg = context.MakeMessage();

            msg.Text = message;
            if (!string.IsNullOrEmpty(image))
            {
                msg.Attachments = new List <Attachment>();
                msg.Attachments.Add(new Attachment {
                    ContentType = "image/png", ContentUrl = image
                });
            }

            try
            {
                if (!string.IsNullOrEmpty(intent))
                {
                    StorageLogger.LogData(new DataLog {
                        Question = original, Answer = message, Intent = intent, User = context.MakeMessage().Recipient.Name
                    });
                }
            }
            catch { }

            await context.PostAsync(msg);
        }
コード例 #2
0
ファイル: LUISManager.cs プロジェクト: sebagomez/GX26Bot
        public async Task Restroom(IDialogContext context, IAwaitable <IMessageActivity> activity, LuisResult result)
        {
            if (IsScoreTooLow(context, result))
            {
                await None(context, activity, result);

                return;
            }
            else
            {
                OnSuccess(context);
            }

            LanguageManager lang = await LanguageManager.GetLanguage(context, activity);

            StorageLogger.LogData(new DataLog {
                Question = result.Query, Answer = lang.WhatFloor, Intent = RESTROOM
            });

            var floors = new[] { 2, 3, 4 };

            PromptDialog.Choice(context, RestroomFloorComplete, floors, string.Format(lang.WhatFloor, floors), string.Format(lang.InvalidFloor, floors), 3, PromptStyle.Auto);
        }