messages.deleteHistory
Deletes communication history.
func (c *Client) MessagesDeleteHistory(ctx context.Context, request *MessagesDeleteHistoryRequest) (*MessagesAffectedHistory, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.MessagesDeleteHistory(ctx, &tg.MessagesDeleteHistoryRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // *MessagesAffectedHistory
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
JustClear | bool | — | Just clear history for the current user, without actually removing messages for every chat user |
Revoke | bool | — | Whether to delete the message history for all chat participants |
Peer | InputPeerClass | yes | User or chat, communication history of which will be deleted |
MaxID | int | yes | Maximum ID of message to delete |
MinDate | int | — | Delete all messages newer than this UNIX timestamp |
MaxDate | int | — | Delete all messages older than this UNIX timestamp |
Returns
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | CHANNEL_PRIVATE | You haven't joined this channel/supergroup. |
| 400 | CHAT_ADMIN_REQUIRED | You must be an admin in this chat to do this. |
| 400 | CHAT_ID_INVALID | The provided chat id is invalid. |
| 400 | CHAT_REVOKE_DATE_UNSUPPORTED | min_date and max_date are not available for using with non-user peers. |
| 400 | MAX_DATE_INVALID | The specified maximum date is invalid. |
| 400 | MESSAGE_ID_INVALID | The provided message id is invalid. |
| 400 | MIN_DATE_INVALID | The specified minimum date is invalid. |
| 400 | MSG_ID_INVALID | Invalid message ID provided. |
| 400 | PEER_ID_INVALID | The provided peer id is invalid. |
References
- Official documentation
- Generated Go reference
- TL definition:
messages.deleteHistory#b08f922a