1
0
Fork 0

Added EditMessageMedia method

This commit is contained in:
Maxim Lebedev 2018-07-26 23:52:05 +05:00
parent 82b90ad9af
commit b37f632c07
No known key found for this signature in database
GPG Key ID: F8978F46FF0FFA4F
1 changed files with 43 additions and 0 deletions

43
edit_message_media.go Normal file
View File

@ -0,0 +1,43 @@
package telegram
import json "github.com/pquerna/ffjson/ffjson"
type EditMessageMediaParameters struct {
// Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
ChatID int64 `json:"chat_id,omitempty"`
// Required if inline_message_id is not specified. Identifier of the sent message
MessageID int `json:"message_id,omitempty"`
// Required if chat_id and message_id are not specified. Identifier of the inline message
InlineMessageID string `json:"inline_message_id,omitempty"`
// A JSON-serialized object for a new media content of the message
Media *InputMedia `json:"media"`
// A JSON-serialized object for a new inline keyboard.
ReplyMarkup *InlineKeyboardMarkup `json:"reply_markup,omitempty"`
}
// EditMessageMedia edit audio, document, photo, or video messages. If a message
// is a part of a message album, then it can be edited only to a photo or a video.
// Otherwise, message type can be changed arbitrarily. When inline message is
// edited, new file can't be uploaded. Use previously uploaded file via its
// file_id or specify a URL. On success, if the edited message was sent by the
// bot, the edited Message is returned, otherwise True is returned.
func (b *Bot) EditMessageMedia(emmp *EditMessageMediaParameters) (m *Message, err error) {
var src []byte
src, err = json.Marshal(emmp)
if err != nil {
return nil, err
}
resp := new(Response)
resp, err = b.request(src, MethodEditMessageMedia)
if err != nil {
return nil, err
}
err = json.Unmarshal(*resp.Result, m)
return
}