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
|
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 {
|
func (c *Client) messageToText(message *client.Message) string {
|
||||||
if message.Content == nil {
|
if message.Content == nil {
|
||||||
log.Warnf("Unknown message (big emoji?): %#v", message)
|
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
|
return "chat title set to: " + changeTitle.Title
|
||||||
case client.TypeMessageLocation:
|
case client.TypeMessageLocation:
|
||||||
location, _ := message.Content.(*client.MessageLocation)
|
location, _ := message.Content.(*client.MessageLocation)
|
||||||
|
return c.formatLocation(location.Location)
|
||||||
|
case client.TypeMessageVenue:
|
||||||
|
venue, _ := message.Content.(*client.MessageVenue)
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"coordinates: %v,%v | https://www.google.com/maps/search/%v,%v/",
|
"*%s*\n%s\n%s",
|
||||||
location.Location.Latitude,
|
venue.Venue.Title,
|
||||||
location.Location.Longitude,
|
venue.Venue.Address,
|
||||||
location.Location.Latitude,
|
c.formatLocation(venue.Venue.Location),
|
||||||
location.Location.Longitude,
|
|
||||||
)
|
)
|
||||||
case client.TypeMessagePhoto:
|
case client.TypeMessagePhoto:
|
||||||
photo, _ := message.Content.(*client.MessagePhoto)
|
photo, _ := message.Content.(*client.MessagePhoto)
|
||||||
|
|
Loading…
Reference in a new issue