Skip to content

Instantly share code, notes, and snippets.

@isdaviddong
Created February 11, 2019 04:31
Show Gist options
  • Select an option

  • Save isdaviddong/8e087d3417b0fff761c9f4333de983d0 to your computer and use it in GitHub Desktop.

Select an option

Save isdaviddong/8e087d3417b0fff761c9f4333de983d0 to your computer and use it in GitHub Desktop.
protected void Button1_Click(object sender, EventArgs e)
{
//建立RuchMenu
var item = new isRock.LineBot.RichMenu.RichMenuItem();
item.name = "no name";
item.chatBarText = "快捷選單";
//建立左方按鈕區塊
var leftButton = new isRock.LineBot.RichMenu.Area();
leftButton.bounds.x = 0;
leftButton.bounds.y = 0;
leftButton.bounds.width = 460;
leftButton.bounds.height = 1686;
leftButton.action = new MessageAction() { label = "左", text = "/左" };
//建立右方按鈕區塊
var rightButton = new isRock.LineBot.RichMenu.Area();
rightButton.bounds.x = 2040;
rightButton.bounds.y = 0;
rightButton.bounds.width = 2040 + 460;
rightButton.bounds.height = 1686;
rightButton.action = new MessageAction() { label = "右", text = "/右" };
//將area加入RichMenuItem
item.areas.Add(leftButton);
item.areas.Add(rightButton);
//建立Menu Item並綁定指定的圖片
var menu = isRock.LineBot.Utility.CreateRichMenu(
item, new Uri("http://arock.blob.core.windows.net/blogdata201902/test01.png"), channelAccessToken);
//將Menu Item設為預設Menu
isRock.LineBot.Utility.SetDefaultRichMenu(menu.richMenuId, channelAccessToken);
Response.Write($"OK, {menu.richMenuId}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment