Skip to content
Snippets Groups Projects
Commit 14412f9a authored by Ophestra's avatar Ophestra
Browse files

use last image of thing

parent 691e4333
No related branches found
No related tags found
No related merge requests found
......@@ -176,10 +176,15 @@ func respondTelegram(update tgbotapi.Update) {
header, has := makeHeader(update.Message, false)
if update.Message.Photo != nil && len(*update.Message.Photo) > 0 {
if update.Message.Photo != nil && (len(*update.Message.Photo)/4) > 0 {
fids := ""
files := make([]*discordgo.File, len(*update.Message.Photo))
for i, info := range *update.Message.Photo {
files := make([]*discordgo.File, len(*update.Message.Photo)/4)
p := *update.Message.Photo
for i := 0; i < len(files); i++ {
// FIXME: multiple images
info := p[((i+1)*4)-1]
var url string
if u, err := botAPI.GetFileDirectURL(info.FileID); err != nil {
msg := tgbotapi.NewMessage(update.Message.Chat.ID, "error getting URL")
......@@ -199,8 +204,8 @@ func respondTelegram(update tgbotapi.Update) {
return
} else {
files[i] = &discordgo.File{
Name: "sticker.webp",
ContentType: "image/webp",
Name: "image.jpg",
ContentType: "image/jpeg",
Reader: resp.Body,
}
//goland:noinspection GoDeferInLoop
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment