photos.GetUserPhotos
Returns the list of user photos.
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.photos.GetUserPhotos({
      userId: "username",
      offset: 43,
      maxId: 0,
      limit: 100,
    })
  );
  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.photos.Photos = await client.invoke(
    new Api.photos.GetUserPhotos({
      userId: "username",
      offset: 43,
      maxId: 0,
      limit: 100,
    })
  );
  console.log(result); // prints the result
})();
Parameters
| Name | Type | Description | 
|---|---|---|
| userId | InputUser | User ID | 
| offset | int | Number of list elements to be skipped | 
| maxId | long | If a positive value was transferred, the method will return only photos with IDs less than the set one | 
| limit | int | Number of list elements to be returned | 
Result
Possible errors
| Code | Type | Description | 
|---|---|---|
| 400 | MAX_ID_INVALID | The provided max ID is invalid. | 
| 400 | MSG_ID_INVALID | Invalid message ID provided. | 
| 400 | USER_ID_INVALID | The provided user ID is invalid. | 
Can bots use this method?
Yes