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

12
main.go
View File

@ -79,12 +79,22 @@ func main() {
if c == 50 { if c == 50 {
break break
} }
result := &tgbotapi.InlineQueryResultPhoto{ 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", Type: "photo",
ID: uuid.New().String(), ID: uuid.New().String(),
URL: image.Image, URL: image.Image,
ThumbURL: image.Thumbnail, ThumbURL: image.Thumbnail,
} }
}
results = append(results, result) results = append(results, result)
} }
inlineConf := tgbotapi.InlineConfig{ inlineConf := tgbotapi.InlineConfig{