From dfbd03621722266735bf947d880ae5a3476628dd Mon Sep 17 00:00:00 2001 From: Hamcha Date: Thu, 13 Dec 2018 14:02:42 +0100 Subject: [PATCH] Add support for editing inline messages --- command.go | 1 + telegram.go | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/command.go b/command.go index 107be53..1f72322 100644 --- a/command.go +++ b/command.go @@ -106,6 +106,7 @@ type ClientAlbumData struct { type ClientEditMediaData struct { ChatID int64 MessageID int64 + InlineID string Media interface{} ReplyMarkup interface{} `json:",omitempty"` } diff --git a/telegram.go b/telegram.go index ae279d8..e7adb6b 100644 --- a/telegram.go +++ b/telegram.go @@ -220,9 +220,13 @@ func (t Telegram) EditMedia(data ClientEditMediaData) { checkerr("SendAlbum/json.Marshal", err) } postdata := url.Values{ - "chat_id": {strconv.FormatInt(data.ChatID, 10)}, - "message_id": {strconv.FormatInt(data.MessageID, 10)}, - "media": {string(jsonmedia)}, + "media": {string(jsonmedia)}, + } + if data.InlineID != "" { + postdata.Set("inline_message_id", data.InlineID) + } else { + postdata.Set("chat_id", strconv.FormatInt(data.ChatID, 10)) + postdata.Set("message_id", strconv.FormatInt(data.MessageID, 10)) } if data.ReplyMarkup != nil { replyjson, err := json.Marshal(data.ReplyMarkup)