Fix backwards compatibility for Live Location.
parent
4ec899a62e
commit
72f87b43e3
|
@ -266,7 +266,7 @@ func TestSendWithContact(t *testing.T) {
|
||||||
func TestSendWithLocation(t *testing.T) {
|
func TestSendWithLocation(t *testing.T) {
|
||||||
bot, _ := getBot(t)
|
bot, _ := getBot(t)
|
||||||
|
|
||||||
_, err := bot.Send(tgbotapi.NewLocation(ChatID, 40, 40, 86400))
|
_, err := bot.Send(tgbotapi.NewLocation(ChatID, 40, 40))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
|
|
@ -268,14 +268,13 @@ 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, live_period int) LocationConfig {
|
func NewLocation(chatID int64, latitude float64, longitude float64) LocationConfig {
|
||||||
return LocationConfig{
|
return LocationConfig{
|
||||||
BaseChat: BaseChat{
|
BaseChat: BaseChat{
|
||||||
ChatID: chatID,
|
ChatID: chatID,
|
||||||
},
|
},
|
||||||
Latitude: latitude,
|
Latitude: latitude,
|
||||||
Longitude: longitude,
|
Longitude: longitude,
|
||||||
LivePeriod: live_period,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,14 +465,13 @@ 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, live_period int) InlineQueryResultLocation {
|
func NewInlineQueryResultLocation(id, title string, latitude, longitude float64) 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,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,14 +127,13 @@ func TestNewInlineQueryResultDocument(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewInlineQueryResultLocation(t *testing.T) {
|
func TestNewInlineQueryResultLocation(t *testing.T) {
|
||||||
result := tgbotapi.NewInlineQueryResultLocation("id", "name", 40, 50, 86400)
|
result := tgbotapi.NewInlineQueryResultLocation("id", "name", 40, 50)
|
||||||
|
|
||||||
if result.Type != "location" ||
|
if result.Type != "location" ||
|
||||||
result.ID != "id" ||
|
result.ID != "id" ||
|
||||||
result.Title != "name" ||
|
result.Title != "name" ||
|
||||||
result.Latitude != 40 ||
|
result.Latitude != 40 ||
|
||||||
result.Longitude != 50 ||
|
result.Longitude != 50 {
|
||||||
result.LivePeriod != 86400 {
|
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue