Add support for GIFs
parent
cf1dd4d760
commit
869938b061
20
main.go
20
main.go
|
@ -79,11 +79,21 @@ func main() {
|
|||
if c == 50 {
|
||||
break
|
||||
}
|
||||
result := &tgbotapi.InlineQueryResultPhoto{
|
||||
Type: "photo",
|
||||
ID: uuid.New().String(),
|
||||
URL: image.Image,
|
||||
ThumbURL: image.Thumbnail,
|
||||
var result interface{}
|
||||
if strings.HasSuffix(image.Image, ".gif") {
|
||||
result = &tgbotapi.InlineQueryResultGIF{
|
||||
Type: "gif",
|
||||
ID: uuid.New().String(),
|
||||
URL: image.Image,
|
||||
ThumbURL: image.Thumbnail,
|
||||
}
|
||||
} else {
|
||||
result = &tgbotapi.InlineQueryResultPhoto{
|
||||
Type: "photo",
|
||||
ID: uuid.New().String(),
|
||||
URL: image.Image,
|
||||
ThumbURL: image.Thumbnail,
|
||||
}
|
||||
}
|
||||
results = append(results, result)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue