-
Notifications
You must be signed in to change notification settings - Fork 0
/
inline_query_result_gif.go
executable file
·70 lines (66 loc) · 3.31 KB
/
inline_query_result_gif.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Code AutoGenerated; DO NOT EDIT.
package types
import (
"encoding/json"
"fmt"
)
// InlineQueryResultGif Represents a link to an animated GIF file
// By default, this animated GIF file will be sent by the user with optional caption
// Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
type InlineQueryResultGif struct {
Caption string `json:"caption,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
GifDuration int `json:"gif_duration,omitempty"`
GifHeight int `json:"gif_height,omitempty"`
GifURL string `json:"gif_url"`
GifWidth int64 `json:"gif_width,omitempty"`
ID string `json:"id"`
InputMessageContent any `json:"input_message_content,omitempty"`
ParseMode string `json:"parse_mode,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"`
ThumbnailURL string `json:"thumbnail_url"`
Title string `json:"title,omitempty"`
}
func (entity InlineQueryResultGif) MarshalJSON() ([]byte, error) {
alias := struct {
Type string `json:"type"`
ID string `json:"id"`
GifURL string `json:"gif_url"`
GifWidth int64 `json:"gif_width,omitempty"`
GifHeight int `json:"gif_height,omitempty"`
GifDuration int `json:"gif_duration,omitempty"`
ThumbnailURL string `json:"thumbnail_url"`
ThumbnailMimeType string `json:"thumbnail_mime_type,omitempty"`
Title string `json:"title,omitempty"`
Caption string `json:"caption,omitempty"`
ParseMode string `json:"parse_mode,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
InputMessageContent any `json:"input_message_content,omitempty"`
}{
Type: "gif",
ID: entity.ID,
GifURL: entity.GifURL,
GifWidth: entity.GifWidth,
GifHeight: entity.GifHeight,
GifDuration: entity.GifDuration,
ThumbnailURL: entity.ThumbnailURL,
ThumbnailMimeType: entity.ThumbnailMimeType,
Title: entity.Title,
Caption: entity.Caption,
ParseMode: entity.ParseMode,
CaptionEntities: entity.CaptionEntities,
ReplyMarkup: entity.ReplyMarkup,
InputMessageContent: entity.InputMessageContent,
}
if entity.InputMessageContent != nil {
switch entity.InputMessageContent.(type) {
case InputTextMessageContent, InputLocationMessageContent, InputVenueMessageContent, InputContactMessageContent, InputInvoiceMessageContent:
break
default:
return nil, fmt.Errorf("input_message_content: unknown type: %T", entity.InputMessageContent)
}
}
return json.Marshal(alias)
}