1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
view := slack.ModalViewRequest{
Type: slack.VTModal,
Title: slack.NewTextBlockObject(slack.PlainTextType, "サンプル", false, false),
Submit: slack.NewTextBlockObject(slack.PlainTextType, "OK", true, false),
Close: slack.NewTextBlockObject(slack.PlainTextType, "キャンセル", true, false),
}
options := []*slack.OptionBlockObject{
slack.NewOptionBlockObject("opt1", slack.NewTextOject(slack.PlainTextType, "1個", false, false), nil),
slack.NewOptionBlockObject("opt2", slack.NewTextOject(slack.PlainTextType, "2個", false, false), nil),
slack.NewOptionBlockObject("opt3", slack.NewTextOject(slack.PlainTextType, "3個", false, false), nil),
}
inputBlock = slack.NewInputBlock(
"select-menu",
slack.NewTextBlockObject(
slack.PlainTextType, "マルチセレクト", false, false),
slack.NewOptionsMultiSelectBlockElement(
slack.MultiOptTypeStatic,
slack.NewTextBlockObject(slack.PlainTextType, "複数選択", false, false),
"" /* action_id */, options...))
view.Blocks.BlockSet = append(view.Blocks.BlockSet, inputBlock)
view.Blocks.BlockSet = append(view.Blocks.BlockSet,
slack.NewActionBlock("select-menu-action",
slack.NewButtonBlockElement("", "all", slack.NewTextBlockObject(slack.PlainTextType, "すべて選択", false, false)).WithStyle(slack.StylePrimary),
slack.NewButtonBlockElement("", "none", slack.NewTextBlockObject(slack.PlainTextType, "すべて解除", false, false)).WithStyle(slack.StyleDanger)))
client.OpenView(triggerID, view)
|