Skip to main content

messages.setHistoryTTL

Set maximum Time-To-Live of all messages in the specified chat

func (c *Client) MessagesSetHistoryTTL(ctx context.Context, request *MessagesSetHistoryTTLRequest) (UpdatesClass, error)

Calling this method

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

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

Parameters

NameTypeRequiredDescription
PeerInputPeerClassyesThe dialog
PeriodintyesAutomatically delete all messages sent in the chat after this many seconds

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400CHAT_NOT_MODIFIEDNo changes were made to chat information because the new information you passed is identical to the current information.
400PEER_ID_INVALIDThe provided peer id is invalid.
400TTL_PERIOD_INVALIDThe specified TTL period is invalid.

References