Support venue messages
This commit is contained in:
parent
4b2969925b
commit
00f6e41e71
|
@ -364,6 +364,16 @@ func (c *Client) formatBantime(hours int64) int32 {
|
|||
return until
|
||||
}
|
||||
|
||||
func (c *Client) formatLocation(location *client.Location) string {
|
||||
return fmt.Sprintf(
|
||||
"coordinates: %v,%v | https://www.google.com/maps/search/%v,%v/",
|
||||
location.Latitude,
|
||||
location.Longitude,
|
||||
location.Latitude,
|
||||
location.Longitude,
|
||||
)
|
||||
}
|
||||
|
||||
func (c *Client) messageToText(message *client.Message) string {
|
||||
if message.Content == nil {
|
||||
log.Warnf("Unknown message (big emoji?): %#v", message)
|
||||
|
@ -399,12 +409,14 @@ func (c *Client) messageToText(message *client.Message) string {
|
|||
return "chat title set to: " + changeTitle.Title
|
||||
case client.TypeMessageLocation:
|
||||
location, _ := message.Content.(*client.MessageLocation)
|
||||
return c.formatLocation(location.Location)
|
||||
case client.TypeMessageVenue:
|
||||
venue, _ := message.Content.(*client.MessageVenue)
|
||||
return fmt.Sprintf(
|
||||
"coordinates: %v,%v | https://www.google.com/maps/search/%v,%v/",
|
||||
location.Location.Latitude,
|
||||
location.Location.Longitude,
|
||||
location.Location.Latitude,
|
||||
location.Location.Longitude,
|
||||
"*%s*\n%s\n%s",
|
||||
venue.Venue.Title,
|
||||
venue.Venue.Address,
|
||||
c.formatLocation(venue.Venue.Location),
|
||||
)
|
||||
case client.TypeMessagePhoto:
|
||||
photo, _ := message.Content.(*client.MessagePhoto)
|
||||
|
|
Loading…
Reference in a new issue