Added `live_period` for Location
parent
846d467e14
commit
65947daaab
|
@ -571,8 +571,9 @@ func (config VoiceConfig) method() string {
|
||||||
// LocationConfig contains information about a SendLocation request.
|
// LocationConfig contains information about a SendLocation request.
|
||||||
type LocationConfig struct {
|
type LocationConfig struct {
|
||||||
BaseChat
|
BaseChat
|
||||||
Latitude float64 // required
|
Latitude float64 // required
|
||||||
Longitude float64 // required
|
Longitude float64 // required
|
||||||
|
LivePeriod int // optional
|
||||||
}
|
}
|
||||||
|
|
||||||
// values returns a url.Values representation of LocationConfig.
|
// values returns a url.Values representation of LocationConfig.
|
||||||
|
@ -584,6 +585,9 @@ func (config LocationConfig) values() (url.Values, error) {
|
||||||
|
|
||||||
v.Add("latitude", strconv.FormatFloat(config.Latitude, 'f', 6, 64))
|
v.Add("latitude", strconv.FormatFloat(config.Latitude, 'f', 6, 64))
|
||||||
v.Add("longitude", strconv.FormatFloat(config.Longitude, 'f', 6, 64))
|
v.Add("longitude", strconv.FormatFloat(config.Longitude, 'f', 6, 64))
|
||||||
|
if config.LivePeriod != 0 {
|
||||||
|
v.Add("live_period", strconv.Itoa(config.LivePeriod))
|
||||||
|
}
|
||||||
|
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
20
helpers.go
20
helpers.go
|
@ -268,13 +268,14 @@ func NewContact(chatID int64, phoneNumber, firstName string) ContactConfig {
|
||||||
// NewLocation shares your location.
|
// NewLocation shares your location.
|
||||||
//
|
//
|
||||||
// chatID is where to send it, latitude and longitude are coordinates.
|
// chatID is where to send it, latitude and longitude are coordinates.
|
||||||
func NewLocation(chatID int64, latitude float64, longitude float64) LocationConfig {
|
func NewLocation(chatID int64, latitude float64, longitude float64, live_period int) LocationConfig {
|
||||||
return LocationConfig{
|
return LocationConfig{
|
||||||
BaseChat: BaseChat{
|
BaseChat: BaseChat{
|
||||||
ChatID: chatID,
|
ChatID: chatID,
|
||||||
},
|
},
|
||||||
Latitude: latitude,
|
Latitude: latitude,
|
||||||
Longitude: longitude,
|
Longitude: longitude,
|
||||||
|
LivePeriod: live_period,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,13 +466,14 @@ func NewInlineQueryResultDocument(id, url, title, mimeType string) InlineQueryRe
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInlineQueryResultLocation creates a new inline query location.
|
// NewInlineQueryResultLocation creates a new inline query location.
|
||||||
func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) InlineQueryResultLocation {
|
func NewInlineQueryResultLocation(id, title string, latitude, longitude float64, live_period int) InlineQueryResultLocation {
|
||||||
return InlineQueryResultLocation{
|
return InlineQueryResultLocation{
|
||||||
Type: "location",
|
Type: "location",
|
||||||
ID: id,
|
ID: id,
|
||||||
Title: title,
|
Title: title,
|
||||||
Latitude: latitude,
|
Latitude: latitude,
|
||||||
Longitude: longitude,
|
Longitude: longitude,
|
||||||
|
LivePeriod: live_period,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
types.go
21
types.go
|
@ -331,8 +331,9 @@ type Contact struct {
|
||||||
|
|
||||||
// Location contains information about a place.
|
// Location contains information about a place.
|
||||||
type Location struct {
|
type Location struct {
|
||||||
Longitude float64 `json:"longitude"`
|
Longitude float64 `json:"longitude"`
|
||||||
Latitude float64 `json:"latitude"`
|
Latitude float64 `json:"latitude"`
|
||||||
|
LivePeriod int `json:"live_period"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Venue contains information about a venue, including its Location.
|
// Venue contains information about a venue, including its Location.
|
||||||
|
@ -639,11 +640,12 @@ type InlineQueryResultDocument struct {
|
||||||
|
|
||||||
// InlineQueryResultLocation is an inline query response location.
|
// InlineQueryResultLocation is an inline query response location.
|
||||||
type InlineQueryResultLocation struct {
|
type InlineQueryResultLocation struct {
|
||||||
Type string `json:"type"` // required
|
Type string `json:"type"` // required
|
||||||
ID string `json:"id"` // required
|
ID string `json:"id"` // required
|
||||||
Latitude float64 `json:"latitude"` // required
|
Latitude float64 `json:"latitude"` // required
|
||||||
Longitude float64 `json:"longitude"` // required
|
Longitude float64 `json:"longitude"` // required
|
||||||
Title string `json:"title"` // required
|
LivePeriod int `json:"live_period"` // optional
|
||||||
|
Title string `json:"title"` // required
|
||||||
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
|
||||||
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
InputMessageContent interface{} `json:"input_message_content,omitempty"`
|
||||||
ThumbURL string `json:"thumb_url"`
|
ThumbURL string `json:"thumb_url"`
|
||||||
|
@ -679,8 +681,9 @@ type InputTextMessageContent struct {
|
||||||
// InputLocationMessageContent contains a location for displaying
|
// InputLocationMessageContent contains a location for displaying
|
||||||
// as an inline query result.
|
// as an inline query result.
|
||||||
type InputLocationMessageContent struct {
|
type InputLocationMessageContent struct {
|
||||||
Latitude float64 `json:"latitude"`
|
Latitude float64 `json:"latitude"`
|
||||||
Longitude float64 `json:"longitude"`
|
Longitude float64 `json:"longitude"`
|
||||||
|
LivePeriod int `json:"live_period"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// InputVenueMessageContent contains a venue for displaying
|
// InputVenueMessageContent contains a venue for displaying
|
||||||
|
|
Loading…
Reference in New Issue