Exemplo n.º 1
0
        public IHttpActionResult POST()
        {
            try
            {
                #region 取得一些基本資料
                //取得 http Post RawData(should be JSON)
                string postData = Request.Content.ReadAsStringAsync().Result;
                //剖析JSON
                var ReceivedMessage = isRock.LineBot.Utility.Parsing(postData);
                //取得訊息的種類
                var Type = ReceivedMessage.events[0].type;
                //要回覆的訊息內容
                string Message = "";
                //交通部API
                PTXApi getAPIData = new PTXApi();

                //取得 UID or GID
                //狀況1.單獨與機器人交談的使用者,talkToken及senderToken都取userid,因為機器人只會回覆該使用者
                //狀況2.在群組呼叫機器人,且加了機器人好友,talkToken取userid以利資料庫存取,sendeToken取groupid,因使用狀況是在群組,故應於群組回覆
                //狀況3.在群組呼叫機器人,但沒有加機器人好友,talkToken及senderToken都取groupid,因為機器人只看得到groupid,使用者也不會和機器人私下對談
                string talkToken   = "";
                string senderToken = "";
                if (ReceivedMessage.events[0].source.userId == null && ReceivedMessage.events[0].source.groupId != null)
                {
                    talkToken   = ReceivedMessage.events[0].source.groupId.ToString();
                    senderToken = ReceivedMessage.events[0].source.groupId.ToString();
                }
                else if (ReceivedMessage.events[0].source.userId != null && ReceivedMessage.events[0].source.groupId == null)
                {
                    talkToken   = ReceivedMessage.events[0].source.userId.ToString();
                    senderToken = ReceivedMessage.events[0].source.userId.ToString();
                }
                else
                {
                    talkToken   = ReceivedMessage.events[0].source.userId.ToString();
                    senderToken = ReceivedMessage.events[0].source.groupId.ToString();
                }
                #endregion

                #region 判斷使用者發送的文字訊息

                if (ReceivedMessage.events[0].message.text != null)
                {
                    //狀況1 取到完整的句子
                    switch (ReceivedMessage.events[0].message.text)
                    {
                    case "sendImageMap":
                        SendRequest.SendImageMap(senderToken);
                        break;

                    case "給我匿名網址":
                        Message = "講話不用負責任,網址給你 : https://linebotfortest.azurewebsites.net/home/index/" + senderToken;
                        break;

                    case "車子停哪":

                        DBSearch dbprocess = new DBSearch();
                        Dictionary <string, string> getParkingData = dbprocess.returnParkingData(talkToken);

                        if (getParkingData != null)
                        {
                            SendRequest.SendLocation(senderToken, getParkingData["parkingLat"], getParkingData["parkingLon"], "你車停在這啦!", "可能因天氣地形因素影響而有出入");
                        }
                        else
                        {
                            Message = "你沒有紀錄停車位置!";
                        }
                        break;
                    }
                    //狀況二,針對字串取重點字
                    if (ReceivedMessage.events[0].message.text.Length > 8 && (ReceivedMessage.events[0].message.text.Substring(0, 8) == "幫我google" || ReceivedMessage.events[0].message.text.Substring(0, 8) == "幫我GOOGLE" || ReceivedMessage.events[0].message.text.Substring(0, 8) == "幫我Google"))
                    {
                        Message = "我來幫你google:\n https://www.google.com.tw/search?hl=zh-TW&q=" + ReceivedMessage.events[0].message.text.Substring(9).Replace(" ", "%20");
                    }

                    if (ReceivedMessage.events[0].message.text.Length > 3 && ReceivedMessage.events[0].message.text.Substring(0, 3) == "我想去")
                    {
                        DBSearch dbprocess = new DBSearch();
                        Dictionary <string, string> getLoactionData = dbprocess.returnLocationData(talkToken);

                        if (getLoactionData != null)
                        {
                            string googleUrl = "https://www.google.com.tw/maps/dir/" + Uri.EscapeDataString(getLoactionData["locationLat"] + "," + getLoactionData["locationLon"]) + "/" + Uri.EscapeDataString(ReceivedMessage.events[0].message.text.Substring(3));

                            SendRequest.sendButtonTemplate(senderToken,
                                                           new List <isRock.LineBot.TemplateActionBase>()
                            {
                                new isRock.LineBot.UriAction()
                                {
                                    label = "點這邊開啟GoogleMap導航", uri = new Uri(googleUrl)
                                }
                            },
                                                           "幫您導航", "以下選項協助您抵達目的地", ChannelAccessToken);
                        }
                    }

                    if (ReceivedMessage.events[0].message.text.Length > 7 && ReceivedMessage.events[0].message.text.Substring(0, 7) == "send fb")
                    {
                        SendRequest.sendFacebookMsg(Geocoding.test, ReceivedMessage.events[0].message.text.Substring(8));
                    }
                }
                #endregion

                #region 如果使用者丟圖片 ...

                if (Type == "message" && ReceivedMessage.events[0].message.type.Trim().ToLower() == "image")
                {
                    isRock.LineBot.Bot bot = new isRock.LineBot.Bot(ChannelAccessToken);
                    //取得使用者上傳的圖片
                    var imageBytes = bot.GetUserUploadedContent(ReceivedMessage.events[0].message.id.ToString());
                    //非同步,送給VisionRecognize進行圖像辨識
                    VisionRecognize.MakeAnalysisRequest(imageBytes, senderToken);
                }

                #endregion


                #region CICtest 對話流程測試

                //ConversationEntity
                isRock.LineBot.Conversation.InformationCollector <CICClass> CIC = new isRock.LineBot.Conversation.InformationCollector <CICClass>(ChannelAccessToken);
                //取得流程的結果
                ProcessResult <CICClass> result;

                //篩選對話的資料,如果不符流程問題的格式則退回重問
                CIC.OnMessageTypeCheck += (s, e) =>
                {
                    string regex = @"^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$";
                    Regex  r     = new Regex(regex, RegexOptions.IgnoreCase);

                    switch (e.CurrentPropertyName)
                    {
                    case "Geocoding":
                        if (!r.IsMatch(e.ReceievedMessage))
                        {
                            e.isMismatch      = true;
                            e.ResponseMessage = "只接受座標資訊 ... \n請給我你的座標資訊,或者跟我說『取消』來結束流程 ...";
                        }
                        break;

                    case "process":
                        if (e.ReceievedMessage == "幫我導航" | e.ReceievedMessage == "幫我記錄停車位置" | e.ReceievedMessage == "最近的3個公車站" | e.ReceievedMessage == "最近的3個Youbike站")
                        {
                            e.isMismatch = false;
                        }
                        else
                        {
                            e.isMismatch      = true;
                            e.ResponseMessage = "請點選選單選項,或者說『取消』來結束流程";
                            // e.CurrentPropertyName = "";
                        }
                        break;
                    }
                };
                //輸入Hey!進入程序
                if (ReceivedMessage.events[0].message.text == "Hey!")
                {
                    result  = CIC.Process(ReceivedMessage.events[0], true);
                    Message = "開始程序\n";

                    SendRequest.sendButtonTemplate(senderToken,
                                                   new List <isRock.LineBot.TemplateActionBase>()
                    {
                        new isRock.LineBot.MessageAction()
                        {
                            label = "導航", text = "幫我導航"
                        },
                        new isRock.LineBot.MessageAction()
                        {
                            label = "記錄停車位置", text = "幫我記錄停車位置"
                        },
                        new isRock.LineBot.MessageAction()
                        {
                            label = "公車站資訊", text = "最近的3個公車站"
                        },
                        new isRock.LineBot.MessageAction()
                        {
                            label = "Youbike站資訊", text = "最近的3個Youbike站"
                        }
                    },
                                                   "Hello!", "想做些什麼?", ChannelAccessToken);
                }
                else
                {
                    if (ReceivedMessage.events[0].message.type.Trim().ToLower() != "text")
                    {
                        if (ReceivedMessage.events[0].message.latitude != 0)
                        {
                            ReceivedMessage.events[0].message.text = ReceivedMessage.events[0].message.latitude + "," + ReceivedMessage.events[0].message.longitude;
                            result = CIC.Process(ReceivedMessage.events[0]);
                        }
                        else
                        {
                            ReceivedMessage.events[0].message.text = " ";
                            result = CIC.Process(ReceivedMessage.events[0]);
                        }
                    }
                    else
                    {
                        result = CIC.Process(ReceivedMessage.events[0]);
                    }
                }


                switch (result.ProcessResultStatus)
                {
                case ProcessResultStatus.Processed:
                    Message += result.ResponseMessageCandidate;
                    break;

                case ProcessResultStatus.Done:
                    char[]   delimiterChars = { ',' };
                    string   geocoding      = result.ConversationState.ConversationEntity.Geocoding;
                    string[] latAndLon      = geocoding.Split(delimiterChars);

                    switch (result.ConversationState.ConversationEntity.process)
                    {
                    case "最近的3個Youbike站":
                        Message = getAPIData.returnBikeData(senderToken, latAndLon[0], latAndLon[1]);
                        break;

                    case "最近的3個公車站":
                        Message = getAPIData.returnBusData(senderToken, latAndLon[0], latAndLon[1]);
                        break;

                    case "幫我導航":
                        DBSearch dbprocess = new DBSearch();
                        dbprocess.SaveLocation(talkToken, ReceivedMessage);
                        Message = "想去嗎哪?格式:我想去OOXXOOXX";
                        break;

                    case "幫我記錄停車位置":
                        DBSearch dbparking = new DBSearch();
                        dbparking.testSaveParkingData(talkToken, latAndLon[0], latAndLon[1]);
                        Message = "座標已經記錄完畢!查詢請打『車子停哪』";
                        break;
                    }

                    break;

                case ProcessResultStatus.Pass:
                    //                        Message += "你說啥我看不懂";
                    break;

                case ProcessResultStatus.Exception:
                    Message += result.ResponseMessageCandidate;
                    break;

                case ProcessResultStatus.Break:
                    Message += result.ResponseMessageCandidate;
                    Message += "\n若需要我請再 Hey! 一次,我會出現的";
                    break;

                case ProcessResultStatus.InputDataFitError:
                    Message += "Oops!!\n";
                    Message += result.ResponseMessageCandidate;
                    break;

                default:
                    break;
                }
                #endregion


                if (!string.IsNullOrEmpty(Message))
                {
                    isRock.LineBot.Utility.ReplyMessage(ReceivedMessage.events[0].replyToken, Message, ChannelAccessToken);
                }

                return(Ok());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(Ok());
            }
        }
Exemplo n.º 2
0
        public IHttpActionResult POST()
        {
            string ChannelAccessToken = "!!!!!!!!!!! 請換成你自己的Channel Access Token !!!!!!!!!!!!!!!!!";
            var    responseMsg        = "";

            try
            {
                //定義資訊蒐集者
                isRock.LineBot.Conversation.InformationCollector <LeaveRequestV2> CIC =
                    new isRock.LineBot.Conversation.InformationCollector <LeaveRequestV2>(ChannelAccessToken);
                CIC.OnMessageTypeCheck += (s, e) => {
                    switch (e.CurrentPropertyName)
                    {
                    case "代理人":
                        if (e.ReceievedMessage != "eric")
                        {
                            e.isMismatch      = true;
                            e.ResponseMessage = "我們公司只有eric,代理人請找eric...";
                        }
                        break;

                    case "假別":
                        if (e.ReceievedMessage != "事假" && e.ReceievedMessage != "病假" && e.ReceievedMessage != "公假")
                        {
                            e.isMismatch      = true;
                            e.ResponseMessage = "你只能輸入事假,病假,事假其中之一";
                        }
                        break;

                    default:
                        break;
                    }
                };

                //取得 http Post RawData(should be JSO
                string postData = Request.Content.ReadAsStringAsync().Result;
                //剖析JSON
                var ReceivedMessage = isRock.LineBot.Utility.Parsing(postData);
                //定義接收CIC結果的類別
                ProcessResult <LeaveRequestV2> result;
                if (ReceivedMessage.events[0].message.text == "我要請假")
                {
                    //把訊息丟給CIC
                    result      = CIC.Process(ReceivedMessage.events[0], true);
                    responseMsg = "開始請假程序\n";
                }
                else
                {
                    //把訊息丟給CIC
                    result = CIC.Process(ReceivedMessage.events[0]);
                }

                //處理 CIC回覆的結果
                switch (result.ProcessResultStatus)
                {
                case ProcessResultStatus.Processed:
                    if (result.ResponseButtonsTemplateCandidate != null)
                    {
                        //如果有template Message,直接回覆,否則放到後面一起回覆
                        isRock.LineBot.Utility.ReplyTemplateMessage(
                            ReceivedMessage.events[0].replyToken,
                            result.ResponseButtonsTemplateCandidate,
                            ChannelAccessToken);
                        return(Ok());
                    }
                    //取得候選訊息發送
                    responseMsg += result.ResponseMessageCandidate;
                    break;

                case ProcessResultStatus.Done:
                    responseMsg += result.ResponseMessageCandidate;
                    responseMsg += $"蒐集到的資料有...\n";
                    responseMsg += Newtonsoft.Json.JsonConvert.SerializeObject(result.ConversationState.ConversationEntity);
                    break;

                case ProcessResultStatus.Pass:
                    responseMsg = $"你說的 '{ReceivedMessage.events[0].message.text}' 我看不懂,如果想要請假,請跟我說 : 『我要請假』";
                    break;

                case ProcessResultStatus.Exception:
                    //取得候選訊息發送
                    responseMsg += result.ResponseMessageCandidate;
                    break;

                case ProcessResultStatus.Break:
                    //取得候選訊息發送
                    responseMsg += result.ResponseMessageCandidate;
                    break;

                case ProcessResultStatus.InputDataFitError:
                    responseMsg += "\n資料型態不合\n";
                    responseMsg += result.ResponseMessageCandidate;
                    break;

                default:
                    //取得候選訊息發送
                    responseMsg += result.ResponseMessageCandidate;
                    break;
                }
                //回覆用戶訊息
                isRock.LineBot.Utility.ReplyMessage(ReceivedMessage.events[0].replyToken, responseMsg, ChannelAccessToken);
                //回覆API OK
                return(Ok());
            }
            catch (Exception ex)
            {
                //如果你要偵錯的話
                //isRock.LineBot.Utility.PushMessage("!!!!!!!!!!!!   換成你自己的 Admin Line UserId !!!!!!!!!!!!!", ex.Message, ChannelAccessToken);
                //return Ok();
                throw ex;
            }
        }
        public IHttpActionResult POST()
        {
            var responseMsg = "";

            try
            {
                //定義資訊蒐集者
                isRock.LineBot.Conversation.InformationCollector <LeaveRequest> CIC =
                    new isRock.LineBot.Conversation.InformationCollector <LeaveRequest>(ChannelAccessToken);
                CIC.OnMessageTypeCheck += (s, e) => {
                    switch (e.CurrentPropertyName)
                    {
                    case "代理人":
                        if (e.ReceievedMessage != "kant")
                        {
                            e.isMismatch      = true;
                            e.ResponseMessage = "你的代理人只有kant,代理人請找kant...";
                        }
                        break;

                    case "假別":
                        if (e.ReceievedMessage != "事假" && e.ReceievedMessage != "病假" && e.ReceievedMessage != "公假")
                        {
                            e.isMismatch      = true;
                            e.ResponseMessage = "你只能輸入事假,病假,事假其中之一";
                        }
                        break;

                    default:
                        break;
                    }
                };

                //取得 http Post RawData(should be JSO
                string postData = Request.Content.ReadAsStringAsync().Result;
                //剖析JSON
                var ReceivedMessage = isRock.LineBot.Utility.Parsing(postData);
                foreach (var LineItem in ReceivedMessage.events)
                {
                    //定義接收CIC結果的類別
                    ProcessResult <LeaveRequest> result;
                    if (LineItem.message.text == "我要請假")
                    {
                        //把訊息丟給CIC
                        result      = CIC.Process(LineItem, true);
                        responseMsg = "開始請假程序\n";
                    }
                    else
                    {
                        //把訊息丟給CIC
                        result = CIC.Process(LineItem);
                    }

                    if (LineItem.message.text == "bye")
                    {
                        // 回覆用戶
                        isRock.LineBot.Utility.ReplyMessage(LineItem.replyToken, "bye-bye", ChannelAccessToken);
                        // 離開
                        if (string.Equals(LineItem.source.type, "room", StringComparison.OrdinalIgnoreCase))
                        {
                            isRock.LineBot.Utility.LeaveRoom(LineItem.source.roomId, ChannelAccessToken);
                        }
                        if (string.Equals(LineItem.source.type, "group", StringComparison.OrdinalIgnoreCase))
                        {
                            isRock.LineBot.Utility.LeaveGroup(LineItem.source.groupId, ChannelAccessToken);
                        }
                        //回覆API OK
                        return(Ok());
                    }

                    //處理 CIC回覆的結果
                    switch (result.ProcessResultStatus)
                    {
                    case ProcessResultStatus.Processed:
                        if (result.ResponseButtonsTemplateCandidate != null)
                        {
                            //如果有template Message,直接回覆,否則放到後面一起回覆
                            isRock.LineBot.Utility.ReplyTemplateMessage(
                                LineItem.replyToken,
                                result.ResponseButtonsTemplateCandidate,
                                ChannelAccessToken);
                            return(Ok());
                        }
                        //取得候選訊息發送
                        responseMsg += result.ResponseMessageCandidate;
                        break;

                    case ProcessResultStatus.Done:
                        responseMsg += result.ResponseMessageCandidate;
                        responseMsg += $"蒐集到的資料有...\n";
                        responseMsg += Newtonsoft.Json.JsonConvert.SerializeObject(result.ConversationState.ConversationEntity);
                        break;

                    case ProcessResultStatus.Pass:
                        //responseMsg = $"你說的 '{LineItem.message.text}' 我看不懂,如果想要請假,請跟我說 : 『我要請假』";
                        break;

                    case ProcessResultStatus.Exception:
                        //取得候選訊息發送
                        responseMsg += result.ResponseMessageCandidate;
                        break;

                    case ProcessResultStatus.Break:
                        //取得候選訊息發送
                        responseMsg += result.ResponseMessageCandidate;
                        break;

                    case ProcessResultStatus.InputDataFitError:
                        responseMsg += "\n資料型態不合\n";
                        responseMsg += result.ResponseMessageCandidate;
                        break;

                    default:
                        //取得候選訊息發送
                        responseMsg += result.ResponseMessageCandidate;
                        break;
                    }
                    //回覆用戶訊息
                    if (!string.IsNullOrWhiteSpace(responseMsg))
                    {
                        isRock.LineBot.Utility.ReplyMessage(LineItem.replyToken, responseMsg, ChannelAccessToken);
                    }
                }

                //回覆API OK
                return(Ok());
            }
            catch (Exception ex)
            {
                //如果你要偵錯的話
                isRock.LineBot.Utility.PushMessage(AdminUserId, ex.Message, ChannelAccessToken);
                return(Ok());
                //throw ex;
            }
        }
Exemplo n.º 4
0
        public IHttpActionResult POST()
        {
            try
            {
                var author  = "";
                var message = "";



                //建立actions,作為ButtonTemplate的用戶回覆行為
                var actions = new List <isRock.LineBot.TemplateActionBase>();

                //定義資訊蒐集者
                isRock.LineBot.Conversation.InformationCollector <LeaveRequest> CIC =
                    new isRock.LineBot.Conversation.InformationCollector <LeaveRequest>(ChannelAccessToken);
                //定義接收CIC結果的類別
                ProcessResult <LeaveRequest> CICresult;

                //設定ChannelAccessToken(或抓取Web.Config)
                this.ChannelAccessToken = Properties.Settings.Default["ChannelAccessToken"].ToString();

                this.PushMessage("U849bacfde38571008bbcb71d1f0017a9", "WWWWWWW");
                //取得Line Event
                isRock.LineBot.Event LineEvent = this.ReceivedMessage.events.FirstOrDefault();

                //Uid
                string Uid = LineEvent.source.userId;

                if (LineEvent.message.text == "人生")
                {
                    var windom = _LifeRepo.Get();
                    message     = windom.message;
                    author      = "———" + windom.author;
                    responseMsg = message + author;

                    this.ReplyMessage(LineEvent.replyToken, responseMsg);
                }
                else if (LineEvent.message.text == "愛情")
                {
                    var windom = _LoveRepo.Get();
                    message     = windom.message;
                    author      = "———" + windom.author;
                    responseMsg = message + author;


                    this.ReplyMessage(LineEvent.replyToken, responseMsg);
                }
                else if (LineEvent.message.text == "心靈")
                {
                    var windom = _SoulRepo.Get();
                    message     = windom.message;
                    responseMsg = message;


                    this.ReplyMessage(LineEvent.replyToken, responseMsg);
                }
                else
                {
                    if (ReceivedMessage.events[0].message.text.IndexOf("DISC") >= 0)
                    {
                        dicDISCCount = new Dictionary <string, int>()
                        {
                            { "A", 0 }, { "B", 0 }, { "C", 0 }, { "D", 0 }
                        };

                        //把訊息丟給CIC
                        CICresult = CIC.Process(ReceivedMessage.events[0], true);
                        this.PushMessage(Uid, "請在30秒內回答以下問題");

                        responseMsg = "開始測驗\n";

                        switch (CICresult.ProcessResultStatus)
                        {
                        case ProcessResultStatus.Processed:

                            //ResponseButtonsTemplateCandidate的部分
                            if (CICresult.ResponseButtonsTemplateCandidate != null)
                            {
                                //如果有template Message,直接回覆,否則放到後面一起回覆
                                isRock.LineBot.Utility.ReplyTemplateMessage(
                                    ReceivedMessage.events[0].replyToken,
                                    CICresult.ResponseButtonsTemplateCandidate,
                                    ChannelAccessToken);
                                return(Ok());
                            }

                            //取得候選訊息發送
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;

                        case ProcessResultStatus.Done:
                            responseMsg += CICresult.ResponseMessageCandidate;
                            responseMsg += $"蒐集到的資料有...\n";
                            responseMsg += Newtonsoft.Json.JsonConvert.SerializeObject(CICresult.ConversationState.ConversationEntity);
                            break;

                        case ProcessResultStatus.Pass:
                            responseMsg = $"你說的 '{ReceivedMessage.events[0].message.text}' 我看不懂,如果想要請假,請跟我說 : 『我要請假』";
                            break;

                        case ProcessResultStatus.Exception:
                            //取得候選訊息發送
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;

                        case ProcessResultStatus.Break:
                            //取得候選訊息發送
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;

                        case ProcessResultStatus.InputDataFitError:
                            responseMsg += "\n資料型態不合\n";
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;

                        default:
                            //取得候選訊息發送
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;
                        }

                        isRock.LineBot.Utility.ReplyMessage(ReceivedMessage.events[0].replyToken, responseMsg, ChannelAccessToken);
                    }
                    else
                    {
                        CIC.OnMessageTypeCheck += (s, e) =>
                        {
                            if (e.CurrentPropertyName.IndexOf("Question") >= 0)
                            {
                                string key = e.ReceievedMessage.Substring(0, 1);
                                dicDISCCount[key]++;
                            }
                        };

                        //把訊息丟給CIC
                        CICresult = CIC.Process(ReceivedMessage.events[0]);

                        switch (CICresult.ProcessResultStatus)
                        {
                        case ProcessResultStatus.Processed:

                            //ResponseButtonsTemplateCandidate的部分
                            if (CICresult.ResponseButtonsTemplateCandidate != null)
                            {
                                //如果有template Message,直接回覆,否則放到後面一起回覆
                                isRock.LineBot.Utility.ReplyTemplateMessage(
                                    ReceivedMessage.events[0].replyToken,
                                    CICresult.ResponseButtonsTemplateCandidate,
                                    ChannelAccessToken);
                                return(Ok());
                            }

                            //取得候選訊息發送
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;

                        case ProcessResultStatus.Done:

                            switch (dicDISCCount.Aggregate((x, y) => x.Value > y.Value ? x : y).Key)
                            {
                            case "A":
                                this.PushMessage(Uid, "你是:孔雀 (影響型):外向 多言 樂觀");
                                this.PushMessage(Uid, "特點:一群人裡面說話最多的 天生希望成為注意力的中心,具有很強的好奇心 熱情 熱心具有表達能力 精力充沛 具有幹勁(但是卻缺乏毅力 所以常常這幹幹 那乾幹) 好表現 粗線條 輕許諾(因為熱心所以常常答應別人 但是由於記憶差 所以常常答應後就忘記了) 以自己的快樂為主");
                                this.PushMessage(Uid, "缺點:以自己為中心 獨霸主題 愛打斷別人的談話 不注意記憶 變化無常 這類人易交朋友 但深切的朋友卻不多 喜好多卻不精 缺乏毅力");
                                this.ReplyMessage(ReceivedMessage.events[0].replyToken, "切入點:如果跟這類型的人交往 一定要多誇獎他 多鼓勵他 多給他說話的機會");
                                break;

                            case "B":
                                this.PushMessage(Uid, "你是:老虎 (支配型) : 外向 行動者 樂觀");
                                this.PushMessage(Uid, "特點:喜歡做主 行動力強 行動速度 思考力稍弱 喜歡做目標 不達目的不罷休 充滿自信 意志堅定 有活力 做事主動 不易氣餒 是推動別人行動的人 粗線條 不容易適應環境 (不過由於行動力很強 所以往往做事會有很大成就) ");
                                this.PushMessage(Uid, "缺點:不易看到別人的需求,只看到自己的需求 做錯事後很容易原諒自己 固執 易爭吵 好鬥 說話極易傷害別人 具有強迫性 很容易支配別人 無耐性 專橫 經常人際關係差 (這類人總覺得自己是對的 不太需要朋友,並且這類人天生行動力強 但是即使是正確的事情 也因為性格問題 說話傷害到別人 而得不到別人的支持和認同)");
                                this.ReplyMessage(ReceivedMessage.events[0].replyToken, "注意點:這類型嚴重者會很獨斷 霸道 容易讓別人感到壓力 相處很累");
                                break;

                            case "C":
                                this.PushMessage(Uid, "你是:貓頭鷹 (分析型):內向 思考者 對事物看法較為負面");
                                this.PushMessage(Uid, "特點:以思考為主 深思熟慮 嚴肅 有目標 並且目標感很強 追求完美 有藝術天分 沉悶 關注細節 完美主義 高標準 想得多但做得少 做事前一定要先想個計劃 有條理 有組織 交友慎重(但一旦交往 就會很忠誠的對待朋友) 關心別人 為別人犧牲是自己的意願 (所以這類型的人一生一定有幾個特別好的朋友一輩子的朋友那種)情感豐富容易感動 也容易受傷 高標準–對自己要求高對​​別人要求也高 希望一切都作的很好 很對 、理想主義 朝著自己的目標前進");
                                this.PushMessage(Uid, "缺點:行動力弱 優柔寡斷 容易抑鬱(常常是因為要求過高了 當達不到時候就會很失望)容易自慚自愧 悲觀 天生消極 易受環境影響 情緒化 注意點:這類型的人太容易思考 過分時會情緒低落");
                                this.ReplyMessage(ReceivedMessage.events[0].replyToken, "切入點:如果想和著類型的人合作 一定要先打動他 但是不要急功近利 要一點一點的建立信任和感情 這類型的人 一旦認同你後 會很忠誠 忠心");
                                break;

                            case "D":
                                this.PushMessage(Uid, "你是:無尾熊(穩健型):內向 執行者 追隨者");
                                this.PushMessage(Uid, "特點:性格低調 易相處 很輕鬆 平和 無異議 耐心 適應力強 無攻擊性 很好的聆聽者 人際關係好(和事老) 所以朋友很多 不愛生氣,一但答應下的工作會默默做完");
                                this.PushMessage(Uid, "缺點:不容易興奮 拒絕改變 喜歡一成不變 目標感不強 看似懶惰 不願承擔責任 迴避壓力 沉默、馬虎 無主見(需要力量型的人 給於指導,但不要施加壓力) 不善於做決定");
                                this.PushMessage(Uid, "切入點:和這類型的人交往 一定要鼓勵他 促進他");
                                this.ReplyMessage(ReceivedMessage.events[0].replyToken, "注意點:這類型過分時會毫無主見 做事漫不經心");
                                break;
                            }
                            return(Ok());

                            //responseMsg += CICresult.ResponseMessageCandidate;
                            //responseMsg += $"蒐集到的資料有...\n";
                            //responseMsg += Newtonsoft.Json.JsonConvert.SerializeObject(CICresult.ConversationState.ConversationEntity);
                            break;

                        case ProcessResultStatus.Pass:
                            //回音機器人
                            responseMsg = LineEvent.message.text;
                            this.ReplyMessage(LineEvent.replyToken, "我是回音機器人--你說了[" + responseMsg + "]");
                            //responseMsg = $"你說的 '{ReceivedMessage.events[0].message.text}' 我看不懂,如果想要請假,請跟我說 : 『我要請假』";
                            break;

                        case ProcessResultStatus.Exception:
                            //取得候選訊息發送
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;

                        case ProcessResultStatus.Break:
                            //取得候選訊息發送
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;

                        case ProcessResultStatus.InputDataFitError:
                            responseMsg += "\n資料型態不合\n";
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;

                        default:
                            //取得候選訊息發送
                            responseMsg += CICresult.ResponseMessageCandidate;
                            break;
                        }
                        isRock.LineBot.Utility.ReplyMessage(ReceivedMessage.events[0].replyToken, responseMsg, ChannelAccessToken);
                    }
                }

                return(Ok());
            }
            catch (Exception ex)
            {
                //回覆訊息
                this.PushMessage("!!!改成你的AdminUserId!!!", "發生錯誤:\n" + ex.Message);
                //response OK
                return(Ok());
            }
        }