GramJS

account.UpdateTheme

Update theme

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.account.UpdateTheme({
      format: "some string here",
      theme: new Api.InputTheme({
        id: BigInt("-4156887774564"),
        accessHash: BigInt("-4156887774564"),
      }),
      slug: "some string here",
      title: "My very normal title",
      document: new Api.InputDocument({
        id: BigInt("-4156887774564"),
        accessHash: BigInt("-4156887774564"),
        fileReference: Buffer.from("arbitrary data here"),
      }),
      settings: new Api.InputThemeSettings({
        baseTheme: new Api.BaseThemeClassic({}),
        accentColor: 43,
        messageTopColor: 43,
        messageBottomColor: 43,
        wallpaper: new Api.InputWallPaper({
          id: BigInt("-4156887774564"),
          accessHash: BigInt("-4156887774564"),
        }),
        wallpaperSettings: new Api.WallPaperSettings({
          blur: true,
          motion: true,
          backgroundColor: 43,
          secondBackgroundColor: 43,
          intensity: 43,
          rotation: 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.Theme = await client.invoke(
    new Api.account.UpdateTheme({
      format: "some string here",
      theme: new Api.InputTheme({
        id: BigInt("-4156887774564"),
        accessHash: BigInt("-4156887774564"),
      }),
      slug: "some string here",
      title: "My very normal title",
      document: new Api.InputDocument({
        id: BigInt("-4156887774564"),
        accessHash: BigInt("-4156887774564"),
        fileReference: Buffer.from("arbitrary data here"),
      }),
      settings: new Api.InputThemeSettings({
        baseTheme: new Api.BaseThemeClassic({}),
        accentColor: 43,
        messageTopColor: 43,
        messageBottomColor: 43,
        wallpaper: new Api.InputWallPaper({
          id: BigInt("-4156887774564"),
          accessHash: BigInt("-4156887774564"),
        }),
        wallpaperSettings: new Api.WallPaperSettings({
          blur: true,
          motion: true,
          backgroundColor: 43,
          secondBackgroundColor: 43,
          intensity: 43,
          rotation: 43,
        }),
      }),
    })
  );
  console.log(result); // prints the result
})();

Parameters

NameTypeDescription
flags#Flags, see TL conditional fields
formatstringTheme format, a string that identifies the theming engines supported by the client
themeInputThemeTheme to update
slugflags.0?stringUnique theme ID
titleflags.1?stringTheme name
documentflags.2?InputDocumentTheme file
settingsflags.3?InputThemeSettingsTheme settings

Result

Theme

Possible errors

CodeTypeDescription

Can bots use this method?

No