GramJS

stats.LoadAsyncGraph

Load channel statistics graph asynchronously

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.stats.LoadAsyncGraph({
      token: "some string here",
      x: BigInt("-4156887774564"),
    })
  );
  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.StatsGraph = await client.invoke(
    new Api.stats.LoadAsyncGraph({
      token: "some string here",
      x: BigInt("-4156887774564"),
    })
  );
  console.log(result); // prints the result
})();

Parameters

NameTypeDescription
flags#Flags, see TL conditional fields
tokenstringGraph token from statsGraphAsync constructor
xflags.0?longZoom value, if required

Result

StatsGraph

Possible errors

CodeTypeDescription
400GRAPH_EXPIRED_RELOADThis graph has expired, please obtain a new graph token.
400GRAPH_INVALID_RELOADInvalid graph token provided, please reload the stats and provide the updated token.
400GRAPH_OUTDATED_RELOADThe graph is outdated, please get a new async token using stats.getBroadcastStats.

Can bots use this method?

No

statsGraphAsync

This channel statistics graph must be generated asynchronously using stats.loadAsyncGraph to reduce server load

Channel statistics

Telegram offers detailed channel statistics for channels and supergroups.