Add support for editing inline messages

This commit is contained in:
Hamcha 2018-12-13 14:02:42 +01:00
parent e51fe7f419
commit dfbd036217
Signed by: hamcha
GPG key ID: A40413D21021EAEE
2 changed files with 8 additions and 3 deletions

View file

@ -106,6 +106,7 @@ type ClientAlbumData struct {
type ClientEditMediaData struct {
ChatID int64
MessageID int64
InlineID string
Media interface{}
ReplyMarkup interface{} `json:",omitempty"`
}

View file

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