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
Name | Type | Description |
---|---|---|
flags | # | Flags, see TL conditional fields |
token | string | Graph token from statsGraphAsync constructor |
x | flags.0?long | Zoom value, if required |
Result
Possible errors
Code | Type | Description |
---|---|---|
400 | GRAPH_EXPIRED_RELOAD | This graph has expired, please obtain a new graph token. |
400 | GRAPH_INVALID_RELOAD | Invalid graph token provided, please reload the stats and provide the updated token. |
400 | GRAPH_OUTDATED_RELOAD | The graph is outdated, please get a new async token using stats.getBroadcastStats. |
Can bots use this method?
No
Related pages
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.