Skip to main content

messages.saveDraft

Save a message draft associated to a chat.

func (c *Client) MessagesSaveDraft(ctx context.Context, request *MessagesSaveDraftRequest) (bool, error)

Calling this method​

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

res, err := api.MessagesSaveDraft(ctx, &tg.MessagesSaveDraftRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // bool
return nil
})

Parameters​

NameTypeRequiredDescription
NoWebpagebool—Disable generation of the webpage preview
InvertMediabool—If set, any eventual webpage preview will be shown on top of the message instead of at the bottom.
ReplyToInputReplyToClass—If set, indicates that the message should be sent in reply to the specified message or story.
PeerInputPeerClassyesDestination of the message that should be sent
MessagestringyesThe draft
Entities[]MessageEntityClass—Message entities for styled text
MediaInputMediaClass—Attached media
Effectint64—Specifies a message effect » to use for the message.
SuggestedPostSuggestedPost—Used to suggest a post to a channel, see here » for more info on the full flow.
RichMessageInputRichMessageClass—RichMessage field of MessagesSaveDraftRequest.

Returns​

bool

Possible errors​

CodeTypeDescription
400CHAT_ADMIN_REQUIREDYou must be an admin in this chat to do this.
400ENTITY_BOUNDS_INVALIDA specified entity offset or length is invalid, see here » for info on how to properly compute the entity offset/length.
400INPUT_USER_DEACTIVATEDThe specified user was deleted.
400MSG_ID_INVALIDInvalid message ID provided.
400PEER_ID_INVALIDThe provided peer id is invalid.

References​