initConnection
Initialize connection
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.initConnection({
apiId: 8925113,
deviceModel: 'random string here',
systemVersion: 'random string here',
appVersion: 'random string here',
systemLangCode: 'random string here',
langPack: 'random string here',
langCode: 'random string here',
proxy: new Api.InputClientProxy({...}),
params: new Api.JSONValue({...}),
query: new Api.!X({...}),
}));
console.log(result); // prints the result
})();
TL schema
---functions---
initConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X;
Parameters
Name
Type
Description
For now, only the tz_offset field is supported, for specifying timezone offset in seconds.| |query|!X|The query itself|
Result
X
Possible errors
Code
Type
Description
400
CONNECTION_LAYER_INVALID
Layer invalid
Can bots use this methd ?
yes
Related pages
Last updated
Was this helpful?