Layer 220
MessagesDeleteMessages
Deletes messages by their identifiers.
method
Users
Bots
Business
messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
Parameters
| Name | Type | Description |
|---|---|---|
| Flags | # | Flags, see TL conditional fields |
| Revoke | flags.0?true | Whether to delete messages for all participants of the chat |
| Id | Vector<int> | Message ID list |
Returns
messages.AffectedMessagesPossible Errors
| Code | Type | Description |
|---|---|---|
| 403 | BOT_ACCESS_FORBIDDEN | The specified method can be used over a business connection for some operations, but the specified query attempted an operation that is not allowed over a business connection. |
| 400 | BUSINESS_CONNECTION_INVALID | The connection_id passed to the wrapping invoke With Business Connection call is invalid. |
| 403 | MESSAGE_DELETE_FORBIDDEN | You can't delete one of the messages you tried to delete, most likely because it is a service message. |
| 400 | MESSAGE_ID_INVALID | The provided message id is invalid. |
| 400 | SELF_DELETE_RESTRICTED | Business bots can't delete messages just for the user, revoke must be set. |
Gogram Example
// MessagesDeleteMessages - using Params struct result, err := client.MessagesDeleteMessages(&tg.MessagesDeleteMessagesParams{ Id: []int{}, // Optional fields: // Revoke: true, }) if err != nil { // handle error } // result is *tg.MessagesAffectedMessages