Add caption editing

This commit is contained in:
Hamcha 2018-12-13 14:24:27 +01:00
parent a99c4b181d
commit 7ea298ae9e
Signed by: hamcha
GPG key ID: A40413D21021EAEE

View file

@ -163,13 +163,17 @@ func webhook(update tg.APIUpdate) {
card, err := scryfallGetCardByID(parts[1])
facenum, _ := strconv.Atoi(parts[2])
if err == nil {
face, _, buttons := getCardEntry(card, facenum)
face, caption, buttons := getCardEntry(card, facenum)
api.EditMedia(tg.ClientEditMediaData{
InlineID: *update.Callback.InlineID,
Media: tg.APIInputMediaPhoto{
Type: "photo",
Media: face.Large,
},
})
api.EditCaption(tg.ClientEditCaptionData{
InlineID: *update.Callback.InlineID,
Caption: caption,
ReplyMarkup: &tg.APIInlineKeyboardMarkup{
InlineKeyboard: [][]tg.APIInlineKeyboardButton{buttons},
},