Skip to main content

messages.editMessage

Edit message

func (c *Client) MessagesEditMessage(ctx context.Context, request *MessagesEditMessageRequest) (UpdatesClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.MessagesEditMessage(ctx, &tg.MessagesEditMessageRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters

NameTypeRequiredDescription
NoWebpageboolDisable webpage preview
InvertMediaboolIf set, any eventual webpage preview will be shown on top of the message instead of at the bottom.
PeerInputPeerClassyesWhere was the message sent
IDintyesID of the message to edit
MessagestringNew message
MediaInputMediaClassNew attached media
ReplyMarkupReplyMarkupClassReply markup for inline keyboards
Entities[]MessageEntityClassMessage entities for styled text
ScheduleDateintScheduled message date for scheduled messages
ScheduleRepeatPeriodintOnce sent, this message will be automatically re-scheduled to be re-sent again this many seconds in the future, see here » for more info on repeating scheduled messages.
QuickReplyShortcutIDintIf specified, edits a quick reply shortcut message, instead ».
RichMessageInputRichMessageClassRichMessage field of MessagesEditMessageRequest.

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400BOT_DOMAIN_INVALIDBot domain invalid.
400BOT_INVALIDThis is not a valid bot.
400BUSINESS_CONNECTION_INVALIDThe connection_id passed to the wrapping invokeWithBusinessConnection call is invalid.
400BUSINESS_PEER_INVALIDMessages can't be set to the specified peer through the current business connection.
400BUTTON_COPY_TEXT_INVALIDThe specified keyboardButtonCopy.copy_text is invalid.
400BUTTON_DATA_INVALIDThe data of one or more of the buttons you provided is invalid.
400BUTTON_TYPE_INVALIDThe type of one or more of the buttons you provided is invalid.
400BUTTON_URL_INVALIDButton URL invalid.
400CHANNEL_INVALIDThe provided channel is invalid.
406CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
403CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
400CHAT_FORWARDS_RESTRICTEDYou can't forward messages from a protected chat.
403CHAT_SEND_GIFS_FORBIDDENYou can't send gifs in this chat.
403CHAT_WRITE_FORBIDDENYou can't write in this chat.
400DOCUMENT_INVALIDThe specified document is invalid.
400ENTITIES_TOO_LONGYou provided too many styled message entities.
400ENTITY_BOUNDS_INVALIDA specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length.
400FILE_PARTS_INVALIDThe number of file parts is invalid.
400IMAGE_PROCESS_FAILEDFailure while processing image.
403INLINE_BOT_REQUIREDOnly the inline bot can edit message.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MEDIA_CAPTION_TOO_LONGThe caption is too long.
400MEDIA_EMPTYThe provided media object is invalid.
400MEDIA_GROUPED_INVALIDYou tried to send media of different types in an album.
400MEDIA_INVALIDMedia invalid.
400MEDIA_NEW_INVALIDThe new media is invalid.
400MEDIA_PREV_INVALIDPrevious media invalid.
400MEDIA_TTL_INVALIDThe specified media TTL is invalid.
403MESSAGE_AUTHOR_REQUIREDMessage author required.
400MESSAGE_EDIT_TIME_EXPIREDYou can't edit this message anymore, too much time has passed since its creation.
400MESSAGE_EMPTYThe provided message is empty.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400MESSAGE_NOT_MODIFIEDThe provided message data is identical to the previous message data, the message wasn't modified.
400MESSAGE_TOO_LONGThe provided message is too long.
400MSG_ID_INVALIDInvalid message ID provided.
500MSG_WAIT_FAILEDA waiting call returned an error.
400PEER_ID_INVALIDThe provided peer id is invalid.
400PEER_TYPES_INVALIDThe passed keyboardButtonSwitchInline.peer_types field is invalid.
400PHOTO_EXT_INVALIDThe extension of the photo is invalid.
400PHOTO_INVALID_DIMENSIONSThe photo dimensions are invalid.
400PHOTO_SAVE_FILE_INVALIDInternal issues, try again later.
400REPLY_MARKUP_INVALIDThe provided reply markup is invalid.
400REPLY_MARKUP_TOO_LONGThe specified reply_markup is too long.
400SCHEDULE_DATE_INVALIDInvalid schedule date provided.
400TODO_ITEMS_EMPTYA checklist was specified, but no checklist items were passed.
400TODO_ITEM_DUPLICATEDuplicate checklist items detected.
400USER_BANNED_IN_CHANNELYou're banned from sending messages in supergroups/channels.
400WEBPAGE_NOT_FOUNDA preview for the specified webpage url could not be generated.

References