Exemplo n.º 1
0
        //ButtonsTemplate
        protected void Button1_Click(object sender, EventArgs e)
        {
            var bot = new isRock.LineBot.Bot(channelAccessToken);

            var ButtonTmpMsg = new isRock.LineBot.ButtonsTemplate()
            {
                text              = "文字",
                title             = "標題",
                altText           = "替代文字",
                thumbnailImageUrl = new Uri("https://66.media.tumblr.com/2e37eafc9b6b715ed99b31fb6f72e6a5/tumblr_inline_pjjzfnFy7a1u06gc8_640.jpg")
            };
            //add actions
            var action1 = new isRock.LineBot.MessageAction()
            {
                label = "顯示的標題", text = "呈現的文字"
            };

            ButtonTmpMsg.actions.Add(action1);

            var action2 = new isRock.LineBot.UriAction()
            {
                label = "顯示的標題", uri = new Uri("http://www.google.com")
            };

            ButtonTmpMsg.actions.Add(action2);

            bot.PushMessage(AdminUserId, ButtonTmpMsg);
        }
Exemplo n.º 2
0
        //ConfirmTemplate
        protected void Button2_Click(object sender, EventArgs e)
        {
            var bot = new isRock.LineBot.Bot(channelAccessToken);

            var CarouselTmpMsg = new isRock.LineBot.ConfirmTemplate()
            {
                text    = "文字",
                altText = "替代文字",
            };
            //add actions
            var action1 = new isRock.LineBot.MessageAction()
            {
                label = "OK", text = "呈現的文字"
            };

            CarouselTmpMsg.actions.Add(action1);

            var action2 = new isRock.LineBot.UriAction()
            {
                label = "NO", uri = new Uri("http://www.google.com")
            };

            CarouselTmpMsg.actions.Add(action2);

            bot.PushMessage(AdminUserId, CarouselTmpMsg);
        }
Exemplo n.º 3
0
        protected void Button5_Click(object sender, EventArgs e)
        {
            isRock.LineBot.Bot bot = new isRock.LineBot.Bot("9YwfPyWbdWkYqcs5aistrwDTZaPwLAivy+9vpvKS034TVyF9Cj7UhHcttzo4CJ1+zLH7YadJ7B5U9a9ho/4Kg6mU+Z5u0bHvo8zo7y3+8BwccBpL+4QDGrknX16T3roNmLnxVaOhmwkyXXQ/G2INFwdB04t89/1O/w1cDnyilFU=");
            bot.PushMessage("U275c68b802e11bb599413ef87dcea051", "hihihihihihi~");
            var Userinfo = bot.GetUserInfo("U275c68b802e11bb599413ef87dcea051");

            Response.Write(Userinfo.displayName + Userinfo.pictureUrl + "<br/>" + Userinfo.statusMessage);
        }
Exemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //var bot = new Bot(channelAccessToken);
            bot.PushMessage(AdminUserId, $"測試 {DateTime.Now.ToString()} ! ");
            //bot.PushMessage(AdminUserId, Label2);
            string s_url;

            s_url = "?name=" + Label2;
            Response.Redirect(s_url);     //queryString 使用完後重新導向新的網站
        }
Exemplo n.º 5
0
        public IActionResult LineBotTest()
        {
            try
            {
                var bot = new isRock.LineBot.Bot(ChannelAccessToken);
                //push text
                bot.PushMessage(_UserID, "Hello World");

            }
            catch (Exception ex)
            {

            }
            return Ok();
        }
Exemplo n.º 6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            isRock.LineBot.Bot bot = new isRock.LineBot.Bot(channelAccessToken);
            //建立buttonsTemplate
            var button = new isRock.LineBot.ButtonsTemplate()
            {
                altText           = "altText",
                text              = "text",
                title             = "title",
                thumbnailImageUrl = new Uri("https://i.imgur.com/pAiJpHg.png")
            };

            //actions
            button.actions.Add(new isRock.LineBot.MessageAction()
            {
                label = "美式漢堡",
                text  = "美式漢堡"
            });
            button.actions.Add(new isRock.LineBot.MessageAction()
            {
                label = "台灣漢堡",
                text  = "台灣漢堡"
            });
            button.actions.Add(new isRock.LineBot.MessageAction()
            {
                label = "熱狗堡",
                text  = "熱狗堡"
            });

            //建立訊息集合(一次發送多則訊息)
            var msgs = new List <isRock.LineBot.MessageBase>();

            //add messages to
            msgs.Add(new isRock.LineBot.TextMessage("請選擇您喜歡的餐點:"));
            var ButtonsTmp = new isRock.LineBot.TemplateMessage(button);

            //quickReply
            ButtonsTmp.quickReply.items.Add(
                new isRock.LineBot.QuickReplyDatetimePickerAction(
                    "期望送達時間", "期望送達時間", isRock.LineBot.DatetimePickerModes.time));
            //將ButtonsTmp加入msgs
            msgs.Add(ButtonsTmp);
            //發送
            bot.PushMessage(AdminUserId, msgs);
        }
Exemplo n.º 7
0
        protected void Button5_Click(object sender, EventArgs e)
        {
            //建立Bot instance
            isRock.LineBot.Bot bot =
                new isRock.LineBot.Bot(channelAccessToken);  //傳入Channel access token

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

            actions.Add(new isRock.LineBot.MessageActon()
            {
                label = "標題-文字回覆", text = "回覆文字"
            });
            actions.Add(new isRock.LineBot.UriActon()
            {
                label = "標題-Google", uri = new Uri("http://www.google.com")
            });
            actions.Add(new isRock.LineBot.PostbackActon()
            {
                label = "標題-發生postack", data = "abc=aaa&def=111"
            });

            //單一Column
            var Column = new isRock.LineBot.Column
            {
                text  = "ButtonsTemplate文字訊息",
                title = "ButtonsTemplate標題",
                //設定圖片
                thumbnailImageUrl = new Uri("https://arock.blob.core.windows.net/blogdata201706/22-124357-ad3c87d6-b9cc-488a-8150-1c2fe642d237.png"),
                actions           = actions //設定回覆動作
            };

            //建立CarouselTemplate
            var CarouselTemplate = new isRock.LineBot.CarouselTemplate();

            //這是範例,所以用一組樣板建立三個
            CarouselTemplate.columns.Add(Column);
            CarouselTemplate.columns.Add(Column);
            CarouselTemplate.columns.Add(Column);
            //發送 CarouselTemplate
            bot.PushMessage(AdminUserId, CarouselTemplate);
        }
Exemplo n.º 8
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Bot bot     = new isRock.LineBot.Bot("WJ10DIkt+Y8abCGbAb/OmK/35F3iZ3h4xiB3CE8/B6SzkfTg4mLGonn/9nVI/P33o6+SnGwSBtKYjfa65YJSdfskV7Lf5RtWUAEmZajgARKdJva3ufd3cn7i/H4F/FXA685e75j18IsFjwDgSmugcQdB04t89/1O/w1cDnyilFU=");
            var actions = new List <TemplateActionBase>();

            actions.Add(new DateTimePickerAction()
            {
                label = "選取時間",
                mode  = "time"
            });
            var ButtonTemplate = new ButtonsTemplate()
            {
                text              = "選取時間來設定自動推送訊息喔~~",
                title             = "設定推送任務時間",
                thumbnailImageUrl = new Uri("http://www.sayjb.com/wp-content/uploads/2017/02/unnamed-file-9.jpg"),
                actions           = actions
            };

            bot.PushMessage("Ub7f9aa656d9493aa12bc911993678a4e", ButtonTemplate);
        }
Exemplo n.º 9
0
        //QuickReplyMessageAction
        protected void Button3_Click(object sender, EventArgs e)
        {
            //icon位置
            const string IconUrl = "https://pic.pimg.tw/chico386/1414112596-3072196168_n.png";

            //建立一個TextMessage物件
            isRock.LineBot.TextMessage m =
                new isRock.LineBot.TextMessage("請在底下選擇一個選項");

            //在TextMessage物件的quickReply屬性中加入items
            m.quickReply.items.Add(
                new isRock.LineBot.QuickReplyMessageAction(
                    $"一般標籤", "點選後顯示的text文字"));

            m.quickReply.items.Add(
                new isRock.LineBot.QuickReplyMessageAction(
                    $"有圖示的標籤", "點選後顯示的text文字", new Uri(IconUrl)));
            //加入QuickReplyDatetimePickerAction
            m.quickReply.items.Add(
                new isRock.LineBot.QuickReplyDatetimePickerAction(
                    "選時間", "選時間", isRock.LineBot.DatetimePickerModes.datetime,
                    new Uri(IconUrl)));
            //加入QuickReplyLocationAction
            m.quickReply.items.Add(
                new isRock.LineBot.QuickReplyLocationAction(
                    "選地點", new Uri(IconUrl)));
            //加入QuickReplyCameraAction
            m.quickReply.items.Add(
                new isRock.LineBot.QuickReplyCameraAction(
                    "Show Camera", new Uri(IconUrl)));
            //加入QuickReplyCamerarollAction
            m.quickReply.items.Add(
                new isRock.LineBot.QuickReplyCamerarollAction(
                    "Show Cameraroll", new Uri(IconUrl)));
            //建立bot instance
            isRock.LineBot.Bot bot = new isRock.LineBot.Bot(channelAccessToken);
            //透過Push發送訊息
            bot.PushMessage(AdminUserId, m);
        }
Exemplo n.º 10
0
 public void PushMessage(ImageCarouselTemplate response)
 {
     _RockBot.PushMessage(UserInfo.userId, response);
 }