messages.saveDraft

Save a message draft associated to a chat.

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.saveDraft({
        noWebpage: true,
        replyToMsgId: 255667,
        peer: new Api.InputPeer({...}),
        message: 'random string here',
        entities: [new Api.MessageEntity({...})],
        }));
    console.log(result); // prints the result
})();

TL schema

boolFalse#bc799737 = Bool;
boolTrue#997275b5 = Bool;
---functions---
messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> = Bool;

Parameters

Name

Type

Description

flags

no_webpage

Disable generation of the webpage preview

reply_to_msg_id

Message ID the message should reply to

peer

Destination of the message that should be sent

message

The draft

entities

Message entities for styled text

Result

Bool

Possible errors

Code

Type

Description

400

PEER_ID_INVALID

The provided peer id is invalid

Can bots use this methd ?

yes

How to create styled text with message entities

How to handle message drafts

Last updated