Added web_app fields for the buttons

pull/509/head
Mikhail Borovikov 2 years ago
parent 4b2f8743d1
commit e22b5f4f64

@ -80,12 +80,13 @@ type InlineButton struct {
// It will be used as a callback endpoint.
Unique string `json:"unique,omitempty"`
Text string `json:"text"`
URL string `json:"url,omitempty"`
Data string `json:"callback_data,omitempty"`
InlineQuery string `json:"switch_inline_query,omitempty"`
InlineQueryChat string `json:"switch_inline_query_current_chat"`
Login *Login `json:"login_url,omitempty"`
Text string `json:"text"`
URL string `json:"url,omitempty"`
Data string `json:"callback_data,omitempty"`
InlineQuery string `json:"switch_inline_query,omitempty"`
InlineQueryChat string `json:"switch_inline_query_current_chat"`
WebApp *WebAppInfo `json:"web_app,omitempty"`
Login *Login `json:"login_url,omitempty"`
}
// With returns a copy of the button with data.
@ -129,6 +130,12 @@ type Login struct {
WriteAccess bool `json:"request_write_access,omitempty"`
}
// WebAppInfo represents a parameter of the inline keyboard button
// or the keyboard button used to launch Web App.
type WebAppInfo struct {
URL string `json:"url"`
}
// MarshalJSON implements json.Marshaler interface.
// It needed to avoid InlineQueryChat and Login fields conflict.
// If you have Login field in your button, InlineQueryChat must be skipped.

@ -169,9 +169,10 @@ func (r *ReplyMarkup) copy() *ReplyMarkup {
type ReplyButton struct {
Text string `json:"text"`
Contact bool `json:"request_contact,omitempty"`
Location bool `json:"request_location,omitempty"`
Poll PollType `json:"request_poll,omitempty"`
Contact bool `json:"request_contact,omitempty"`
Location bool `json:"request_location,omitempty"`
Poll PollType `json:"request_poll,omitempty"`
WebApp WebAppInfo `json:"request_web_app,omitempty"`
}
// MarshalJSON implements json.Marshaler. It allows to pass

Loading…
Cancel
Save