messages.deleteHistory

Deletes communication history.

Example

const {Api, TelegramClient} = require('telegram');
const {StringSession} = require('telegram/sessions');

const session = new StringSession('');
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
    const result = await client.invoke(new Api.messages.deleteHistory({
        justClear: true,
        revoke: true,
        peer: new Api.InputPeer({...}),
        maxId: 6598494,
        }));
    console.log(result); // prints the result
})();

TL schema

messages.affectedHistory#b45c69d1 pts:int pts_count:int offset:int = messages.AffectedHistory;
---functions---
messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true revoke:flags.1?true peer:InputPeer max_id:int = messages.AffectedHistory;

Parameters

Name

Type

Description

flags

just_clear

Just clear history for the current user, without actually removing messages for every chat user

revoke

Whether to delete the message history for all chat participants

peer

User or chat, communication history of which will be deleted

max_id

Maximum ID of message to delete

Result

messages.AffectedHistory

Possible errors

Code

Type

Description

400

CHAT_ID_INVALID

The provided chat id is invalid

400

MESSAGE_ID_INVALID

The provided message id is invalid

400

MSG_ID_INVALID

Invalid message ID provided

400

PEER_ID_INVALID

The provided peer id is invalid

Can bots use this methd ?

yes

Last updated