Add support for GIFs

main
Astra 2022-10-16 14:23:42 +00:00
parent cf1dd4d760
commit 869938b061
1 changed files with 15 additions and 5 deletions

20
main.go
View File

@ -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)
}