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
NoWebpageboolDisable generation of the webpage preview
InvertMediaboolIf set, any eventual webpage preview will be shown on top of the message instead of at the bottom.
ReplyToInputReplyToClassIf 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[]MessageEntityClassMessage entities for styled text
MediaInputMediaClassAttached media
Effectint64Specifies a message effect » to use for the message.
SuggestedPostSuggestedPostUsed to suggest a post to a channel, see here » for more info on the full flow.
RichMessageInputRichMessageClassRichMessage 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