Completing inline API, closing #104.

pull/108/head
Ian Byrd 7 years ago
parent 2a1158c03a
commit 5ba925eaba
No known key found for this signature in database
GPG Key ID: 598F598CA3B8055F

@ -26,8 +26,8 @@ type Query struct {
// Sender.
From User `json:"from"`
// (Optional) Sender location, only for bots that request user location.
Location Location `json:"location"`
// Sender location, only for bots that request user location.
Location *Location `json:"location"`
// Text of the query (up to 512 characters).
Text string `json:"query"`
@ -128,6 +128,8 @@ func inferIQR(result Result) error {
r.Type = "video"
case *VoiceResult:
r.Type = "voice"
case *StickerResult:
r.Type = "sticker"
default:
return fmt.Errorf("result %v is not supported", result)
}

@ -66,6 +66,9 @@ type AudioResult struct {
// Optional. Audio duration in seconds.
Duration int `json:"audio_duration,omitempty"`
// If Cache != "", it'll be used instead
Cache string `json:"audio_file_id,omitempty"`
}
// ContentResult represents a contact with a phone number.
@ -109,6 +112,9 @@ type DocumentResult struct {
// Optional. URL of the thumbnail (jpeg only) for the file.
ThumbURL string `json:"thumb_url,omitempty"`
// If Cache != "", it'll be used instead
Cache string `json:"document_file_id,omitempty"`
}
// GifResult represents a link to an animated GIF file.
@ -133,6 +139,9 @@ type GifResult struct {
// URL of the static thumbnail for the result (jpeg or gif).
ThumbURL string `json:"thumb_url"`
// If Cache != "", it'll be used instead
Cache string `json:"gif_file_id,omitempty"`
}
// LocationResult represents a location on a map.
@ -172,6 +181,9 @@ type Mpeg4GifResult struct {
// Optional. Caption of the MPEG-4 file to be sent, 0-200 characters.
Caption string `json:"caption,omitempty"`
// If Cache != "", it'll be used instead
Cache string `json:"mpeg4_file_id,omitempty"`
}
// ResultResult represents a link to a photo.
@ -200,6 +212,9 @@ type PhotoResult struct {
// URL of the thumbnail for the photo.
ThumbURL string `json:"thumb_url"`
// If Cache != "", it'll be used instead
Cache string `json:"photo_file_id,omitempty"`
}
// VenueResult represents a venue.
@ -254,6 +269,9 @@ type VideoResult struct {
// Optional. Short description of the result.
Description string `json:"description,omitempty"`
// If Cache != "", it'll be used instead
Cache string `json:"video_file_id,omitempty"`
}
// VoiceResult represents a link to a voice recording in an .ogg
@ -271,4 +289,15 @@ type VoiceResult struct {
// Optional. Recording duration in seconds.
Duration int `json:"voice_duration"`
// If Cache != "", it'll be used instead
Cache string `json:"voice_file_id,omitempty"`
}
// StickerResult represents an inline cached sticker response.
type StickerResult struct {
ResultBase
// If Cache != "", it'll be used instead
Cache string `json:"sticker_file_id,omitempty"`
}

@ -30,11 +30,8 @@ func (input *InputTextMessageContent) IsInputMessageContent() bool {
// to be sent as the result of an inline query.
// See also: https://core.telegram.org/bots/api#inputlocationmessagecontent
type InputLocationMessageContent struct {
// Latitude of the location in degrees.
Latitude float32 `json:"latitude"`
// Longitude of the location in degrees.
Longitude float32 `json:"longitude"`
Lat float32 `json:"latitude"`
Lng float32 `json:"longitude"`
}
func (input *InputLocationMessageContent) IsInputMessageContent() bool {
@ -45,11 +42,8 @@ func (input *InputLocationMessageContent) IsInputMessageContent() bool {
// be sent as the result of an inline query.
// See also: https://core.telegram.org/bots/api#inputvenuemessagecontent
type InputVenueMessageContent struct {
// Latitude of the location in degrees.
Latitude float32 `json:"latitude"`
// Longitude of the location in degrees.
Longitude float32 `json:"longitude"`
Lat float32 `json:"latitude"`
Lng float32 `json:"longitude"`
// Name of the venue.
Title string `json:"title"`

Loading…
Cancel
Save