messages.sendEncryptedFile
Sends a message with a file attachment to a secret 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.sendEncryptedFile({
silent: true,
peer: new Api.InputEncryptedChat({...}),
randomId: 5730016,
data: Buffer.from('some bytes here'),
file: new Api.InputEncryptedFile({...}),
}));
console.log(result); // prints the result
})();
TL schema
messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage;
messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage;
---functions---
messages.sendEncryptedFile#5559481d flags:# silent:flags.0?true peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage;
Parameters
Name
Type
Description
data
TL-serialization of DecryptedMessage type, encrypted with a key generated during chat initialization
Result
Possible errors
Code
Type
Description
400
DATA_TOO_LONG
Data too long
400
ENCRYPTION_DECLINED
The secret chat was declined
400
MD5_CHECKSUM_INVALID
The MD5 checksums do not match
400
MSG_WAIT_FAILED
A waiting call returned an error
Can bots use this methd ?
yes
Related pages
Object describes the contents of an encrypted message.
Last updated
Was this helpful?