GramJS

langpack.GetDifference

Get new updates.

Example

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

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result = await client.invoke(
    new Api.langpack.GetDifference({
      langPack: "some string here",
      langCode: "some string here",
      fromVersion: 43,
    })
  );
  console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result: Api.LangPackDifference = await client.invoke(
    new Api.langpack.GetDifference({
      langPack: "some string here",
      langCode: "some string here",
      fromVersion: 43,
    })
  );
  console.log(result); // prints the result
})();

Parameters

NameTypeDescription
flags#Flags, see TL conditional fields
ptsintPTS, see updates.
ptsTotalLimitflags.0?intFor fast updating: if provided and pts + pts\_total\_limit < remote pts, updates.differenceTooLong will be returned.
Simply tells the server to not return the difference if it is bigger than pts\_total\_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000
dateintdate, see updates.
qtsintQTS, see updates.

Result

updates.Difference

Possible errors

CodeTypeDescription
401AUTH_KEY_PERM_EMPTYThe temporary auth key must be binded to the permanent auth key to use these methods.
400CDN_METHOD_INVALIDYou can't call this method in a CDN DC
400DATE_EMPTYDate empty
400PERSISTENT_TIMESTAMP_EMPTYPersistent timestamp empty
400PERSISTENT_TIMESTAMP_INVALIDPersistent timestamp invalid

Can bots use this method?

Yes

Working with Updates

How to subscribe to updates and handle them properly.

updates.differenceTooLong

The difference is too long, and the specified state must be used to refetch updates.