Skip to content

Commit 4f22dca

Browse files
committed
fix: NewDataButton
1 parent e73274e commit 4f22dca

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

botkb/buttons.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ var _ Button = (*UrlButton)(nil)
1919
var _ Button = (*SwitchInlineQueryButton)(nil)
2020
var _ Button = (*SwitchInlineQueryCurrentChatButton)(nil)
2121

22+
func NewDataButton(text, data string) *DataButton {
23+
return &DataButton{Text: text, Data: data}
24+
}
25+
2226
type DataButton struct {
2327
Text string
2428
Data string
@@ -37,6 +41,10 @@ type UrlButton struct {
3741
URL string
3842
}
3943

44+
func NewUrlButton(text, url string) *UrlButton {
45+
return &UrlButton{Text: text, URL: url}
46+
}
47+
4048
func (UrlButton) ButtonType() ButtonType {
4149
return ButtonTypeURL
4250
}
@@ -50,6 +58,10 @@ type SwitchInlineQueryButton struct {
5058
Query string
5159
}
5260

61+
func NewSwitchInlineQueryButton(text, query string) *SwitchInlineQueryButton {
62+
return &SwitchInlineQueryButton{Text: text, Query: query}
63+
}
64+
5365
func (SwitchInlineQueryButton) ButtonType() ButtonType {
5466
return ButtonTypeSwitchInlineQuery
5567
}
@@ -63,6 +75,10 @@ type SwitchInlineQueryCurrentChatButton struct {
6375
Query string
6476
}
6577

78+
func NewSwitchInlineQueryCurrentChatButton(text, query string) *SwitchInlineQueryCurrentChatButton {
79+
return &SwitchInlineQueryCurrentChatButton{Text: text, Query: query}
80+
}
81+
6682
func (SwitchInlineQueryCurrentChatButton) ButtonType() ButtonType {
6783
return ButtonTypeSwitchInlineQueryCurrentChat
6884
}

0 commit comments

Comments
 (0)