Skip to content

Commit 7c6ac56

Browse files
JonathanGuncrispgm
authored andcommitted
fix(card): add Name to SelectMenuBlock
1 parent 4b5b24f commit 7c6ac56

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

card/select_menu.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var _ Element = (*SelectMenuBlock)(nil)
44

55
// SelectMenuBlock 菜单元素
66
type SelectMenuBlock struct {
7+
name string
78
tag string
89
placeholder string
910
initialOption string
@@ -14,6 +15,7 @@ type SelectMenuBlock struct {
1415

1516
type selectMenuRenderer struct {
1617
ElementTag
18+
Name string `json:"name,omitempty"`
1719
Placeholder Renderer `json:"placeholder,omitempty"`
1820
InitialOption string `json:"initial_option,omitempty"`
1921
Options []Renderer `json:"options,omitempty"`
@@ -31,6 +33,7 @@ func (s *SelectMenuBlock) Render() Renderer {
3133
Options: renderElements(s.options),
3234
Value: s.value,
3335
Placeholder: Text(s.placeholder).Render(),
36+
Name: s.name,
3437
}
3538
if s.confirm != nil {
3639
ret.Confirm = s.confirm.Render()
@@ -50,6 +53,12 @@ func SelectMenu(opt ...*OptionBlock) *SelectMenuBlock {
5053
return ret
5154
}
5255

56+
// Name 菜单的标识
57+
func (s *SelectMenuBlock) Name(n string) *SelectMenuBlock {
58+
s.name = n
59+
return s
60+
}
61+
5362
// SelectPerson 选人模式,value应设置为人员的open_id,options 为空则候选人员为当前群组
5463
func (s *SelectMenuBlock) SelectPerson() *SelectMenuBlock {
5564
s.tag = "select_person"

0 commit comments

Comments
 (0)